display the jframe in the middle

how can i display the jframe at the middle of screen?and how can i hide it ?
[90 byte] By [student14a] at [2007-11-27 2:15:36]
# 1
> how can i display the jframe at the middle of screen?give the frame a size - eitherframe.setSize(..);orframe.pack();thenframe.setLocationRelativeTo(null);> how can i hide it ?you must be joking - how do you show it?
Michael_Dunna at 2007-7-12 2:12:38 > top of Java-index,Desktop,Core GUI APIs...
# 2
you can get the screen size using this function(java.awt.Toolkit.getDefaultToolkit().getScreenSize().width()-yourScreen.width())/2similarly for height..
chaos_begins_herea at 2007-7-12 2:12:38 > top of Java-index,Desktop,Core GUI APIs...
# 3
> and how can i hide it ?I think this might work:yourJFrame.hide()Or use setVisible (I don't recall exactly, but check the APIs). I do hope there's another JFrame that will show that frame again...
astigmatika at 2007-7-12 2:12:38 > top of Java-index,Desktop,Core GUI APIs...
# 4
> and how can i hide it ?you can hide your Frame by using this line:myFrame.setVisible(false);
Program_Javaa at 2007-7-12 2:12:38 > top of Java-index,Desktop,Core GUI APIs...