1. import java.awt.BorderLayout;
  2. import java.awt.EventQueue;
  3.  
  4. import javax.swing.JFrame;
  5. import javax.swing.JPanel;
  6. import javax.swing.border.EmptyBorder;
  7. import java.awt.BorderLayout;
  8. import java.awt.EventQueue;
  9.  
  10. import javax.swing.JFrame;
  11. import javax.swing.JOptionPane;
  12. import javax.swing.JPanel;
  13. import javax.swing.border.EmptyBorder;
  14. import javax.swing.JButton;
  15. import java.awt.Color;
  16. import javax.swing.JTextArea;
  17. import javax.swing.GroupLayout;
  18. import javax.swing.GroupLayout.Alignment;
  19. import javax.swing.LayoutStyle.ComponentPlacement;
  20. import javax.swing.JCheckBox;
  21. import javax.swing.JTextField;
  22. import java.awt.event.ActionListener;
  23. import java.awt.event.ActionEvent;
  24. import javax.swing.SwingConstants;
  25. import java.awt.Font;
  26.  
  27. public class gui1 extends JFrame {
  28.  
  29. private JPanel contentPane;
  30. private JTextField textField;
  31.  
  32. /**
  33. * Launch the application.
  34. */
  35. public static void main(String[] args) {
  36. EventQueue.invokeLater(new Runnable() {
  37. public void run() {
  38. try {
  39. gui1 frame = new gui1();
  40. frame.setVisible(true);
  41. } catch (Exception e) {
  42. e.printStackTrace();
  43. }
  44. }
  45. });
  46. }
  47.  
  48. /**
  49. * Create the frame.
  50. */
  51. public void f1(){
  52. //获取文本框的内容
  53. textField.getText();
  54. //对字符串进行解析(获取你有用的信息)//1+1=
  55. //System.out.println(textField.getText());
  56. //1+1=
  57.  
  58. //截取+号之前的数据,+号之后=号之前的数据
  59.  
  60. int aa1 =(textField.getText()).indexOf("+");
  61. int aa2 =(textField.getText()).indexOf("-");
  62. int aa3 =(textField.getText()).indexOf("*");
  63. int aa4 =(textField.getText()).indexOf("/");
  64. //判断加减乘除
  65. if(-!=aa1){
  66. int a=(textField.getText()).indexOf("+");
  67. //int b=(textField.getText()).indexOf("+1");
  68. int d=(textField.getText()).indexOf("=");
  69. String str1=new String();
  70. String str2=new String();
  71. str1=(textField.getText()).substring(,a);
  72. str2=(textField.getText()).substring(a+,d);
  73.  
  74. //截取到了之后,结果是个字符串,要进行转换,转换成int
  75. int e1=Integer.parseInt(str1);
  76. int e2=Integer.parseInt(str2);
  77. //执行操作,计算(用方法实现),返回值int
  78. gui1 ss=new gui1();
  79. ss.f(e1,e2);
  80. textField.setText(""+ss.f(e1,e2));
  81. }else if(-!=aa2){
  82. int a=(textField.getText()).indexOf("-");
  83. //int b=(textField.getText()).indexOf("+1");
  84. int d=(textField.getText()).indexOf("=");
  85. String str1=new String();
  86. String str2=new String();
  87. str1=(textField.getText()).substring(,a);
  88. str2=(textField.getText()).substring(a+,d);
  89.  
  90. //截取到了之后,结果是个字符串,要进行转换,转换成int
  91. int e1=Integer.parseInt(str1);
  92. int e2=Integer.parseInt(str2);
  93. //执行操作,计算(用方法实现),返回值int
  94. gui1 ss=new gui1();
  95. ss.f4(e1,e2);
  96. textField.setText(""+ss.f4(e1,e2));
  97.  
  98. }else if(-!=aa3){
  99. int a=(textField.getText()).indexOf("*");
  100. //int b=(textField.getText()).indexOf("+1");
  101. int d=(textField.getText()).indexOf("=");
  102. String str1=new String();
  103. String str2=new String();
  104. str1=(textField.getText()).substring(,a);
  105. str2=(textField.getText()).substring(a+,d);
  106.  
  107. //截取到了之后,结果是个字符串,要进行转换,转换成int
  108. int e1=Integer.parseInt(str1);
  109. int e2=Integer.parseInt(str2);
  110. //执行操作,计算(用方法实现),返回值int
  111. gui1 ss=new gui1();
  112. ss.f2(e1,e2);
  113. textField.setText(""+ss.f2(e1,e2));
  114.  
  115. }else if(-!=aa4){
  116. int a=(textField.getText()).indexOf("/");
  117. //int b=(textField.getText()).indexOf("+1");
  118. int d=(textField.getText()).indexOf("=");
  119. String str1=new String();
  120. String str2=new String();
  121. str1=(textField.getText()).substring(,a);
  122. str2=(textField.getText()).substring(a+,d);
  123.  
  124. //截取到了之后,结果是个字符串,要进行转换,转换成int
  125. int e1=Integer.parseInt(str1);
  126. int e2=Integer.parseInt(str2);
  127. //执行操作,计算(用方法实现),返回值int
  128. gui1 ss=new gui1();
  129. ss.f3(e1,e2);
  130. textField.setText(""+ss.f3(e1,e2));
  131.  
  132. }
  133. //输出结果,settext(string t),字符串,int转成成string,作为入参{String = 1+“1”}
  134. //String a1=(String)"a2";
  135. //输出结果:把之前的=号公式,要放在前面
  136.  
  137. }
  138. public int f(int w,int r){
  139. int p=w+r;
  140. return p;
  141. }
  142. public int f4(int w,int r){
  143. int p=w-r;
  144. return p;
  145. }
  146. public int f2(int w,int r){
  147. int p=w*r;
  148. return p;
  149. }
  150. public int f3(int w,int r){
  151. int p=w/r;
  152. return p;
  153. }
  154. public gui1() {
  155. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  156. setBounds(, , , );
  157. contentPane = new JPanel();
  158. contentPane.setBackground(Color.LIGHT_GRAY);
  159. contentPane.setForeground(Color.GREEN);
  160. contentPane.setBorder(new EmptyBorder(, , , ));
  161. setContentPane(contentPane);
  162.  
  163. JButton btnNewButton_8 = new JButton("m-");
  164. btnNewButton_8.addActionListener(new ActionListener() {
  165. public void actionPerformed(ActionEvent arg0) {
  166. }
  167. });
  168. btnNewButton_8.setBackground(Color.ORANGE);
  169.  
  170. JButton btnNewButton_6 = new JButton("+");
  171.  
  172. JButton btnNewButton_18 = new JButton("*");
  173.  
  174. JButton btnNewButton_20 = new JButton("\u221A ");
  175.  
  176. JButton btnNewButton_22 = new JButton("%");
  177.  
  178. JButton btnNewButton_21 = new JButton("1/x");
  179.  
  180. textField = new JTextField();
  181. textField.setColumns();
  182.  
  183. JButton btnNewButton = new JButton("MC");
  184. btnNewButton.setBackground(Color.LIGHT_GRAY);
  185.  
  186. JButton btnMr = new JButton("MR");
  187.  
  188. JButton btnMs = new JButton("MS");
  189.  
  190. JButton btnM = new JButton("M+");
  191.  
  192. JButton btnM_1 = new JButton("M-");
  193.  
  194. JButton button_4 = new JButton("<--");
  195. button_4.setFont(new Font("宋体", Font.PLAIN, ));
  196. button_4.addActionListener(new ActionListener() {
  197. public void actionPerformed(ActionEvent e) {
  198. }
  199. });
  200.  
  201. JButton button_5 = new JButton("");
  202. button_5.addActionListener(new ActionListener() {
  203. public void actionPerformed(ActionEvent e) {
  204. textField.setText(textField.getText()+"");
  205. }
  206. });
  207.  
  208. JButton button_6 = new JButton("");
  209. button_6.addActionListener(new ActionListener() {
  210. public void actionPerformed(ActionEvent e) {
  211. textField.setText(textField.getText()+"");
  212. }
  213. });
  214.  
  215. JButton button_7 = new JButton("");
  216. button_7.addActionListener(new ActionListener() {
  217. public void actionPerformed(ActionEvent arg0) {
  218. textField.setText(textField.getText()+"");
  219. }
  220. });
  221.  
  222. JButton button_8 = new JButton("");
  223. button_8.addActionListener(new ActionListener() {
  224. public void actionPerformed(ActionEvent e) {
  225. textField.setText(textField.getText()+"");
  226. String inputValue = JOptionPane.showInputDialog("请输入密码:");
  227. }
  228. });
  229.  
  230. JButton btnCe = new JButton("CE");
  231.  
  232. JButton button_10 = new JButton("");
  233. button_10.addActionListener(new ActionListener() {
  234. public void actionPerformed(ActionEvent e) {
  235. textField.setText(textField.getText()+"");
  236. }
  237. });
  238.  
  239. JButton button_11 = new JButton("");
  240. button_11.addActionListener(new ActionListener() {
  241. public void actionPerformed(ActionEvent e) {
  242. textField.setText(textField.getText()+"");
  243. }
  244. });
  245.  
  246. JButton button_12 = new JButton("");
  247. button_12.addActionListener(new ActionListener() {
  248. public void actionPerformed(ActionEvent arg0) {
  249. textField.setText(textField.getText()+"");
  250. }
  251. });
  252.  
  253. JButton btnC = new JButton("C");
  254. btnC.addActionListener(new ActionListener() {
  255. public void actionPerformed(ActionEvent e) {
  256. textField.setText("");
  257. }
  258. });
  259.  
  260. JButton button_14 = new JButton("\u00B1");
  261.  
  262. JButton button_15 = new JButton("\u221A");
  263. button_15.setFont(new Font("宋体", Font.PLAIN, ));
  264. button_15.addActionListener(new ActionListener() {
  265. public void actionPerformed(ActionEvent arg0) {
  266. textField.setText(textField.getText()+"√");
  267. }
  268. });
  269.  
  270. JButton button_16 = new JButton("");
  271. button_16.addActionListener(new ActionListener() {
  272. public void actionPerformed(ActionEvent e) {
  273. textField.setText(textField.getText()+"");
  274. }
  275. });
  276.  
  277. JButton button_17 = new JButton("/");
  278. button_17.addActionListener(new ActionListener() {
  279. public void actionPerformed(ActionEvent e) {
  280. textField.setText(textField.getText()+"/");
  281. }
  282. });
  283.  
  284. JButton button_18 = new JButton("%");
  285.  
  286. JButton button_19 = new JButton("");
  287. button_19.addActionListener(new ActionListener() {
  288. public void actionPerformed(ActionEvent e) {
  289. textField.setText(textField.getText()+"");
  290. }
  291. });
  292.  
  293. JButton button_20 = new JButton("*");
  294. button_20.addActionListener(new ActionListener() {
  295. public void actionPerformed(ActionEvent e) {
  296. textField.setText(textField.getText()+"*");
  297. }
  298. });
  299.  
  300. JButton btnx = new JButton("1/x");
  301. btnx.setFont(new Font("微软雅黑", Font.PLAIN, ));
  302. btnx.addActionListener(new ActionListener() {
  303. public void actionPerformed(ActionEvent arg0) {
  304. }
  305. });
  306.  
  307. JButton button_22 = new JButton("");
  308. button_22.addActionListener(new ActionListener() {
  309. public void actionPerformed(ActionEvent e) {
  310. textField.setText(textField.getText()+"");
  311. }
  312. });
  313.  
  314. JButton button_23 = new JButton("-");
  315. button_23.addActionListener(new ActionListener() {
  316. public void actionPerformed(ActionEvent e) {
  317. textField.setText(textField.getText()+"-");
  318. }
  319. });
  320.  
  321. JButton button_24 = new JButton(".");
  322. button_24.addActionListener(new ActionListener() {
  323. public void actionPerformed(ActionEvent e) {
  324. textField.setText(textField.getText()+".");
  325. }
  326. });
  327.  
  328. JButton button_25 = new JButton("+");
  329. button_25.addActionListener(new ActionListener() {
  330. public void actionPerformed(ActionEvent e) {
  331. textField.setText(textField.getText()+"+");
  332. //JOptionPane.showConfirmDialog(null,
  333. // "请选择", "titie", JOptionPane.YES_NO_OPTION);
  334.  
  335. }
  336. });
  337.  
  338. JButton button_26 = new JButton("=");
  339. button_26.addActionListener(new ActionListener() {
  340. public void actionPerformed(ActionEvent e) {
  341. //等于、、结果输出
  342.  
  343. textField.setText(textField.getText()+"=");
  344. f1();
  345. }
  346.  
  347. });
  348. GroupLayout gl_contentPane = new GroupLayout(contentPane);
  349. gl_contentPane.setHorizontalGroup(
  350. gl_contentPane.createParallelGroup(Alignment.LEADING)
  351. .addGroup(gl_contentPane.createSequentialGroup()
  352. .addGap()
  353. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  354. .addGroup(gl_contentPane.createSequentialGroup()
  355. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
  356. .addGroup(gl_contentPane.createSequentialGroup()
  357. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  358. .addComponent(button_6, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  359. .addComponent(button_7, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  360. .addPreferredGap(ComponentPlacement.RELATED)
  361. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  362. .addComponent(button_11, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  363. .addComponent(button_12, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
  364. .addComponent(button_8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  365. .addPreferredGap(ComponentPlacement.RELATED)
  366. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  367. .addGroup(gl_contentPane.createSequentialGroup()
  368. .addComponent(button_19, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  369. .addPreferredGap(ComponentPlacement.RELATED)
  370. .addComponent(button_20, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  371. .addPreferredGap(ComponentPlacement.RELATED)
  372. .addComponent(btnx, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  373. .addGroup(gl_contentPane.createSequentialGroup()
  374. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  375. .addGroup(gl_contentPane.createSequentialGroup()
  376. .addComponent(button_22, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  377. .addPreferredGap(ComponentPlacement.RELATED)
  378. .addComponent(button_23, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  379. .addGroup(gl_contentPane.createSequentialGroup()
  380. .addComponent(button_24, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  381. .addPreferredGap(ComponentPlacement.RELATED)
  382. .addComponent(button_25, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
  383. .addPreferredGap(ComponentPlacement.RELATED)
  384. .addComponent(button_26, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
  385. .addPreferredGap(ComponentPlacement.RELATED)
  386. .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
  387. .addGroup(gl_contentPane.createSequentialGroup()
  388. .addGap()
  389. .addComponent(btnNewButton_6, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  390. .addPreferredGap(ComponentPlacement.UNRELATED)
  391. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  392. .addComponent(btnNewButton_21, GroupLayout.DEFAULT_SIZE, , Short.MAX_VALUE)
  393. .addComponent(btnNewButton_22, GroupLayout.DEFAULT_SIZE, , Short.MAX_VALUE)
  394. .addComponent(btnNewButton_20, GroupLayout.DEFAULT_SIZE, , Short.MAX_VALUE))
  395. .addGap()
  396. .addComponent(btnNewButton_18))
  397. .addGroup(gl_contentPane.createSequentialGroup()
  398. .addGap()
  399. .addComponent(btnNewButton_8)
  400. .addGap())))
  401. .addGroup(gl_contentPane.createSequentialGroup()
  402. .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  403. .addPreferredGap(ComponentPlacement.RELATED)
  404. .addComponent(btnMr, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  405. .addPreferredGap(ComponentPlacement.RELATED)
  406. .addComponent(btnMs, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  407. .addPreferredGap(ComponentPlacement.RELATED)
  408. .addComponent(btnM, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  409. .addPreferredGap(ComponentPlacement.RELATED)
  410. .addComponent(btnM_1, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  411. .addComponent(textField, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  412. .addGroup(gl_contentPane.createSequentialGroup()
  413. .addComponent(button_4, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  414. .addPreferredGap(ComponentPlacement.RELATED)
  415. .addComponent(btnCe, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  416. .addPreferredGap(ComponentPlacement.RELATED)
  417. .addComponent(btnC, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  418. .addPreferredGap(ComponentPlacement.RELATED)
  419. .addComponent(button_14, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  420. .addPreferredGap(ComponentPlacement.RELATED)
  421. .addComponent(button_15, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  422. .addGroup(gl_contentPane.createSequentialGroup()
  423. .addComponent(button_5, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  424. .addPreferredGap(ComponentPlacement.RELATED)
  425. .addComponent(button_10, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  426. .addPreferredGap(ComponentPlacement.RELATED)
  427. .addComponent(button_16, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  428. .addPreferredGap(ComponentPlacement.RELATED)
  429. .addComponent(button_17, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  430. .addPreferredGap(ComponentPlacement.RELATED)
  431. .addComponent(button_18, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
  432. .addContainerGap())
  433. );
  434. gl_contentPane.setVerticalGroup(
  435. gl_contentPane.createParallelGroup(Alignment.TRAILING)
  436. .addGroup(gl_contentPane.createSequentialGroup()
  437. .addContainerGap()
  438. .addComponent(textField, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  439. .addPreferredGap(ComponentPlacement.UNRELATED)
  440. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  441. .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  442. .addComponent(btnMr, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  443. .addComponent(btnMs, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  444. .addComponent(btnM, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  445. .addComponent(btnM_1, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  446. .addPreferredGap(ComponentPlacement.RELATED)
  447. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  448. .addComponent(button_4, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  449. .addComponent(btnCe, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  450. .addComponent(btnC, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  451. .addComponent(button_14, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  452. .addComponent(button_15, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  453. .addPreferredGap(ComponentPlacement.RELATED)
  454. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  455. .addGroup(gl_contentPane.createSequentialGroup()
  456. .addGap()
  457. .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
  458. .addGroup(gl_contentPane.createSequentialGroup()
  459. .addComponent(btnNewButton_20)
  460. .addPreferredGap(ComponentPlacement.RELATED)
  461. .addComponent(btnNewButton_22)
  462. .addPreferredGap(ComponentPlacement.RELATED))
  463. .addComponent(btnNewButton_8, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  464. .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
  465. .addComponent(btnNewButton_18)
  466. .addComponent(btnNewButton_21))
  467. .addGap()
  468. .addComponent(btnNewButton_6))
  469. .addGroup(gl_contentPane.createSequentialGroup()
  470. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  471. .addGroup(gl_contentPane.createSequentialGroup()
  472. .addComponent(button_5, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  473. .addPreferredGap(ComponentPlacement.RELATED)
  474. .addComponent(button_6, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  475. .addGroup(gl_contentPane.createSequentialGroup()
  476. .addComponent(button_10, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  477. .addPreferredGap(ComponentPlacement.RELATED)
  478. .addComponent(button_11, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  479. .addGroup(gl_contentPane.createSequentialGroup()
  480. .addComponent(button_16, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  481. .addPreferredGap(ComponentPlacement.RELATED)
  482. .addComponent(button_19, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  483. .addGroup(gl_contentPane.createSequentialGroup()
  484. .addComponent(button_17, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  485. .addPreferredGap(ComponentPlacement.RELATED)
  486. .addComponent(button_20, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
  487. .addPreferredGap(ComponentPlacement.RELATED)
  488. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  489. .addComponent(button_12, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  490. .addComponent(button_7, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  491. .addComponent(button_22, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  492. .addComponent(button_23, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE))
  493. .addPreferredGap(ComponentPlacement.RELATED)
  494. .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
  495. .addComponent(button_25, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  496. .addComponent(button_24, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  497. .addComponent(button_8, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
  498. .addGroup(gl_contentPane.createSequentialGroup()
  499. .addComponent(button_18, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  500. .addPreferredGap(ComponentPlacement.RELATED)
  501. .addComponent(btnx, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)
  502. .addPreferredGap(ComponentPlacement.RELATED)
  503. .addComponent(button_26, GroupLayout.PREFERRED_SIZE, , GroupLayout.PREFERRED_SIZE)))
  504. .addGap())
  505. );
  506. contentPane.setLayout(gl_contentPane);
  507. }
  508. }

gui小计算器的程序写法的更多相关文章

  1. 算法课上机实验(一个简单的GUI排序算法比较程序)

    (在家里的电脑上Linux Deepin截的图,屏幕大一点的话,deepin用着还挺不错的说) 这个应该是大二的算法课程上机实验时做的一个小程序,也是我的第一个GUI小程序,实现什么的都记不清了,只记 ...

  2. 用PYTHON首选的GUI库WXPYTHON做程序界面

    大家好,我是A8U神经网络,今天又要跟大家分享一下wxWidgets开发神经网络程序界面的一些经验,希望对开发有兴趣的朋友有所帮助.跨平台的GUI工具库以GTK +,Qt和wxWidgets闻名. G ...

  3. 架构师JavaScript 的对象继承方式,有几种程序写法?

    架构师JavaScript 的对象继承方式,有几种程序写法?   一.对象冒充 其原理如下:构造函数使用 this 关键字给所有属性和方法赋值(即采用类声明的构造函数方式).因为构造函数只是一个函数, ...

  4. Java实现 蓝桥杯 历届试题 小计算器

    历届试题 小计算器 时间限制:1.0s 内存限制:256.0MB 问题描述 模拟程序型计算器,依次输入指令,可能包含的指令有 1. 数字:'NUM X',X为一个只包含大写字母和数字的字符串,表示一个 ...

  5. js小程序写法优化

    (function(){ var gcld_but = document.getElementById("gcld_but"), gcld_but_li = gcld_but.ge ...

  6. Java GUI小程序--画板

     画板效果  (以前写在Csdn上的博文,没去水印,Csdn名字同博客园) 布局类: package gary; import java.awt.Color; import java.awt.even ...

  7. python 爬取糗事百科 gui小程序

    前言:有时候无聊看一些搞笑的段子,糗事百科还是个不错的网站,所以就想用Python来玩一下.也比较简单,就写出来分享一下.嘿嘿 环境:Python 2.7 + win7 现在开始,打开糗事百科网站,先 ...

  8. GUI小程序---理解GUI

    package com.gui; import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent ...

  9. python库的tkinter带你进入GUI世界(计算器简单功能)

    前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者: 一个处女座的程序猿 PS:如有需要Python学习资料的小伙伴可以加 ...

随机推荐

  1. 自动化web前端测试,自动登录网站.目前发现最靠谱的方法是imacros

    imacros免费版 登录宏代码的示例: //首先登出URL GOTO=http://yoursite/logout.html//打开登录页面URL GOTO=http://yoursite/logi ...

  2. 数据库的范式,第一、二、三、四、五范式、BC范式

    数据库的规范化(上一篇博客有写到)的程度不同,便有了这么多种范式.数据库范式是数据库设计必不可少的知识,没有对范式的理解,就无法设计出高效率.优雅的数据库,甚至设计出错误误的数据库.课本中的定义比较抽 ...

  3. OpenWrt 对外网开放vsftp服务和samba服务

    对WAN开放vsFTP OpenWrt默认启动了vsftp服务, 在Luci上没找到配置界面, 但是后台是有这个服务的, 如果在Openwrt的lan下, 可以直接使用FileZilla之类的客户端连 ...

  4. mycat偶尔会出现JVM报错double free or corruption并崩溃退出

    mycat偶尔会出现JVM报错double free or corruption并崩溃退出 没有复杂的sql,也没有大量的io INFO | jvm | // :: | *** Error in `j ...

  5. Python的虚拟机安装已经如何配置Scrapy for Mac

    时间:2018年2月21日 因为时间问题,以下笔记就粗略记录.仅作为个人笔记为用 安装virtualenv和virtualenvwrapper 如何安装的细节下面这篇也有介绍,包括如何使用切换虚拟机也 ...

  6. 整体C#与Sql培训内容及结构

    图如果看不清可以右键存图片到本地

  7. 在 java 开发接口中需要注意的问题

    1 在开发过程中免不了对接上游或下游,有合作就要保证入参.出参的准确性.一个接口一般只能处理有限情况下的情况,因此在逻辑处理前要对入参进行校验. 2 在自己的逻辑处理过程中,要时刻持有怀疑的态度.假设 ...

  8. Asp.Net Newtonsoft.Json使用教程

    json序列化和反序列化的使用教程 实体 public class wendaModel { private string _title; private string _cons; public s ...

  9. iOS开发下载文件速度计算

    当我们写下载界面的时候,需要向用户展示每秒下载多少KB,这个时候就需要计算速度.如下: 我用的是AFNetworking来做下载的,我们拿AFHTTPRequestOperation来举列,AFHTT ...

  10. 关于Cocos的内存管理机制引发一些异常的解决方案

    错误:引发了异常: 读取访问权限冲突. this 是 0xDDDDDDDD.或者hero是 0xDDDDDDDD.hero是在GameController里创建的对象 这个的意思是this所指向的内存 ...