Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public class PlayButton {
  2. public JButton play = getButton();
  3.  
  4. private JButton getButton(){
  5. JButton button = new JButton("Играть");
  6. button.setSize(100,50);
  7. button.setMaximumSize(button.getSize());
  8. button.addActionListener(new ActionListener() {
  9. @Override
  10. public void actionPerformed(ActionEvent e) {
  11. if(Desktop.isDesktopSupported()){
  12. Desktop desktop = Desktop.getDesktop();
  13. try {
  14. desktop.open(new File("C:\\Users\\Oleg\\AppData\\Roaming\\minecraft.exe"));
  15. } catch (IOException e1) {
  16. e1.printStackTrace();
  17. }
  18. }
  19. }
  20. });
  21.  
  22. return button;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement