aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes add(lable) doesnt show till i resize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "add(lable) doesnt show till i resize" Watch "add(lable) doesnt show till i resize" New topic
Author

add(lable) doesnt show till i resize

chop ficaro
Ranch Hand

Joined: May 02, 2010
Posts: 30
im trying to move my debugging output from system.out.println() to the frame i made with the awt that already has some buttons and things in it. so every time i do something, im trying to do this.add(label) to tell me that what i expect is being done is being done. but when i add lables, they dont show up until i resize the window, and then it shows up horizontally to the left and vertically centered. so i figure, the other stuff in the window is hiding it, so i try setSize(200,200) in the constructor. But that didnt even resize the window! now, i have to resize the window to 400 pixels vertically to see the text show up, as if all it did was make a big white block of size 200x200 that hides my new lables! whats the right way to move my debugging to this frame?
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Welcome to Java Ranch!

The first thing to realize is that any time you change the structure of a graphical element (like adding components to a frame/panel), you need to call validate() on it to tell it that it needs to re-do it's layout and display work.

Next, what you are describing is a very heavy-weight way to view debugging messages. It might be easier to create a scrolling text area, then just add your messages to the text displayed by that text area.

chop ficaro
Ranch Hand

Joined: May 02, 2010
Posts: 30
thanks i will look up how to do that
chop ficaro
Ranch Hand

Joined: May 02, 2010
Posts: 30
got it working! thank you very much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: add(lable) doesnt show till i resize