import java.awt.*;import java.awt.event.*;import java.io.*;public class Test implements ActionListener { Frame f = new Frame("一步运算计算器");//创建窗架 TextField[] tf = new TextField[3];Label La1 = new Label("+");Button btn = new Button("=");int[] a = new ...
import java.awt.event.*;import java.awt.image.BufferedImage;public class TestCopy { public static void main(String[] args) { final JFrame f = new JFrame();JPanel p = new JPanel(new GridLayout(2,1));f.setContentP...
g.drawLine(10,10,736,10);}});jbt1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){Graphics grap=jp2.getGraphics();//创建所画组件对象grap.drawPolygon(xPoint,yPoint,3);}});jbt2.addActionListener(new ActionListener(){public void actionPerformed(Actio...
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 sizes = new HashMap();private Map
我基于你原来画图的方法,添加了事件触发的命令b[j].setActionCommand("b" + j);否则你不能在事件响应处理的方法中使用e.getActionCommand(),而且字符串的比较用equals方法比较好。现在可以运行了,你可以看一下:import java.applet.Applet;import java.awt.*;import java.awt.event.ActionEvent;imp...