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);
}
}
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);
}
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);
}
}
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();
}
}
Aggregations