Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Application extends JFrame {
- private static final String TITLE = "Average Machine";
- private static final String vNum = " - v0.10";
- private static final int WIDTH = 320;
- private static final int HEIGHT = 120;
- private JPanel panel;
- private JTextField field, infoField;
- private JButton btnAdd, btnClear, btnAvg;
- private JLabel label;
- public Application() {
- initLayout();
- initComponents();
- }
- private void initLayout() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setResizable(false);
- setLocationRelativeTo(null);
- setSize(WIDTH, HEIGHT);
- setVisible(true);
- }
- private void initComponents() {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception e) {
- e.printStackTrace();
- return;
- }
- Font font0 = new Font("Arial", Font.PLAIN, 11);
- Font font1 = new Font("Arial", Font.PLAIN, 11);
- panel = new JPanel();
- btnAdd = new JButton("Add");
- btnAvg = new JButton("Average");
- btnClear = new JButton("Clear");
- field = new JTextField();
- field.setHorizontalAlignment(SwingConstants.CENTER);
- field.setColumns(38);
- infoField = new JTextField();
- infoField.setHorizontalAlignment(SwingConstants.CENTER);
- infoField.setEditable(false);
- infoField.setText("Average Machine: Started");
- infoField.setColumns(38);
- label = new JLabel("All Rights Reserverd" + vNum);
- add(panel, BorderLayout.CENTER);
- panel.add(infoField);
- panel.add(field);
- panel.add(btnAdd);
- panel.add(btnAvg);
- panel.add(btnClear);
- panel.add(label);
- }
- public static void main(String[] args) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- new Application();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement