Java Code Examples for javax.swing.JToolBar#addSeparator()

The following examples show how to use javax.swing.JToolBar#addSeparator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ButtonFactory.java    From openAGV with Apache License 2.0 6 votes vote down vote up
/**
 * Creates toolbar buttons and adds them to the specified JToolBar
 *
 * @param bar
 * @param editor
 */
public static void addAlignmentButtonsTo(JToolBar bar, final DrawingEditor editor) {
  bar.add(new AlignAction.West(editor)).setFocusable(false);
  bar.add(new AlignAction.East(editor)).setFocusable(false);
  bar.add(new AlignAction.Horizontal(editor)).setFocusable(false);
  bar.add(new AlignAction.North(editor)).setFocusable(false);
  bar.add(new AlignAction.South(editor)).setFocusable(false);
  bar.add(new AlignAction.Vertical(editor)).setFocusable(false);

  bar.addSeparator();

  bar.add(new MoveAction.West(editor)).setFocusable(false);
  bar.add(new MoveAction.East(editor)).setFocusable(false);
  bar.add(new MoveAction.North(editor)).setFocusable(false);
  bar.add(new MoveAction.South(editor)).setFocusable(false);

  bar.addSeparator();

  bar.add(new BringToFrontAction(editor)).setFocusable(false);
  bar.add(new SendToBackAction(editor)).setFocusable(false);
}
 
Example 2
Source File: PolicySelectionTool.java    From workcraft with MIT License 6 votes vote down vote up
@Override
public void updateControlsToolbar(JToolBar toolbar, final GraphEditor editor) {
    super.updateControlsToolbar(toolbar, editor);

    JButton bundleButton = GuiUtils.createIconButton(
            GuiUtils.createIconFromSVG("images/policy-selection-bundle.svg"),
            "Bundle selected transitions (" + DesktopApi.getMenuKeyName() + "-B)");
    bundleButton.addActionListener(event -> selectionBundle(editor));
    toolbar.add(bundleButton);

    JButton unbundleButton = GuiUtils.createIconButton(
            GuiUtils.createIconFromSVG("images/policy-selection-unbundle.svg"),
            "Unbundle selected transitions (" + DesktopApi.getMenuKeyName() + "+Shift-B)");
    unbundleButton.addActionListener(event -> selectionUnbundle(editor));
    toolbar.add(unbundleButton);
    if (toolbar.getComponentCount() > 0) {
        toolbar.addSeparator();
    }
}
 
Example 3
Source File: BsafTest.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Builds and answers the tool bar.
 */
private Component buildToolBar ()
{
    JToolBar toolBar = new SeparableToolBar();
    toolBar.setBackground(Color.PINK);
    ///toolBar.putClientProperty(Options.HEADER_STYLE_KEY, Boolean.TRUE);

    toolBar.add(createCenteredLabel("Tool Bar"));

    JButton button1 = new JButton("Bouton #1");
    toolBar.add(button1);

    toolBar.addSeparator();

    JButton button2 = new JButton("Bouton #2");
    toolBar.add(button2);

    return toolBar;
}
 
Example 4
Source File: ViewChooser.java    From javamoney-examples with Apache License 2.0 6 votes vote down vote up
private
Panel
createToolBarPanel()
{
  Panel panel = new Panel();
  JToolBar toolBar = new JToolBar();
  Dimension separator = new Dimension(50, 10);

  // Build tool bar.
  toolBar.setFloatable(false);

  toolBar.add(getLinks()[HOME]);
  toolBar.addSeparator(separator);
  toolBar.add(getLinks()[BUDGETS]);
  toolBar.addSeparator(separator);
  toolBar.add(getLinks()[TOTALS]);

  // Build panel.
  panel.setAnchor(GridBagConstraints.WEST);
  panel.add(toolBar, 0, 0, 1, 1, 100, 100);

  return panel;
}
 
Example 5
Source File: MovieContainer.java    From iBioSim with Apache License 2.0 5 votes vote down vote up
/**
 * adds the toolbar at the bottom
 */
private void addPlayUI() {
	// Add the bottom menu bar
	movieToolbar = new JToolBar();
	
	fileButton = makeToolButton("", "choose_simulation_file", "Choose Simulation", this);
	movieToolbar.add(fileButton);
	
	clearButton = makeToolButton("", "clearAppearances", "Clear Appearances", this);
	movieToolbar.add(clearButton);
	
	movieToolbar.addSeparator();
	
	rewindButton = makeToolButton("movie" + File.separator + "rewind.png", "rewind", "Rewind", this);
	movieToolbar.add(rewindButton);

	singleStepButton = makeToolButton("movie" + File.separator + "single_step.png", "singlestep", "Single Step", this);
	movieToolbar.add(singleStepButton);
	
	playPauseButton = makeToolButton("movie" + File.separator + "play.png", "playpause", "Play", this);
	movieToolbar.add(playPauseButton);
		
	slider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 0);
	slider.setSnapToTicks(true);
	movieToolbar.add(slider);
	
	movieToolbar.setFloatable(false);

	this.add(movieToolbar, BorderLayout.SOUTH);
}
 
Example 6
Source File: FiltersManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Called only from AWT */
private void initPanel () {
    setBorder(new EmptyBorder(1, 2, 3, 5));

    // configure toolbar
    JToolBar toolbar = new JToolBar(JToolBar.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    // create toggle buttons
    int filterCount = filtersDesc.getFilterCount();
    toggles = new ArrayList<JToggleButton>(filterCount);
    JToggleButton toggleButton = null;
    
    Map<String,Boolean> fStates = new HashMap<String, Boolean>(filterCount * 2);

    for (int i = 0; i < filterCount; i++) {
        toggleButton = createToggle(fStates, i);
        toggles.add(toggleButton);
    }
    
    // add toggle buttons
    JToggleButton curToggle;
    Dimension space = new Dimension(3, 0);
    for (int i = 0; i < toggles.size(); i++) {
        curToggle = toggles.get(i);
        curToggle.addActionListener(this);
        toolbar.add(curToggle);
        if (i != toggles.size() - 1) {
            toolbar.addSeparator(space);
        }
    }
    
    add(toolbar);
    
    // initialize member states map
    synchronized (STATES_LOCK) {
        filterStates = fStates;
    }
}
 
Example 7
Source File: MainPanel.java    From swift-explorer with Apache License 2.0 5 votes vote down vote up
private JToolBar createToolBar ()
{
    JToolBar toolBar = new JToolBar(getLocalizedString("StoredObject"));
    
    toolBar.add(storedObjectPreviewAction).setToolTipText(getLocalizedString("Preview"));
    toolBar.add(storedObjectOpenAction).setToolTipText(getLocalizedString("Open_in_Browser"));
    toolBar.add(storedObjectViewMetaData).setToolTipText(getLocalizedString("View_Metadata"));
    toolBar.addSeparator();
    toolBar.add(storedObjectGetInfoAction).setToolTipText(getLocalizedString("Get_Info"));
    toolBar.addSeparator();
    toolBar.add(storedObjectUploadFilesAction).setToolTipText(getLocalizedString("Upload_Files"));
    toolBar.add(storedObjectDownloadFilesAction).setToolTipText(getLocalizedString("Download_Files"));
    toolBar.addSeparator();
    toolBar.add(storedObjectCreateDirectoryAction).setToolTipText(getLocalizedString("Create_Directory"));
    toolBar.add(storedObjectUploadDirectoryAction).setToolTipText(getLocalizedString("Upload_Directory"));
    toolBar.add(storedObjectDownloadDirectoryAction).setToolTipText(getLocalizedString("Download_Directory"));
    
    toolBar.addSeparator();
    toolBar.add(progressButton) ;
    
    toolBar.addSeparator();
    toolBar.add(stopButton) ;
    
    //if (nativeMacOsX)
    	addSearchPanel (toolBar) ;
    
    return (toolBar) ;
}
 
Example 8
Source File: MainMenu.java    From tda with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * create a toolbar showing the most important main menu entries.
 */
private void createToolBar() {
    toolBar = new JToolBar("TDA Toolbar");
    if(listener.runningAsJConsolePlugin || listener.runningAsVisualVMPlugin) {
        toolBar.add(createToolBarButton("Request a Thread Dump", "FileOpen.png"));
        toolBar.setFloatable(false);
    } else {
        toolBar.add(createToolBarButton("Open Logfile", "FileOpen.png"));
        closeToolBarButton = createToolBarButton("Close selected Logfile", "CloseFile.png");
        closeToolBarButton.setEnabled(false);
        toolBar.add(closeToolBarButton);
    }
    toolBar.addSeparator();
    toolBar.add(createToolBarButton("Preferences", "Preferences.png"));
    toolBar.addSeparator();
    expandButton = createToolBarButton("Expand all nodes", "Expanded.png");
    expandButton.setEnabled(false);
    toolBar.add(expandButton);
    collapseButton = createToolBarButton("Collapse all nodes", "Collapsed.png");
    collapseButton.setEnabled(false);
    toolBar.add(collapseButton);
    toolBar.addSeparator();
    findLRThreadsButton = createToolBarButton("Find long running threads", "FindLRThreads.png");
    findLRThreadsButton.setEnabled(false);
    toolBar.add(findLRThreadsButton);
    
    toolBar.add(createToolBarButton("Filters", "Filters.png"));
    toolBar.add(createToolBarButton("Custom Categories", "CustomCat.png"));
    toolBar.addSeparator();
}
 
Example 9
Source File: Schematic.java    From iBioSim with Apache License 2.0 5 votes vote down vote up
/**
 * toolbar for when you're looking at a grid
 * @return
 */
private JToolBar buildGridToolbar() {
	
	JToolBar toolBar = new JToolBar();
	
	ButtonGroup modeButtonGroup = new ButtonGroup();
	selectButton = makeRadioToolButton("select_mode.png", "", "Select (" +
			KeyEvent.getKeyText(KeyEvent.VK_ESCAPE) + ")", this, modeButtonGroup); 
	toolBar.add(selectButton);
	selectButton.setSelected(true);
	addComponentButton = makeRadioToolButton("add_component.png", "", "Add Modules (M)", this, modeButtonGroup);
	toolBar.add(addComponentButton);
	toolBar.add(makeToolButton("", "editGridSize", "Edit Grid Size", this));
	
	toolBar.addSeparator();
	
	zoomButton = new JToggleButton();
	zoomButton.setText("Zoom");
	
	panButton = new JToggleButton();
	panButton.setText("Pan");
	
	toolBar.add(zoomButton);
	toolBar.add(makeToolButton("", "unZoom", "Un-Zoom", this));
	toolBar.add(panButton);
	
	toolBar.addSeparator();

	modelPanel = new ModelPanel(bioModel, modelEditor);
	toolBar.add(modelPanel);
	toolBar.setFloatable(false);
	
	/*
	compartmentList.setSelectedItem(bioModel.getDefaultCompartment());
	compartmentList.addActionListener(this);
	*/
	
	return toolBar;
}
 
Example 10
Source File: DefaultSyntaxKit.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add all pop-up menu items to a Toolbar.  <b>You need to call the validate method
 * on the toolbar after this is done to layout the buttons.</b>
 * Only Actions which have a SMALL_ICON property will be added to the toolbar
 * There are three Configuration Keys that affect the appearance of the added buttons:
 * CONFIG_TOOLBAR_ROLLOVER, CONFIG_TOOLBAR_BORDER, CONFIG_TOOLBAR_OPAQUE
 * 
 * @param editorPane
 * @param toolbar
 */
public void addToolBarActions(JEditorPane editorPane, JToolBar toolbar) {
	String[] toolBarItems = getConfig().getPropertyList(CONFIG_TOOLBAR);
	if (toolBarItems == null || toolBarItems.length == 0) {
		toolBarItems = getConfig().getPropertyList(CONFIG_MENU);
		if (toolBarItems == null || toolBarItems.length == 0) {
			return;
		}
	}
	boolean btnRolloverEnabled = getConfig().getBoolean(CONFIG_TOOLBAR_ROLLOVER, true);
	boolean btnBorderPainted = getConfig().getBoolean(CONFIG_TOOLBAR_BORDER, false);
	boolean btnOpaque = getConfig().getBoolean(CONFIG_TOOLBAR_OPAQUE, false);
	int btnBorderSize = getConfig().getInteger(CONFIG_TOOLBAR_BORDER_SIZE, 2);
	for (String menuString : toolBarItems) {
		if (menuString.equals("-") ||
			menuString.startsWith("<") ||
			menuString.startsWith(">")) {
			toolbar.addSeparator();
		} else {
			Action action = editorPane.getActionMap().get(menuString);
			if (action != null && action.getValue(Action.SMALL_ICON) != null) {
				JButton b = toolbar.add(action);
				b.setRolloverEnabled(btnRolloverEnabled);
				b.setBorderPainted(btnBorderPainted);
				b.setOpaque(btnOpaque);
				b.setFocusable(false);
				b.setBorder(BorderFactory.createEmptyBorder(btnBorderSize,
					btnBorderSize, btnBorderSize, btnBorderSize));
			}
		}
	}
}
 
Example 11
Source File: TraceTopology.java    From Thunder with Apache License 2.0 5 votes vote down vote up
private void initializeToolBar() {
    traceIdTextField = new JBasicTextField();
    traceIdTextField.setPreferredSize(new Dimension(200, traceIdTextField.getPreferredSize().height));

    boolean loggerTabSelection = PropertiesContext.isLoggerTabSelection();
    if (loggerTabSelection) {
        String loggerTraceId = PropertiesContext.getLoggerTraceId();
        traceIdTextField.setText(loggerTraceId);
    }

    JToolBar toolBar = getGraph().getToolbar();
    toolBar.addSeparator();
    toolBar.add(new JClassicButton(createConfigDataSourceAction()));
    toolBar.add(Box.createHorizontalStrut(5));
    toolBar.add(new JBasicLabel("Trace ID :"));
    toolBar.add(Box.createHorizontalStrut(5));
    toolBar.add(traceIdTextField);
    toolBar.add(new JClassicButton(createShowTopologyAction()));
    toolBar.add(new JClassicButton(createShowTableAction()));
    toolBar.add(new JClassicButton(createShowInfoAction()));
    toolBar.add(new JClassicButton(createShowSchematicAction()));
    toolBar.addSeparator();
    toolBar.add(createConfigButton(false));

    ButtonManager.updateUI(toolBar);

    setGroupAutoExpand(true);
}
 
Example 12
Source File: TablesSelector.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void populatePopup() {
    JPanel content = new JPanel(new BorderLayout());
    
    JLabel hint = new JLabel(SELECT_TABLES, JLabel.LEADING);
    hint.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
    content.add(hint, BorderLayout.NORTH);

    final SelectedTablesModel tablesModel = new SelectedTablesModel();
    final ProfilerTable tablesTable = new ProfilerTable(tablesModel, true, false, null);
    tablesTable.setColumnToolTips(new String[] {
        COLUMN_SELECTED_TOOLTIP,
        COLUMN_TABLE_TOOLTIP });
    tablesTable.setMainColumn(1);
    tablesTable.setFitWidthColumn(1);
    tablesTable.setDefaultSortOrder(1, SortOrder.ASCENDING);
    tablesTable.setSortColumn(1);
    tablesTable.setFixedColumnSelection(0); // #268298 - make sure SPACE always hits the Boolean column
    tablesTable.setColumnRenderer(0, new CheckBoxRenderer());
    LabelRenderer projectRenderer = new LabelRenderer();
    tablesTable.setColumnRenderer(1, projectRenderer);
    int w = new JLabel(tablesTable.getColumnName(0)).getPreferredSize().width;
    tablesTable.setDefaultColumnWidth(0, w + 15);
    int h = tablesTable.getRowHeight() * 8;
    h += tablesTable.getTableHeader().getPreferredSize().height;
    projectRenderer.setText("A LONGEST EXPECTED TABLE NAME A LONGEST EXPECTED TABLE NAME"); // NOI18N
    Dimension prefSize = new Dimension(w + projectRenderer.getPreferredSize().width, h);
    tablesTable.setPreferredScrollableViewportSize(prefSize);
    ProfilerTableContainer tableContainer = new ProfilerTableContainer(tablesTable, true, null);
    JPanel tableContent = new JPanel(new BorderLayout());
    tableContent.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
    tableContent.add(tableContainer, BorderLayout.CENTER);
    content.add(tableContent, BorderLayout.CENTER);

    JToolBar controls = new FilteringToolbar(FILTER_TABLES) {
        protected void filterChanged() {
            if (isAll()) tablesTable.setRowFilter(null);
            else tablesTable.setRowFilter(new RowFilter() {
                public boolean include(RowFilter.Entry entry) {
                    return passes(entry.getStringValue(1));
                }
            });
        }
    };
    
    controls.add(Box.createHorizontalStrut(2));
    controls.addSeparator();
    controls.add(Box.createHorizontalStrut(3));
    
    selectAll = new SmallButton(" " + ACT_SELECT_ALL + " ") { // NOI18N
        protected void fireActionPerformed(ActionEvent e) {
            super.fireActionPerformed(e);
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    selected.clear();
                    tablesModel.fireTableDataChanged();
                    doSelectionChanged(selected);
                }
            });
        }
    };
    controls.add(selectAll);
    unselectAll = new SmallButton(" " + ACT_UNSELECT_ALL + " ") { // NOI18N
        protected void fireActionPerformed(ActionEvent e) {
            super.fireActionPerformed(e);
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    selected.clear();
                    selected.addAll(Arrays.asList(tables));
                    tablesModel.fireTableDataChanged();
                    doSelectionChanged(selected);
                }
            });
        }
    };
    controls.add(unselectAll);

    content.add(controls, BorderLayout.SOUTH);

    panel = content;
    
    updateSelectionButtons();
}
 
Example 13
Source File: Schematic.java    From iBioSim with Apache License 2.0 4 votes vote down vote up
/**
	 * create the toolbar.
	 * @return
	 */
	private JToolBar buildToolBar(){

		JToolBar toolBar = new JToolBar();
		
		ButtonGroup modeButtonGroup = new ButtonGroup();
		selectButton = makeRadioToolButton("select_mode.png", "", "Select (" + KeyEvent.getKeyText(KeyEvent.VK_ESCAPE)
				+ ")", this, modeButtonGroup); 
		toolBar.add(selectButton);
		selectButton.setSelected(true);
		addCompartmentButton = makeRadioToolButton("add_compartment.png", "", "Add Compartment (" + 
				KeyEvent.getKeyText(KeyEvent.VK_ALT) + " C)", this, modeButtonGroup);
		toolBar.add(addCompartmentButton);
		addSpeciesButton = makeRadioToolButton("add_species.png", "", "Add Species (S)", this, modeButtonGroup);
		toolBar.add(addSpeciesButton);
		addReactionButton = makeRadioToolButton("add_reaction.png", "", "Add Reactions (R)", this, modeButtonGroup);
		toolBar.add(addReactionButton);
		addComponentButton = makeRadioToolButton("add_component.png", "", "Add Modules (M)", this, modeButtonGroup);
		toolBar.add(addComponentButton);
		addPromoterButton = makeRadioToolButton("promoter_mode.png", "", "Add Promoters (" +
				KeyEvent.getKeyText(KeyEvent.VK_SHIFT) + " P)", this, modeButtonGroup);
		toolBar.add(addPromoterButton);
		addVariableButton = makeRadioToolButton("variable_mode.png", "", "Add Variables (V)", this, modeButtonGroup);
		toolBar.add(addVariableButton);
		addBooleanButton = makeRadioToolButton("boolean_mode.png", "", "Add Booleans (B)", this, modeButtonGroup);
		toolBar.add(addBooleanButton);
		addPlaceButton = makeRadioToolButton("add_place.png", "", "Add Places (P)", this, modeButtonGroup);
		toolBar.add(addPlaceButton);
		addTransitionButton = makeRadioToolButton("add_transition.png", "", "Add Transitions (T)", this, modeButtonGroup);
		toolBar.add(addTransitionButton);
		addRuleButton = makeRadioToolButton("rule_mode.png", "", "Add Rules (" +
				KeyEvent.getKeyText(KeyEvent.VK_SHIFT) + " R)", this, modeButtonGroup);
		toolBar.add(addRuleButton);
		addConstraintButton = makeRadioToolButton("constraint_mode.png", "", "Add Constraints (" +
				KeyEvent.getKeyText(KeyEvent.VK_SHIFT) + " C)", this, modeButtonGroup);
		toolBar.add(addConstraintButton);
		addEventButton = makeRadioToolButton("event_mode.png", "", "Add Events (E)", this, modeButtonGroup);
		toolBar.add(addEventButton);
		selfInfluenceButton = makeRadioToolButton("self_influence.png", "", "Add Self Influences (I)", this, modeButtonGroup);
		toolBar.add(selfInfluenceButton);

		toolBar.addSeparator();
		ButtonGroup influenceButtonGroup = new ButtonGroup();
		
		activationButton = makeRadioToolButton("activation.png", "", "Activation", this, influenceButtonGroup);
		activationButton.setSelected(true);
		toolBar.add(activationButton);
		inhibitionButton = makeRadioToolButton("inhibition.png", "", "Repression", this, influenceButtonGroup);
		toolBar.add(inhibitionButton);
		noInfluenceButton = makeRadioToolButton("no_influence.png", "", "No Influence", this, influenceButtonGroup);
		toolBar.add(noInfluenceButton);
		bioActivationButton = makeRadioToolButton("bio_activation.png", "", "Complex Formation", this, influenceButtonGroup);
		toolBar.add(bioActivationButton);
		reactionButton = makeRadioToolButton("reaction.png", "", "Reaction", this, influenceButtonGroup);
		toolBar.add(reactionButton);
		modifierButton = makeRadioToolButton("modifier.png", "", "Modifier", this, influenceButtonGroup);
		toolBar.add(modifierButton);

		toolBar.addSeparator();
		toolBar.add(makeToolButton("choose_layout.png", "showLayouts", "Apply Layout", this));
		
		toolBar.addSeparator();
		
		zoomButton = new JToggleButton();
		zoomButton.setText("Zoom");
		zoomButton.setToolTipText("Use the mouse wheel to zoom");
		
		panButton = new JToggleButton();
		panButton.setText("Pan");
		panButton.setToolTipText("Use mouse dragging to pan");
		
		toolBar.add(zoomButton);
		toolBar.add(makeToolButton("", "unZoom", "Un-Zoom", this));
		toolBar.add(panButton);
		//toolBar.add(Utils.makeToolButton("", "saveSBOL", "Save SBOL", this));
		//toolBar.add(Utils.makeToolButton("", "exportSBOL", "Export SBOL", this));
		
		toolBar.addSeparator();

		modelPanel = new ModelPanel(bioModel, modelEditor);
		toolBar.add(modelPanel);
		
//		if (bioModel.getElementSBOLCount() == 0 && bioModel.getModelSBOLAnnotationFlag())
//			sbolDescriptorsButton.setEnabled(false);

		toolBar.setFloatable(false);
		
		return toolBar;
	}
 
Example 14
Source File: AttributeEditorDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
public AttributeEditorDialog(Operator exampleSource) {
	super(ApplicationFrame.getApplicationFrame(), "attribute_editor", ModalityType.APPLICATION_MODAL, new Object[] {});

	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(this);

	DataControl control = new DataControl(0, 0, "Example", "Attribute", false);
	attributeEditor = new AttributeEditor(exampleSource, control);
	control.addViewChangeListener(attributeEditor);
	getContentPane().add(control, BorderLayout.WEST);
	getContentPane().add(new ExtendedJScrollPane(attributeEditor), BorderLayout.CENTER);
	control.update();

	// initialize actions
	initActions();

	// menu bar
	JMenuBar menuBar = new JMenuBar();

	JMenu fileMenu = new ResourceMenu("attribute_editor_file");
	fileMenu.add(OPEN_ATTRIBUTE_FILE_ACTION);
	fileMenu.add(SAVE_ATTRIBUTE_FILE_ACTION);
	fileMenu.add(LOAD_DATA_ACTION);
	fileMenu.add(SAVE_DATA_ACTION);
	fileMenu.add(LOAD_SERIES_DATA_ACTION);
	fileMenu.addSeparator();
	fileMenu.add(CLOSE_ACTION);
	menuBar.add(fileMenu);

	JMenu tableMenu = new ResourceMenu("attribute_editor_table");
	tableMenu.add(attributeEditor.GUESS_TYPE_ACTION);
	tableMenu.add(attributeEditor.GUESS_ALL_TYPES_ACTION);
	tableMenu.add(attributeEditor.REMOVE_COLUMN_ACTION);
	tableMenu.add(attributeEditor.REMOVE_ROW_ACTION);
	tableMenu.add(attributeEditor.USE_ROW_AS_NAMES_ACTION);
	tableMenu.add(CLEAR_ACTION);
	menuBar.add(tableMenu);

	setJMenuBar(menuBar);

	// tool bar
	JToolBar toolBar = new ExtendedJToolBar();
	toolBar.add(OPEN_ATTRIBUTE_FILE_ACTION);
	toolBar.add(SAVE_ATTRIBUTE_FILE_ACTION);
	toolBar.add(LOAD_DATA_ACTION);
	toolBar.add(SAVE_DATA_ACTION);
	toolBar.addSeparator();
	toolBar.add(CLEAR_ACTION);
	getContentPane().add(toolBar, BorderLayout.NORTH);

	setSize((int) Math.max(600, super.getOwner().getWidth() * 2.0d / 3.0d),
			(int) Math.max(400, super.getOwner().getHeight() * 2.0d / 3.0d));
	setLocationRelativeTo(super.getOwner());
}
 
Example 15
Source File: ImageViewer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Creates toolbar. */
    private JToolBar createToolBar() {
        // Definition of toolbar.
        JToolBar toolBar = new JToolBar();
        toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); //NOI18N
        toolBar.setFloatable (false);
        toolBar.setName (NbBundle.getBundle(ImageViewer.class).getString("ACSN_Toolbar"));
        toolBar.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACSD_Toolbar"));
            JButton outButton = new JButton(SystemAction.get(ZoomOutAction.class));
            outButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_ZoomOut"));
            outButton.setMnemonic(NbBundle.getBundle(ImageViewer.class).getString("ACS_Out_BTN_Mnem").charAt(0));
            outButton.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACSD_Out_BTN"));
            outButton.setText("");
        toolBar.add(outButton);       
        toolbarButtons.add(outButton);
            JButton inButton = new JButton(SystemAction.get(ZoomInAction.class));
            inButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_ZoomIn"));
            inButton.setMnemonic(NbBundle.getBundle(ImageViewer.class).getString("ACS_In_BTN_Mnem").charAt(0));
            inButton.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACSD_In_BTN"));
            inButton.setText("");
        toolBar.add(inButton);
        toolbarButtons.add(inButton);
        toolBar.addSeparator(new Dimension(11, 0));
        
        JButton button;
        
        toolBar.add(button = getZoomButton(1,1));
        toolbarButtons.add(button);
        toolBar.addSeparator(new Dimension(11, 0));
        toolBar.add(button = getZoomButton(1,3));
        toolbarButtons.add(button);
        toolBar.add(button = getZoomButton(1,5));
        toolbarButtons.add(button);
        toolBar.add(button = getZoomButton(1,7));
        toolbarButtons.add(button);
        toolBar.addSeparator(new Dimension(11, 0));
        toolBar.add(button = getZoomButton(3,1));
        toolbarButtons.add(button);
        toolBar.add(button = getZoomButton(5,1));
        toolbarButtons.add(button);
        toolBar.add(button = getZoomButton(7,1));
        toolbarButtons.add(button);
        toolBar.addSeparator(new Dimension(11, 0));
//        SystemAction sa = SystemAction.get(CustomZoomAction.class);
//        sa.putValue (Action.SHORT_DESCRIPTION, NbBundle.getBundle(ImageViewer.class).getString("LBL_CustomZoom"));
        toolBar.add (button = getZoomButton ());
        toolbarButtons.add(button);
        toolBar.addSeparator(new Dimension(11, 0));
        toolBar.add(button = getGridButton());
        toolbarButtons.add(button);
        
        // Image Dimension
        toolBar.addSeparator(new Dimension(11, 0));
        toolBar.add(new JLabel(NbBundle.getMessage(ImageViewer.class, "LBL_ImageDimensions", imageWidth, imageHeight)));

        // Image File Size in KB, MB
        if (imageSize != -1) {
            toolBar.addSeparator(new Dimension(11, 0));

            double kb = 1024.0;
            double mb = kb * kb;

            final double size;
            final String label;

            if (imageSize >= mb) {
                size = imageSize / mb;
                label = "LBL_ImageSizeMb"; // NOI18N
            } else if (imageSize >= kb) {
                size = imageSize / kb;
                label = "LBL_ImageSizeKb"; // NOI18N
            } else {
                size = imageSize;
                label = "LBL_ImageSizeBytes"; //NOI18N
            }

            toolBar.add(new JLabel(NbBundle.getMessage(ImageViewer.class, label, formatter.format(size))));
        }

        for (JButton jb : toolbarButtons) {
            jb.setFocusable(false);
        }

        return toolBar;
    }
 
Example 16
Source File: MainFrame.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
public MainFrame() {
	showConfigName(null);
	setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	addWindowListener(new MainFrameListener());
	setGlassPane(new GlassPane(this));
	_fileChooser.setFileFilter(new FileChooserFilter(
			Messages.getString("MainFrame.config.files"),
			new String[] {".xml", ".cfg"}));

	_toolBar = new JToolBar();
	_toolBar.setFloatable(false);
	_toolBar.setRollover(true);
	addButton("images/new.png",	Messages.getString("MainFrame.new.config"),
			new NewActionListener());
	addButton("images/open.png", Messages.getString("MainFrame.open.config"),
			new OpenActionListener());
	addButton("images/save.png", Messages.getString("MainFrame.save.config"),
			new SaveActionListener());
	_toolBar.addSeparator();
	addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"),
			new BuildActionListener());
	_runButton = addButton("images/run.png",
			Messages.getString("MainFrame.test.wrapper"),
			new RunActionListener());
	setRunEnabled(false);
	_toolBar.addSeparator();
	addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"),
			new AboutActionListener());

	_configForm = new ConfigFormImpl();
	getContentPane().setLayout(new BorderLayout());
	getContentPane().add(_toolBar, BorderLayout.NORTH);
	getContentPane().add(_configForm, BorderLayout.CENTER);
	pack();
	Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
	Dimension fr = getSize();
	fr.width += 25;
	fr.height += 100;
	setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2,
			fr.width, fr.height);
	setVisible(true);
}
 
Example 17
Source File: Schematic.java    From iBioSim with Apache License 2.0 4 votes vote down vote up
/**
 * create the toolbar.
 * @return
 */
private JToolBar buildLEMAToolBar(){

	JToolBar toolBar = new JToolBar();
	
	ButtonGroup modeButtonGroup = new ButtonGroup();
	selectButton = makeRadioToolButton("select_mode.png", "", "Select (" +
			KeyEvent.getKeyText(KeyEvent.VK_ESCAPE) + ")", this, modeButtonGroup); 
	toolBar.add(selectButton);
	selectButton.setSelected(true);
	addComponentButton = makeRadioToolButton("add_component.png", "", "Add Modules (M)", this, modeButtonGroup);
	toolBar.add(addComponentButton);
	addBooleanButton = makeRadioToolButton("boolean_mode.png", "", "Add Booleans (B)", this, modeButtonGroup);
	toolBar.add(addBooleanButton);
	addVariableButton = makeRadioToolButton("variable_mode.png", "", "Add Variables (V)", this, modeButtonGroup);
	toolBar.add(addVariableButton);
	addPlaceButton = makeRadioToolButton("add_place.png", "", "Add Places (P)", this, modeButtonGroup);
	toolBar.add(addPlaceButton);
	addTransitionButton = makeRadioToolButton("add_transition.png", "", "Add Transitions (T)", this, modeButtonGroup);
	toolBar.add(addTransitionButton);
	addRuleButton = makeRadioToolButton("rule_mode.png", "", "Add Rules (" +
			KeyEvent.getKeyText(KeyEvent.VK_SHIFT) + " R)", this, modeButtonGroup);
	toolBar.add(addRuleButton);
	addConstraintButton = makeRadioToolButton("constraint_mode.png", "", "Add Constraints (" +
			KeyEvent.getKeyText(KeyEvent.VK_SHIFT) + " C)", this, modeButtonGroup);
	toolBar.add(addConstraintButton);
	//addEventButton = Utils.makeRadioToolButton("event_mode.png", "", "Add Events", this, modeButtonGroup);
	//toolBar.add(addEventButton);

	//toolBar.addSeparator();
	ButtonGroup influenceButtonGroup = new ButtonGroup();
	
	activationButton = makeRadioToolButton("activation.png", "", "Activation", this, influenceButtonGroup);
	activationButton.setSelected(true);
	//toolBar.add(activationButton);

	toolBar.addSeparator();
	toolBar.add(makeToolButton("choose_layout.png", "showLayouts", "Apply Layout", this));
	
	toolBar.addSeparator();
	
	zoomButton = new JToggleButton();
	zoomButton.setText("Zoom");
	zoomButton.setToolTipText("Use the mouse wheel to zoom");
	
	panButton = new JToggleButton();
	panButton.setText("Pan");
	panButton.setToolTipText("Use mouse dragging to pan");
	
	toolBar.add(zoomButton);
	toolBar.add(makeToolButton("", "unZoom", "Un-Zoom", this));
	toolBar.add(panButton);
	//toolBar.add(Utils.makeToolButton("", "saveSBOL", "Save SBOL", this));
	//toolBar.add(Utils.makeToolButton("", "exportSBOL", "Export SBOL", this));
	
	//toolBar.addSeparator();

	//ModelPanel modelPanel = new ModelPanel(bioModel, modelEditor);
	//toolBar.add(modelPanel);

	toolBar.setFloatable(false);
	
	return toolBar;
}
 
Example 18
Source File: MainFrame.java    From PyramidShader with GNU General Public License v3.0 4 votes vote down vote up
public MainFrame() {
	showConfigName(null);
	setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	addWindowListener(new MainFrameListener());
	setGlassPane(new GlassPane(this));
	_fileChooser.setFileFilter(new FileChooserFilter(
			Messages.getString("MainFrame.config.files"),
			new String[] {".xml", ".cfg"}));

	_toolBar = new JToolBar();
	_toolBar.setFloatable(false);
	_toolBar.setRollover(true);
	addButton("images/new.png",	Messages.getString("MainFrame.new.config"),
			new NewActionListener());
	addButton("images/open.png", Messages.getString("MainFrame.open.config"),
			new OpenActionListener());
	addButton("images/save.png", Messages.getString("MainFrame.save.config"),
			new SaveActionListener());
	_toolBar.addSeparator();
	addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"),
			new BuildActionListener());
	_runButton = addButton("images/run.png",
			Messages.getString("MainFrame.test.wrapper"),
			new RunActionListener());
	setRunEnabled(false);
	_toolBar.addSeparator();
	addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"),
			new AboutActionListener());

	_configForm = new ConfigFormImpl();
	getContentPane().setLayout(new BorderLayout());
	getContentPane().add(_toolBar, BorderLayout.NORTH);
	getContentPane().add(_configForm, BorderLayout.CENTER);
	pack();
	Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
	Dimension fr = getSize();
	fr.width += 25;
	fr.height += 100;
	setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2,
			fr.width, fr.height);
	setVisible(true);
}
 
Example 19
Source File: EditorRootPane.java    From libGDX-Path-Editor with Apache License 2.0 4 votes vote down vote up
private JToolBar createToolbar() {
	JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
	toolBar.setFloatable(false);
	
	ImageIcon newProjectIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_newProject));
	newProjectButton = new JButton(newProjectIcon);
	newProjectButton.setActionCommand(MenuConsts.newProject);
	newProjectButton.setToolTipText(MenuConsts.newProject);
	newProjectButton.addActionListener(menuHandler);
	
	ImageIcon openProjectIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_openProject));
	openProjectButton = new JButton(openProjectIcon);
	openProjectButton.setActionCommand(MenuConsts.openProject);
	openProjectButton.setToolTipText(MenuConsts.openProject);
	openProjectButton.addActionListener(menuHandler);
	
	ImageIcon saveProjectIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_saveProject));
	saveProjectButton = new JButton(saveProjectIcon);
	saveProjectButton.setActionCommand(MenuConsts.saveProhect);
	saveProjectButton.setToolTipText(MenuConsts.saveProhect);
	saveProjectButton.addActionListener(menuHandler);
	
	ImageIcon closeProjectIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_closeProject));
	closeProjectButton = new JButton(closeProjectIcon);
	closeProjectButton.setActionCommand(MenuConsts.closeProject);
	closeProjectButton.setToolTipText(MenuConsts.closeProject);
	closeProjectButton.addActionListener(menuHandler);
	
	ImageIcon addScreenIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_addScreen));
	addScreenButton = new JButton(addScreenIcon);
	addScreenButton.setActionCommand(MenuConsts.addScreen);
	addScreenButton.setToolTipText(MenuConsts.addScreen);
	addScreenButton.addActionListener(menuHandler);
	
	ImageIcon addBGIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_addBG));
	addBGButton = new JButton(addBGIcon);
	addBGButton.setActionCommand(MenuConsts.addBG);
	addBGButton.setToolTipText(MenuConsts.addBG);
	addBGButton.addActionListener(menuHandler);
	
	ImageIcon addVertexIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_addVertex));
	addVertexButton = new JToggleButton(addVertexIcon);
	addVertexButton.setActionCommand(MenuConsts.addVertex);
	addVertexButton.setToolTipText(MenuConsts.addVertex);
	addVertexButton.addActionListener(menuHandler);
	
	ImageIcon editVertexIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_editVertex));
	editVertexButton = new JToggleButton(editVertexIcon);
	editVertexButton.setActionCommand(MenuConsts.moveVertex);
	editVertexButton.setToolTipText(MenuConsts.moveVertex);
	editVertexButton.addActionListener(menuHandler);
	
	ImageIcon insertVertexIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_insertVertex));
	insertVertexButton = new JToggleButton(insertVertexIcon);
	insertVertexButton.setActionCommand(MenuConsts.insertVertex);
	insertVertexButton.setToolTipText(MenuConsts.insertVertex);
	insertVertexButton.addActionListener(menuHandler);
	
	ImageIcon removeVertexIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_removeVertex));
	removeVertexButton = new JToggleButton(removeVertexIcon);
	removeVertexButton.setActionCommand(MenuConsts.removeVertex);
	removeVertexButton.setToolTipText(MenuConsts.removeVertex);
	removeVertexButton.addActionListener(menuHandler);
	
	ImageIcon clearPathIcon = new ImageIcon(this.getClass().getResource(ResourcesConsts.ic_toolbar_clearPath));
	clearPathButton = new JButton(clearPathIcon);
	clearPathButton.setActionCommand(MenuConsts.clearPath);
	clearPathButton.setToolTipText(MenuConsts.clearPath);
	clearPathButton.addActionListener(menuHandler);
	
	toolBar.add(newProjectButton);
	toolBar.add(openProjectButton);
	toolBar.add(saveProjectButton);
	toolBar.add(closeProjectButton);
	toolBar.addSeparator(new Dimension(10, 32));
	toolBar.add(addScreenButton);
	toolBar.addSeparator(new Dimension(10, 32));
	toolBar.add(addBGButton);
	toolBar.addSeparator(new Dimension(10, 32));
	toolBar.add(addVertexButton);
	toolBar.add(editVertexButton);
	toolBar.add(insertVertexButton);
	toolBar.add(removeVertexButton);
	toolBar.add(clearPathButton);
	
	return toolBar;
}
 
Example 20
Source File: ButtonFactory.java    From openAGV with Apache License 2.0 4 votes vote down vote up
/**
 * Creates toolbar buttons and adds them to the specified JToolBar
 *
 * @param toolBar
 * @param editor
 */
public static void addAttributesButtonsTo(
    JToolBar toolBar,
    DrawingEditor editor) {

  JButton button;

  button = toolBar.add(new PickAttributesAction(editor));
  button.setFocusable(false);

  button = toolBar.add(new ApplyAttributesAction(editor));
  button.setFocusable(false);

  toolBar.addSeparator();

  addColorButtonsTo(toolBar, editor);

  toolBar.addSeparator();

  addStrokeButtonsTo(toolBar, editor);

  toolBar.addSeparator();

  addFontButtonsTo(toolBar, editor);
}