-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWelcomeScreen.java
More file actions
36 lines (28 loc) · 912 Bytes
/
WelcomeScreen.java
File metadata and controls
36 lines (28 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.apcs;
import javax.swing.*;
import java.awt.event.*;
public class WelcomeScreen extends JFrame {
private JButton button1;
private JTextField textField1;
public static void main(String[] args) {
JFrame f = new JFrame();
final JTextField tf = new JTextField();
tf.setBounds(170,50, 50,20);
tf.setText("Quest");
tf.setEditable(false); // makes sure to set text field to be uneditable
JButton b = new JButton("START.");
b.setBounds(150,150,95,30);
/*
this is how to make the button do something
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
tf.setText("Welcome to Javatpoint.");
}
});*/
f.add(b);
f.add(tf);
f.setSize(400,300);
f.setLayout(null);
f.setVisible(true);
}
}