javax.swing.JButton#setRolloverEnabled ( )源码实例Demo

下面列出了javax.swing.JButton#setRolloverEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: StatusLineComponent.java
private void createCloseButton() {
    discardCloseButton();
    closeButton = new JButton();
    closeButton.setBorderPainted(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setOpaque(false);
    closeButton.setContentAreaFilled(false);
    
    Object img = UIManager.get("nb.progress.cancel.icon");
    if( null != img ) {
        closeButton.setIcon( ListComponent.iconOrImage2icon( img ) );
    }
    img = UIManager.get("nb.progress.cancel.icon.mouseover");
    if( null != img ) {
        closeButton.setRolloverEnabled(true);
        closeButton.setRolloverIcon( ListComponent.iconOrImage2icon( img ) );
    }
    img = UIManager.get("nb.progress.cancel.icon.pressed");
    if( null != img ) {
        closeButton.setPressedIcon( ListComponent.iconOrImage2icon( img ) );
    }
}
 
源代码2 项目: netbeans   文件: WatchAnnotationProvider.java
private void addActions(JToolBar tb, Action[] actions) {
    tb.removeAll();
    boolean visible = false;
    if (actions != null) {
        for (Action a : actions) {
            if (a != null) {
                JButton btn = tb.add(a);
                btn.setBorder(new javax.swing.border.EmptyBorder(0, 2, 0, 2));
                btn.setBorderPainted(false);
                btn.setContentAreaFilled(false);
                btn.setRolloverEnabled(false);
                btn.setOpaque(false);
                btn.setFocusable(false);
                visible = true;
            } else {
                tb.add(new JSeparator(JSeparator.VERTICAL));
            }
        }
    }
    tb.setVisible(visible);
}
 
源代码3 项目: netbeans   文件: BrowserMenu.java
private JComponent createConfigureButton() {
    if( null == browserProvider || !browserProvider.hasCustomizer() )
        return null;
    JButton button = new JButton(NbBundle.getMessage(BrowserMenu.class, "Ctl_ConfigurePhoneGap"));
    button.addActionListener( new ActionListener() {

        @Override
        public void actionPerformed( ActionEvent e ) {
            browserProvider.customize();
        }
    });
    button.setBorder( new EmptyBorder(1, 1, 1, 1) );
    button.setMargin( new Insets(0, 0, 0, 0) );

    button.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
    button.setHorizontalAlignment( JLabel.LEFT );
    button.setFocusable( false );

    button.setBorderPainted( false );
    button.setFocusPainted( false );
    button.setRolloverEnabled( true );
    button.setContentAreaFilled( false );

    return button;
}
 
源代码4 项目: netbeans   文件: ControlsToolbar.java
@Override
protected void addImpl( Component comp, Object constraints, int index ) {
    super.addImpl( comp, constraints, index ); 
    if( comp instanceof JButton ) {
        JButton btn = (JButton) comp;
        btn.setContentAreaFilled( false );
        btn.setOpaque( false );
        btn.setBorder( BorderFactory.createEmptyBorder(2,2,2,2) );
        btn.setFocusable( false );
        btn.setBorderPainted( false );
        btn.setRolloverEnabled( UIManager.getBoolean("nb.multitabs.button.rollover") );
    }
}
 
源代码5 项目: netbeans   文件: CloseButtonFactory.java
/**
 * Creates a small 'close' JButton with close icon, rollover icon and pressed icon according to Look and Feel
 *
 * @return JButton with close icons.
 */
public static JButton createCloseButton() {
    JButton closeButton = new JButton();
    int size = 16;
    closeButton.setPreferredSize(new Dimension(size, size));
    closeButton.setContentAreaFilled(false);
    closeButton.setFocusable(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setBorderPainted(false);
    closeButton.setRolloverEnabled(true);
    closeButton.setIcon(getCloseTabImage());
    closeButton.setRolloverIcon(getCloseTabRolloverImage());
    closeButton.setPressedIcon(getCloseTabPressedImage());
    return closeButton;
}
 
源代码6 项目: netbeans   文件: CloseButtonFactory.java
/**
 * Creates a big 'close' JButton with close icon, rollover icon and pressed icon according to Look and Feel
 *
 * @return JButton with close icons.
 */
public static JButton createBigCloseButton() {
    JButton closeButton = new JButton();
    int size = 19;
    closeButton.setPreferredSize(new Dimension(size, size));
    closeButton.setContentAreaFilled(false);
    closeButton.setFocusable(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setBorderPainted(false);
    closeButton.setRolloverEnabled(true);
    closeButton.setIcon(getBigCloseTabImage());
    closeButton.setRolloverIcon(getBigCloseTabRolloverImage());
    closeButton.setPressedIcon(getBigCloseTabPressedImage());
    return closeButton;
}
 
源代码7 项目: JByteMod-Beta   文件: MyToolBar.java
protected JButton makeNavigationButton(String action, ImageIcon i, ActionListener a) {
  JButton button = WebButton.createIconWebButton(i, StyleConstants.smallRound, true);
  button.setToolTipText(action);
  button.addActionListener(a);
  button.setFocusable(false);
  button.setBorderPainted(false);
  button.setRolloverEnabled(false);
  return button;
}
 
源代码8 项目: zap-extensions   文件: CloseTabPanel.java
public CloseTabPanel(String tabName, NumberedTabbedPane ntp) {
    super();
    this.ntp = ntp;
    this.setOpaque(false);
    JLabel lblTitle = new JLabel(tabName);
    JButton btnClose = new JButton();
    btnClose.setOpaque(false);

    // Configure icon and rollover icon for button
    btnClose.setRolloverIcon(CLOSE_TAB_RED_ICON);
    btnClose.setRolloverEnabled(true);
    btnClose.setContentAreaFilled(false);
    btnClose.setToolTipText(Constant.messages.getString("all.button.close"));
    btnClose.setIcon(CLOSE_TAB_GREY_ICON);
    // Set a border only on the left side so the button doesn't make the tab too big
    btnClose.setBorder(new EmptyBorder(0, 6, 0, 0));
    // This is needed to Macs for some reason
    btnClose.setBorderPainted(false);

    // Make sure the button can't get focus, otherwise it looks funny
    btnClose.setFocusable(false);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1;

    this.add(lblTitle, gbc);

    gbc.gridx++;
    gbc.weightx = 0;
    this.add(btnClose, gbc);

    btnClose.addActionListener(new CloseActionHandler(this.ntp, tabName));
}
 
源代码9 项目: jpexs-decompiler   文件: DefaultSyntaxKit.java
/**
 * Add all pop-up menu items to a Toolbar.  <b>You need to call the validate method
 * on the toolbar after this is done to layout the buttons.</b>
 * Only Actions which have a SMALL_ICON property will be added to the toolbar
 * There are three Configuration Keys that affect the appearance of the added buttons:
 * CONFIG_TOOLBAR_ROLLOVER, CONFIG_TOOLBAR_BORDER, CONFIG_TOOLBAR_OPAQUE
 * 
 * @param editorPane
 * @param toolbar
 */
public void addToolBarActions(JEditorPane editorPane, JToolBar toolbar) {
	String[] toolBarItems = getConfig().getPropertyList(CONFIG_TOOLBAR);
	if (toolBarItems == null || toolBarItems.length == 0) {
		toolBarItems = getConfig().getPropertyList(CONFIG_MENU);
		if (toolBarItems == null || toolBarItems.length == 0) {
			return;
		}
	}
	boolean btnRolloverEnabled = getConfig().getBoolean(CONFIG_TOOLBAR_ROLLOVER, true);
	boolean btnBorderPainted = getConfig().getBoolean(CONFIG_TOOLBAR_BORDER, false);
	boolean btnOpaque = getConfig().getBoolean(CONFIG_TOOLBAR_OPAQUE, false);
	int btnBorderSize = getConfig().getInteger(CONFIG_TOOLBAR_BORDER_SIZE, 2);
	for (String menuString : toolBarItems) {
		if (menuString.equals("-") ||
			menuString.startsWith("<") ||
			menuString.startsWith(">")) {
			toolbar.addSeparator();
		} else {
			Action action = editorPane.getActionMap().get(menuString);
			if (action != null && action.getValue(Action.SMALL_ICON) != null) {
				JButton b = toolbar.add(action);
				b.setRolloverEnabled(btnRolloverEnabled);
				b.setBorderPainted(btnBorderPainted);
				b.setOpaque(btnOpaque);
				b.setFocusable(false);
				b.setBorder(BorderFactory.createEmptyBorder(btnBorderSize,
					btnBorderSize, btnBorderSize, btnBorderSize));
			}
		}
	}
}
 
源代码10 项目: ios-image-util   文件: MainFrame.java
/**
 * Set preferences to Menu button.
 *
 * @param button
 * @param foregroundColor
 * @param backgroundColor
 * @param font
 * @return
 */
private JButton initMenuButton(JButton button, Color foregroundColor, Color backgroundColor, Font font) {
	button.setBackground(backgroundColor);
	button.setForeground(foregroundColor);
	button.setBorderPainted(false);
	button.setFocusPainted(false);
	button.setHorizontalTextPosition(SwingConstants.CENTER);
	button.setVerticalTextPosition(SwingConstants.BOTTOM);
	button.setFont(font);
	button.setMargin(new Insets(2, 16, 2, 16));
	button.setOpaque(true);
	button.setDoubleBuffered(true);
	button.setRolloverEnabled(true);
	return button;
}