Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.util.ArrayList;
- import java.util.Scanner;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- import javax.swing.UIManager;
- import razionali.Razionale;
- public class GraficaDet
- { private JFrame frame;
- /* INIZIO PARTE DA PERSONALIZZARE */
- private JButton bottone1;
- /* FINE PARTE DA PERSONALIZZARE */
- public GraficaDet()
- { frame = new JFrame();
- frame.getContentPane().setLayout(null);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- impostaLF();
- frame.setVisible(true);
- inizializzaContenuto();
- /* INIZIO PARTE DA PERSONALIZZARE */
- frame.setBounds(100, 100, 500, 450);
- frame.setTitle("Esempio");
- /* FINE PARTE DA PERSONALIZZARE */
- }
- private void impostaLF()
- { try
- { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- }
- catch(Exception e)
- { System.out.println(e);
- System.exit(0);
- }
- }
- private void inizializzaContenuto()
- { /* INIZIO PARTE DA PERSONALIZZARE */
- bottone1 = new JButton("Aumenta");
- frame.getContentPane().add(bottone1);
- bottone1.setBounds(80, 30, 120, 30);
- bottone1.addActionListener(new PressioneBottone1());
- /* FINE PARTE DA PERSONALIZZARE */
- }
- /* INIZIO PARTE DA PERSONALIZZARE */
- private class PressioneBottone1 implements ActionListener
- { public void actionPerformed(ActionEvent e)
- { int n = Integer.parseInt(etichetta1.getText());
- if(n<10)
- n++;
- etichetta1.setText(""+n);
- }
- }
- /* FINE PARTE DA PERSONALIZZARE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement