IPAssignApp.java
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package tsinghuaip;
- import javax.swing.UIManager;
- import java.awt.*;
- public class IPAssignApp {
- boolean packFrame = false;
- //Construct the application
- public IPAssignApp() {
- IPAssignFrm frame = new IPAssignFrm();
- //Validate frames that have preset sizes
- //Pack frames that have useful preferred size info, e.g. from their layout
- if (packFrame) {
- frame.pack();
- }
- else {
- frame.validate();
- }
- //Center the window
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- Dimension frameSize = frame.getSize();
- if (frameSize.height > screenSize.height) {
- frameSize.height = screenSize.height;
- }
- if (frameSize.width > screenSize.width) {
- frameSize.width = screenSize.width;
- }
- frame.setLocation( (screenSize.width - frameSize.width) / 2,
- (screenSize.height - frameSize.height) / 2);
- frame.setVisible(true);
- frame.setResizable(false);
- }
- public static void main(String[] args) {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- new IPAssignApp();
- }
- }