use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.
the class ReactionCartoonEditorPanel method getUngroupButton.
private JToolBarToggleButton getUngroupButton() {
if (ungroupButton == null) {
try {
JToolBarToggleButton button = new JToolBarToggleButton();
UngroupToolShapeIcon.setMod(button);
button.setActionCommand(Mode.UNGROUP.getActionCommand());
ungroupButton = button;
} catch (Throwable throwable) {
handleException(throwable);
}
}
return ungroupButton;
}
use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.
the class ReactionCartoonEditorPanel method initConnections.
private void initConnections() throws Exception {
for (JToolBarToggleButton modeButton : getModeButtons()) {
modeButton.addActionListener(this);
}
for (JToolBarToggleButton viewButton : getViewButtons()) {
viewButton.addActionListener(this);
}
ButtonModel selection = modeButtonGroup.getSelection();
if (selection != null) {
getReactionCartoonTool().setModeString(selection.getActionCommand());
} else {
getReactionCartoonTool().setMode(Mode.SELECT);
}
getRandomLayoutButton().addActionListener(this);
getAnnealLayoutButton().addActionListener(this);
getCircleLayoutButton().addActionListener(this);
getRelaxerLayoutButton().addActionListener(this);
getLevellerLayoutButton().addActionListener(this);
getZoomInButton().addActionListener(this);
getZoomOutButton().addActionListener(this);
getGlgLayoutJButton().addActionListener(this);
getShrinkCanvasButton().addActionListener(this);
getExpandCanvasButton().addActionListener(this);
getFloatRequestButton().addActionListener(this);
getHighlightCatalystsButton().addActionListener(this);
for (JToolBarToggleButton sizeButton : getSizeOptionsButtons()) {
sizeButton.addActionListener(this);
}
}
use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.
the class ReactionCartoonEditorPanel method getGroupMoleculeButton.
private JToolBarToggleButton getGroupMoleculeButton() {
if (groupMoleculeButton == null) {
try {
JToolBarToggleButton button = new JToolBarToggleButton();
GroupMoleculeToolShape.setMod(button);
button.setActionCommand(Mode.GROUPMOLECULE.getActionCommand());
groupMoleculeButton = button;
} catch (Throwable throwable) {
handleException(throwable);
}
}
return groupMoleculeButton;
}
use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.
the class ReactionCartoonEditorPanel method getHighlightCatalystsButton.
private JToolBarToggleButton getHighlightCatalystsButton() {
if (highlightCatalystsButton == null) {
try {
JToolBarToggleButton button = new JToolBarToggleButton();
HighlightCatalystShapeIcon.setStructureToolMod(button);
button.setActionCommand(Mode.HIGHLIGHTCATALYST.getActionCommand());
highlightCatalystsButton = button;
} catch (Throwable throwable) {
handleException(throwable);
}
}
return highlightCatalystsButton;
}
use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.
the class SpeciesToolShapeIcon method paintIcon.
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (c == null) {
return;
}
if (!(c instanceof JToolBarToggleButton)) {
return;
}
JToolBarToggleButton b = (JToolBarToggleButton) c;
Graphics2D g2 = (Graphics2D) g;
Color colorOld = g2.getColor();
Paint paintOld = g2.getPaint();
Stroke strokeOld = g2.getStroke();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// (diameter-circleDiameter) / 2
int xx = 2;
int yy = 2;
Color exterior, interior;
if (state == State.normal) {
exterior = Color.green.darker().darker();
interior = Color.white;
xx += x;
yy += y;
} else {
exterior = Color.green.darker();
interior = Color.white;
// button moves a little bit to simulate 3D pressing of a button
xx += x + 1;
yy += y + 1;
}
Ellipse2D e = new Ellipse2D.Double(xx, yy, circleDiameter, circleDiameter);
Point2D center = new Point2D.Float(xx + circleDiameter / 2, yy + circleDiameter / 2);
float radius = circleDiameter * 0.5f;
Point2D focus = new Point2D.Float(xx + circleDiameter / 2 - 2, yy + circleDiameter / 2 - 2);
float[] dist = { 0.1f, 1.0f };
Color[] colors = { interior, exterior };
RadialGradientPaint p = new RadialGradientPaint(center, radius, focus, dist, colors, CycleMethod.NO_CYCLE);
g2.setPaint(p);
g2.fill(e);
g.setColor(Color.black);
g2.draw(e);
g2.setStroke(strokeOld);
g2.setColor(colorOld);
g2.setPaint(paintOld);
}
Aggregations