當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractButton.repaint方法代碼示例

本文整理匯總了Java中javax.swing.AbstractButton.repaint方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractButton.repaint方法的具體用法?Java AbstractButton.repaint怎麽用?Java AbstractButton.repaint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.AbstractButton的用法示例。


在下文中一共展示了AbstractButton.repaint方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: actionPerformed

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@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();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:TabListPopupAction.java

示例2: actionPerformed

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@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();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:TabListPopupAction.java

示例3: refresh

import javax.swing.AbstractButton; //導入方法依賴的package包/類
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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:TransparentToolBar.java

示例4: focusLost

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
public void focusLost(FocusEvent e) {
	super.focusLost(e);
	AbstractButton b = (AbstractButton) e.getSource();
	b.getModel().setArmed(false);
	b.repaint();
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:8,代碼來源:ButtonListener.java

示例5: createDropDownButton

import javax.swing.AbstractButton; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:46,代碼來源:CodeEvaluatorUI.java


注:本文中的javax.swing.AbstractButton.repaint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。