Question
CODE GIVEN: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JCapitals extends JFrame implements ItemListener { FlowLayout flow = new FlowLayout(); JLabel countryLabel = new
CODE GIVEN:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JCapitals extends JFrame implements ItemListener {
FlowLayout flow = new FlowLayout();
JLabel countryLabel = new JLabel("Select a country");
JComboBox countryBox = new JComboBox();
JTextField capitalField = new JTextField(25);
// your code here
public JCapitals() {
// Write your code here
}
public static void main(String[] arguments) {
JCapitals cframe = new JCapitals();
cframe.setSize(400, 150);
cframe.setVisible(true);
}
@Override
public void itemStateChanged(ItemEvent list) {
// Write your code here
}
}
Programming Exercise 14-7 Instructions w = l 10 Write an application that allows a user to select a country from a list box that contains the following seven options. After the user makes. a selection, display the country's capital city. Country Capital Austria Vienna Canada Toronto England London France Paris Italy Mexico Spain Grading Rome Mexico City Madrid |Capitals.java 1 import javax.swing.*; 2 import java.awt.*; 3 import java.awt.event.*; 4 public class JCapitals extends JFrame implements ItemListener { 5 6 FlowLayout flow = new FlowLayout(); 7 JLabel countryLabel = new JLabel("Select a country"); JComboBox countryBox= new JComboBox (); JTextField capitalField = new JTextField(25); 8 9 // your code here 10 public JCapitals() { + > Terminal sandbox $ X + Desktop + []
Step by Step Solution
3.39 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
8 7 public class JCapitals extends JFrame implements ItemListener FlowLayout flow new FlowLayout Flo...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started