Java Code Examples for javax.swing.JToggleButton#setBackground()
The following examples show how to use
javax.swing.JToggleButton#setBackground() .
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 File: IconPanel.java From netbeans-mmd-plugin with Apache License 2.0 | 6 votes |
@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 File: SeaGlassDesktopIconUI.java From seaglass with Apache License 2.0 | 6 votes |
protected void installComponents() { if (UIManager.getBoolean("InternalFrame.useTaskBar")) { iconPane = new JToggleButton(frame.getTitle(), frame.getFrameIcon()) { public String getToolTipText() { return getText(); } public JPopupMenu getComponentPopupMenu() { return frame.getComponentPopupMenu(); } }; ToolTipManager.sharedInstance().registerComponent(iconPane); iconPane.setFont(desktopIcon.getFont()); iconPane.setBackground(desktopIcon.getBackground()); iconPane.setForeground(desktopIcon.getForeground()); } else { iconPane = new SeaGlassInternalFrameTitlePane(frame); iconPane.setName("InternalFrame.northPane"); } desktopIcon.setLayout(new BorderLayout()); desktopIcon.add(iconPane, BorderLayout.CENTER); }
Example 3
Source File: TabSelector.java From magarena with GNU General Public License v3.0 | 5 votes |
public void addTab(MagicPlayerZone zone, int player) { final JToggleButton button = new JToggleButton(); button.setToolTipText(null); button.setBackground(this.backgroundColor); button.setFocusable(false); button.setPreferredSize(buttonDimension); button.setActionCommand(zone.name() + DELIM + player + DELIM + buttons.size()); button.addActionListener(this); buttons.add(button); buttonPanel.add(button); if (buttons.size() == 1) { showTab(button); } }
Example 4
Source File: JButtonFactory.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
private static void setToggleButtonProperties(SoundIdReader soundIdReader, JToggleButton button) { button.setBackground(ColorPalette.DARK_BACKGROUND_COLOR); addClickSoundEffect(soundIdReader, button); setButtonProperties(button); }