Question: JAVA public class FirstGUI extends JFrame { JButton button = new JButton(Go); JLabel label = new JLabel(COMP163); public FirstGUI() { setSize(250, 250); Container pane =
JAVA
public class FirstGUI extends JFrame {
JButton button = new JButton("Go");
JLabel label = new JLabel("COMP163");
public FirstGUI() {
setSize(250, 250);
Container pane = getContentPane();
BoxLayout layout = new BoxLayout(pane, BoxLayout.Y_AXIS);
setLayout(layout);
pane.add(button);
pane.add(label);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args) {
FirstGUI myprog = new FirstGUI();
}
}
Below the button and label do this:
2. Add a JTextField with string "Hello world."
3. Add a JComboBox with the days of the week
Create a String array named weekdays filled with the days of the week.
Allocate a JComboBox
4. Add both to the pane using pane.add() method, just like the button and label.
Run your program to make sure it works and the GUI shows all the features you have added.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
