List of usage examples for javax.swing JToolBar setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:org.openmicroscopy.shoola.agents.metadata.editor.OriginalMetadataComponent.java
/** * Builds the tool bar.// w w w . j a v a2 s.c om * * @return See above. */ private JComponent buildToolBar() { JToolBar bar = new JToolBar(); bar.setFloatable(false); bar.setRollover(true); bar.setBorder(null); bar.add(downloadButton); return bar; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Lays out the components using a <code>FlowLayout</code>. * /*w w w.j av a 2 s . c o m*/ * @param button The component to lay out. * @param component The component to lay out. * @param sizeRow The size of the row. * @return See above. */ private JPanel layoutEditablefield(Component button, JComponent component, int sizeRow) { JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 2, 2, 0); c.gridy = 0; c.gridx = 0; if (button != null) { JToolBar bar = new JToolBar(); bar.setBorder(null); bar.setFloatable(false); bar.setBackground(UIUtilities.BACKGROUND_COLOR); bar.add(button); p.add(bar, c); c.gridx++; } if (sizeRow > 0) { c.ipady = sizeRow; c.gridheight = 2; } p.add(component, c); JPanel content = UIUtilities.buildComponentPanel(p, 0, 0); content.setBackground(UIUtilities.BACKGROUND_COLOR); return content; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.ToolBar.java
/** * Builds the general bar.//from w w w. ja v a 2 s . co m * * @return See above. */ private JComponent buildGeneralBar() { JToolBar bar = new JToolBar(); bar.setBackground(UIUtilities.BACKGROUND_COLOR); bar.setFloatable(false); bar.setRollover(true); bar.setBorder(null); bar.add(saveButton); bar.add(Box.createHorizontalStrut(5)); bar.add(refreshButton); bar.add(Box.createHorizontalStrut(5)); bar.add(viewButton); bar.add(Box.createHorizontalStrut(5)); bar.add(linkButton); bar.add(Box.createHorizontalStrut(5)); bar.add(saveAsButton); bar.add(Box.createHorizontalStrut(5)); bar.add(publishingButton); /* if (MetadataViewerAgent.isAdministrator()) { bar.add(Box.createHorizontalStrut(5)); bar.add(uploadScriptButton); } bar.add(Box.createHorizontalStrut(5)); bar.add(scriptsButton); */ //bar.add(scriptsButton); return bar; }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Helper method to create the tool bar hosting the edit items. * /*from ww w .j ava2 s. c o m*/ * @return See above. */ private JToolBar createSearchBar() { JToolBar bar = new JToolBar(); bar.setFloatable(false); bar.setRollover(true); bar.setBorder(null); bar.add(new JSeparator(JSeparator.VERTICAL)); bar.add(new JToggleButton(controller.getAction(TreeViewerControl.SEARCH))); return bar; }
From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java
/** * Invokes when the activity end. /*from w w w . j av a 2 s . co m*/ * * @param result The result of the activity. */ public void endActivity(Object result) { this.result = result; boolean busy = status.isBusy(); reset(); if (result instanceof Map) { Map<String, Object> m = convertResult((Map<String, Object>) result); int size = m.size(); this.result = m; remove(resultPane); Color c = getBackground(); if (size == 0) { JToolBar row = new JToolBar(); row.setOpaque(false); row.setFloatable(false); row.setBorder(null); row.setBackground(c); JButton button; if (errorObject != null) { button = createButton(ActivityResultRow.ERROR_TEXT, ERROR, this); button.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showMenu((JComponent) e.getSource(), ERROR, e.getX(), e.getY()); } }); row.add(button); } if (infoObject != null) { button = createButton(ActivityResultRow.INFO_TEXT, INFO, this); button.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { showMenu((JComponent) e.getSource(), INFO, e.getX(), e.getY()); } }); row.add(button); } add(row, paneIndex); } else { Entry<String, Object> entry; Iterator<Entry<String, Object>> i = m.entrySet().iterator(); ActivityResultRow row = null; JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.setBackground(c); int index = 0; int max = 2; JButton moreButton = null; while (i.hasNext()) { entry = (Entry<String, Object>) i.next(); this.result = entry.getValue(); row = new ActivityResultRow((String) entry.getKey(), entry.getValue(), this); row.setBackground(c); row.addPropertyChangeListener(listener); resultButtons.add(row); if (index < max) content.add(row); else { if (moreButton == null) { moreButton = createButton("" + (m.size() - max) + " more", ALL_RESULT, this); content.add(moreButton); } } index++; } if (m.size() == 1) add(row, paneIndex); else add(content, paneIndex); resultPane = content; } repaint(); } firePropertyChange(UNREGISTER_ACTIVITY_PROPERTY, null, this); notifyActivityEnd(); //Post an event to //if (busy) { EventBus bus = registry.getEventBus(); bus.post(new ActivityProcessEvent(this, busy)); //} }
From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java
/** * Helper method to create an empty, floatable toolbar with rollover * effect for the icon buttons and an etched border. * * @return See above./* w ww . jav a 2s . c o m*/ */ private JToolBar createToolBar() { JToolBar bar = new JToolBar(); bar.setBorder(BorderFactory.createEtchedBorder()); bar.setFloatable(false); bar.putClientProperty("JToolBar.isRollover", Boolean.valueOf(true)); return bar; }
From source file:utybo.branchingstorytree.swing.editor.StoryEditor.java
public StoryEditor(BranchingStory baseStory) throws BSTException { setLayout(new MigLayout("hidemode 3", "[grow]", "[][grow]")); JToolBar toolBar = new JToolBar(); toolBar.setBorder(null); toolBar.setFloatable(false);/*ww w . j av a 2 s . c om*/ add(toolBar, "cell 0 0,growx"); JButton btnSaveAs = new JButton(Lang.get("saveas"), new ImageIcon(Icons.getImage("Save As", 16))); btnSaveAs.addActionListener(e -> { saveAs(); }); toolBar.add(btnSaveAs); JButton btnSave = new JButton(Lang.get("save"), new ImageIcon(Icons.getImage("Save", 16))); btnSave.addActionListener(e -> { save(); }); toolBar.add(btnSave); JButton btnPlay = new JButton(Lang.get("play"), new ImageIcon(Icons.getImage("Circled Play", 16))); btnPlay.addActionListener(ev -> { try { String s = exportToString(); File f = Files.createTempDirectory("openbst").toFile(); File bstFile = new File(f, "expoted.bst"); try (FileOutputStream fos = new FileOutputStream(bstFile);) { IOUtils.write(s, fos, StandardCharsets.UTF_8); } OpenBSTGUI.getInstance().openStory(bstFile); } catch (Exception e) { OpenBST.LOG.error("Export failed", e); Messagers.showException(OpenBSTGUI.getInstance(), Lang.get("editor.exportfail"), e); } }); toolBar.add(btnPlay); JButton btnFilePreview = new JButton(Lang.get("editor.exportpreview"), new ImageIcon(Icons.getImage("PreviewText", 16))); btnFilePreview.addActionListener(e -> { try { String s = exportToString(); JDialog dialog = new JDialog(OpenBSTGUI.getInstance(), Lang.get("editor.exportpreview")); JTextArea jta = new JTextArea(s); jta.setLineWrap(true); jta.setWrapStyleWord(true); dialog.add(new JScrollPane(jta)); dialog.setModalityType(ModalityType.APPLICATION_MODAL); dialog.setSize((int) (Icons.getScale() * 350), (int) (Icons.getScale() * 300)); dialog.setLocationRelativeTo(OpenBSTGUI.getInstance()); dialog.setVisible(true); } catch (Exception x) { OpenBST.LOG.error("Failed to preview", x); Messagers.showException(OpenBSTGUI.getInstance(), Lang.get("editor.previewerror"), x); } }); toolBar.add(btnFilePreview); Component horizontalGlue = Box.createHorizontalGlue(); toolBar.add(horizontalGlue); JButton btnClose = new JButton(Lang.get("close"), new ImageIcon(Icons.getImage("Cancel", 16))); btnClose.addActionListener(e -> { askClose(); }); toolBar.add(btnClose); for (final Component component : toolBar.getComponents()) { if (component instanceof JButton) { ((JButton) component).setHideActionText(false); ((JButton) component).setToolTipText(((JButton) component).getText()); ((JButton) component).setText(""); } } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setTabPlacement(JTabbedPane.LEFT); add(tabbedPane, "cell 0 1,grow"); tabbedPane.addTab("Beta Warning", new StoryEditorWelcomeScreen()); details = new StoryDetailsEditor(this); tabbedPane.addTab(Lang.get("editor.details"), details); nodesEditor = new StoryNodesEditor(); tabbedPane.addTab(Lang.get("editor.nodes"), nodesEditor); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("control S"), "doSave"); this.getActionMap().put("doSave", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { save(); } }); importFrom(baseStory); }