javax.swing.AbstractButton#repaint ( )源码实例Demo

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

源代码1 项目: FlatLaf   文件: FlatToggleButtonUI.java
@Override
protected void propertyChange( AbstractButton b, PropertyChangeEvent e ) {
	super.propertyChange( b, e );

	switch( e.getPropertyName() ) {
		case BUTTON_TYPE:
			if( BUTTON_TYPE_TAB.equals( e.getOldValue() ) || BUTTON_TYPE_TAB.equals( e.getNewValue() ) ) {
				MigLayoutVisualPadding.uninstall( b );
				MigLayoutVisualPadding.install( b );
				b.revalidate();
			}

			b.repaint();
			break;

		case TAB_BUTTON_UNDERLINE_HEIGHT:
		case TAB_BUTTON_UNDERLINE_COLOR:
		case TAB_BUTTON_SELECTED_BACKGROUND:
			b.repaint();
			break;
	}
}
 
源代码2 项目: netbeans   文件: TabListPopupAction.java
@Override
public void actionPerformed(ActionEvent ae) {
    if ("pressed".equals(ae.getActionCommand())) { //NOI18N
        JComponent jc = (JComponent) ae.getSource();
        Point p = new Point(jc.getWidth(), jc.getHeight());
        SwingUtilities.convertPointToScreen(p, jc);
        if (!ButtonPopupSwitcher.isShown()) {
            ButtonPopupSwitcher.showPopup(jc, displayer, p.x, p.y);
        } else {
            ButtonPopupSwitcher.hidePopup();
        }
        //Other portion of issue 37487, looks funny if the
        //button becomes pressed
        if (jc instanceof AbstractButton) {
            AbstractButton jb = (AbstractButton) jc;
            jb.getModel().setPressed(false);
            jb.getModel().setRollover(false);
            jb.getModel().setArmed(false);
            jb.repaint();
        }
    }
}
 
源代码3 项目: netbeans   文件: TabListPopupAction.java
@Override
public void actionPerformed( ActionEvent ae ) {
    if ("pressed".equals(ae.getActionCommand())) { //NOI18N
        JComponent jc = (JComponent) ae.getSource();
        Point p = new Point(jc.getWidth(), jc.getHeight());
        SwingUtilities.convertPointToScreen(p, jc);
        if (!ButtonPopupSwitcher.isShown()) {
            ButtonPopupSwitcher.showPopup(jc, controller, p.x, p.y);
        } else {
            ButtonPopupSwitcher.hidePopup();
        }
        //Other portion of issue 37487, looks funny if the
        //button becomes pressed
        if (jc instanceof AbstractButton) {
            AbstractButton jb = (AbstractButton) jc;
            jb.getModel().setPressed(false);
            jb.getModel().setRollover(false);
            jb.getModel().setArmed(false);
            jb.repaint();
        }
    }
}
 
源代码4 项目: FlatLaf   文件: FlatButtonUI.java
protected void propertyChange( AbstractButton b, PropertyChangeEvent e ) {
	switch( e.getPropertyName() ) {
		case SQUARE_SIZE:
		case MINIMUM_WIDTH:
		case MINIMUM_HEIGHT:
			b.revalidate();
			break;

		case BUTTON_TYPE:
			b.revalidate();
			b.repaint();
			break;
	}
}
 
源代码5 项目: netbeans   文件: TransparentToolBar.java
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
源代码6 项目: visualvm   文件: TransparentToolBar.java
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
源代码7 项目: visualvm   文件: TransparentToolBar.java
private void refresh(final AbstractButton b) {
    b.setBackground(UISupport.getDefaultBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
源代码8 项目: rapidminer-studio   文件: ButtonListener.java
@Override
public void focusLost(FocusEvent e) {
	super.focusLost(e);
	AbstractButton b = (AbstractButton) e.getSource();
	b.getModel().setArmed(false);
	b.repaint();
}
 
源代码9 项目: rapidminer-studio   文件: ToggleButtonListener.java
@Override
public void focusLost(FocusEvent e) {
	super.focusLost(e);
	AbstractButton b = (AbstractButton) e.getSource();
	b.getModel().setArmed(false);
	b.repaint();
}
 
源代码10 项目: netbeans   文件: CodeEvaluatorUI.java
private JButton createDropDownButton() {
    Icon icon = ImageUtilities.loadImageIcon("org/netbeans/modules/debugger/resources/evaluator/drop_down_arrow.png", false);
    final JButton button = new DropDownButton();
    button.setIcon(icon);
    String tooltipText = NbBundle.getMessage(CodeEvaluatorUI.class, "CTL_Expressions_Dropdown_tooltip");
    button.setToolTipText(tooltipText);
    button.setEnabled(false);
    Dimension size = new Dimension(icon.getIconWidth() + 3, icon.getIconHeight() + 2);
    button.setPreferredSize(size);
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setFocusable(false);
    AbstractAction action = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if ("pressed".equals(e.getActionCommand())) {
                JComponent jc = (JComponent) e.getSource();
                Point p = new Point(0, 0);
                SwingUtilities.convertPointToScreen(p, jc);
                if (!ButtonPopupSwitcher.isShown()) {
                    SwitcherTableItem[] items = createSwitcherItems();
                    ButtonPopupSwitcher.selectItem(jc, items, p.x, p.y);
                }
                //Other portion of issue 37487, looks funny if the
                //button becomes pressed
                if (jc instanceof AbstractButton) {
                    AbstractButton jb = (AbstractButton) jc;
                    jb.getModel().setPressed(false);
                    jb.getModel().setRollover(false);
                    jb.getModel().setArmed(false);
                    jb.repaint();
                }
            }
        } // actionPerformed

        @Override
        public boolean isEnabled() {
            return !getEditItemsList().isEmpty();
        }

    };
    action.putValue(Action.SMALL_ICON, icon);
    action.putValue(Action.SHORT_DESCRIPTION, tooltipText);
    button.setAction(action);
    return button;
}
 
源代码11 项目: pumpernickel   文件: QButtonUI.java
protected void repaintButtons() {
	for (AbstractButton button : buttons) {
		button.repaint();
	}
}