Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.knugi;
- /* */ import java.awt.Container;
- /* */ import java.awt.EventQueue;
- /* */ import java.awt.event.ActionEvent;
- /* */ import java.awt.event.ActionListener;
- /* */ import javax.swing.JButton;
- /* */ import javax.swing.JFrame;
- /* */ import javax.swing.JTextField;
- /* */
- /* */
- /* */
- /* */ public class Counter
- /* */ {
- /* */ private JFrame frame;
- /* */ private JTextField licznik;
- /* */ private int count = 0;
- /* */ public static void main(String[] args)
- /* */ {
- /* 20 */ EventQueue.invokeLater(new Runnable() {
- /* */ public void run() {
- /* */ try {
- /* 23 */ Counter window = new Counter();
- /* 24 */ window.frame.setVisible(true);
- /* */ } catch (Exception e) {
- /* 26 */ e.printStackTrace();
- /* */ }
- /* */ }
- /* */ });
- /* */ }
- /* */
- /* */
- /* */
- /* */ public Counter()
- /* */ {
- /* 36 */ initialize();
- /* */ }
- /* */
- /* */
- /* */
- /* */ private void initialize()
- /* */ {
- /* 43 */ this.frame = new JFrame();
- /* 44 */ this.frame.setBounds(100, 100, 230, 254);
- /* 45 */ this.frame.setDefaultCloseOperation(3);
- /* 46 */ this.frame.getContentPane().setLayout(null);
- /* */
- /* 48 */ JButton btnClick = new JButton("Nacisnij mnie");
- /* 49 */ btnClick.addActionListener(new ActionListener() {
- /* */ public void actionPerformed(ActionEvent e) {
- count++;
- /* 51 */ Counter.this.licznik.setText(count+"");
- /* */ }
- /* 53 */ });
- /* 54 */ btnClick.setBounds(0, 0, 214, 176);
- /* 55 */ this.frame.getContentPane().add(btnClick);
- /* */
- /* 57 */ this.licznik = new JTextField();
- /* 58 */ this.licznik.setEditable(false);
- /* 59 */ this.licznik.setBounds(0, 175, 214, 40);
- /* 60 */ this.frame.getContentPane().add(this.licznik);
- /* 61 */ this.licznik.setColumns(10);
- this.licznik.setText("0");
- /* */ }
- /* */ }
- /* Location: C:\Users\fogel\Desktop\projekt.jar!\Clicker\Counter.class
- * Java compiler version: 8 (52.0)
- * JD-Core Version: 0.7.1
- */
Advertisement
Add Comment
Please, Sign In to add comment