| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1805 人关注过本帖
标题:象棋二(chessFrame.java)
只看楼主 加入收藏
编写蓝图
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2005-11-28
收藏
 问题点数:0 回复次数:3 
象棋二(chessFrame.java)

package chess;

import java.awt.Toolkit;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension;

public class chessApp {
boolean packFrame = false;

/**
* Construct and show the application.
*/
public chessApp() {
chessFrame frame = new chessFrame();
// 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);
}

/**
* 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 chessApp();
}
});
}
}

搜索更多相关主题的帖子: 象棋 java chessFrame import awt 
2006-04-11 12:27
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
收藏
得分:0 
你发错了,怎么发到J2ME来了

可惜不是你,陪我到最后
2006-04-11 19:09
haishanglang
Rank: 1
等 级:新手上路
帖 子:378
专家分:0
注 册:2006-3-2
收藏
得分:0 
楼主的程序似乎有问题哟,我用JBuilder2006运行后抛出了几个异常:
java.lang.NullPointerException
at chess.chessFrame.drawChessMan(chessFrame.java:230)
at chess.chessFrame.<init>(chessFrame.java:58)
at chess.chessApp.<init>(chessApp.java:15)
at chess.chessApp$1.run(chessApp.java:53)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

2006-09-13 19:15
禹_二
Rank: 1
等 级:新手上路
帖 子:661
专家分:0
注 册:2006-9-13
收藏
得分:0 
呵呵,根本就不全,在别的机子上就运行不了。

2006-09-17 12:18
快速回复:象棋二(chessFrame.java)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.051280 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved