当前位置: 首页>>代码示例>>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;未经允许,请勿转载。