Java JSP Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP  Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python Java JSP Application Hosting Web Hosting website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP,Python
Java JSP Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP, Python Java JSP Application Hosting Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, Python,JSP
Java JSP Application Hosting Web Hosting Sign-Up Java JSP Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting  Java JSP Application Hosting Resellers web hosting, website hosting, web site hosting Java JSP Application Hosting EZ Site Control Panel for web hosting,website hosting, web site hosting
Java JSP Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python,JSP,  Fundraising
Java JSP Application Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting
WWW.

Call Us Toll-Free
(877) 256-0328

Outside USA
1 - (201) 505-0430

Java JSP Application Hosting Welcome Java JSP Application Hosting Web Hosting Plans Overview , Fund Raising, Fundraising, web hosting, website hosting, web site hosting Java JSP Application Hosting Fund Raising, Fundraising, web hosting Java JSP Application Hosting Resellers, web Hosting Java JSP Application Hosting Web Design, web Hosting Java JSP Application Hosting Extra Services,  web Hosting Java JSP Application Hosting Traffic Booster, web hosting Java JSP Application Hosting Traffic Booster, web hosting Java JSP Application Hosting Technical Support,  web Hosting Java JSP Application Hosting webmaster tips,  web Hosting Java JSP Application Hosting 30 Day Money Back, web hosting Java JSP Application Hosting Legal Notices for Web Hosting Java JSP Application Hosting Glossary Computer Terms for web Hosting Java JSP Application Hosting Contact Information - web hosting

Site Map
Java JSP Application Hosting Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python, JSP Java JSP Application Hosting Java JSP Application Hosting Java JSP Application Hosting Java JSP Application Hosting Java JSP Application Hosting Questions and Exercises: Using Swing Components (The Java™ Tutorials > Creating a GUI with JFC/Swing)
Trail: Creating a GUI with JFC/Swing
Home Page > Creating a GUI with JFC/Swing
Questions and Exercises: Using Swing Components

Use the information in this lesson and the component how-to sections to help you complete these questions and exercises.

Questions

1. Find the component that best fits each of the following needs. Write down both the component’s common name (such as “frame”) and find the component's how-to page online. [Hint: You can use A Visual Index to the Swing Components to help you answer this question.]

a. A component that lets the user pick a color.

b. A component that displays an icon, but that doesn’t react to user clicks.

c. A component that looks like a button and that, when pressed, brings up a menu of items for the user to choose from.

d. A container that looks like a frame, but that appears (usually with other, similar containers) within a real frame.

e. A container that lets the user determine how two components share a limited amount of space.

2. Which method do you use to add a menu bar to a top-level container such as a JFrame?

3. Which method do you use to specify the default button for a top-level container such as a JFrame or JDialog?

4. Which method do you use to enable and disable components such as JButtons? What class is it defined in?

5. a. Which Swing components use ListSelectionModel? [Hint: The “Use” link at the top of the specification for each interface and class takes you to a page showing where in the API that interface or class is referenced.]

b. Do those components use any other models to handle other aspects of the components’ state? If so, list the other models’ types.

6. Which type of model holds a text component’s content?

Exercises

1. Implement a program with a GUI that looks like the one shown below. Put the main method in a class named MyDemo1.

MyDemo1.png


2. Make a copy of MyDemo1.java named MyDemo2.java. Add a menu bar to MyDemo2.


3. Copy MyDemo1.java to MyDemo3.java. Add a button (JButton) to MyDemo3.java. Make it the default button.

 

Check your answers.
Previous page: Solving Common Component Problems
Next page: Concurrency in Swing
 
 
 

Add to My Yahoo!

XML icon

Add to Google

 

 

 

 

 

 

 

 

 

 

 

JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP at JSP.aldenWEBhosting.com Servlets at servlets.aldenWEBhosting.com Tomcat at Tomcat.aldenWEBhosting.com mysql at mysql.aldenWEBhosting.com Java at Java.aldenWEBhosting.com Web Hosts Portal Web Links Web Links Web Hosting JSP Solutions Web Links JSP Solutions Web Hosting Servlets Solutions Web Links Servlets Solutions Web Hosting Web Links Web Links . . .
.
.
. .
.
. .
. . . . . . . . . . . jsp hosting servlets hosting web hosting web sites designed cheap web hosting web site hosting myspace web hosting