List of usage examples for com.jgoodies.looks Options HEADER_STYLE_KEY
String HEADER_STYLE_KEY
To view the source code for com.jgoodies.looks Options HEADER_STYLE_KEY.
Click Source Link
From source file:de.dal33t.powerfolder.ui.util.SimpleComponentFactory.java
License:Open Source License
/** * @return a popup menu/* ww w .j a va 2 s . c o m*/ */ public static JPopupMenu createPopupMenu() { JPopupMenu popupmenu = new JPopupMenu(); popupmenu.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); return popupmenu; }
From source file:de.dfki.dmas.owls2wsdl.gui.MenuBarView.java
License:Open Source License
/** * Builds, configures, and returns the menubar. Requests HeaderStyle, * look-specific BorderStyles, and Plastic 3D hint from Launcher. */// w w w . jav a 2s .co m JMenuBar buildMenuBar(Settings settings, GUIActionListener actionListener) { this.actionListener = actionListener; JMenuBar bar = new JMenuBar(); bar.putClientProperty(Options.HEADER_STYLE_KEY, settings.getMenuBarHeaderStyle()); bar.putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, settings.getMenuBarPlasticBorderStyle()); bar.putClientProperty(WindowsLookAndFeel.BORDER_STYLE_KEY, settings.getMenuBarWindowsBorderStyle()); bar.putClientProperty(PlasticLookAndFeel.IS_3D_KEY, settings.getMenuBar3DHint()); bar.add(buildFileMenu()); bar.add(buildEditMenu()); bar.add(buildViewMenu()); bar.add(buildExtrasMenu()); bar.add(buildHelpMenu()); return bar; }
From source file:de.xplib.xdbm.ui.ApplicationMenuBar.java
License:Open Source License
/** * @param appIn The main frame./*from ww w. j av a 2 s . c o m*/ */ public ApplicationMenuBar(final Application appIn) { this.app = appIn; this.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.SINGLE); this.putClientProperty(PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE); this.app.setJMenuBar(this); this.add(this.jmFile); this.jmFile.add(this.jmFileNew); this.jmFileNew.setIcon(Application.createIcon("icon/menu.new.png")); this.jmFileNew.add(new JMenuItem(NewCollectionAction.INSTANCE)); this.jmFileNew.add(new JMenuItem(NewVirtualCollectionAction.INSTANCE)); this.jmFileNew.add(new JMenuItem(NewXMLResourceAction.INSTANCE)); this.jmFile.addSeparator(); this.jmFile.add(this.jmiFileConnect); this.jmFile.add(this.jmiFileDisconnect); this.jmFile.addSeparator(); this.jmFile.addSeparator(); this.jmFile.add(this.jmiExit); this.add(this.jmEdit); this.jmEdit.add(new JMenuItem(CutResourceAction.INSTANCE)); this.jmEdit.add(new JMenuItem(CopyResourceAction.INSTANCE)); this.jmEdit.add(new JMenuItem(PasteResourceAction.INSTANCE)); this.jmEdit.add(new JMenuItem(new FlippingAction( new Action[] { DeleteResourceAction.INSTANCE, DeleteCollectionAction.INSTANCE }))); this.add(this.jmView); this.jmView.add(this.jmViewPlugins); this.initPlugins(); /* Map map = this.app.getConfig().getPluginFiles(); Iterator it = map.keySet().iterator(); while (it.hasNext()) { try { Plugin p = ((PluginFile) map.get(it.next())).createPlugin(); this.jmViewPlugins.add(new JMenuItem(p.getTitle())); } catch (Exception e) { e.printStackTrace(); } } */ this.jmView.addSeparator(); this.jmView.add(new JMenuItem(ShowXMLAction.INSTANCE)); this.jmView.add(new JMenuItem(ShowPCVResourceAction.INSTANCE)); this.add(this.jmQuery); this.jmQuery.add(new JMenuItem(QueryCollectionAction.INSTANCE)); this.jmQuery.add(new JMenuItem(QueryXMLResourceAction.INSTANCE)); // we have build the system menu, now we setup the plugin menus. for (int i = 0; i < this.plugins.length; i++) { this.plugins[i].setUpMenu(this); } I18N i18n = I18N.getInstance(); i18n.addObserver(this); this.updateI18N(i18n); Config cfg = this.app.getConfig(); cfg.addObserver(this); this.update(cfg); }
From source file:de.xplib.xdbm.ui.ApplicationToolBars.java
License:Open Source License
private JToolBar createToolBar(JButton[] buttons) { JToolBar bar = ToolBarFactory.createToolBar(false, buttons, true); bar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); bar.putClientProperty(Options.HEADER_STYLE_KEY, settings.getToolBarHeaderStyle()); bar.putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, settings.getToolBarPlasticBorderStyle()); bar.putClientProperty(WindowsLookAndFeel.BORDER_STYLE_KEY, settings.getToolBarWindowsBorderStyle()); bar.putClientProperty(PlasticLookAndFeel.IS_3D_KEY, settings.getToolBar3DHint()); bar.setFloatable(true);// w ww. j a v a 2 s.c o m return bar; }
From source file:etomica.virial.cluster2.mvc.view.MenuBarView.java
License:Mozilla Public License
/** * Builds, configures, and returns the JMenuBar. Requests HeaderStyle, * look-specific BorderStyles, and Plastic 3D hint from Launcher. *///from w w w . j a v a 2 s . c o m JMenuBar buildMenuBar(ApplicationView parent) { JGoodiesSettings settings = ApplicationUI.uiSettings; JMenuBar bar = new JMenuBar(); bar.putClientProperty(Options.HEADER_STYLE_KEY, settings.getMenuBarHeaderStyle()); bar.putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, settings.getMenuBarPlasticBorderStyle()); bar.putClientProperty(WindowsLookAndFeel.BORDER_STYLE_KEY, settings.getMenuBarWindowsBorderStyle()); bar.putClientProperty(PlasticLookAndFeel.IS_3D_KEY, settings.getMenuBar3DHint()); bar.add(buildFileMenu()); bar.add(buildRadioMenu()); bar.add(buildCheckMenu()); bar.add(buildHtmlMenu()); bar.add(buildAlignmentTestMenu()); bar.add(buildHelpMenu(parent)); return bar; }
From source file:etomica.virial.cluster2.mvc.view.ToolBarView.java
License:Mozilla Public License
public static JToolBar mainToolbar(ApplicationView parent) { JGoodiesSettings settings = ApplicationUI.uiSettings; JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false);// w ww. j av a 2 s . c o m toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); toolBar.putClientProperty(Options.HEADER_STYLE_KEY, settings.getToolBarHeaderStyle()); toolBar.putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, settings.getToolBarPlasticBorderStyle()); toolBar.putClientProperty(WindowsLookAndFeel.BORDER_STYLE_KEY, settings.getToolBarWindowsBorderStyle()); toolBar.putClientProperty(PlasticLookAndFeel.IS_3D_KEY, settings.getToolBar3DHint()); AbstractButton button; toolBar.add(createToolBarButton("backward.gif", "Back")); button = createToolBarButton("forward.gif", "Next"); button.setEnabled(false); toolBar.add(button); toolBar.add(createToolBarButton("home.gif", "Home")); toolBar.addSeparator(); ActionListener openAction = parent.new OpenFileActionListener(); button = createToolBarButton("open.gif", "Open", openAction, KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_DOWN_MASK)); button.addActionListener(openAction); toolBar.add(button); toolBar.add(createToolBarButton("print.gif", "Print")); toolBar.add(createToolBarButton("refresh.gif", "Update")); toolBar.addSeparator(); ButtonGroup group = new ButtonGroup(); button = createToolBarRadioButton("pie_mode.png", "Pie Chart"); button.setSelectedIcon(ApplicationUI.readImageIcon("pie_mode_selected.gif")); group.add(button); button.setSelected(true); toolBar.add(button); button = createToolBarRadioButton("bar_mode.png", "Bar Chart"); button.setSelectedIcon(ApplicationUI.readImageIcon("bar_mode_selected.gif")); group.add(button); toolBar.add(button); button = createToolBarRadioButton("table_mode.png", "Table"); button.setSelectedIcon(ApplicationUI.readImageIcon("table_mode_selected.gif")); group.add(button); toolBar.add(button); toolBar.addSeparator(); button = createToolBarButton("help.gif", "Open Help"); button.addActionListener(parent.new HelpActionListener()); toolBar.add(button); return toolBar; }
From source file:fi.smaa.jsmaa.gui.AbstractGUIFactory.java
License:Open Source License
private JMenuBar buildMenuBar() { JMenuBar menuBar = new JMenuBar(); menuBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); for (JMenuItem l : getEntityMenuList()) { menuBar.add(l);//from w w w. jav a2s .co m } menuBar.add(buildResultsMenu()); menuBar.add(Box.createHorizontalGlue()); menuBar.add(buildHelpMenu()); return menuBar; }
From source file:IceGridGUI.LiveDeployment.GraphView.java
License:Open Source License
public GraphView(Coordinator coordinator, String title) { _coordinator = coordinator;//from w w w .j a va2 s. c om setTitle(title); _preferences = Preferences.userNodeForPackage(getClass()); // // Don't destroy JavaFX when the frame is disposed. // Platform.setImplicitExit(false); setIconImage(Utils.getIcon("/icons/16x16/metrics_graph.png").getImage()); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { close(); } }); // // Graph preferences. // Action preferences = new AbstractAction("Preferences") { @Override public void actionPerformed(ActionEvent event) { // // Set the title // JTextField title = new JTextField(getTitle()); JPanel titlePanel; { DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("pref,2dlu,pref:grow", "pref")); builder.append("Title:", title); titlePanel = builder.getPanel(); } // // SpinnerNumberModel to set a refresh period. // SpinnerNumberModel refreshPeriod = new SpinnerNumberModel(getRefreshPeriod(), _minRefreshPeriod, _maxRefreshPeriod, 1); // // SpinnerNumberModel to set the maximum number of samples to keep in X axis. // final SpinnerNumberModel samples = new SpinnerNumberModel(_samples, _minSamples, _maxSamples, 1); JPanel refreshPanel; { DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("pref,2dlu,pref:grow", "pref")); builder.rowGroupingEnabled(true); final JSpinner spinner = new JSpinner(refreshPeriod); builder.append("Sample interval:", spinner); builder.append("", new JLabel("<html><p>Sample interval in seconds; must be between 1" + "<br/>and 3600 seconds.</p></html>")); refreshPanel = builder.getPanel(); } // // JComboBox to select time format used in X Axis // JComboBox<String> dateFormats = new JComboBox<String>(_dateFormats); dateFormats.setSelectedItem(getDateFormat()); JPanel xAxisPanel; { DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("pref,2dlu,pref:grow", "pref")); builder.append("Samples displayed:", new JSpinner(samples)); builder.append("", new JLabel("<html><p>The number of samples displayed on a graph;" + "<br/>must be between 2 and 300." + "</p></html>")); builder.append("Time format:", dateFormats); xAxisPanel = builder.getPanel(); } FormLayout layout = new FormLayout("fill:pref:grow", "pref"); final DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.border(Borders.DIALOG); builder.append(titlePanel); builder.nextLine(); builder.append(refreshPanel); builder.nextLine(); builder.append(xAxisPanel); if (JOptionPane.showConfirmDialog(GraphView.this, builder.getPanel(), "Metrics Graph Preferences", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) != JOptionPane.OK_OPTION) { return; } setTitle(title.getText()); setRefreshPeriod(refreshPeriod.getNumber().intValue()); setMaximumSamples(samples.getNumber().intValue()); setDateFormat((String) dateFormats.getSelectedItem()); } }; _legendTable = new JTable(_legendModel) { //Implement table cell tool tips. @Override public String getToolTipText(java.awt.event.MouseEvent e) { if (convertColumnIndexToModel(columnAtPoint(e.getPoint())) == 6) { return _legendModel.getRows(new int[] { rowAtPoint(e.getPoint()) })[0].cell.getField() .getColumnToolTip(); } else { return null; } } }; // // Adjust row height for larger fonts // int fontSize = _legendTable.getFont().getSize(); int minRowHeight = fontSize + fontSize / 3; if (_legendTable.getRowHeight() < minRowHeight) { _legendTable.setRowHeight(minRowHeight); } // // Graph preferences. // final Action delete = new AbstractAction("Delete") { @Override public void actionPerformed(ActionEvent event) { int[] selectedRows = _legendTable.getSelectedRows(); for (int i = 0; i < selectedRows.length; ++i) { selectedRows[i] = _legendTable.convertRowIndexToModel(selectedRows[i]); } // // Remove selected rows from the legend model. // final MetricsRow[] rows = _legendModel.removeRows(selectedRows); // // Remove rows from series hash maps // for (MetricsRow row : rows) { Map<String, Map<String, Map<String, MetricsRow>>> j = _series.get(row.info); Map<String, Map<String, MetricsRow>> k = j.get(row.cell.getField().getMetricsName()); Map<String, MetricsRow> l = k.get(row.cell.getId()); l.remove(row.cell.getField().getFieldName()); if (l.size() == 0) { k.remove(row.cell.getId()); if (k.size() == 0) { j.remove(row.cell.getField().getMetricsName()); if (j.size() == 0) { _series.remove(row.info); if (_series.size() == 0) { stopRefresh(); } } } } } // // Remove series from the chart, in JavaFx thread. // enqueueJFX(new Runnable() { @Override public void run() { for (MetricsRow row : rows) { for (int i = 0; i < row.series.size(); ++i) { XYChart.Series<Number, Number> series = row.series.get(i); String seriesClass = getSeriesClass(series); if (seriesClass != null) { _styles.remove(seriesClass); } // // Don't remove the XYChart.Series object here, to avoid the series // style classes to be reasign by JavaFX. // // _chart.getData().remove(row.series); try { series.getData().clear(); } catch (NullPointerException ex) { // JavaFX bug } } } } }); } }; delete.setEnabled(false); delete.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); _legendTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { delete.setEnabled(_legendTable.getSelectedRows().length > 0); } } }); // // Create the tool bar // class ToolBar extends JToolBar { public ToolBar() { putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, BorderStyle.SEPARATOR); setFloatable(false); putClientProperty("JToolBar.isRollover", Boolean.TRUE); JButton button = new JButton(delete); button.setText(null); button.setIcon(Utils.getIcon("/icons/24x24/delete.png")); add(button); } } // // Create menus // JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(java.awt.event.KeyEvent.VK_F); fileMenu.add(preferences); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic(java.awt.event.KeyEvent.VK_E); editMenu.add(delete); menuBar.add(editMenu); setJMenuBar(menuBar); // // Set default renderer for numeric values. // _legendTable.setDefaultRenderer(Double.class, new FormatedNumberRenderer("#0.000")); // // Set a combobox to edit the scale factors. // JComboBox<Double> scales = new JComboBox<Double>(_scales); scales.setRenderer(new DecimalRenderer(scales.getRenderer())); _legendTable.getColumnModel().getColumn(7).setCellEditor(new DefaultCellEditor(scales)); // //Set default renderer and editor for Color.class column. // _legendTable.setDefaultRenderer(Color.class, new ColorRenderer(true)); _legendTable.setDefaultEditor(Color.class, new ColorEditor()); _legendTable.setAutoCreateRowSorter(true); final JFXPanel fxPanel = new JFXPanel(); fxPanel.setMinimumSize(new Dimension(0, 200)); fxPanel.setPreferredSize(new Dimension(800, 400)); // // Build the split pane, with the chart graph and the legend table. // _splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); _splitPane.setTopComponent(fxPanel); JScrollPane scrollPane = new JScrollPane(_legendTable); scrollPane.setTransferHandler(new TransferHandler()); scrollPane.setMinimumSize(new Dimension(0, 50)); scrollPane.setPreferredSize(new Dimension(800, 200)); _splitPane.setBottomComponent(scrollPane); DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("fill:pref:grow", "fill:pref:grow, pref")); builder.append(_splitPane); builder.nextLine(); JPanel panel = builder.getPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); getContentPane().add(new ToolBar(), BorderLayout.PAGE_START); getContentPane().add(panel, BorderLayout.CENTER); setPreferredSize(new Dimension(800, 600)); // // initialize the scene in JavaFX thread. // enqueueJFX(new Runnable() { @Override public void run() { _xAxis = new NumberAxis(); _yAxis = new NumberAxis(); _chart = new LineChart<Number, Number>(_xAxis, _yAxis); _chart.setCreateSymbols(false); _xAxis.setLabel("Time (" + getDateFormat() + ")"); _xAxis.setTickLabelFormatter(_timeFormater); _xAxis.setForceZeroInRange(false); _chart.setAnimated(true); _chart.setLegendVisible(false); final Scene scene = new Scene(_chart); scene.setOnDragOver(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); if (event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType)) { Object object = db.getContent(LocalObjectMimeType); if (object instanceof MetricsViewTransferableData) { event.acceptTransferModes(TransferMode.COPY); } } event.consume(); } }); scene.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { boolean success = false; Dragboard db = event.getDragboard(); if (event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType)) { Object object = db.getContent(LocalObjectMimeType); if (object instanceof MetricsViewTransferableData) { addSeries((MetricsViewTransferableData) object); success = true; } } event.setDropCompleted(success); event.consume(); } }); fxPanel.setScene(scene); } }); pack(); if (!loadPreferences()) { Rectangle otherRect = _coordinator.getMainFrame().getBounds(); Rectangle thisRect = getBounds(); if (otherRect.width < thisRect.width || otherRect.height < thisRect.height) { setLocationRelativeTo(null); } else { setLocationRelativeTo(_coordinator.getMainFrame()); } _splitPane.setDividerLocation(400); } setVisible(true); // // Show info dialog if required. // if (showInfo()) { JCheckBox checkbox = new JCheckBox("Do not show this message again."); String message = "Drop metrics cells to add them to the graph."; JOptionPane.showConfirmDialog(this, new Object[] { message, checkbox }, "Information", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); if (checkbox.isSelected()) { _preferences.node("GraphView").putBoolean("showInfo", false); } } }
From source file:net.dpml.depot.desktop.Desktop.java
License:Apache License
/** * Builds and answers the menu bar./*from ww w .j a v a 2 s .c o m*/ */ private JMenuBar buildMenuBar() { JMenu menu; JMenuBar menuBar = new JMenuBar(); menuBar.putClientProperty(Options.HEADER_STYLE_KEY, Boolean.TRUE); menu = new JMenu("File"); menu.add(new JMenuItem("New...")); menu.add(new JMenuItem("Open...")); menu.add(new JMenuItem("Save")); menu.addSeparator(); menu.add(new JMenuItem("Preferences...")); menu.addSeparator(); menu.add(new JMenuItem("Print...")); menuBar.add(menu); menu = new JMenu("Edit"); menu.add(new JMenuItem("Cut")); menu.add(new JMenuItem("Copy")); menu.add(new JMenuItem("Paste")); menuBar.add(menu); return menuBar; }
From source file:net.dpml.depot.desktop.Desktop.java
License:Apache License
/** * Builds the tool bar./*ww w . jav a 2 s. c om*/ */ private Component buildToolBar() { JToolBar toolBar = new JToolBar(); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); toolBar.putClientProperty(Options.HEADER_STYLE_KEY, Boolean.TRUE); m_apply = new ApplyButton(); toolBar.add(m_apply); m_undo = new UndoButton(); toolBar.add(m_undo); toolBar.addSeparator(); m_layout = new LayoutToggleButton(); toolBar.add(m_layout); return toolBar; }