Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package tictactoe;
  2.  
  3. import java.net.URL;
  4.  
  5. import javax.swing.ImageIcon;
  6. import javax.swing.JFrame;
  7. import javax.swing.UIManager;
  8. import javax.swing.UnsupportedLookAndFeelException;
  9.  
  10. public class Main {
  11.  
  12. public static ImageIcon getImageIcon(String filename) {
  13. ImageIcon icon = null;
  14. URL url = Main.class.getResource(filename);
  15. if (url != null) {
  16. System.out.println("getImageicon: url=" + url);
  17. icon = new ImageIcon(url);
  18. System.out.println("getImageicon: image=" + icon.getImage());
  19. } else {
  20. System.out.println("getImageicon: url=null");
  21. }
  22. return icon;
  23. }
  24.  
  25. public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
  26. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  27. Board board = new Board();
  28. JFrame frame1 = new JFrame("Board");
  29. frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  30. frame1.add(board);
  31. frame1.pack();
  32. frame1.setVisible(true);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement