Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

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.

CountryCapita

lAustriaVienna

CanadaToronto

EnglandLondon

FranceParis

ItalyRome

MexicoMexico City

SpainMadrid

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);

// code here

public JCapitals() {

// 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) {

// code here

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions