Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Components not showing in Applet

 
Stanley Mungai
Ranch Hand
Posts: 155
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making an Applet and After the Login, the following Form Should Show. The form is showing Properly bu the Components are not visible. Can anyone tell me why?

This is My class:




The Button, The labels and the TextField Are not visible.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49411
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your setVisible() call should be last. Otherwise you can try validate() or revalidate().
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, an Applet doesn't need a setVisible(true) at all.

Additionally, you need to learn how to use layout managers: http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html

It's good practice to remove inane IDE generated comments and your own comments that aren't relevant to the stated problem before posting here; anything extraneous just adds clutter.
 
Stanley Mungai
Ranch Hand
Posts: 155
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys I actually Do not think This is the Problem because the Applet Shows all The components on its own. I think It is how I am calling it from the Login Class. I used This Method




Is this enough to make the Applet start or there s something I am Misiing??
 
Campbell Ritchie
Sheriff
Pie
Posts: 49411
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you altered the original code to remove the setVisible call? You mustn’t do that.
 
Stanley Mungai
Ranch Hand
Posts: 155
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was FOllowing Burke's Advice, But My Issue is that When the Applet is run On its own, the components displays. It is Suppossed to be started after Login from another Applet. What I a Getting is a blank Form.

Returned the SetVisible(true) function....Nothing
 
Campbell Ritchie
Sheriff
Pie
Posts: 49411
62
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn’t mean the code you are using, I meant the code you had posted. Sorry for not being clear. You mustn’t change the code in a post after it has been answered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic