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


Java JButton.putClientProperty方法代碼示例

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


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

示例1: getToolbarPresenter

import javax.swing.JButton; //導入方法依賴的package包/類
public static Component getToolbarPresenter(Action action) {
    JButton button = new JButton(action);
    button.setBorderPainted(false);
    button.setOpaque(false);
    button.setText(null);
    button.putClientProperty("hideActionText", Boolean.TRUE); // NOI18N
    Object icon = action.getValue(Action.SMALL_ICON);
    if (icon == null) {
        icon = ImageUtilities.loadImageIcon("org/netbeans/modules/dlight/terminal/action/local_term.png", false);// NOI18N
    }
    if (!(icon instanceof Icon)) {
        throw new IllegalStateException("No icon provided for " + action); // NOI18N
    }
    button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon) icon));
    return button;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:TerminalSupportImpl.java

示例2: testIconsSystemAction24

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Test whether pressed, rollover and disabled 24x24 icons
 * work for SystemAction.
 */
public void testIconsSystemAction24() throws Exception {
    Action saInstance = SystemAction.get(TestSystemAction.class);
    
    JButton jb = new JButton();
    jb.putClientProperty("PreferredIconSize",new Integer(24));
    Actions.connect(jb, saInstance);
    
    Icon icon = jb.getIcon();
    assertNotNull(icon);
    checkIfLoadedCorrectIcon(icon, jb, 4, "Enabled icon");
    
    Icon rolloverIcon = jb.getRolloverIcon();
    assertNotNull(rolloverIcon);
    checkIfLoadedCorrectIcon(rolloverIcon, jb, 5, "Rollover icon");
    
    Icon pressedIcon = jb.getPressedIcon();
    assertNotNull(pressedIcon);
    checkIfLoadedCorrectIcon(pressedIcon, jb, 6, "Pressed icon");
    
    Icon disabledIcon = jb.getDisabledIcon();
    assertNotNull(disabledIcon);
    checkIfLoadedCorrectIcon(disabledIcon, jb, 7, "Disabled icon");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:ActionsTest.java

示例3: adjustButton

import javax.swing.JButton; //導入方法依賴的package包/類
private JButton adjustButton(JButton b) {
    b.setBorderPainted(false);
    b.setOpaque(false);
    b.setText(null);
    b.putClientProperty("hideActionText", Boolean.TRUE);	// NOI18N
    // NOI18N
    return b;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:TerminalContainerCommon.java

示例4: getToolbarPresenter

import javax.swing.JButton; //導入方法依賴的package包/類
@Override
public Component getToolbarPresenter() {
    if (popup != null) {
        JButton button = DropDownButtonFactory.createDropDownButton(
            (ImageIcon) getValue(SMALL_ICON), 
            popup
        );
        button.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
        button.setAction(this);
        return button;
    } else {
        return new JButton(this);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:RunScriptAction.java

示例5: testIconsAction24

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Test whether pressed, rollover and disabled 24x24 icons
 * work for javax.swing.Action.
 */
public void testIconsAction24() throws Exception {
    JButton jb = new JButton();
    jb.putClientProperty("PreferredIconSize",new Integer(24));
    Actions.connect(jb, new TestAction());
    
    Icon icon = jb.getIcon();
    assertNotNull(icon);
    checkIfLoadedCorrectIcon(icon, jb, 4, "Enabled icon24");
    
    Icon rolloverIcon = jb.getRolloverIcon();
    assertNotNull(rolloverIcon);
    checkIfLoadedCorrectIcon(rolloverIcon, jb, 5, "Rollover icon24");
    
    Icon pressedIcon = jb.getPressedIcon();
    assertNotNull(pressedIcon);
    checkIfLoadedCorrectIcon(pressedIcon, jb, 6, "Pressed icon24");
    
    Icon disabledIcon = jb.getDisabledIcon();
    assertNotNull(disabledIcon);
    checkIfLoadedCorrectIcon(disabledIcon, jb, 7, "Disabled icon24");

    Icon selectedIcon = jb.getSelectedIcon();
    assertNotNull(selectedIcon);
    checkIfLoadedCorrectIcon(selectedIcon, jb, 12, "Selected icon24");

    Icon rolloverSelectedIcon = jb.getRolloverSelectedIcon();
    assertNotNull(rolloverSelectedIcon);
    checkIfLoadedCorrectIcon(rolloverSelectedIcon, jb, 13, "RolloverSelected icon24");

    // no pressedSelected

    Icon disabledSelectedIcon = jb.getDisabledSelectedIcon();
    assertNotNull(disabledSelectedIcon);
    checkIfLoadedCorrectIcon(disabledSelectedIcon, jb, 15, "DisabledSelected icon24");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:40,代碼來源:ActionsTest.java

示例6: getToolbarPresenter

import javax.swing.JButton; //導入方法依賴的package包/類
@Override
public Component getToolbarPresenter() {
    if (popupMenu != null) {
        JButton button = DropDownButtonFactory.createDropDownButton(
            (ImageIcon) getValue(SMALL_ICON), 
            popupMenu
        );
        button.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
        button.setAction(this);
        return button;
    } else {
        return new JButton(this);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:NavigationHistoryBackAction.java

示例7: setNodes

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Sets the right set of nodes to display
 * @param offset Index of the first node to show
 */
private void setNodes(int offset) {
	nodesPanel.removeAll();

	for (int i=offset; i<nodes.size() && i < offset + MAX_NODE_COUNT; i++) {
		DTNHost h = nodes.get(i);
		JButton jb = new JButton(h.toString());
		jb.putClientProperty(HOST_KEY, h);
		jb.addActionListener(this);
		nodesPanel.add(jb);
	}
	
	revalidate();
	repaint();
}
 
開發者ID:mdonnyk,項目名稱:the-one-mdonnyk,代碼行數:19,代碼來源:NodeChooser.java

示例8: createButton

import javax.swing.JButton; //導入方法依賴的package包/類
public JButton createButton(Action a) 
{ 
 	JButton b = new JButton(); 
 
 	b.putClientProperty("displayActionText", Boolean.TRUE); 
 	b.setAction(a); 
 	
 	return b; 
}
 
開發者ID:HML-UnBBayes,項目名稱:hml,代碼行數:10,代碼來源:TreePanel.java

示例9: SecurePasswordInputPanel

import javax.swing.JButton; //導入方法依賴的package包/類
private SecurePasswordInputPanel() {
    super(new GridLayout(0, 1));

    this.passwordField = new JPasswordField(10);
    passwordField.setEditable(false);

    add(passwordField);

    Set<Integer> rows = new HashSet<Integer>(KEYS_MAP.keySet());
    final int n = rows.size();

    SecureRandom random = new SecureRandom();
    while (!rows.isEmpty()) {
        int row = random.nextInt() % n;
        if (!rows.contains(row)) {
            continue;
        }

        String[] keys = KEYS_MAP.get(row);
        rows.remove(row);

        JPanel panel = new JPanel();
        for (int column = 0; column < keys.length; column++) {
            String text = keys[column];
            JButton button = new JButton(text);
            button.setFont(button.getFont().deriveFont(Font.TRUETYPE_FONT));
            if (CLEAR.equalsIgnoreCase(text)) {
                button.setBackground(Color.red);
            } else if (CAPS.equalsIgnoreCase(text) || BACKSPACE.equalsIgnoreCase(text)) {
                button.setBackground(Color.lightGray);
            } else {
                buttons.add(button);
            }

            button.putClientProperty("key", text);
            button.addActionListener(new MyActionListener());
            panel.add(button);
        } // end for
        add(panel);
    } // end while(!rows.isEmpty())

    //setVisible(true);
}
 
開發者ID:xipki,項目名稱:xitk,代碼行數:44,代碼來源:SecurePasswordInputPanel.java


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