第一范文网 - 专业文章范例文档资料分享平台

java实验报告实验六Java图形用户界面

来源:用户分享 时间:2025/5/31 21:18:31 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

.

信 息 工 程 学 院1

Java程序设计 实习报告

JAVA图形用户界面

实验六Java图形用户界面

1.实验目的

(1)掌握图形用户界面基本组件。

(2)了解如何使用布局管理器对组件进行管理。 (3)掌握Java事件处理机制。 2.实验内容

实验题1 编写一个模拟计算器的程序,使用面板和网格布局,添加一个文本框,10个数字按钮(0-9),4个加减乘除按钮,一个等号按钮,一个清除按钮,要求将计算公式和结果显示在文本框中。

运行结果:

实验报告的内容与格式按任课教师的要求书写。 .

.

加法:

主要代码:

private void initComponents() {

.

jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jButton12 = new javax.swing.JButton(); jButton13 = new javax.swing.JButton(); jButton14 = new javax.swing.JButton(); jButton15 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField();

.

setStub(null);

jButton1.setText(\);

jButton1.addActionListener(new

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton2.setText(\);

jButton2.addActionListener(new

});

}

jButton1ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton3.setText(\);

jButton3.addActionListener(new

});

}

jButton2ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton4.setText(\);

jButton4.addActionListener(new

});

}

jButton3ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

.

});

}

jButton4ActionPerformed(evt);

.

jButton5.setText(\);

jButton5.addActionListener(new

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton6.setText(\);

jButton6.addActionListener(new

});

}

jButton5ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton7.setText(\);

jButton7.addActionListener(new

});

}

jButton6ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton8.setText(\);

jButton8.addActionListener(new

});

}

jButton7ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

.

});

}

jButton8ActionPerformed(evt);

.

jButton9.setText(\);

jButton9.addActionListener(new

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton10.setText(\);

jButton10.addActionListener(new

});

}

jButton9ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton11.setText(\); jButton11.addActionListener(new

});

}

jButton10ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

jButton12.setText(\); jButton12.addActionListener(new

});

}

jButton11ActionPerformed(evt);

java.awt.event.ActionListener() {

public void

actionPerformed(java.awt.event.ActionEvent evt) {

.

});

}

jButton12ActionPerformed(evt);

jButton13.setText(\);

搜索更多关于: java实验报告实验六Java图形用户界面 的文档
java实验报告实验六Java图形用户界面.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c2zcdi5nqdo1symv1jox557eja0pqs3006kt_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top