/*
- To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. /package javaapplication1;import java.awt.;/** * * @author Angle~子敬 /public class JavaApplication1 { static Frame f; static Button b; static TextField tf; static List li; /* * @param args the command line arguments */ public static void main(String[] args) { f=new Frame(“prime”); b=new Button(“start”); tf=new TextField(“100”); li=new List(); f.add(tf,“North”); f.add(b,“East”); f.setSize(400,300); f.setVisible(true); // TODO code application logic here } }
/*
- To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. /package javaapplication2;import java.awt.;/** * * @author Angle~子敬 /public class JavaApplication2 { static Frame f; static TextField tf; static Button b[]; /* * @param args the command line arguments / public static void main(String[] args) { f=new Frame(“Calculator”); tf=new TextField(“0”); String s[]={“CE”,“7”,“8”,“9”,"/",“4”,“5”,“6”,"",“1”,“2”,“3”,"-",".",“0”,"=","+"}; b=new Button[17]; for(int i=0;i<b.length;i++) b[i]=new Button(s[i]); Panel p1=new Panel(); Panel p2=new Panel(); p1.setLayout(new BorderLayout()); p2.setLayout(new GridLayout(4,4)); f.add(p1,“North”); f.add(p2,“Center”); p1.add(tf,“Center”); p1.add(b[0],“East”); for(int i=1;i<b.length;i++) p2.add(b[i]); f.setSize(300,200); f.setVisible(true); // TODO code application logic here } }