Realization of Java Window - Calculator (calculated)

xiaoxiao2021-03-06  46

/ ************************************************** ********************* * Module: cauculater.java * Author: administrator * create: 2004-12-7 23:48:21 * purpose: ** *********************************************************** ************************** / pack org.heixue.test.applet;

/ ** * @Author administrator * / import javax.swing. *; Import java.awt.event. *; Import java.awt. *; Public class calculater extends japplet {jmenu [] menus = {new jmenu ("option" NEW JMENU ("About")}; jMenuitem [] items = {new jMenuItem ("About"), new jmenuitem ("Set Background Color")}; jbutton b1 = new jbutton ("calculation"); JOPANE B2 = New Joptionpane ("Operation ..."); jtextfield txt1 = new jtextfield ("100", 10); jtextfield txt2 = new jtextfield ("200", 10); jtextfield txt3 = new jtextfield (20); jlabel [] label = {NEW JLABEL (" "), new jlabel ("=")}; jcolorchooser jcc = new jcolorchooser (); actionListener al = new actionListener () {public void actionPerformed (ActionEvent E) {// String Name = Jbutton) E.GetSource ()). GetText (); int m = joptionpane.showconfirmdialog (NULL, "Continue to calculate?", "OK", JOPANE.YES_NO_OPTION; if (m == 0) {String OP1 = TXT1.GETTEXT (); string op2 = txt2.getText (); txt3.Settext (bussiness (OP1, OP2)); //txt3.SetText (M ");}}}; actionListener al2 = new actionListener () { Public Void ActionPerform ed (ActionEvent e) {JOptionPane.showMessageDialog (null, "OF: black snow group", "About ...", JOptionPane.INFORMATION_MESSAGE);}}; ActionListener al3 = new ActionListener () {public void actionPerformed (ActionEvent e) {JColorchooser.createdialog (NULL, "background color ...", true, jcc, al4, null) .show ();}}; actionListener al4 = new actionListener () {public void ActionPerformed (ActionEvent E) {ChangeFace (0 JCC.GetColor ());}}; public void init () {// Initialize Layout. Container CP = getContentPane (); cp.setLayout (new flowLayout ());

转载请注明原文地址:https://www.9cbs.com/read-82662.html

New Post(0)