Auto Fit on screen

How do i make the JFrame fit on the screen as if i were to click the maxiumize button?
[93 byte] By [ichbinsterbena] at [2007-11-27 3:59:47]
# 1
See the setExtendedState method:[url= http://java.sun.com/javase/6/docs/api/java/awt/Frame.html#setExtendedState(int)]setExtendedState(int)[/url]
DrLaszloJamfa at 2007-7-12 9:04:21 > top of Java-index,Java Essentials,New To Java...
# 2

Thanks worked perfectly.

By the way you wouldn't happen to know why I a picture won't show up unless i press on of the upper right corner buttons would you.

I start off on one JFrame which has a picture and some music in the background, then when i click a button the first JFrame closes, music stops and a new JFrame loads. Now the new music will begin to play but the picture won't show up unless i press on of the upper right corner buttons

ichbinsterbena at 2007-7-12 9:04:21 > top of Java-index,Java Essentials,New To Java...
# 3
I can only guess, but when components don't repaint correctly, you're eithercoding in an incorrect manner, or you need to call revalidate on the component'scontainer, or repaint.
DrLaszloJamfa at 2007-7-12 9:04:21 > top of Java-index,Java Essentials,New To Java...
# 4
That helped thanx
ichbinsterbena at 2007-7-12 9:04:21 > top of Java-index,Java Essentials,New To Java...