Advertisement
TrodelHD

Untitled

Mar 17th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. package Spiel;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Font;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7.  
  8. import javax.swing.JButton;
  9. import javax.swing.JFrame;
  10. import javax.swing.JOptionPane;
  11. import javax.swing.JTextField;
  12.  
  13. public class WaitforConnection {
  14. public GetRandomWord randomword;
  15. public Main m;
  16. public Console console;
  17. public Connection con;
  18. private JButton skip;
  19. private JTextField text;
  20. ActionListener actionListener = new ActionListener() {
  21. public void actionPerformed(ActionEvent e) {
  22. if (e.getSource() == skip) {
  23. connbestaetigung();
  24. }
  25. }
  26. };
  27. private static JFrame frame;
  28. public void show() {
  29. Font font = new Font("Calibri", Font.BOLD, 20);
  30. // create main frame
  31. frame = new JFrame("Warte auf verbindung");
  32. frame.setSize(300, 300);
  33. frame.getContentPane().setLayout(new BorderLayout());
  34.  
  35. skip = new JButton("Überspringen");
  36. frame.add(skip,BorderLayout.PAGE_END);
  37. skip.addActionListener(actionListener);
  38.  
  39. text = new JTextField();
  40. text.setText("Warte auf Verbindung...");
  41. text.setFont(font);
  42. text.setEditable(false);
  43. frame.add(text,BorderLayout.PAGE_START);
  44.  
  45. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  46. frame.setVisible(true);
  47. }
  48. public void connbestaetigung(){
  49. try {frame.dispose();frame = null;} catch (Exception e) {}
  50. MyPanel mp = new MyPanel();
  51.  
  52. String random = randomword.getRandomWord();
  53. JOptionPane.showMessageDialog(frame, "Bitte male "+random);
  54. con.serversendMessage("start rate "+random);
  55.  
  56. }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement