Simple function calculator made by java``

xiaoxiao2021-03-06  103

/ * Beginner Java, a teacher arranged by the teacher, do a simple function calculator * Try a try` `` `Because there are not many things, the powerful method has not learned * so Some ways to understand, * huh, `` `Practice` `` `* master don't swear! * / Import java.applet.applet; import java.awt. *;

public class Calc extends Applet {private Button button0, button1, button2, button3, button4, button5, button6, button7, button8, button9, jia, jian, deng, cheng, chu, clear; TextField show, result; String s1 = "" , S2, S4, S5, S6; CHAR S3, CH1; Double Num1, Num2, Num3; INT S11_LENGTH, NUM4; // ************ Initialization ******** ********* public void init () {show = new textfield (10); result = new textfield (10); button0 = new button ("0"); button1 = new button ("1") Button2 = New Button; Button3 = New Button; Button4 = New Button; Button5 = New Button ("5"); Button6 = New Button ("6") Button7 = New Button ("7"); Button8 = New Button ("8"); Button9 = New Button ("9"); jian = new button (" "); jian = new button ("-") Cheng = New Button ("×"); chu = new button ("÷"); deng = new button ("="); clear = new button; add (show); add (result) SetLayout (NULL); add (button0); add (button2); add (button3); add (button5); add (button6); add (button7); add (button8) Add (button9); Add (ji); add (jian); add (cheng); add (chu); add (deng); add (cle); show .reshape (10, 10, 130, 25); Result.reshape (150, 10, 130, 25); Button0.reshape (10, 50, 45, 20); Button1.reshape (65, 50, 45, 20); Button2.reshape (120, 50, 45, 20); Button3.reshape (175, 50, 45, 20); Button4.reshape (10, 90, 45, 20); Button5.reshape (65, 90, 45, 20); Button6 .reshape (120, 90, 45, 20); Button7.reshape (175, 90, 45, 20); Button8.reshape (10, 130, 45, 20); Button9.reshape (65, 130, 45, 20); jia.reshape (120, 130, 45, 20); jian.reshape (175, 130, 45, 20); cheng.reshape (10,170,45,20); chu.reshape (65, 170, 45, 20); deng.reshape (120, 170, 100, 20); Clear.reshape (230, 130, 55, 60);

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

New Post(0)