import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.lang.String;
public class Calculate
{
public static void main (String[] args)
{
FrameSize frame = new FrameSize();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}
class FrameSize extends JFrame
{
public FrameSize()
{
setSize(600,400); //设置框架尺寸
ButtonPanel panel2 = new ButtonPanel();
Container contentPane = getContentPane();
contentPane.add(panel2);
}
}
//创建按钮面板
class ButtonPanel extends JPanel
{
public ButtonPanel()
{
JButton Button1 = new JButton("0"); //创建按钮
JButton Button2 = new JButton("1");
JButton Button3 = new JButton("2");
add(Button1);
add(Button2);
add(Button3);
ButtonAction ButtonAction1 = new ButtonAction("1"); //40行找不到符号
ButtonAction ButtonAction2 = new ButtonAction("2"); //41行找不到符号
ButtonAction ButtonAction3 = new ButtonAction("3"); //42行找不到符号
Button1.addActionListener(ButtonAction1);
Button2.addActionListener(ButtonAction2);
Button3.addActionListener(ButtonAction3);
}
private class ButtonAction implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if(source == Button1) ButtonText = "0";
else if(source == Button2) ButtonText = "1";
else if(source == Button3) ButtonText = "2";
repaint();
}
}
private JButton Button1;
private JButton Button2;
private JButton Button3;
public String ButtonText=" ";
}
尚方宝剑之说
蛊毒传说
相关分类