StartPoint.java
资源名称:汉诺塔图形演示.rar [点击查看]
上传用户:qiye11114
上传日期:2010-01-20
资源大小:126k
文件大小:2k
源码类别:
其他智力游戏
开发平台:
Java
- package hanoi;
- import java.awt.Toolkit;
- import javax.swing.SwingUtilities;
- import javax.swing.UIManager;
- import java.awt.Dimension;
- /**
- * <p>Title: Hanoi Pan</p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author ZhangYuan
- * @version 1.0
- */
- public class StartPoint {
- boolean packFrame = false;
- /**
- * Construct and show the application.
- */
- public StartPoint() {
- DefaultFrame frame = new DefaultFrame();
- // 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);
- try {
- jbInit();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- /**
- * Application entry point.
- *
- * @param args String[]
- */
- public static void main(String[] args) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- try {
- UIManager.setLookAndFeel(UIManager.
- getSystemLookAndFeelClassName());
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- new StartPoint();
- }
- });
- }
- private void jbInit() throws Exception {
- }
- }