Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. public class Application extends JFrame {
  2.  
  3. private static final String TITLE = "Average Machine";
  4. private static final String vNum = " - v0.10";
  5.  
  6. private static final int WIDTH = 320;
  7. private static final int HEIGHT = 120;
  8.  
  9. private JPanel panel;
  10. private JTextField field, infoField;
  11. private JButton btnAdd, btnClear, btnAvg;
  12. private JLabel label;
  13.  
  14. public Application() {
  15. initLayout();
  16. initComponents();
  17. }
  18.  
  19. private void initLayout() {
  20. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  21. setResizable(false);
  22. setLocationRelativeTo(null);
  23. setSize(WIDTH, HEIGHT);
  24. setVisible(true);
  25. }
  26.  
  27. private void initComponents() {
  28. try {
  29. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  30. } catch (Exception e) {
  31. e.printStackTrace();
  32. return;
  33. }
  34.  
  35. Font font0 = new Font("Arial", Font.PLAIN, 11);
  36. Font font1 = new Font("Arial", Font.PLAIN, 11);
  37.  
  38. panel = new JPanel();
  39.  
  40. btnAdd = new JButton("Add");
  41. btnAvg = new JButton("Average");
  42. btnClear = new JButton("Clear");
  43.  
  44. field = new JTextField();
  45. field.setHorizontalAlignment(SwingConstants.CENTER);
  46. field.setColumns(38);
  47.  
  48. infoField = new JTextField();
  49. infoField.setHorizontalAlignment(SwingConstants.CENTER);
  50. infoField.setEditable(false);
  51. infoField.setText("Average Machine: Started");
  52. infoField.setColumns(38);
  53.  
  54. label = new JLabel("All Rights Reserverd" + vNum);
  55.  
  56. add(panel, BorderLayout.CENTER);
  57. panel.add(infoField);
  58. panel.add(field);
  59. panel.add(btnAdd);
  60. panel.add(btnAvg);
  61. panel.add(btnClear);
  62. panel.add(label);
  63. }
  64.  
  65. public static void main(String[] args) {
  66. SwingUtilities.invokeLater(new Runnable() {
  67. public void run() {
  68. new Application();
  69. }
  70. });
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement