• Post Reply Bookmark Topic Watch Topic
  • New Topic

Button globa the frame all!

 
Gustavo Siqueira
Ranch Hand
Posts: 97
C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See code:







How to solve problem ?
 
Paul Clapham
Sheriff
Posts: 21867
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first step is to find out what the problem is. Perhaps you already did that? If so, then you should just tell us what it is. Nobody wants to spend their time playing guessing games.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change this line
startFrame.add(startButton);

to this
startFrame.add(startButton,BorderLayout.EAST);

and, if you notice a difference, read the JDK help for 'JFrame',
to understand the difference
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the button before you call setVisible(true).
If you add or remove components to an already visible container you need to revalidate() it (or invalidate() if it's not a Swing component). I usually combine it with a call to repaint().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!