当前位置: 首页>>代码示例>>Java>>正文


Java JToggleButton.setFocusable方法代码示例

本文整理汇总了Java中javax.swing.JToggleButton.setFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java JToggleButton.setFocusable方法的具体用法?Java JToggleButton.setFocusable怎么用?Java JToggleButton.setFocusable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JToggleButton的用法示例。


在下文中一共展示了JToggleButton.setFocusable方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createToggleButton

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private static JToggleButton createToggleButton (final String id, String iconPath, String tooltip) {
    Icon icon = ImageUtilities.loadImageIcon(iconPath, false);
    boolean isSelected = isButtonSelected(id);
    final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    toggleButton.setPreferredSize(size);
    toggleButton.setMargin(new Insets(1, 1, 1, 1));
    if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
        // We do not want an ugly border with the exception of Mac, where it paints the toggle state!
        toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
    }
    toggleButton.setToolTipText(tooltip);
    toggleButton.setFocusable(false);
    return toggleButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:VariablesViewButtons.java

示例2: createToggleButton

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private static JToggleButton createToggleButton (final String id, String iconName, String tooltip) {
    Icon icon = loadIcon(iconName);
    boolean isSelected = isButtonSelected(id);
    final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    toggleButton.setPreferredSize(size);
    toggleButton.setMargin(new Insets(1, 1, 1, 1));
    if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
        // We do not want an ugly border with the exception of Mac, where it paints the toggle state!
        toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
    }
    toggleButton.setToolTipText(tooltip);
    toggleButton.setFocusable(false);
    return toggleButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:VariablesViewButtons.java

示例3: RuleEditorViews

import javax.swing.JToggleButton; //导入方法依赖的package包/类
public RuleEditorViews(RuleEditorPanel ruleEditorPanel) {
    this.ruleEditorPanel = ruleEditorPanel;

    updatedOnlyToggleButton = new JToggleButton(new ViewActionSupport.UpdatedOnlyViewAction(this));
    updatedOnlyToggleButton.setToolTipText(updatedOnlyToggleButton.getText());
    updatedOnlyToggleButton.setText(null);
    updatedOnlyToggleButton.setSelected(getViewMode() == ViewMode.UPDATED_ONLY);
    updatedOnlyToggleButton.setFocusable(false);

    categorizedToggleButton = new JToggleButton(new ViewActionSupport.CategorizedViewAction(this));
    categorizedToggleButton.setToolTipText(categorizedToggleButton.getText());
    categorizedToggleButton.setText(null);
    categorizedToggleButton.setSelected(getViewMode() == ViewMode.CATEGORIZED);
    categorizedToggleButton.setFocusable(false);

    allToggleButton = new JToggleButton(new ViewActionSupport.AllViewAction(this));
    allToggleButton.setToolTipText(allToggleButton.getText());
    allToggleButton.setText(null);
    allToggleButton.setSelected(getViewMode() == ViewMode.ALL);
    allToggleButton.setFocusable(false);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:RuleEditorViews.java

示例4: createActivateBreakpointsActionButton

import javax.swing.JToggleButton; //导入方法依赖的package包/类
@NbBundle.Messages({"CTL_DeactivateAllBreakpoints=Deactivate all breakpoints in current session",
                    "CTL_ActivateAllBreakpoints=Activate all breakpoints in current session",
                    "CTL_NoDeactivation=The current session does not allow to deactivate breakpoints",
                    "CTL_NoSession=No debugger session"})
public static AbstractButton createActivateBreakpointsActionButton() {
    ImageIcon icon = ImageUtilities.loadImageIcon(DEACTIVATED_LINE_BREAKPOINT, false);
    final JToggleButton button = new JToggleButton(icon);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    button.setPreferredSize(size);
    button.setMargin(new Insets(1, 1, 1, 1));
    button.setBorder(new EmptyBorder(button.getBorder().getBorderInsets(button)));
    button.setToolTipText(Bundle.CTL_DeactivateAllBreakpoints());
    button.setFocusable(false);
    final BreakpointsActivator ba = new BreakpointsActivator(button);
    button.addActionListener(ba);
    DebuggerManager.getDebuggerManager().addDebuggerListener(DebuggerManager.PROP_CURRENT_ENGINE, new DebuggerManagerAdapter() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            DebuggerEngine de = (DebuggerEngine) evt.getNewValue();
            ba.setCurrentEngine(de);
        }
    });
    ba.setCurrentEngine(DebuggerManager.getDebuggerManager().getCurrentEngine());
    return button;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:BreakpointsViewButtons.java

示例5: createWorkspaceToolBar

import javax.swing.JToggleButton; //导入方法依赖的package包/类
public void createWorkspaceToolBar() {
    JToolBar workspaceToolBar = new JToolBar();
    workspaceToolBar.setFloatable(false);
    for (ActionDescriptor descriptor : getActionDescriptors()) {
        final Action action = descriptor.getAction();
        if (action instanceof ShowWorkspaceAction) {
            JToggleButton button = new JToggleButton(action);
            button.setText(cut((String) action
                    .getValue(Action.ACTION_COMMAND_KEY)));
            button.setToolTipText((String) action
                    .getValue(Action.ACTION_COMMAND_KEY));
            button.addActionListener(new java.awt.event.ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    action.actionPerformed(e);
                }
            });
            button.setFocusable(false);
            workspaceToolBar.add(button);
        }
    }
    factory.setNorthEastCornerComponent(workspaceToolBar);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:24,代码来源:ShowWorkspacePlugin.java

示例6: init

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private void init() {
        initComponents();
        detailsPanel = new JPanel(new GridLayout(1, 1));
        Color color = Utils.getTextBackground();
        detailsPanel.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue()));
        lblEmptyDetails = new JLabel(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_EmptyDetails"), JLabel.CENTER);
        lblEmptyDetails.setFont(italicFont);
        lblEmptyDetails.setEnabled(false);

        JScrollPane scrollPane = new JScrollPane(detailsPanel);
        splitPane.setRightComponent(scrollPane);

        toolBar.setFocusable(false);
        toolBar.setFloatable(false);
        btnSearch = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/notifications/resources/find16.png", true));
        btnSearch.setToolTipText(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_SearchToolTip"));
        btnSearch.setFocusable(false);
        btnSearch.setSelected(NotificationSettings.isSearchVisible());
        //TODO delete 2 lines then quick search API clear text correctly
//        btnSearch.setToolTipText("Disabled due to Quick Search API defects");
//        btnSearch.setEnabled(false);
        btnSearch.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSearchVisible(btnSearch.isSelected());
            }
        });
        toolBar.add(btnSearch);
        toolBar.add(new FiltersMenuButton(notificationManager.getActiveFilter()));

        initLeft();
        showDetails();
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:NotificationCenterTopComponent.java

示例7: createToggle

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private JToggleButton createToggle (Map<String,Boolean> fStates, int index) {
    boolean isSelected = getPreferences().getBoolean( filtersDesc.getName(index), filtersDesc.isSelected(index) );
    Icon icon = filtersDesc.getSelectedIcon(index);
    // ensure small size, just for the icon
    JToggleButton result = new JToggleButton(icon, isSelected);
    Dimension size = new Dimension(icon.getIconWidth() + 6, icon.getIconHeight() + 4);
    result.setPreferredSize(size);
    result.setMargin(new Insets(2,3,2,3));
    result.setToolTipText(filtersDesc.getTooltip(index));
    result.setFocusable(false);
    
    fStates.put(filtersDesc.getName(index), Boolean.valueOf(isSelected));
    
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:FiltersManager.java

示例8: rebuildToolbar

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private void rebuildToolbar() {
    toolbar.removeAll();
    toolbar.setFocusable( false );
    //scope buttons
    List<TaskScanningScope> scopes = ScanningScopeList.getDefault().getTaskScanningScopes();
    for( TaskScanningScope scope : scopes ) {
        final ScopeButton scopeButton = new ScopeButton( taskManager, scope );
        scopeButton.setSelected(scope.equals(Settings.getDefault().getActiveScanningScope()));
        toolbar.add(scopeButton);
    }
    toolbar.add( new JToolBar.Separator() );
    //filter
    JToggleButton toggleFilter = new FiltersMenuButton( filters.getActive() );
    toolbar.add( toggleFilter );
    //grouping & other butons
    toolbar.addSeparator();
    final JToggleButton toggleGroups = new JToggleButton( ImageUtilities.loadImageIcon("org/netbeans/modules/tasklist/ui/resources/groups.png", false)); //NOI18N
    toggleGroups.addItemListener( new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            switchTableModel( e.getStateChange() == ItemEvent.SELECTED );
            Settings.getDefault().setGroupTasksByCategory( toggleGroups.isSelected() );
            toggleGroups.setToolTipText( toggleGroups.isSelected() 
                    ? NbBundle.getMessage( TaskListTopComponent.class, "HINT_TasksAsList" )  //NOI18N
                    : NbBundle.getMessage( TaskListTopComponent.class, "HINT_GrouppedTasks" ) ); //NOI18N
        }
    });
    toggleGroups.setSelected( Settings.getDefault().getGroupTasksByCategory() );
    toggleGroups.setToolTipText( toggleGroups.isSelected() 
                    ? NbBundle.getMessage( TaskListTopComponent.class, "HINT_TasksAsList" )  //NOI18N
                    : NbBundle.getMessage( TaskListTopComponent.class, "HINT_GrouppedTasks" ) ); //NOI18N
    toggleGroups.setFocusable( false );
    toolbar.add( toggleGroups );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:TaskListTopComponent.java

示例9: createToggle

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private JToggleButton createToggle (FiltersDescriptor filtersDesc, int index) {
        boolean isSelected = filtersDesc.isSelected(index);
        Icon icon = filtersDesc.getSelectedIcon(index);
        // ensure small size, just for the icon
        JToggleButton toggleButton = new JToggleButton(icon, isSelected);
//        Dimension size = new Dimension(icon.getIconWidth(), icon.getIconHeight());
//        toggleButton.setPreferredSize(size);
        toggleButton.setMargin(new Insets(2, 2, 2, 2));
        toggleButton.setToolTipText(filtersDesc.getTooltip(index));
        toggleButton.setFocusable(false);
        filtersDesc.connectToggleButton(index, toggleButton);
        return toggleButton;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:InfoPanel.java

示例10: createToolBar

import javax.swing.JToggleButton; //导入方法依赖的package包/类
public JToolBar createToolBar() {
    JToolBar bar = new JToolBar();

    JComboBox zoom = createZoomComboBox();

    for (Action action : getFileActions()) {
        if (action == null)
            bar.addSeparator();
        else
            bar.add(action).setFocusable(false);
    }
    bar.addSeparator();

    JToggleButton grid = new JToggleButton(layoutGridAction);
    grid.setText(null);
    grid.setFocusable(false);

    JToggleButton col = new JToggleButton(layoutColAction);
    col.setText(null);
    col.setFocusable(false);

    ButtonGroup bg = new ButtonGroup();
    bg.add(col);
    bg.add(grid);

    bar.add(grid);
    bar.add(col);
    bar.addSeparator();
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    panel.add(zoom);
    bar.add(panel);
    return bar;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:34,代码来源:PrintPreviewComponent.java

示例11: arrume

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private JToggleButton arrume(JToggleButton btn) {
    Dimension btnDim = new Dimension(40, 40);
    btn.setHideActionText(true);
    btn.setFocusable(false);
    btn.setPreferredSize(btnDim);
    btn.setDoubleBuffered(true);
    //btn.setMargin(new Insets(2, 5, 2, 5));
    btn.setRolloverEnabled(false);
    return btn;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:11,代码来源:Controler.java

示例12: waypointAdded

import javax.swing.JToggleButton; //导入方法依赖的package包/类
/**
 * Called when a waypoint is added. This implementation adds a waypoint button.
 * @param graphic the waypoint graphic, whose ID may or may not be populated.
 * @param graphicUid the waypoint graphic's ID.
 * @see RouteListener#waypointAdded(com.esri.core.map.Graphic, int)
 */
public void waypointAdded(Graphic graphic, int graphicUid) {
    final JToggleButton button = new JToggleButton((String) graphic.getAttributeValue("name"));
    waypointButtonToGraphicId.put(button, graphicUid);
    graphicIdToWaypointButton.put(graphicUid, button);
    Font font = new Font("Arial", Font.PLAIN, 18);
    button.setFont(font);
    button.setFocusable(false);
    button.setSelected(false);
    button.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (button == selectedWaypointButton) {
                //Unselect
                buttonGroup_waypoints.remove(button);
                button.setSelected(false);
                buttonGroup_waypoints.add(button);
                selectedWaypointButton = null;

                routeController.setSelectedWaypoint(null);
            } else {
                selectedWaypointButton = button;

                routeController.setSelectedWaypoint(waypointButtonToGraphicId.get(button));
            }
        }
    });
    button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 60));
    button.setMinimumSize(new Dimension(0, 60));
    jPanel_waypointsList.add(button);
    buttonGroup_waypoints.add(button);
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:38,代码来源:MainMenuJPanel.java

示例13: updateToolbar

import javax.swing.JToggleButton; //导入方法依赖的package包/类
private void updateToolbar(FileObject file, Collection<CssStylesPanelProvider> activeProviders) {

        toolBar.removeAll();
        if (activeProviders.size() <= 1) {
            //remove the whole toolbar, if there's one or zero providers
            removeToolbar();
        } else {
            addToolbar();
        }

        // Button group for document and source buttons
        ButtonGroup buttonGroup = new ButtonGroup();

        boolean first = true;

        CssStylesPanelProvider selected = (file == null) ? null : selectedTabs.get(file.getMIMEType());

        //do the active providers contain the pre-selected provider for this mimetype?
        boolean containsPreselected = selected == null ? false : activeProviders.contains(selected);

        for (CssStylesPanelProvider provider : activeProviders) {
            JToggleButton button = new JToggleButton();
            button.setText(provider.getPanelDisplayName());
            button.setActionCommand(provider.getPanelID());
            button.addActionListener(toolbarListener);

            button.setFocusable(true);
            button.setFocusPainted(false);
            button.setRolloverEnabled(true);

            //copied from org.netbeans.core.multiview.TabsComponent.createButton to make the look 
            //similar to the editor tabs
            Border b = (getButtonBorder());
            if (b != null) {
                button.setBorder(b);
            }
            if (AQUA) {
                button.putClientProperty("JButton.buttonType", "square"); //NOI18N
                button.putClientProperty("JComponent.sizeVariant", "small"); //NOI18N
            }

            buttonGroup.add(button);
            toolBar.add(button);

            if (containsPreselected) {
                //one of the active providers is already pre-selected by user
                if (provider == selected) {
                    //the selected one - activate it
                    button.setSelected(true);
                    setActiveProvider(provider);
                } else {
                    button.setSelected(false);
                }
            } else {
                //no provider has been explicitly selected by the user yet
                button.setSelected(first);
                if (first) {
                    setActiveProvider(provider);
                    first = false;
                }
            }
        }

        revalidate();
        repaint();
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:67,代码来源:CssStylesPanel.java

示例14: FilesPanel

import javax.swing.JToggleButton; //导入方法依赖的package包/类
public FilesPanel(VCSCommitPanel master, Map<String, VCSCommitFilter> filters, int preferedHeight)  {
    super(master, master.getModifier().getMessage(VCSCommitPanelModifier.BundleMessage.FILE_PANEL_TITLE), DEFAULT_DISPLAY_FILES);
    this.filters = filters;
    
    master.getCommitTable().labelFor(filesLabel);
    
    JComponent table = master.getCommitTable().getComponent();
    
    Mnemonics.setLocalizedText(filesLabel, getMessage("CTL_CommitForm_FilesToCommit"));         // NOI18N
    filesLabel.setMaximumSize(new Dimension(Integer.MAX_VALUE, filesLabel.getMaximumSize().height));
    
    table.setPreferredSize(new Dimension(0, preferedHeight));
    
    ButtonGroup bg = new ButtonGroup();
    toolbar = new JToolBar();
    toolbar.setFloatable(false);
    
    for (VCSCommitFilter filter : filters.values()) {
        
        JToggleButton tgb = new JToggleButton();
        tgb.setIcon(filter.getIcon()); 
        tgb.setToolTipText(filter.getTooltip()); 
        tgb.setFocusable(false);
        tgb.setSelected(filter.isSelected());
        tgb.addActionListener(this);                
        tgb.putClientProperty(TOOLBAR_FILTER, filter);
        bg.add(tgb);
        toolbar.add(tgb);
        
    }
    toolbar.setAlignmentX(LEFT_ALIGNMENT);        
    
    sectionPanel.add(toolbar);
    sectionPanel.add(table);
    sectionPanel.add(VCSCommitPanel.makeVerticalStrut(filesLabel, table, RELATED, sectionPanel));
    sectionPanel.add(filesLabel);
    
    sectionPanel.setAlignmentX(LEFT_ALIGNMENT);
    filesLabel.setAlignmentX(LEFT_ALIGNMENT);
    table.setAlignmentX(LEFT_ALIGNMENT);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:CollapsiblePanel.java


注:本文中的javax.swing.JToggleButton.setFocusable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。