Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions

Question

14. Does the all-or-none law apply to dendrites? Why or why not?

Answered: 1 week ago

Question

5. Which chemicals cross the blood-brain barrier passively?

Answered: 1 week ago