java实现选择题选择.docx

上传人:小飞机 文档编号:3061227 上传时间:2023-03-10 格式:DOCX 页数:5 大小:37.24KB
返回 下载 相关 举报
java实现选择题选择.docx_第1页
第1页 / 共5页
java实现选择题选择.docx_第2页
第2页 / 共5页
java实现选择题选择.docx_第3页
第3页 / 共5页
java实现选择题选择.docx_第4页
第4页 / 共5页
java实现选择题选择.docx_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《java实现选择题选择.docx》由会员分享,可在线阅读,更多相关《java实现选择题选择.docx(5页珍藏版)》请在三一办公上搜索。

1、java实现选择题选择java实现选择题选择 说明: 要在E:目录下放置好“头像6.jpg”和“头像5.jpg”作为回答正确、回答错误时候要显示的图片。 import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.JFrame; import java.awt.Dimension; import javax.swing.JLabel; import java.awt.Rectangle; import javax.swing.JRadioButton; import javax.swing.ImageI

2、con; import javax.swing.*; public class EGshiti extends JFrame private static final long serialVersionUID = 1L; private JPanel jContentPane = null; private JLabel jLabel = null; private JLabel jLabel1 = null; private JRadioButton jRadioButton = null; private JRadioButton jRadioButton1 = null; privat

3、e JRadioButton jRadioButton2 = null; private JLabel jLabel2 = null; private JLabel jLabel3 = null; private ButtonGroup bg=null; /* * This is the default constructor */ public EGshiti super; initialize; /* * This method initializes this * * return void */ private void initialize this.setSize(336, 291

4、); this.setContentPane(getJContentPane); this.setTitle(英语试题); this.setVisible(true); this.addWindowListener(new java.awt.event.WindowAdapter public void windowClosing(java.awt.event.WindowEvent e) System.exit(0); ); /* * This method initializes jContentPane * * return javax.swing.JPanel */ private J

5、Panel getJContentPane if (jContentPane = null) jLabel3 = new JLabel; jLabel3.setBounds(new Rectangle(135, 67, 85, 74); jLabel3.setText(); jLabel2 = new JLabel; jLabel2.setBounds(new Rectangle(20, 155, 256, 18); jLabel1 = new JLabel; jLabel1.setBounds(new Rectangle(15, 36, 155, 18); jLabel1.setText(

6、some flowers for you); jLabel = new JLabel; jLabel.setBounds(new Rectangle(15, 14, 39, 18); jLabel.setText(题目:); jContentPane = new JPanel; jContentPane.setLayout(null); jContentPane.add(jLabel, null); jContentPane.add(jLabel1, null); jContentPane.add(getJRadioButton, null); jContentPane.add(getJRad

7、ioButton1, null); jContentPane.add(getJRadioButton2, null); jContentPane.add(jLabel2, null); jContentPane.add(jLabel3, null); bg=new ButtonGroup; bg.add(jRadioButton); bg.add(jRadioButton1); bg.add(jRadioButton2); return jContentPane; /* * This method initializes jRadioButton * * return javax.swing.

8、JRadioButton */ private JRadioButton getJRadioButton if (jRadioButton = null) jRadioButton = new JRadioButton; jRadioButton.setBounds(new Rectangle(16, 60, 88, 26); jRadioButton.setText(A.给你的花); jRadioButton.addActionListener(new java.awt.event.ActionListener public void actionPerformed(java.awt.eve

9、nt.ActionEvent e) jLabel3.setIcon(new ImageIcon(E:头像6.jpg); jLabel2.setText(正确答案:A。原因不用解释了吧呵呵); ); return jRadioButton; /* * This method initializes jRadioButton1 * * return javax.swing.JRadioButton */ private JRadioButton getJRadioButton1 if (jRadioButton1 = null) jRadioButton1 = new JRadioButton;

10、jRadioButton1.setBounds(new Rectangle(16, 90, 88, 26); jRadioButton1.setText(B.给他的花); jRadioButton1.addActionListener(new java.awt.event.ActionListener public void actionPerformed(java.awt.event.ActionEvent e) jLabel3.setIcon(new ImageIcon(E:头像5.jpg); jLabel2.setText(正确答案:A。原因不用解释了吧呵呵); ); return jR

11、adioButton1; /* * This method initializes jRadioButton2 * * return javax.swing.JRadioButton */ private JRadioButton getJRadioButton2 if (jRadioButton2 = null) jRadioButton2 = new JRadioButton; jRadioButton2.setBounds(new Rectangle(16, 123, 88, 26); jRadioButton2.setText(C.给她的花); jRadioButton2.addAct

12、ionListener(new java.awt.event.ActionListener public void actionPerformed(java.awt.event.ActionEvent e) jLabel3.setIcon(new ImageIcon(E:头像5.jpg); jLabel2.setText(正确答案:A。原因不用解释了吧呵呵); ); return jRadioButton2; public static void main(String args) new EGshiti; / jve:decl-index=0:visual-constraint=10,10

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号