Java Code Examples for javax.swing.plaf.metal.MetalToggleButtonUI

The following examples show how to use javax.swing.plaf.metal.MetalToggleButtonUI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans-mmd-plugin   Source File: IconPanel.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
private JToggleButton makeIconButton(@Nonnull final ButtonGroup group, @Nonnull final String name) {
  final JToggleButton result = Utils.UI_COMPO_FACTORY.makeToggleButton();

  final Color panelColor = this.getBackground();

  result.setUI(new MetalToggleButtonUI() {
    @Override
    @Nullable
    protected Color getSelectColor() {
      return panelColor.brighter();
    }
  });

  result.setBackground(panelColor.darker());

  result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(3, 3, 3, 3)));
  result.setIcon(new ImageIcon(MiscIcons.findForName(name)));
  result.setName(name);
  result.setFocusPainted(false);
  result.setToolTipText(name);

  group.add(result);
  return result;
}
 
Example 2
Source Project: openstego   Source File: OpenStegoFrame.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter method for embedButton
 *
 * @return embedButton
 */
public JToggleButton getEmbedButton() {
    if (this.embedButton == null) {
        this.embedButton = new JToggleButton(labelUtil.getString("gui.label.tab.dhEmbed"),
                new ImageIcon(getClass().getResource("/image/EmbedIcon.png")), true);
        if (toggleUiHack) {
            this.embedButton.setUI(new MetalToggleButtonUI());
        }
        this.embedButton.setVerticalTextPosition(SwingConstants.BOTTOM);
        this.embedButton.setHorizontalTextPosition(SwingConstants.CENTER);
        this.embedButton.setFocusable(false);
        this.actionButtonGroup.add(this.embedButton);
    }
    return this.embedButton;
}
 
Example 3
Source Project: openstego   Source File: OpenStegoFrame.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter method for extractButton
 *
 * @return extractButton
 */
public JToggleButton getExtractButton() {
    if (this.extractButton == null) {
        this.extractButton = new JToggleButton(labelUtil.getString("gui.label.tab.dhExtract"),
                new ImageIcon(getClass().getResource("/image/ExtractIcon.png")));
        if (toggleUiHack) {
            this.extractButton.setUI(new MetalToggleButtonUI());
        }
        this.extractButton.setVerticalTextPosition(SwingConstants.BOTTOM);
        this.extractButton.setHorizontalTextPosition(SwingConstants.CENTER);
        this.extractButton.setFocusable(false);
        this.actionButtonGroup.add(this.extractButton);
    }
    return this.extractButton;
}
 
Example 4
Source Project: openstego   Source File: OpenStegoFrame.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter method for genSigButton
 *
 * @return genSigButton
 */
public JToggleButton getGenSigButton() {
    if (this.genSigButton == null) {
        this.genSigButton = new JToggleButton(labelUtil.getString("gui.label.tab.wmGenSig"),
                new ImageIcon(getClass().getResource("/image/EmbedIcon.png"))); // TODO
        if (toggleUiHack) {
            this.genSigButton.setUI(new MetalToggleButtonUI());
        }
        this.genSigButton.setVerticalTextPosition(SwingConstants.BOTTOM);
        this.genSigButton.setHorizontalTextPosition(SwingConstants.CENTER);
        this.genSigButton.setFocusable(false);
        this.actionButtonGroup.add(this.genSigButton);
    }
    return this.genSigButton;
}
 
Example 5
Source Project: openstego   Source File: OpenStegoFrame.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter method for signWmButton
 *
 * @return signWmButton
 */
public JToggleButton getSignWmButton() {
    if (this.signWmButton == null) {
        this.signWmButton = new JToggleButton(labelUtil.getString("gui.label.tab.wmEmbed"),
                new ImageIcon(getClass().getResource("/image/EmbedIcon.png")));
        if (toggleUiHack) {
            this.signWmButton.setUI(new MetalToggleButtonUI());
        }
        this.signWmButton.setVerticalTextPosition(SwingConstants.BOTTOM);
        this.signWmButton.setHorizontalTextPosition(SwingConstants.CENTER);
        this.signWmButton.setFocusable(false);
        this.actionButtonGroup.add(this.signWmButton);
    }
    return this.signWmButton;
}
 
Example 6
Source Project: openstego   Source File: OpenStegoFrame.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter method for verifyWmButton
 *
 * @return verifyWmButton
 */
public JToggleButton getVerifyWmButton() {
    if (this.verifyWmButton == null) {
        this.verifyWmButton = new JToggleButton(labelUtil.getString("gui.label.tab.wmVerify"),
                new ImageIcon(getClass().getResource("/image/ExtractIcon.png")));
        if (toggleUiHack) {
            this.verifyWmButton.setUI(new MetalToggleButtonUI());
        }
        this.verifyWmButton.setVerticalTextPosition(SwingConstants.BOTTOM);
        this.verifyWmButton.setHorizontalTextPosition(SwingConstants.CENTER);
        this.verifyWmButton.setFocusable(false);
        this.actionButtonGroup.add(this.verifyWmButton);
    }
    return this.verifyWmButton;
}