Java实现简单的计算器
要求: 编写一个Java应用程序,采用GridLayout实现如下计算机器的布局及做相应的事件处理
代码实现(本需求完全有个人实现):
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
@SuppressWarnings(“serial”)
class MyComputerWin extends JFrame implements ActionListener {
JTextField expressText; //创建一个单行文本框引用
JPanel numPanel, operPanel;// 创建两个面板引用
JPanel panel; //创建一个面板用于存放文本框与"="按钮。
//创建按钮数组用于存放按钮,并定义数组的长度
JButton[] numBtn = new JButton[12];
JButton[] operBtn = new JButton[6];
String express = “”;
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
expressText <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JTextField</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//实例化单行文本框对象</span>
<span class="token comment">//实例化面板对象</span>
numPanel <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JPanel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operPanel <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JPanel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
panel <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JPanel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置面板为网格布局(GridLayout), 注意: 默认是流动布局(FlowLayout)</span>
panel<span class="token punctuation">.</span><span class="token function">setLayout</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">BorderLayout</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
numPanel<span class="token punctuation">.</span><span class="token function">setLayout</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">GridLayout</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operPanel<span class="token punctuation">.</span><span class="token function">setLayout</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">GridLayout</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//将数字按钮添加到数字面板上</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span>int i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator"><</span> numBtn<span class="token punctuation">.</span>length<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token comment">//创建数字按钮</span>
<span class="token keyword">if</span><span class="token punctuation">(</span>i<span class="token operator">>=</span><span class="token number">0</span><span class="token operator">&&</span>i<span class="token operator"><=</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
numBtn<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">""</span><span class="token operator">+</span><span class="token punctuation">(</span><span class="token number">7</span><span class="token operator">+</span>i<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>i<span class="token operator">>=</span><span class="token number">3</span><span class="token operator">&&</span>i<span class="token operator"><=</span><span class="token number">5</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
numBtn<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">""</span><span class="token operator">+</span><span class="token punctuation">(</span>i<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>i<span class="token operator">>=</span><span class="token number">6</span><span class="token operator">&&</span>i<span class="token operator"><=</span><span class="token number">8</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
numBtn<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">""</span><span class="token operator">+</span><span class="token punctuation">(</span>i<span class="token operator">-</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token punctuation">{<!-- --></span>
numBtn<span class="token punctuation">[</span><span class="token number">9</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">""</span><span class="token operator">+</span><span class="token string">"00"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
numBtn<span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">""</span><span class="token operator">+</span><span class="token string">"0"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
numBtn<span class="token punctuation">[</span><span class="token number">11</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">""</span><span class="token operator">+</span><span class="token string">"^"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
numPanel<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>numBtn<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
numBtn<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token function">addActionListener</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">//设置符号按钮</span>
operBtn<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">"%"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operBtn<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">"/"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operBtn<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">"*"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operBtn<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">"-"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operBtn<span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">"+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operBtn<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">JButton</span><span class="token punctuation">(</span><span class="token string">"="</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//将符号按钮添加到符号面板上</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span>int i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator"><</span> operBtn<span class="token punctuation">.</span>length<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
operPanel<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>operBtn<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operBtn<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token function">addActionListener</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
panel<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>expressText<span class="token punctuation">)</span><span class="token punctuation">;</span>
panel<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>operBtn<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">,</span>BorderLayout<span class="token punctuation">.</span><span class="token constant">EAST</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
operBtn<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token function">addActionListener</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//将文本框添加到窗口上,并设置为边界布局</span>
<span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>panel<span class="token punctuation">,</span> BorderLayout<span class="token punctuation">.</span><span class="token constant">NORTH</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//将面板添加到窗口上</span>
<span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>numPanel<span class="token punctuation">,</span> BorderLayout<span class="token punctuation">.</span><span class="token constant">CENTER</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>operPanel<span class="token punctuation">,</span> BorderLayout<span class="token punctuation">.</span><span class="token constant">EAST</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token keyword">public</span> <span class="token function">MyComputerWin</span><span class="token punctuation">(</span>String title<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token keyword">super</span><span class="token punctuation">(</span>title<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setVisible</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setSize</span><span class="token punctuation">(</span><span class="token number">300</span><span class="token punctuation">,</span> <span class="token number">300</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setLocationRelativeTo</span><span class="token punctuation">(</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">this</span><span class="token punctuation">.</span>expressText<span class="token punctuation">.</span><span class="token function">setBackground</span><span class="token punctuation">(</span>Color<span class="token punctuation">.</span><span class="token constant">YELLOW</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setDefaultCloseOperation</span><span class="token punctuation">(</span>JFrame<span class="token punctuation">.</span><span class="token constant">EXIT_ON_CLOSE</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
@Override
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">actionPerformed</span><span class="token punctuation">(</span>ActionEvent e<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
String s <span class="token operator">=</span> e<span class="token punctuation">.</span><span class="token function">getActionCommand</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//获得发生该事件的相关命令,在这里就是获得按钮事件上的数字。</span>
express <span class="token operator">+=</span> s<span class="token punctuation">;</span> <span class="token comment">//将获得的命令保存起来</span>
expressText<span class="token punctuation">.</span><span class="token function">setText</span><span class="token punctuation">(</span>express<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//将获得的命令放入文本框中。</span>
<span class="token comment">//因为s代表的是单个按钮事件上的命令,所以这里判断s获得的命令是不是"="。</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token string">"="</span><span class="token punctuation">.</span><span class="token function">equals</span><span class="token punctuation">(</span>s<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
String<span class="token punctuation">[</span><span class="token punctuation">]</span> nums <span class="token operator">=</span> express<span class="token punctuation">.</span><span class="token function">split</span><span class="token punctuation">(</span><span class="token string">"\\p{Punct}"</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">// 5+6= 正则表达式 \\p{Punct}代表的是标点符号,这里就是通过标点符号(+,-,*,/.....)来进行分割,然后得到我们想要计算的数字。</span>
String<span class="token punctuation">[</span><span class="token punctuation">]</span> opers <span class="token operator">=</span>express<span class="token punctuation">.</span><span class="token function">split</span><span class="token punctuation">(</span><span class="token string">"\\d+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//利用正则表达式中的多位数字来进行分解。然后得到我们想要的运算符号</span>
String oper<span class="token operator">=</span>opers<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token comment">//定义一个String类型的变量存储符号</span>
double num1<span class="token operator">=</span>Integer<span class="token punctuation">.</span><span class="token function">parseInt</span><span class="token punctuation">(</span>nums<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
double num2<span class="token operator">=</span>Integer<span class="token punctuation">.</span><span class="token function">parseInt</span><span class="token punctuation">(</span>nums<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
double result<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token keyword">switch</span><span class="token punctuation">(</span>oper<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token keyword">case</span> <span class="token string">"+"</span><span class="token punctuation">:</span>express<span class="token operator">+=</span>num1<span class="token operator">+</span>num2<span class="token punctuation">;</span><span class="token keyword">break</span><span class="token punctuation">;</span>
<span class="token keyword">case</span> <span class="token string">"-"</span><span class="token punctuation">:</span>express<span class="token operator">+=</span>num1<span class="token operator">-</span>num2<span class="token punctuation">;</span><span class="token keyword">break</span><span class="token punctuation">;</span>
<span class="token keyword">case</span> <span class="token string">"*"</span><span class="token punctuation">:</span>express<span class="token operator">+=</span>num1<span class="token operator">*</span>num2<span class="token punctuation">;</span><span class="token keyword">break</span><span class="token punctuation">;</span>
<span class="token keyword">case</span> <span class="token string">"/"</span><span class="token punctuation">:</span><span class="token keyword">if</span><span class="token punctuation">(</span>num2<span class="token operator">!=</span><span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
express<span class="token operator">+=</span>num1<span class="token operator">/</span>num2<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token punctuation">{<!-- --></span>
express<span class="token operator">+=</span><span class="token string">"分母为0,不能计算!!"</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">break</span><span class="token punctuation">;</span>
<span class="token keyword">case</span> <span class="token string">"%"</span><span class="token punctuation">:</span>express<span class="token operator">+=</span>num1<span class="token operator">/</span><span class="token number">100</span><span class="token operator">*</span>num2<span class="token punctuation">;</span><span class="token keyword">break</span><span class="token punctuation">;</span>
<span class="token keyword">case</span> <span class="token string">"^"</span><span class="token punctuation">:</span><span class="token keyword">for</span><span class="token punctuation">(</span>int i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator"><</span>num2<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
result<span class="token operator">*=</span>num1<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
express<span class="token operator">+=</span>result<span class="token punctuation">;</span><span class="token keyword">break</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">//express+=result;</span>
expressText<span class="token punctuation">.</span><span class="token function">setText</span><span class="token punctuation">(</span>express<span class="token punctuation">)</span><span class="token punctuation">;</span>
express<span class="token operator">=</span><span class="token string">""</span><span class="token punctuation">;</span> <span class="token comment">//计算完之后将数据清空</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
}
public class MyComputer {
<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span>String<span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token keyword">new</span> <span class="token class-name">MyComputerWin</span><span class="token punctuation">(</span><span class="token string">"我的计算器"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
代码如下:
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
i…
明天我给你远程操作一下9小时前回复
-
爱码士 strive_day : 又到了收藏学习的一天 18小时前 回复举报
-
-
码工 程序猿啊哈 回复 : 感谢支持 14小时前 回复举报
-
- <
- 1
- >
</div>
02-14 354实训目的:掌握 Java GUI 开发中的布局管理和事件处理机制。
实训要求:(1)要使用 java 的 GUI 设计出计算器界面。(2)通过界面按钮,可以实现整数或浮点数的四则运算,并能将结果显示在界面中。(3)计算可以有小数点,和正负整数的计算。(4)要有清零功能。
二 类设计中缀表达式的计算solution(String str)
用来中算后缀表达…
03-17 1万+程序编写思路:
在编写这个计算器小程序时,首先需要对窗体和窗体中的组件有一个合理的布局,使编写出来的窗体看着美观简洁又实用.其次就是要注意对运算符和数字键的处理,为这些数字键和运算符键添加动作监听,使其在点击时,能够在文本框中输入相应的值.然后通过对文本框添加监听,获取文本框中的值,再进行相应的运算,并将结果输出的结果显示文本框中.
此程序的难点在于对于动作监听的…
05-26 1万+以下两图是计算器的结果展示:
好了,那么今天我们来讲一下安卓计算器的简单实现,对于广大愁于编程的初学者大学生来说,自己制作一个计算器的作业会非常难,但是不要害怕,编程本来就很难,智商跟不上
05-2105-30 7598题目要求:编写一个Applet,利用两个文本框对象input1和input2,接收用户从键盘输入的两个整型数。当用户单击“计算”按钮时,可进行算术计算,并输出运算结果;运算结果放在多行文本域JTextArea组件中。
思路如下:
先放置所有组件在一个顶层容器中
布置组件位置,我使用了GridLayout,简单方便放置组件,毕竟初学
写出四个计算按钮的buttona…
05-18 2万+03-15 4万+©️2020 CSDN 皮肤主题: 深蓝海洋 设计师:CSDN官方博客 返回首页最新评论
- Java实现简单的计算器
- Java实现简单的计算器
Java劝退师、: 代码之路任重道远,愿跟博主努力习之。 最近我也在学习写博客,有空来看看我呀,一起互相学习。期待你的关注与支持
- Java实现简单的计算器
程序猿啊哈: 加我QQ 2562777581 明天我给你远程操作一下
- Java实现简单的计算器
weixin_53535262: 我使用了快速修复,输出是输出了,但是页面是白板,什么都没有。大佬带带我。
- Java实现简单的计算器
weixin_53535262: 我调成大写他就能输出,但是是白板。
-