Advertisement
fromMars

Basic Window on Screen

Apr 22nd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. package com.zetcode;
  2.  
  3. import java.awt.EventQueue;
  4. import javax.swing.JFrame;
  5.  
  6. public class SimpleEx extends JFrame {
  7.  
  8.     public SimpleEx() {
  9.  
  10.         initUI();
  11.     }
  12.  
  13.     private void initUI() {
  14.        
  15.         setTitle("Simple example");
  16.         setSize(300, 200);
  17.         setLocationRelativeTo(null);
  18.         setDefaultCloseOperation(EXIT_ON_CLOSE);
  19.     }
  20.  
  21.     public static void main(String[] args) {
  22.  
  23.         EventQueue.invokeLater(() -> {
  24.             SimpleEx ex = new SimpleEx();
  25.             ex.setVisible(true);
  26.         });
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement