Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. public class Application {
  2.  
  3. private static final String TITLE = "Average Machine";
  4.  
  5. private static final int WIDTH = 320;
  6. private static final int HEIGHT = WIDTH / 16 * 9;
  7.  
  8. private Application() {
  9.  
  10. }
  11.  
  12. private static void createWindow() {
  13. try {
  14. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  15. } catch (Exception e) {
  16. e.printStackTrace();
  17. return;
  18. }
  19. JPanel contentPane = new JPanel();
  20. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  21. contentPane.setLayout(null);
  22.  
  23. JTextField field = new JTextField();
  24. field.setHorizontalAlignment(SwingConstants.CENTER);
  25. field.setBounds(0, 22, 414, 20);
  26. contentPane.add(field);
  27. field.setColumns(10);
  28. JFrame frame = new JFrame(Application.TITLE);
  29. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  30. frame.setResizable(false);
  31. frame.setLocationRelativeTo(null);
  32. frame.setSize(WIDTH, HEIGHT);
  33. frame.setVisible(true);
  34. frame.add(contentPane);
  35. }
  36.  
  37. public static void main(String[] args) {
  38.  
  39. createWindow();
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement