Advertisement
Guest User

Untitled

a guest
May 29th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. import java.awt.event.ActionEvent;
  2. import java.awt.event.ActionListener;
  3. import java.util.ArrayList;
  4. import java.util.Scanner;
  5.  
  6. import javax.swing.ImageIcon;
  7. import javax.swing.JButton;
  8. import javax.swing.JFrame;
  9. import javax.swing.JLabel;
  10. import javax.swing.JTextField;
  11. import javax.swing.UIManager;
  12.  
  13. import razionali.Razionale;
  14.  
  15.  
  16. public class GraficaDet
  17. { private JFrame frame;
  18.  
  19. /* INIZIO PARTE DA PERSONALIZZARE */
  20. private JButton bottone1;
  21.  
  22. /* FINE PARTE DA PERSONALIZZARE */
  23.  
  24. public GraficaDet()
  25. { frame = new JFrame();
  26. frame.getContentPane().setLayout(null);
  27. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  28. impostaLF();
  29. frame.setVisible(true);
  30. inizializzaContenuto();
  31.  
  32. /* INIZIO PARTE DA PERSONALIZZARE */
  33. frame.setBounds(100, 100, 500, 450);
  34. frame.setTitle("Esempio");
  35. /* FINE PARTE DA PERSONALIZZARE */
  36. }
  37.  
  38. private void impostaLF()
  39. { try
  40. { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  41. }
  42. catch(Exception e)
  43. { System.out.println(e);
  44. System.exit(0);
  45. }
  46. }
  47.  
  48. private void inizializzaContenuto()
  49. { /* INIZIO PARTE DA PERSONALIZZARE */
  50. bottone1 = new JButton("Aumenta");
  51. frame.getContentPane().add(bottone1);
  52. bottone1.setBounds(80, 30, 120, 30);
  53. bottone1.addActionListener(new PressioneBottone1());
  54.  
  55.  
  56.  
  57. /* FINE PARTE DA PERSONALIZZARE */
  58. }
  59.  
  60. /* INIZIO PARTE DA PERSONALIZZARE */
  61. private class PressioneBottone1 implements ActionListener
  62. { public void actionPerformed(ActionEvent e)
  63. { int n = Integer.parseInt(etichetta1.getText());
  64. if(n<10)
  65. n++;
  66. etichetta1.setText(""+n);
  67. }
  68. }
  69.  
  70.  
  71. /* FINE PARTE DA PERSONALIZZARE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement