Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cz.sunnas.school.LS.hour05_swing;
- import java.awt.BorderLayout;
- import java.awt.Dimension;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JComponent;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.KeyStroke;
- public class NumericPanel extends JFrame{
- private final JPanel numbs;
- private final JPanel display;
- public static void main( String[] args ) throws Exception {
- NumericPanel numPan = new NumericPanel();
- }
- public NumericPanel() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setTitle("Numeric Panel");
- setMinimumSize(new Dimension(250, 300));
- setResizable(true);
- setLocationRelativeTo(null);
- setLayout(new BorderLayout());
- numbs = new JPanel(new GridLayout(4, 3, 25, 25));
- display = new JPanel(new FlowLayout(FlowLayout.CENTER));
- display.add(new Display(0, 50));
- numbs.add(new Button("0", 0, 60, 20));
- numbs.add(new Button("1", 1, 60, 20));
- numbs.add(new Button("2", 2, 60, 20));
- numbs.add(new Button("3", 3, 60, 20));
- numbs.add(new Button("4", 4, 60, 20));
- numbs.add(new Button("5", 5, 60, 20));
- numbs.add(new Button("6", 6, 60, 20));
- numbs.add(new Button("7", 7, 60, 20));
- numbs.add(new Button("8", 8, 60, 20));
- numbs.add(new Button("9", 9, 60, 20));
- numbs.add(new Button("E", 10, 60, 20));
- numbs.add(new Button("C", 11, 60, 20));
- add(display, BorderLayout.NORTH);
- add(numbs, BorderLayout.CENTER);
- setVisible(true);
- pack();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement