java代码写亲戚计算器 java的计算器代码(11)


// 解析窗体大小
int frameWidth = frameSize.width;
int frameHeight = frameSize.height;
// 设置窗体位置
jFrame.setBounds(centerX - frameWidth / 2, centerY - frameHeight / 2,
frameWidth, frameHeight);
jFrame.setTitle(title);// 设置标题
if (iconFileName != null) {
jFrame.setIconImage(tk.getImage(iconFileName));// 设置图标
}
// 设置皮肤com.sun.java.swing.plaf.windows.WindowsLookAndFeel
/**/
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
SwingUtilities.updateComponentTreeUI(jFrame);
} catch (Exception e1) {
e1.printStackTrace();
}
jFrame.setResizable(resizable);// 设置窗体是否可以改变大小
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置程序关闭动作
jFrame.setVisible(true);// 显示窗体
}
}
class CalculatorFrame extends JFrame {
public CalculatorFrame() {
add(new CalculatorPanel());
MyFrameUitl.init(this, new Dimension(400, 300), "简易计算器", null,
false);
this.pack();// 让组件按原始大小显示,并且窗体的大小刚好能够容纳所有的组件
}
}
public class CalculatorTest {
public static void main(String[] args) {
new CalculatorFrame();
}
}
运行效果:
求JAVA编写的 简易计算器程序 , 附上注释1、首先准备好软件即eclipse和java,下载安装完成后打开eclipse 。
2、点击左上角的file 新建一个project 。
3、给project取一个名字,其他的选项都是默认然后点击finish 。
4、接下来是新建一个class 。
5、在给class取名字的时候注意用英文名的首字母要大写 。完成后点击finish 。
6、这就是开始写代码的工作台,将代码写在绿字下 。
7、这就是第一个hello world程序 。
java代码写亲戚计算器的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java的计算器代码、java代码写亲戚计算器的信息别忘了在本站进行查找喔 。

推荐阅读