Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Application {
- private static final String TITLE = "Average Machine";
- private static final int WIDTH = 320;
- private static final int HEIGHT = WIDTH / 16 * 9;
- private Application() {
- }
- private static void createWindow() {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception e) {
- e.printStackTrace();
- return;
- }
- JPanel contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- contentPane.setLayout(null);
- JTextField field = new JTextField();
- field.setHorizontalAlignment(SwingConstants.CENTER);
- field.setBounds(0, 22, 414, 20);
- contentPane.add(field);
- field.setColumns(10);
- JFrame frame = new JFrame(Application.TITLE);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setResizable(false);
- frame.setLocationRelativeTo(null);
- frame.setSize(WIDTH, HEIGHT);
- frame.setVisible(true);
- frame.add(contentPane);
- }
- public static void main(String[] args) {
- createWindow();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement