info.java
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package infomanagement;
- import javax.swing.UIManager;
- import java.awt.*;
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author unascribed
- * @version 1.0
- */
- public class info {
- private boolean packFrame = false;
- //Construct the application
- public info() {
- Frame1 frame = new Frame1();
- //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);
- }
- //Main method
- public static void main(String[] args) {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- }
- catch(Exception e) {
- e.printStackTrace();
- }
- new info();
- }
- }