Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.*;
- public class AppGUI extends JFrame {
- public AppGUI(){
- setTitle("AppGUI");
- JPanel p1 = new JPanel();
- JPanel p2 = new JPanel();
- //p1.setBackground(Color.RED);
- JTextField display = new JTextField("0.0");
- JButton b1 = new JButton("MC");
- JButton b2 = new JButton("MR");
- JButton b3 = new JButton("MS");
- JButton b4 = new JButton("M+");
- p1.setLayout(new GridLayout(4,4));
- JButton a1 = new JButton("1");
- JButton a2 = new JButton("2");
- JButton a3 = new JButton("3");
- JButton a4 = new JButton("4");
- JButton a5 = new JButton("5");
- JButton a6 = new JButton("6");
- JButton a7 = new JButton("7");
- JButton a8 = new JButton("8");
- JButton a9 = new JButton("9");
- JButton a10 = new JButton("0");
- JButton a11 = new JButton(".");
- JButton a12 = new JButton("=");
- JButton c1 = new JButton("+");
- JButton c2 = new JButton("-");
- JButton c3 = new JButton("*");
- JButton c4 = new JButton("/");
- p2.setLayout(new GridLayout(4,1));
- p2.add(b1);
- p2.add(b2);
- p2.add(b3);
- p2.add(b4);
- p1.add(a9);
- p1.add(a8);
- p1.add(a7);
- p1.add(c1);
- p1.add(a6);
- p1.add(a5);
- p1.add(a4);
- p1.add(c2);
- p1.add(a3);
- p1.add(a2);
- p1.add(a1);
- p1.add(c3);
- p1.add(a10);
- p1.add(a11);
- p1.add(a12);
- p1.add(c4);
- add(display,BorderLayout.PAGE_START);
- add(p2,BorderLayout.LINE_START);
- add(p1, BorderLayout.CENTER);
- }
- public static void main(String[] args){
- AppGUI frame = new AppGUI();
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setSize(600, 500);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement