Example usage for javax.swing JToggleButton setMinimumSize

List of usage examples for javax.swing JToggleButton setMinimumSize

Introduction

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

Prototype

@BeanProperty(description = "The minimum size of the component.")
public void setMinimumSize(Dimension minimumSize) 

Source Link

Document

Sets the minimum size of this component to a constant value.

Usage

From source file:Main.java

public static JToggleButton createToggleButton(ImageIcon icon, int dimension, String tooltipText) {
    JToggleButton btn = new JToggleButton();
    btn.setToolTipText(tooltipText);/*from   w w w .j  a  va 2 s. co m*/
    btn.setIcon(icon);

    btn.setMaximumSize(new Dimension(dimension, dimension));
    btn.setMinimumSize(new Dimension(dimension, dimension));
    btn.setPreferredSize(new Dimension(dimension, dimension));
    btn.setMargin(new Insets(0, 0, 0, 0));

    return btn;
}

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(// w  w w.ja  v  a2 s. co  m
            "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);
}

From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java

/**
 * Create "Start Recording" Button and attach the event handler.
 * /*from www  . j  av a 2s. c  o  m*/
 * @return created Button.
 */
private JToggleButton createRecordingButton() {
    JToggleButton button = decoratedToSimpleButton(new JToggleButton("Start Recording"));
    button.setText("Start Recording");
    button.setSelected(false);
    button.setMinimumSize(new Dimension(100, 30));
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JToggleButton button = (JToggleButton) e.getSource();
            if (button.isSelected()) {
                button.setText("Stop Recording");
                button.setSelected(true);
                messageBus.getPublisher(Topics.START_RECORDING).propertyChange(new PropertyChangeEvent(
                        RecordingControlPanel.this, "Start Recording", null, getFilteredFileTypes()));
            } else {
                if (!stopConfirm()) {
                    button.setSelected(true);
                    return;
                }
                messageBus.getPublisher(Topics.STOP_RECORDING)
                        .propertyChange(new PropertyChangeEvent(RecordingControlPanel.this, "Stop Recording",
                                null, Pair.of(getFilteredFileTypes(), getGenerationOption())));
                button.setText("Start Recording");
            }
        }
    });
    return button;
}