Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import javax.swing.JFrame;
  2. import javax.swing.JTextField;
  3. import javax.swing.JLabel;
  4.  
  5. public class myFrame extends JFrame{
  6. public myFrame(){ // constructor
  7. super("Guess the number game");
  8.  
  9. JLabel newLabel = new JLabel("I have a number between 0 and 1000. Can you guess my number?" + "\n" + "Please enter your first guess");
  10. this.add(newLabel);
  11. this.setVisible(true);
  12.  
  13. JTextField textField = new JTextField(4);
  14. this.add(textField);
  15. this.setVisible(true);
  16. }
  17. }
  18.  
  19. public class TestGame {
  20. public static void main(String[] args) {
  21. myFrame game = new myFrame();
  22. game.setVisible(true);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement