• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

add(lable) doesnt show till i resize

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks i will look up how to do that
 
chop ficaro
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
got it working! thank you very much
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic