use of org.cytoscape.internal.prefs.lib.ColorPane in project cytoscape-impl by cytoscape.
the class AbstractPrefsPanel method inject.
// ------------------------------------------------------------------
// For each type of control we have used,
// here we push a value into the control (inject).
// and pull the value out (scrape)
protected void inject(String value, JComponent control) {
if (control instanceof JCheckBox) {
JCheckBox ck = (JCheckBox) control;
boolean val = value.toLowerCase().startsWith("t");
ck.setSelected(val);
}
if (control instanceof JTextField) {
JTextField fld = (JTextField) control;
fld.setText(value);
}
if (control instanceof JComboBox) {
JComboBox s = (JComboBox) control;
s.setSelectedItem(value);
}
if (control instanceof ColorPane) {
ColorPane s = (ColorPane) control;
try {
s.setColor(new Color(Integer.parseInt(value)));
} catch (NumberFormatException e) {
}
}
if (control instanceof JSlider) {
JSlider s = (JSlider) control;
try {
int i = Integer.parseInt(value);
s.setValue(i);
} catch (NumberFormatException e) {
}
}
}
use of org.cytoscape.internal.prefs.lib.ColorPane in project cytoscape-impl by cytoscape.
the class PrefsColor method makeColorColumn.
VBox makeColorColumn(String description, Color[] colors, String selection) {
VBox box = new VBox(false, false);
int row = 0;
for (Color color : colors) {
ColorPane c = new ColorPane(row++, 0, color, null);
c.setEnabled(false);
c.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
select(box, description);
}
});
box.add(c);
}
box.setBorder(description.equals(selection) ? red4 : orange4);
box.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
select(box, description);
}
});
allVisPalettes.put(description, box);
return box;
}
Aggregations