Java
  Home arrow Java arrow Java's Advanced User Interface Compone...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Java's Advanced User Interface Components
By: Gayathri Gokul
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 15
    2003-11-11

    Table of Contents:
  • Java's Advanced User Interface Components
  • More on the List Class
  • Scrollbars and Sliders
  • Canvases

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Java's Advanced User Interface Components
    (Page 1 of 4 )

    Last time, we mastered some basic UI components and worked on how to add them to panels, organize their layout, and manage their events. Having covered all the basic techniques that we’ll need to get started with Java interface programming in our first article, Java's Basic User Interface Components, we will move on to some advanced UI components. Today, I’ll be covering scrolling lists, scrollbars, and canvases, and their functionality. It is amazing to see how many of complex tasks are simplified with the help of these advanced user interface components.

    The List Class

    The list class allows us to create a scrolling list of values. We can enable single or multiple selections using a list. All that the user has to do is double-click on an item to make a selection. A scrolling list is functionally similar to a choice menu in that it lets us pick several options from a list, but scrolling lists differ in two significant ways:
    • Scrolling lists are not pop-up menus. They're displayed as a list of items from which you can choose one or more items. If the number of items is larger than the list box, a scrollbar is automatically provided so that you can see the other items.
    • You can choose more than one item in the list (if the list has been defined to allow multiple selection).

    In short, scrolling lists provide a menu of items that can be selected or deselected. Unlike choice menus, scrolling lists are not pop-up menus and can be defined to allow multiple selections. To create a scrolling list, an instance of the List class is created and then we add individual items to that list.

    To create a scrolling list use, one of the following constructors:
    • List() creates an empty scrolling list that enables only one selection at a time.
    • List(int, boolean) creates a scrolling list with the indicated number of items visible on the list (there is no limit as to the number of actual items you can add to the list). The boolean argument indicates whether this list enables multiple selections (true) or not (false).

    After creating a List object, add items to it using the addItem() method and then add the list itself to the panel that contains it. Here's an example that creates a list five items high that allows multiple selections

    More Java Articles
    More By Gayathri Gokul


     

       

    JAVA ARTICLES

    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup
    - Using RPC-Style Web Services with J2EE
    - Integrating XML with J2EE
    - Taming Tiger: Concurrent Collections
    - Combating the ‘Object Crisis’

    Iron Speed



    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway