Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Okno extends JFrame{
- JFrame frame = new JFrame("Kalkulator");
- public Okno(){
- super("Kalkulator");
- frame.setPreferredSize(new Dimension(160, 250));
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setLayout(null);
- frame.pack();
- frame.setVisible(true);
- }
- }
- public class MojPanel extends JPanel{
- JPanel panel = new JPanel();
- JTextField textField = new JTextField("Właśnie taaak");
- //Buttons
- JButton buttonStart = new JButton("S");
- JButton buttonZero = new JButton("0");
- JButton buttonOne = new JButton("1");
- JButton buttonTwo = new JButton("2");
- JButton buttonThree = new JButton("3");
- JButton buttonFour = new JButton("4");
- JButton buttonFive = new JButton("5");
- JButton buttonSix = new JButton("6");
- JButton buttonSeven = new JButton("7");
- JButton buttonEight = new JButton("8");
- JButton buttonNine = new JButton("9");
- JButton buttonPlus = new JButton("+");
- JButton buttonMinus = new JButton("-");
- JButton buttonMultiplication = new JButton("x");
- JButton buttonDivine = new JButton("/");
- JButton buttonEquals = new JButton("=");
- public MojPanel(){
- panel.add(buttonStart);
- }
- }
- }
- public class Kalkulator extends MojPanel {
- public static void main(String[] args) {
- Okno okno=new Okno(); // tworzymy nowy obiekt typu Okno (dalej będziemy o nim mówić "okienko"), który zaraz stworzymy
- okno.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // zamknięcie okienka ma być jednoznaczne z zamknięciem programu
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement