Guest User

Untitled

a guest
Jun 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.Toolkit;
  3. import java.awt.Dimension;
  4.  
  5. class SlotMachine
  6. {
  7. public static void main(String[] args)
  8. {
  9. JFrame window = new JFrame();
  10. window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  11. window.setTitle("Slots!");
  12. window.setSize(200,200);
  13.  
  14. Toolkit toolkit = window.getToolkit();
  15. Dimension size = toolkit.getScreenSize();
  16.  
  17. window.setLocation(size.width/2 - window.getWidth()/2, size.height/2 - window.getHeight()/2);
  18.  
  19. JLabel label = new JLabel("Slot Machine v1.0");
  20. label.setSize(200,200);
  21. label.setLocation(window.getWidth()/2,window.getHeight()/2);
  22.  
  23. window.add(label);
  24. window.setVisible(true);
  25. }
  26. }
Add Comment
Please, Sign In to add comment