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 916147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:00:08+00:00 2026-05-15T18:00:08+00:00

OK so I have this applet thats like this BorderLayout.CENTER – (Within this is

  • 0

OK so I have this applet thats like this

  • BorderLayout.CENTER – (Within this is JPanel)
  • BorderLayout.EAST – (Within this is a new GridLayout (4,5)
  • BorderLayout.SOUTH – (Within this is a TextArea)

Anyway, on the applet, I have to HOVER over the buttons to see them. They don’t paint there I guess but I’m adding them in the init() method… so I don’t know what I am doing wrong and why it’s doing this.

setLayout( new BorderLayout() );
JPanel invOne = new JPanel(new GridLayout(5,4));
JPanel game = new JPanel();
add(invOne, BorderLayout.EAST);
add(game, BorderLayout.CENTER);
add(c, BorderLayout.SOUTH);

invOne.setBounds(416,0, 60, 28);

for (int i = 0,  j = 20;  i < 20;  i = i+1, j = j-1)  {
   invOne.add(new JButton("SLOT " + j));
   invOne.setBounds(32,32,100,100);
   invOne.setFocusable(false);
}

game.setBounds(0,0, 416, 288);
repaint();
  • 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-05-15T18:00:09+00:00Added an answer on May 15, 2026 at 6:00 pm

    What are you trying to accomplish with all the setBounds() calls? Either you let pack() set your panel’s size according to what’s inside, or you set bounds once to where you want to see that panel sit. Especially the calls with a size of 32×32 pixels are not helping at all.


    EDIT:

    I found these problems:

    • As one other poster mentioned, you’re mixing Swing and AWT components. That doesn’t work well. Essentially, if some of the components you use have a “J” at the beginning, you’ll want to go with “J”‘s for all of them. AWT is now considered “old school”. It’s a bit confusing because some classes and components used in GUIs don’t have J’s. I guess you need to work carefully with good examples or look the classes up.

    • For some reason, the applet didn’t want to work well until I gave explicit row/column counts to the TextArea (now called JTextArea). I changed new TextArea() to new JTextArea(3,20).

    • The biggest problem may have been the empty paint() method. I wonder how the applet displayed anything at all? You could have removed the paint() method; I fixed it by calling super.paint().

    • Finally, class names (such as bl) should start with uppercase characters. The compiler in IdeOne grumbled at me for that.

    Here’s my fixed code.

    Happy hacking!

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

Sidebar

Related Questions

I have a Java Applet that is generating an image. Ultimately, I would like
i would like to launch an applet in an build.xml like this: <java classname=sun.applet.AppletViewer
We have created an applet with javafx and it seems that in order to
first of all, i like to say that i have read the other two
I am trying to wrap my head around the rules of applet use. I
I have a 3-rd party java application (I don't own source code) and I
I'm copying code from one part of our application (an applet) to inside the
I would like to get all instances of a repeating action via a eScript
We currently have a corporate intranet built with ASP.NET and originally designed for IE.
I made a neat little photo gallery here at - http://schnell.dreamhosters.com/wallpapers.php Feel free to

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.