List of usage examples for javax.swing JToggleButton setCursor
public void setCursor(Cursor cursor)
From source file:org.datacleaner.windows.AnalysisJobBuilderWindowImpl.java
private JToggleButton createViewToggleButton(final String text, final String iconPath) { final ImageIcon icon = imageManager.getImageIcon(iconPath); final JToggleButton button = new JToggleButton(text, icon); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); button.setFont(WidgetUtils.FONT_SMALL); button.setForeground(WidgetUtils.BG_COLOR_BRIGHTEST); button.setBackground(WidgetUtils.BG_COLOR_DARK); button.setBorderPainted(false);//from w w w .j av a2 s .c om button.setBorder(new CompoundBorder(WidgetUtils.BORDER_THIN, new EmptyBorder(0, 4, 0, 4))); return button; }
From source file:org.revager.tools.GUITools.java
/** * Creates a new image toggle button./*from w w w.j a v a2s . c o m*/ * * @param icon * the normal icon * @param rolloverIcon * the rollover icon * @param action * the action * * @return the newly created image button */ public static JToggleButton newImageToggleButton(ImageIcon icon, ImageIcon rolloverIcon, Action action) { JToggleButton button = new JToggleButton(action); button.setToolTipText(button.getText()); button.setText(null); button.setContentAreaFilled(false); button.setBorder(new EmptyBorder(0, 0, 0, 0)); button.setMargin(new Insets(0, 0, 0, 0)); button.setBorderPainted(false); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); button.setFocusPainted(false); button.setFocusable(false); button.setIcon(icon); button.setRolloverIcon(rolloverIcon); button.setRolloverSelectedIcon(rolloverIcon); button.setSelectedIcon(rolloverIcon); return button; }
From source file:org.revager.tools.GUITools.java
/** * Creates a new image toggle button./*from ww w.j a va 2 s. co m*/ * * @return the newly created image toggle button */ public static JToggleButton newImageToggleButton() { JToggleButton button = new JToggleButton(); button.setBorder(new EmptyBorder(2, 2, 2, 8)); button.setMargin(new Insets(0, 0, 0, 0)); button.setBorderPainted(false); button.setOpaque(false); button.setContentAreaFilled(false); button.setFocusable(false); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return button; }
From source file:org.ut.biolab.medsavant.client.view.Menu.java
public void addSection(SectionView section) { final JPanel sectionPanel = ViewUtil.getClearPanel(); sectionPanel.setLayout(new BoxLayout(sectionPanel, BoxLayout.Y_AXIS)); sectionPanel.setVisible(false);/*from www .j a va 2 s.co m*/ //HoverButton sectionButton = new SectionButton(section, sectionPanel); //sectionButton.setSelectedColor(ViewUtil.getSecondaryMenuColor()); final JToggleButton sectionButton = ViewUtil.getTogglableIconButton(section.getIcon()); sectionButton.setName(section.getName()); sectionButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); sectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { primaryMenuButtons.setSelected(sectionButton.getModel(), true); if (previousSectionPanel != null) { previousSectionPanel.setVisible(false); } // Act as if we clicked the first sub-section button. ((SubSectionButton) sectionPanel.getComponent(0)).subSectionClicked(); sectionPanel.setVisible(true); previousSectionPanel = sectionPanel; primaryMenu.invalidate(); } }); ButtonGroup subSectionsGroup = new ButtonGroup(); for (SubSectionView v : section.getSubSections()) { subSectionViews.add(v); SubSectionButton subSectionButton = new SubSectionButton(v, subSectionsGroup); sectionPanel.add(subSectionButton); subSectionsGroup.add(subSectionButton); map.put(v, subSectionButton); } primaryMenuButtons.add(sectionButton); sectionPanel.add(Box.createVerticalStrut(50)); secondaryMenu.add(sectionPanel); primaryMenuSectionButtonContainer.add(ViewUtil.subTextComponent(sectionButton, section.getName())); primaryMenuSectionButtonContainer.add(ViewUtil.getLargeSeparator()); }