Skip to content

Instantly share code, notes, and snippets.

@andrewfree
Created March 5, 2011 03:27
Show Gist options
  • Save andrewfree/856074 to your computer and use it in GitHub Desktop.
Save andrewfree/856074 to your computer and use it in GitHub Desktop.
/* */ import java.awt.BorderLayout;
/* */ import java.awt.Font;
/* */ import java.awt.GridLayout;
/* */ import javax.swing.JApplet;
/* */ import javax.swing.JButton;
/* */ import javax.swing.JLabel;
/* */ import javax.swing.JPanel;
/* */
/* */ public class Lab8A extends Panel
/* */ {
/* 8 */ private JButton[] buttons = new JButton[10];
/* 9 */ private JButton buttonDot = new JButton(".");
/* 10 */ private JButton clear = new JButton("clear");
/* */
/* 12 */ private JLabel label1 = new JLabel("0.0");
/* 13 */ private JPanel pan = new JPanel();
/* */
/* 15 */ private JPanel outerPan = new JPanel();
/* 16 */ private boolean decimal = false;
/* */
/* */ public Lab8A()
/* */ {
/* 22 */ setLayout(null);
/* 23 */ setSize(600, 700);
/* 24 */ setLocation(400, 40);
/* */
/* 26 */ Font font = new Font("Arial", 1, 30);
/* 27 */ Font font2 = new Font("Arial", 1, 20);
/* 28 */ this.pan.setLayout(new GridLayout(4, 3));
/* 29 */ Lab8A.ButtonListener ears = new Lab8A.ButtonListener(this);
/* */
/* 31 */ for (int i = 1; i < 10; i++) {
/* 32 */ this.buttons[i] = new JButton(i);
/* 33 */ this.buttons[i].setFont(font);
/* 34 */ this.buttons[i].addActionListener(ears);
/* 35 */ this.pan.add(this.buttons[i]);
/* */ }
/* */
/* 38 */ this.buttons[0] = new JButton("0");
/* 39 */ this.buttons[0].addActionListener(ears);
/* 40 */ this.buttons[0].setFont(font);
/* 41 */ this.pan.add(this.buttons[0]);
/* */
/* 43 */ this.buttonDot.setFont(font);
/* 44 */ this.buttonDot.addActionListener(ears);
/* */
/* 46 */ this.clear.setFont(font2);
/* 47 */ this.clear.addActionListener(ears);
/* */
/* 49 */ this.label1.setFont(font);
/* */
/* 51 */ this.outerPan.setLayout(new BorderLayout());
/* */
/* 55 */ this.pan.add(this.buttons[0]);
/* 56 */ this.pan.add(this.buttonDot);
/* 57 */ this.pan.add(this.clear);
/* */
/* 60 */ this.outerPan.setSize(300, 500);
/* 61 */ this.outerPan.setLocation(0, 0);
/* 62 */ this.outerPan.add(this.pan, "Center");
/* */
/* 64 */ this.outerPan.add(this.label1, "North");
/* */
/* 67 */ add(this.outerPan);
/* */ }
/* */ }
/* Location: /Users/toXic/Desktop/delete/
* Qualified Name: Lab8A
* JD-Core Version: 0.6.0
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment