Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.Component;
- import java.awt.Cursor;
- import java.awt.Frame;
- import java.awt.event.*;
- import java.awt.Color.*;
- import java.util.Random.*;
- class Harald extends Thread implements ActionListener
- {
- JFrame harald;
- JLabel Spiel;
- JTextArea Text;
- Cursor c;
- JComponent component;
- JButton butter;
- JButton butt;
- ActionEvent e;
- Windowlauscher amfenster;
- public Harald()
- {
- Spiel = new JLabel("Hallo, Ich möchte ein Spiel mit dir Spielen. Spielst du mit mir ?") ;
- c = new Cursor(Cursor.CROSSHAIR_CURSOR);
- amfenster = new Windowlauscher();
- butter = new JButton ("JOO");
- butt = new JButton ("NÄH");
- harald = new JFrame("GUI NO.1");
- harald.setLayout(null);
- harald.setBounds(0, 0,1280, 995);
- Spiel.setBounds(420, 120, 450, 20);
- butter.setBounds(465, 200, 80, 80);
- butt.setBounds(645, 200, 80, 80);
- butter.addActionListener(this);
- butt.addActionListener(this);
- harald.addWindowListener(amfenster);
- harald.add(Spiel);
- harald.add(butter);
- harald.add(butt);
- harald.setResizable(false);
- harald.setVisible(true);
- }
- public void actionPerformed(ActionEvent e)
- {
- if(e.getSource()==butter)
- {
- harald.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
- }
- if(e.getSource()==butt)
- {
- System.exit(0);
- }
- }
- public void run()
- {
- for(int i = 0; i < 10; i++)
- {
- try
- {
- sleep(5000);
- }
- catch(InterruptedException e)
- {
- }
- }
- }
- public static void main(String[] args)
- {
- Harald blub = new Harald();
- blub.run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement