IPAssignApp.java~1~
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:1k
源码类别:

Java编程

开发平台:

Java

  1. package tsinghuaip;
  2. import javax.swing.UIManager;
  3. import java.awt.*;
  4. public class IPAssignApp {
  5.     boolean packFrame = false;
  6.     //Construct the application
  7.     public IPAssignApp() {
  8.         IPAssignFrm frame = new IPAssignFrm();
  9.         //Validate frames that have preset sizes
  10.         //Pack frames that have useful preferred size info, e.g. from their layout
  11.         if (packFrame) {
  12.             frame.pack();
  13.         }
  14.         else {
  15.             frame.validate();
  16.         }
  17.         //Center the window
  18.         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  19.         Dimension frameSize = frame.getSize();
  20.         if (frameSize.height > screenSize.height) {
  21.             frameSize.height = screenSize.height;
  22.         }
  23.         if (frameSize.width > screenSize.width) {
  24.             frameSize.width = screenSize.width;
  25.         }
  26.         frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
  27.         frame.setVisible(true);
  28.     }
  29.     //Main method
  30.     public static void main(String[] args) {
  31.         try {
  32.             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  33.         }
  34.         catch(Exception e) {
  35.             e.printStackTrace();
  36.         }
  37.         new IPAssignApp();
  38.     }
  39. }