Back to index

wims  3.65+svn20090927
Public Member Functions | Private Attributes
ptolemy.gui.Query.QueryColorChooser Class Reference

Panel containing an entry box and color chooser. More...

Inheritance diagram for ptolemy.gui.Query.QueryColorChooser:
Inheritance graph
Collaboration diagram for ptolemy.gui.Query.QueryColorChooser:
Collaboration graph

List of all members.

Public Member Functions

 QueryColorChooser (String name, String defaultColor)
void actionPerformed (ActionEvent e)
String getSelectedColor ()
void setColor (String name)

Private Attributes

JTextField _entryBox
String _name

Detailed Description

Panel containing an entry box and color chooser.

Definition at line 1666 of file

Constructor & Destructor Documentation

ptolemy.gui.Query.QueryColorChooser.QueryColorChooser ( String  name,
String  defaultColor 
) [inline]

Definition at line 1667 of file

            //_defaultColor = defaultColor;
            _entryBox = new JTextField(defaultColor, _width);

            JButton button = new JButton("Choose");

            // Add the listener last so that there is no notification
            // of the first value.
            _entryBox.addActionListener(new QueryActionListener(name));

            // Add a listener for loss of focus.  When the entry gains
            // and then loses focus, listeners are notified of an update,
            // but only if the value has changed since the last notification.
            // FIXME: Unfortunately, Java calls this listener some random
            // time after the window has been closed.  It is not even a
            // a queued event when the window is closed.  Thus, we have
            // a subtle bug where if you enter a value in a line, do not
            // hit return, and then click on the X to close the window,
            // the value is restored to the original, and then sometime
            // later, the focus is lost and the entered value becomes
            // the value of the parameter.  I don't know of any workaround.
            _entryBox.addFocusListener(new QueryFocusListener(name));

            _name = name;

Member Function Documentation

void ptolemy.gui.Query.QueryColorChooser.actionPerformed ( ActionEvent  e) [inline]

Definition at line 1697 of file

            // Read the current color from the text field.
            String spec = getSelectedColor().trim();
            Color newColor = JColorChooser.showDialog(Query.this,
                    "Choose Color", stringToColor(spec));

            if (newColor != null) {
                float[] components = newColor.getRGBComponents(null);
                StringBuffer string = new StringBuffer("{");

                // Use the syntax of arrays.
                for (int j = 0; j < components.length; j++) {

                    if (j < (components.length - 1)) {
                    } else {


Here is the call graph for this function:

Definition at line 1723 of file

            return _entryBox.getText();

Here is the caller graph for this function:

void ptolemy.gui.Query.QueryColorChooser.setColor ( String  name) [inline]

Definition at line 1727 of file


Member Data Documentation

Definition at line 1731 of file

Definition at line 1733 of file

The documentation for this class was generated from the following file: