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

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

源代码1 项目: netbeans   文件: AbstractToolbarFactory.java
private void configureToolbarButton (AbstractButton item, String containerCtx, String action, ActionProvider provider, Map ctx) {
        item.setFocusable(false);
        item.setName(action);
        item.putClientProperty (KEY_ACTION, action);
        item.setToolTipText(
            provider.getDisplayName(action, containerCtx));
//        item.setToolTipText(provider.getDescription(action, containerCtx));
        int state = ctx == null ? ActionProvider.STATE_VISIBLE :
            provider.getState (action, containerCtx, ctx);
        boolean enabled = (state & ActionProvider.STATE_ENABLED) != 0;
        item.setEnabled(enabled);
        boolean visible = (state & ActionProvider.STATE_VISIBLE) != 0;
        item.setVisible (visible);
        boolean toggled = (state & ActionProvider.STATE_SELECTED) != 0;
        item.setSelected(toggled);
//        item.setMnemonic(provider.getMnemonic(action, containerCtx));
//        item.setDisplayedMnemonicIndex(provider.getMnemonicIndex(action, containerCtx));
        item.setIcon(provider.getIcon(action, containerCtx, BeanInfo.ICON_COLOR_16x16));
    }
 
源代码2 项目: FlatLaf   文件: FlatFileChooserUI.java
private void patchUI( JFileChooser fc ) {
	// turn top-right buttons into toolbar buttons
	Component topPanel = fc.getComponent( 0 );
	if( (topPanel instanceof JPanel) &&
		(((JPanel)topPanel).getLayout() instanceof BorderLayout) )
	{
		Component topButtonPanel = ((JPanel)topPanel).getComponent( 0 );
		if( (topButtonPanel instanceof JPanel) &&
			(((JPanel)topButtonPanel).getLayout() instanceof BoxLayout) )
		{
			Insets margin = UIManager.getInsets( "Button.margin" );
			Component[] comps = ((JPanel)topButtonPanel).getComponents();
			for( int i = comps.length - 1; i >= 0; i-- ) {
				Component c = comps[i];
				if( c instanceof JButton || c instanceof JToggleButton ) {
					AbstractButton b = (AbstractButton)c;
					b.putClientProperty( FlatClientProperties.BUTTON_TYPE,
						FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON );
					b.setMargin( margin );
					b.setFocusable( false );
				} else if( c instanceof Box.Filler )
					((JPanel)topButtonPanel).remove( i );
			}
		}
	}

	// increase maximum row count of directory combo box popup list
	try {
		Component directoryComboBox =  ((JPanel)topPanel).getComponent( 2 );
		if( directoryComboBox instanceof JComboBox ) {
			int maximumRowCount = UIManager.getInt( "ComboBox.maximumRowCount" );
			if( maximumRowCount > 0 )
				((JComboBox<?>)directoryComboBox).setMaximumRowCount( maximumRowCount );
		}
	} catch( ArrayIndexOutOfBoundsException ex ) {
		// ignore
	}
}
 
源代码3 项目: netbeans   文件: NbEditorToolBar.java
private void processButton(AbstractButton button) {
    removeButtonContentAreaAndBorder(button);
    button.setMargin(BUTTON_INSETS);
    if (button instanceof AbstractButton) {
        button.addMouseListener(sharedMouseListener);
    }
    //fix of issue #69642. Focus shouldn't stay in toolbar
    button.setFocusable(false);
}
 
源代码4 项目: netbeans   文件: DataViewUI.java
private void processButton(AbstractButton button) {
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setMargin(BUTTON_INSETS);
    if (button instanceof AbstractButton) {
        button.addMouseListener(sharedMouseListener);
    }
    //Focus shouldn't stay in toolbar
    button.setFocusable(false);
}
 
源代码5 项目: snap-desktop   文件: ProductSceneView.java
private AdjustableViewScrollPane createScrollPane() {
    AbstractButton zoomAllButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ZoomAll13.gif"),
            false);
    zoomAllButton.setFocusable(false);
    zoomAllButton.setFocusPainted(false);
    zoomAllButton.addActionListener(e -> getLayerCanvas().zoomAll());

    AdjustableViewScrollPane scrollPane = new AdjustableViewScrollPane(layerCanvas);
    // todo - use sceneImage.getConfiguration() (nf, 18.09.2008)
    scrollPane.setBackground(DEFAULT_IMAGE_BACKGROUND_COLOR);
    scrollPane.setCornerComponent(zoomAllButton);
    return scrollPane;
}
 
源代码6 项目: FancyBing   文件: GoGuiToolBar.java
private AbstractButton addButton(AbstractButton button)
{
    button.setFocusable(false);
    add(button);
    return button;
}
 
源代码7 项目: netbeans   文件: SlidingTabDisplayerButtonUI.java
/** Overridden to not call super.installDefaults() and only set the button
 * to be non-focusable */
@Override
public void installDefaults (AbstractButton b) {
    b.setFocusable (false);
}
 
源代码8 项目: netbeans   文件: SearchButton.java
private static void processButton(AbstractButton button) {
    removeButtonContentAreaAndBorder(button);
    button.setMargin(BUTTON_INSETS);
    button.addMouseListener(sharedMouseListener);
    button.setFocusable(false);
}