wt.clients.util
Class EnumeratedChoice

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Choice
          extended by wt.clients.util.EnumeratedChoice
All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible

public class EnumeratedChoice
extends Choice

This class allows the selection of the allowable values for a specified EnumeratedType class in a choice list.



Supported API: true

Extendable: false Sample code:


        static public void main(String args[])
        {
            if (args.length == 0 )
            {
                System.out.println("supply enumeration class");
                return;
            }

            String classname = args[0];
                class DriverFrame extends java.awt.Frame
                {
                    EnumeratedChoice choice = null;
                        public DriverFrame(String title)
                        {
                super(title);
                                addWindowListener(new java.awt.event.WindowAdapter() {
                                        public void windowClosing(java.awt.event.WindowEvent event)
                                        {
                                                dispose();        // free the system resources
                                                System.exit(0); // close the application
                                        }
                                });
                                setLayout(new java.awt.BorderLayout());
                                setSize(300,300);
                                choice = new EnumeratedChoice();
                                choice.setDisplayNonSelectable(true);

                                add(choice, "Center");

                                choice.addItemListener( new java.awt.event.ItemListener() {
                                    public void itemStateChanged(ItemEvent ie)
                                    {
                                        EnumeratedType value = choice.getSelectedEnumeratedType();
                                        System.out.println("Selected value is now " + value);
                                    }
                                });
                        }
                        public void setClass(String name)
                        {
                                try {
                                    choice.setEnumeratedTypeClassName(name);
                            }
                            catch(PropertyVetoException pve)
                            {
                                pve.printStackTrace();
                            }
                        }

                        public void setClass(Class a_class)
                        {
                                try {
                                    choice.setEnumeratedTypeClass(a_class);
                            }
                            catch(PropertyVetoException pve)
                            {
                                pve.printStackTrace();

                            }
                    }
                }
        DriverFrame df;
        df = new DriverFrame("EnumeratedChoice Test");
        df.setClass(classname);
        df.show();
        }

 

See Also:
wt.fc.EnumeratedType;, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Choice
Choice.AccessibleAWTChoice
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 
Methods inherited from class java.awt.Choice
add, addItem, addItemListener, addNotify, countItems, getAccessibleContext, getItem, getItemCount, getItemListeners, getListeners, getSelectedIndex, getSelectedItem, getSelectedObjects, insert, paramString, processEvent, processItemEvent, remove, remove, removeAll, removeItemListener, select, select
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait