Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. public class Okno extends JFrame{
  2.     JFrame frame = new JFrame("Kalkulator");
  3.     public Okno(){
  4.         super("Kalkulator");
  5.         frame.setPreferredSize(new Dimension(160, 250));
  6.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  7.         frame.setLayout(null);
  8.         frame.pack();
  9.         frame.setVisible(true);
  10.     }
  11. }
  12.  
  13.  
  14. public class MojPanel extends JPanel{
  15.     JPanel panel = new JPanel();
  16.     JTextField textField = new JTextField("Właśnie taaak");
  17.     //Buttons
  18.     JButton buttonStart = new JButton("S");
  19.     JButton buttonZero = new JButton("0");
  20.     JButton buttonOne = new JButton("1");
  21.     JButton buttonTwo = new JButton("2");
  22.     JButton buttonThree = new JButton("3");
  23.     JButton buttonFour = new JButton("4");
  24.     JButton buttonFive = new JButton("5");
  25.     JButton buttonSix = new JButton("6");
  26.     JButton buttonSeven = new JButton("7");
  27.     JButton buttonEight = new JButton("8");
  28.     JButton buttonNine = new JButton("9");
  29.     JButton buttonPlus = new JButton("+");
  30.     JButton buttonMinus = new JButton("-");
  31.     JButton buttonMultiplication = new JButton("x");
  32.     JButton buttonDivine = new JButton("/");
  33.     JButton buttonEquals = new JButton("=");
  34.    
  35.     public MojPanel(){
  36.         panel.add(buttonStart);
  37.         }
  38.     }
  39. }
  40.  
  41.  
  42. public class Kalkulator extends MojPanel {
  43.     public static void main(String[] args) {
  44.         Okno okno=new Okno(); // tworzymy nowy obiekt typu Okno (dalej będziemy o nim mówić "okienko"), który zaraz stworzymy
  45.         okno.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // zamknięcie okienka ma być jednoznaczne z zamknięciem programu
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement