Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in Swing  RSS feed

 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I am really stucked in this thing.
I am writing a simple Swing program to add a JButton and JTextField on a
JFrame.
On running the code, the button is displayed only when I point to the location using mouse.
text field is having same problem.

Please suggest what to do?
Thanks in advance
 
Rok Ć telcer
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Hm ... it sounds to me like a feature and not a bug. ;)

So, in order to help you, you should share with us your code sample/snip.
Since this are Swing basis, the code should not be that long.

You can also check the following example (with one component - JLabel):
http://java.sun.com/docs/books/tutorial/uiswing/examples/components/FrameDemoProject/src/components/FrameDemo.java
Just for crosschecking.


Regards,
Rok
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the button is displayed only when I point to the location using mouse. text field is having same problem.


The order of the code should be:



If you add components after the frame is visible then you need to do:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!