Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8697643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:34:27+00:00 2026-06-13T01:34:27+00:00

I need to make an applet in Java 6, 640*480 pixels, with a toolbar

  • 0

I need to make an applet in Java 6, 640*480 pixels, with a toolbar on the bottom with some buttons, scrollbars, and labels. The best way I could think of was using a BorderLayout, making the BorderLayout.SOUTH region a GridBagLayout (which would contain the controls), and the rest of the BorderLayout area null, as a place for grapics to be drawn with the controls. I can’t find any resources online that don’t use swing, and I don’t know anything about swing to deduce what they are doing or how to translate it into awt code. Here is where I am now. The code ends abruptly in init(), since that’s where the layout mangers start. Thank you for any help you have. Let me know if you need more information then what is here.

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class Bounce extends Applet implements ActionListener, AdjustmentListener
{
    private static final long serialVersionUID = 1L;
    private Graphics page;
    //buttons
    String shapeButtonText = "Square";
    Button shape = new Button(shapeButtonText);
    Button quit = new Button("Quit");
    Button run = new Button("Run");
    Button tail = new Button("Tail");
    Button clear = new Button("Clear");

    //labels
    Label speedLabel = new Label("Speed", Label.CENTER);
    Label sizeLabel = new Label("Size", Label.CENTER);

    //scrollbars
    private final int barHeight = 20;
    private final int SLIDER_WIDTH = 10;
    private final int MAXSPEED = 110;
    private final int MINSPEED = 0;
    private final int UNIT_INC = 1;
    private final int BLOC_INC = 10;
    private final int MAX_SIZE = 110;
    private final int MIN_SIZE = 10;
    Scrollbar speedBar = new Scrollbar(Scrollbar.HORIZONTAL, MINSPEED, SLIDER_WIDTH, 0, MAXSPEED);  
    Scrollbar sizeBar = new Scrollbar(Scrollbar.HORIZONTAL, MIN_SIZE, SLIDER_WIDTH, 0, MAX_SIZE);


    //methods   
    public void init()
    {
        //set up objects
        //speed scroll bar
        speedBar.setUnitIncrement(UNIT_INC);
        speedBar.setBlockIncrement(BLOC_INC);
        speedBar.setValue(MAXSPEED/2);

        //size scrollbar
        sizeBar.setUnitIncrement(UNIT_INC);
        sizeBar.setBlockIncrement(BLOC_INC);
        sizeBar.setValue(MAX_SIZE/2);

        //draw the window
        BorderLayout window = new BorderLayout();
        GridBagLayout toolbar = new GridBagLayout();
        //?
    }

    public void start()
    {
    }

    public void run()
    {
    }

    public void actionPerformed(ActionEvent e)
    {
    }

    public void adjustmentValueChanged(AdjustmentEvent e)
    {
    }

    public void stop()
    {
    }

    public void destory()
    {
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:34:28+00:00Added an answer on June 13, 2026 at 1:34 am

    Let’s clarify a few things. A LayoutManagers are used by a Container (such as Frame, Panel, or Applet) to calculate position and size of the components inside the Container. This means that it is incorrect to talk about “nesting LayoutManagers”. On the other hand you can nest Containers inside each other and give each one its own LayoutManager. I believe this is what you want to do.

    Let me illustrate this with a contrived example:

    public class MyGUI {
        public static void main(String[] args) {
            Frame f = new Frame("Layout Example");
            Panel mainPanel = new Panel(new BorderLayout());
            f.add(mainPanel);
    
            Panel toolBar = new Panel(new FlowLayout());
            toolBar.add(new Button("Button 1"));
            toolBar.add(new Button("Button 2"));
            mainPanel.add(tollBar.NORTH);
    
            Panel statusBar = new Panel(new FlowLayout());
            statusBar.add(new Label("Status"));
            mainPanel.add(statusBar);
    
            f.pack();
            f.show();
        }
    }
    

    Notice that you need to create a new Panel for each LayoutManager. Or rather each Panel that you create needs a LayoutManager. Also, this example can easily be changed from AWT to Swing by replacing Frame with JFrame, Panel with JPanel, Button with JButton, and Label with JLabel.

    p.s. The above code is not tested. It should illustrate the concepts involved here, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a java applet I can embed in a web page
I need make some action (dump statistical data) before the Dart program ends. The
I have a need to integrate a third-party Java applet into a custom web
I need to set java.net.preferIPv4Stack=true to an app started via JNLP (javaws and applet)
I'm programming a java applet. In this applet I need to draw on an
I'm new to Java and I need some advice/information on how to debug my
I need make all of my posts update. I use bulk upload for store,
Need to make certain Ruby strings in my program to be immutable. What is
I need to make a administrative GUI with lots of functionality like lists, forms,
I need to make a moderate system like the one in fmylife.com. Basically the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.