Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 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.  
  12. JTextField textField = new JTextField(4);
  13. this.add(textField);
  14. }
  15.  
  16. public static void main(String[] args) {
  17. myFrame game = new myFrame();
  18. game.setVisible(true);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement