private GCViewerGuiToolBar initToolBar(Map<String, Action> actions) { GCViewerGuiToolBar toolBar = new GCViewerGuiToolBar(); toolBar.setFloatable(false); toolBar.add(actions.get(ActionCommands.OPEN_FILE.toString())); toolBar.add(actions.get(ActionCommands.OPEN_SERIES.toString())); toolBar.add(actions.get(ActionCommands.OPEN_URL.toString())); toolBar.add(actions.get(ActionCommands.EXPORT.toString())); toolBar.add(actions.get(ActionCommands.REFRESH.toString())); JToggleButton watchToggle = new JToggleButton(); watchToggle.setAction(actions.get(ActionCommands.WATCH.toString())); watchToggle.setText(""); toolBar.addWatchToggleButton(watchToggle); toolBar.addSeparator(); JComboBox<String> zoomComboBox = new JComboBox<String>(new String[] {"1%", "5%", "10%", "50%", "100%", "200%", "300%", "500%", "1000%", "5000%"}); zoomComboBox.setSelectedIndex(2); zoomComboBox.setAction(actions.get(ActionCommands.ZOOM.toString())); zoomComboBox.setEditable(true); zoomComboBox.setMaximumSize(zoomComboBox.getPreferredSize()); toolBar.addZoomComboBox(zoomComboBox); toolBar.addSeparator(); toolBar.add(actions.get(ActionCommands.ABOUT.toString())); return toolBar; }
new ToggleForegroundAction(toggleButtonModel, Color.WHITE, Color.RED); toggleForegroundAction.setComponent(jLabel); toggleButton.setAction(toggleForegroundAction);
@Override public void setAction( Action a ) { super.setAction( a ); UpdateNotifier.instance().addActionComponent( this ); ToolTipManager.sharedInstance().registerComponent( this ); }
private JToolBar initToolBar() { final JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.add(openFileAction); toolBar.add(openURLAction); toolBar.add(exportAction); toolBar.add(refreshAction); watchToggle = new JToggleButton(); watchToggle.setAction(watchAction); watchToggle.setText(""); toolBar.add(watchToggle); toolBar.addSeparator(); zoomComboBox = new JComboBox(new String[] {"1%", "5%", "10%", "50%", "100%", "200%", "300%", "500%", "1000%", "5000%"}); zoomComboBox.setSelectedIndex(2); zoomComboBox.setAction(zoomAction); zoomComboBox.setEditable(true); zoomComboBox.setMaximumSize(zoomComboBox.getPreferredSize()); toolBar.add(zoomComboBox); toolBar.addSeparator(); toolBar.add(aboutAction); return toolBar; }
/*************************************************************************** * * **************************************************************************/ public void connectButton (final JToggleButton button) { action.putValue(Action.SHORT_DESCRIPTION, button.getToolTipText()); button.setAction(action); button.setModel(buttonModel); }
JToggleButton addToggleButton(Action a) { JToggleButton tb = new JToggleButton((String) a .getValue(Action.NAME), (Icon) a .getValue(Action.SMALL_ICON)); tb.setMargin(this.zeroInsets); tb.setText(null); tb.setEnabled(a.isEnabled()); tb.setToolTipText((String) a.getValue(Action.SHORT_DESCRIPTION)); tb.setAction(a); add(tb); return tb; } }
private JToggleButton createToggleButton(Container pParent, Element pElement) { JToggleButton toggleButton = (JToggleButton) mBuilder .getWidgetFactory().create(JToggleButton.class.getName(), pElement, pParent); // check if this button is buildNonVisual from an action DispatcherAction action = getAction(pElement, mBuilder .getNameToNonVisual()); if (action != null) { toggleButton.setAction(action); } return toggleButton; }
attachButton.setAction(attachDetachAction); attachButton.setHideActionText(true); warningLabel = new JTextField();
attachButton.setAction(attachDetachAction); attachButton.setHideActionText(true); warningLabel = new JTextField();
private void addPerspective(final PerspectiveSPI perspective, boolean makeActive) { // ensure icon image is always 16x16 ImageIcon buttonIcon = null; if (perspective.getButtonIcon() != null) { Image buttonImage = perspective.getButtonIcon().getImage(); buttonIcon = new ImageIcon(buttonImage.getScaledInstance(16, 16, Image.SCALE_SMOOTH)); } final JToggleButton toolbarButton = new JToggleButton(perspective .getText(), buttonIcon); toolbarButton.setToolTipText(perspective.getText() + " perspective"); Action action = new AbstractAction() { public void actionPerformed(ActionEvent e) { modelMap.setModel(ModelMapConstants.CURRENT_PERSPECTIVE, perspective); } }; action.putValue(Action.NAME, perspective.getText()); action.putValue(Action.SMALL_ICON, buttonIcon); toolbarButton.setAction(action); toolBar.add(toolbarButton); perspectiveButtons.add(toolbarButton); perspectives.put(perspective, toolbarButton); addPerspectiveToVisibilityMenu(perspective); if (makeActive) { toolbarButton.doClick(); } }
private void addPerspective(final PerspectiveSPI perspective, boolean makeActive) { // ensure icon image is always 16x16 ImageIcon buttonIcon = null; if (perspective.getButtonIcon() != null) { Image buttonImage = perspective.getButtonIcon().getImage(); buttonIcon = new ImageIcon(buttonImage.getScaledInstance(16, 16, Image.SCALE_SMOOTH)); } final JToggleButton toolbarButton = new JToggleButton(perspective.getText(), buttonIcon); toolbarButton.setToolTipText(perspective.getText() + " perspective"); Action action = new AbstractAction() { public void actionPerformed(ActionEvent e) { modelMap.setModel(ModelMap.CURRENT_PERSPECTIVE, perspective); } }; action.putValue(Action.NAME, perspective.getText()); action.putValue(Action.SMALL_ICON, buttonIcon); toolbarButton.setAction(action); toolBar.add(toolbarButton); perspectiveButtons.add(toolbarButton); perspectives.put(perspective, toolbarButton); addPerspectiveToVisibilityMenu(perspective); if (makeActive) { toolbarButton.doClick(); } }
noPorts.setSelected(true); noPorts.setAction(new AbstractAction() { noPorts.setFocusPainted(false); allPorts.setAction(new AbstractAction() { allPorts.setFocusPainted(false); blobs.setAction(new AbstractAction() { vertical.setSelected(true); vertical.setAction(new AbstractAction() { vertical.setFocusPainted(false); horizontal.setAction(new AbstractAction() { expandNested.setSelected(true); expandNested.setAction(new AbstractAction() {
final JToggleButton createRuleToggleButton = new JToggleButton(); editCSSRulesAction = new EditCSSRulesAction(); createRuleToggleButton.setAction(editCSSRulesAction); org.openide.awt.Mnemonics.setLocalizedText(createRuleToggleButton, null); createRuleToggleButton.setToolTipText((String)editCSSRulesAction.getValue(Action.NAME));