Example usage for javax.swing JToggleButton setDisabledIcon

List of usage examples for javax.swing JToggleButton setDisabledIcon

Introduction

In this page you can find the example usage for javax.swing JToggleButton setDisabledIcon.

Prototype

@BeanProperty(visualUpdate = true, description = "The disabled icon for the button.")
public void setDisabledIcon(Icon disabledIcon) 

Source Link

Document

Sets the disabled icon for the button.

Usage

From source file:be.nbb.demetra.dfm.DfmExecViewTopComponent.java

@Override
public JComponent getToolbarRepresentation() {
    JToolBar toolBar = NbComponents.newInnerToolbar();
    toolBar.addSeparator();/*from w w w. j  a  v a  2  s. c o m*/
    toolBar.add(Box.createRigidArea(new Dimension(5, 0)));

    JToggleButton startStop = (JToggleButton) toolBar
            .add(new JToggleButton(StartStopCommand.INSTANCE.toAction(this)));
    startStop.setIcon(DemetraUiIcon.COMPILE_16);
    startStop.setDisabledIcon(createDisabledIcon(startStop.getIcon()));
    startStop.setToolTipText("Start/Stop");

    JButton edit = toolBar.add(EditSpecCommand.INSTANCE.toAction(this));
    edit.setIcon(DemetraUiIcon.PREFERENCES);
    edit.setDisabledIcon(createDisabledIcon(edit.getIcon()));
    edit.setToolTipText("Specification");

    JButton clear = toolBar.add(ClearCommand.INSTANCE.toAction(this));
    clear.setIcon(DemetraUiIcon.EDIT_CLEAR_16);
    clear.setDisabledIcon(createDisabledIcon(clear.getIcon()));
    clear.setToolTipText("Clear");

    SwingColorSchemeSupport colorSchemeSupport = SwingColorSchemeSupport
            .from(DemetraUI.getInstance().getColorScheme());
    sparkline = (ChartPanel) toolBar
            .add(Charts.avoidScaling(new ChartPanel(Charts.createSparkLineChart(null))));
    sparkline.setPreferredSize(new Dimension(150, 16));
    sparkline.setMaximumSize(new Dimension(150, 16));
    sparkline.getChart().getXYPlot().setDataset(dataset);
    sparkline.getChart().getXYPlot().getRenderer()
            .setBasePaint(colorSchemeSupport.getLineColor(ColorScheme.KnownColor.GREEN));
    sparkline.setBackground(colorSchemeSupport.getPlotColor());
    sparkline.setBorder(BorderFactory.createLineBorder(colorSchemeSupport.getGridColor()));
    sparkline.setToolTipText("loglikelihood");

    return toolBar;
}