Example usage for javax.swing JToggleButton getIcon

List of usage examples for javax.swing JToggleButton getIcon

Introduction

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

Prototype

public Icon getIcon() 

Source Link

Document

Returns the default icon.

Usage

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

@Override
public JComponent getToolbarRepresentation() {
    JToolBar toolBar = NbComponents.newInnerToolbar();
    toolBar.addSeparator();/*from   ww w .  j a v  a  2 s .com*/
    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;
}