ZKX's LAB

简单java图形界面编程题目:题目具体要求如下,附上我写的代码,请大神们帮我改改,谢谢! java图形界面编程代码

2021-03-11知识7

编写一个java图形界面程序,有两个文本输入操作数 不难,尝试着自己写吧。import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;public class SimpleCalc extends JFrame {public static void main(String[]args){new SimpleCalc();}public SimpleCalc(){setSize(500,200);setDefaultCloseOperation(EXIT_ON_CLOSE);setLocationRelativeTo(null);init();setVisible(true);}protected void init(){setTitle(\"Simple Calc\");JPanel p=new JPanel();add(p);JTextField num1=new JTextField(10);p.add(num1);p.add(new JLabel(\"+\"));JTextField num2=new JTextField(10);p.add(num2);p.add(new JLabel(\"=\"));JTextField result=new JTextField(10);result.setEditable(false);p.add(result);JButton calc=new JButton(\"计算\");calc.addActionListener(new CalcListener(num1,num2,result));p.add(calc);}class CalcListener implements ActionListener {private JTextField num1,num2,result;CalcListener。

简单java图形界面编程题目:题目具体要求如下,附上我写的代码,请大神们帮我改改,谢谢! java图形界面编程代码

Java如何画图形用户界面,Java图形用户界面(GrahicalUerIterface,GUI)编程主要有一下特征:图形界面对象及其框架,图形界面对象的布局,图形界面对象上的事件响应。。

java编写一个图形界面程序 import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.*;import javax.swing.border.Border;class MainFrame extends JFrame {private static final long serialVersionUID=1L;private Map,Integer>;sizes=new HashMap,Integer>;();private Map,Integer>;styles=new HashMap,Integer>;();private Map,Integer>;toppings=new HashMap,Integer>;();public MainFrame(){sizes.put(\"Extra Large\",10);sizes.put(\"Large\",8);sizes.put(\"Medium\",5);sizes.put(\"Small\",3);styles.put(\"Deep Dish\",20);styles.put(\"Regular\",10);styles.put(\"Thin Crust\",5);styles.put(\"Chicago\",3);toppings.put(\"Cheese\",8);toppings.put(\"Tomato\",7);toppings.put(\"Peppers\",6);toppings.put(\"Peperoni\",5);this.setTitle(\"布局及事件处理\");this.setSize(450,350);this.setLayout(new BorderLayout());this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel lblTitle=new JLabel();lblTitle.setText(\"Pizzeria Juno\");lblTitle.setFont(new Font(\"宋体\",Font.BOLD,36));lblTitle.setHorizontalAlignment(SwingConstants.CENTER);this.add(\"North\",。

#java图形界面编程代码#java图形界面编程教程

随机阅读

qrcode
访问手机版