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 using the constructor like this: new JComboBox(weekdays);

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!