Цитата(PovAnd @ 27.3.2008, 16:06 ) | | не-е. это немного не то |
как раз самое то В твоем случае, у меньшего окна вызываешь setLocationRelativeTo(Component c) и вместо "Component c" указываешь свое большое окно, т.е. другими словами указываешь мелкому, чтобы он центрировался относительно большого.
Типа так:
| Код | import javax.swing.JFrame;
public class CenterFrame { public static void main(String[] args) { JFrame frame= new JFrame("Parent"); frame.setSize(400, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); JFrame childFrame = new JFrame("Child"); childFrame.setSize(200, 200); childFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); childFrame.setLocationRelativeTo(frame); childFrame.setVisible(true); } }
|
|