Search in sources :

Example 1 with ItemSelectable

use of java.awt.ItemSelectable in project voltdb by VoltDB.

the class Transfer method itemStateChanged.

/**
     * Method declaration
     *
     *
     * @param e
     */
public void itemStateChanged(ItemEvent e) {
    ItemSelectable item = e.getItemSelectable();
    if (item == lTable) {
        if (iSelectionStep == SELECT_SOURCE_TABLES) {
            String table = lTable.getSelectedItem();
            int selected = ((Integer) e.getItem()).intValue();
            for (int i = 0; i < tTable.size(); i++) {
                TransferTable t = (TransferTable) tTable.elementAt(i);
                if (t == null) {
                    continue;
                }
                if (i == selected) {
                    saveTable();
                    displayTable(t);
                    updateEnabled(true);
                }
            }
        }
    } else {
        // it must be a checkbox
        saveTable();
        updateEnabled(true);
    }
}
Also used : ItemSelectable(java.awt.ItemSelectable)

Example 2 with ItemSelectable

use of java.awt.ItemSelectable in project adempiere by adempiere.

the class SwingTool method addOpaque.

public static void addOpaque(JComponent c, final boolean opaque) {
    ContainerAdapter ca = new ContainerAdapter() {

        public void componentAdded(ContainerEvent e) {
            setOpaque(e.getChild());
        }

        private void setOpaque(Component c) {
            //ignores all selectable items, like buttons
            if (c instanceof ItemSelectable) {
                return;
            } else // sets transparent
            if (c instanceof JComponent) {
                ((JComponent) c).setOpaque(opaque);
            } else // recursively calls this method for all container components
            if (c instanceof Container) {
                for (int i = 0; i > ((Container) c).getComponentCount(); i++) {
                    setOpaque(((Container) c).getComponent(i));
                }
            }
        }
    };
    c.addContainerListener(ca);
}
Also used : ContainerEvent(java.awt.event.ContainerEvent) Container(java.awt.Container) JComponent(javax.swing.JComponent) ContainerAdapter(java.awt.event.ContainerAdapter) JComponent(javax.swing.JComponent) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent) ItemSelectable(java.awt.ItemSelectable)

Example 3 with ItemSelectable

use of java.awt.ItemSelectable in project com.revolsys.open by revolsys.

the class EnableComponentListener method itemStateChanged.

@Override
public void itemStateChanged(final ItemEvent e) {
    final ItemSelectable itemSelectable = e.getItemSelectable();
    final Object[] selectedObjects = itemSelectable.getSelectedObjects();
    if (selectedObjects == null) {
        this.component.setEnabled(false);
    } else {
        this.component.setEnabled(true);
    }
}
Also used : ItemSelectable(java.awt.ItemSelectable)

Example 4 with ItemSelectable

use of java.awt.ItemSelectable in project GCViewer by chewiebug.

the class Zoom method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final ItemSelectable is = (ItemSelectable) e.getSource();
    final Object[] o = is.getSelectedObjects();
    try {
        String item = (String) o[0];
        if (item.endsWith("%")) {
            item = item.substring(0, item.length() - 1);
        }
        final double zoomFactor = Double.parseDouble(item.trim());
        if (zoomFactor > 0) {
            gcViewer.getSelectedGCDocument().getModelChart().setScaleFactor(zoomFactor / 1000.0);
        }
    } catch (NumberFormatException nfe) {
    // nfe.printStackTrace();
    }
}
Also used : ItemSelectable(java.awt.ItemSelectable)

Aggregations

ItemSelectable (java.awt.ItemSelectable)4 Component (java.awt.Component)1 Container (java.awt.Container)1 ContainerAdapter (java.awt.event.ContainerAdapter)1 ContainerEvent (java.awt.event.ContainerEvent)1 JComponent (javax.swing.JComponent)1 JTextComponent (javax.swing.text.JTextComponent)1