Example usage for javax.swing JToggleButton getSize

List of usage examples for javax.swing JToggleButton getSize

Introduction

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

Prototype

public Dimension getSize() 

Source Link

Document

Returns the size of this component in the form of a Dimension object.

Usage

From source file:de.tor.tribes.ui.views.DSWorkbenchStatsFrame.java

private void buildMenu() {
    JXTaskPane editPane = new JXTaskPane();
    editPane.setTitle("Bearbeiten");
    final JToggleButton createStats = new JToggleButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/medal.png")));
    createStats.setToolTipText(/*from   w w  w  . ja  va2 s.  com*/
            "Umschalten zwischen dem Erzeugen von Statistiken und der Anzeige von Verlaufsgrafiken");
    createStats.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            boolean showChartView = !createStats.isSelected();
            if (showChartView) {
                createStats
                        .setIcon(new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/medal.png")));
            } else {
                createStats
                        .setIcon(new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/chart.png")));
            }
            switchStatChartView(showChartView);
        }
    });

    JXButton selectStart = new JXButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/beginning.png")));
    selectStart.setToolTipText("Setzt eine Startmarkierung beim gewhlten Datenpunkt");
    selectStart.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            setStartAnnotation();
        }
    });
    selectStart.setSize(createStats.getSize());
    selectStart.setMinimumSize(createStats.getMinimumSize());
    selectStart.setMaximumSize(createStats.getMaximumSize());
    selectStart.setPreferredSize(createStats.getPreferredSize());
    editPane.getContentPane().add(selectStart);
    JXButton selectEnd = new JXButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/end.png")));
    selectEnd.setToolTipText("Setzt eine Endmarkierung beim gewhlten Datenpunkt");
    selectEnd.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            setEndAnnotation();
        }
    });
    selectEnd.setSize(createStats.getSize());
    selectEnd.setMinimumSize(createStats.getMinimumSize());
    selectEnd.setMaximumSize(createStats.getMaximumSize());
    selectEnd.setPreferredSize(createStats.getPreferredSize());
    editPane.getContentPane().add(selectEnd);

    JXButton removeSelection = new JXButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/delete_region.png")));
    removeSelection.setToolTipText("Lscht alle Datenpunkte zwischen der Start- und Endmarkierung");
    removeSelection.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            removeSelection();
        }
    });
    removeSelection.setSize(createStats.getSize());
    removeSelection.setMinimumSize(createStats.getMinimumSize());
    removeSelection.setMaximumSize(createStats.getMaximumSize());
    removeSelection.setPreferredSize(createStats.getPreferredSize());
    editPane.getContentPane().add(removeSelection);

    createStats.setSize(removeSelection.getSize());
    createStats.setMinimumSize(removeSelection.getMinimumSize());
    createStats.setMaximumSize(removeSelection.getMaximumSize());
    createStats.setPreferredSize(removeSelection.getPreferredSize());

    editPane.getContentPane().add(createStats);

    JXTaskPane viewPane = new JXTaskPane();
    viewPane.setTitle("Anzeige");
    viewPane.getContentPane().add(jViewSelectionBox);

    JXTaskPane settingsPane = new JXTaskPane();
    settingsPane.setTitle("Einstellungen");

    settingsPane.getContentPane().add(jShowItemValues);
    settingsPane.getContentPane().add(jShowLegend);
    settingsPane.getContentPane().add(jShowLines);
    settingsPane.getContentPane().add(jShowDataPoints);

    centerPanel.setupTaskPane(editPane, viewPane, settingsPane);
}