Use SwingUtil to center frames within the screen bounds.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@201 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Chooser.java,v 1.3 2001/07/13 00:10:48 mdb Exp $
|
||||
// $Id: Chooser.java,v 1.4 2001/07/21 02:04:37 shaper Exp $
|
||||
|
||||
package robodj.chooser;
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
import com.samskivert.util.PropertiesUtil;
|
||||
|
||||
import robodj.Log;
|
||||
@@ -76,11 +77,8 @@ public class Chooser
|
||||
// create our primary user interface frame, center the frame in
|
||||
// the screen and show it
|
||||
ChooserFrame frame = new ChooserFrame();
|
||||
Toolkit tk = frame.getToolkit();
|
||||
Dimension ss = tk.getScreenSize();
|
||||
int width = 550, height = 500;
|
||||
frame.setBounds((ss.width-width)/2, (ss.height-height)/2,
|
||||
width, height);
|
||||
frame.setSize(550, 500);
|
||||
SwingUtil.centerFrame(frame);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Importer.java,v 1.4 2001/06/05 17:40:18 mdb Exp $
|
||||
// $Id: Importer.java,v 1.5 2001/07/21 02:04:37 shaper Exp $
|
||||
|
||||
package robodj.importer;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.awt.Toolkit;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
import com.samskivert.util.Log;
|
||||
import com.samskivert.util.PropertiesUtil;
|
||||
|
||||
@@ -59,11 +60,8 @@ public class Importer
|
||||
frame.setPanel(panel);
|
||||
|
||||
// center the frame in the screen and show it
|
||||
Toolkit tk = frame.getToolkit();
|
||||
Dimension ss = tk.getScreenSize();
|
||||
int width = 640, height = 480;
|
||||
frame.setBounds((ss.width-width)/2, (ss.height-height)/2,
|
||||
width, height);
|
||||
frame.setSize(640, 480);
|
||||
SwingUtil.centerFrame(frame);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user