List of usage examples for javax.swing Box createGlue
public static Component createGlue()
From source file:org.isatools.isacreator.gui.formelements.SubForm.java
private JPanel setupOptionsPanel() { options = new JPanel(); options.setLayout(new BoxLayout(options, BoxLayout.LINE_AXIS)); options.setOpaque(false);/*from w w w . j a v a 2s . c om*/ String addRecordString = fieldType == FieldTypes.ASSAY && dataEntryForm != null ? "create assay" : "add a new " + fieldType + " column"; final JLabel addRecord = new JLabel(addRecordString, addRecordIcon, JLabel.LEFT); String toolTipText; if (fieldType == FieldTypes.ASSAY) { toolTipText = "<html><b>Create a new Assay</b>" + " <p>Complete the details for the assay in the fields provided</p>" + " <p>and click this button to add the assay to this study...</p>" + "</html>"; } else { toolTipText = "<html><b>Add a new " + fieldType + "</b>" + " <p>Click here to add a new column to enter an additional " + fieldType + "</p>" + "</html>"; } addRecord.setToolTipText(toolTipText); Font fontToUse = fieldType == FieldTypes.ASSAY && dataEntryForm != null ? UIHelper.VER_12_BOLD : UIHelper.VER_12_PLAIN; UIHelper.renderComponent(addRecord, fontToUse, UIHelper.DARK_GREEN_COLOR, false); addRecord.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { addRecord.setIcon(addRecordIcon); if (addColumn()) { updateTables(); } } @Override public void mouseEntered(MouseEvent mouseEvent) { addRecord.setIcon(addRecordIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { addRecord.setIcon(addRecordIcon); } }); options.add(addRecord); options.add(Box.createHorizontalStrut(10)); removeRecord = new JLabel("Remove " + fieldType + "...", removeIcon, JLabel.LEFT); removeRecord.setVisible(false); UIHelper.renderComponent(removeRecord, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, false); removeRecord.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if (removeRecord.getIcon() != null) { removeRecord.setIcon(removeIcon); } removalConfirmation(fieldType); } @Override public void mouseExited(MouseEvent mouseEvent) { if (removeRecord.getIcon() != null) { removeRecord.setIcon(removeIcon); } } @Override public void mouseEntered(MouseEvent mouseEvent) { if (removeRecord.getIcon() != null) { removeRecord.setIcon(removeIconOver); } } }); if (!showRemoveOption) { removeRecord.setIcon(null); removeRecord.setText(""); } options.add(removeRecord); options.add(Box.createHorizontalStrut(10)); createCustomOptions(); options.add(Box.createGlue()); return options; }
From source file:org.nuclos.client.customcomp.resplan.ResPlanPanel.java
public ResPlanPanel(ResPlanController cntrl, CollectableResPlanModel model, DateTimeModel timeModel) { final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance(); this.controller = cntrl; this.timeModel = timeModel; this.resPlanModel = model; setLayout(new BorderLayout()); JToolBar tb = UIUtils.createNonFloatableToolBar(); tb.setFloatable(false);/*from ww w . j a v a2 s . c o m*/ tb.add(new AbstractAction(localeDelegate.getText("nuclos.resplan.action.refresh"), Icons.getInstance().getIconRefresh16()) { @Override public void actionPerformed(ActionEvent e) { controller.refresh(); } }); tb.add(exportAction); tb.addSeparator(); this.timeHorizon = new Interval<Date>(model.getDefaultViewFrom(), model.getDefaultViewUntil()); final LabeledComponentSupport support = new LabeledComponentSupport(); startDateChooser = new DateChooser(support, timeHorizon.getStart()); startDateChooser.setMinimumSize(startDateChooser.getPreferredSize()); startDateChooser.setMaximumSize(startDateChooser.getPreferredSize()); endDateChooser = new DateChooser(support, timeHorizon.getEnd()); endDateChooser.setMinimumSize(endDateChooser.getPreferredSize()); endDateChooser.setMaximumSize(endDateChooser.getPreferredSize()); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.from"))); tb.add(startDateChooser); tb.add(Box.createHorizontalStrut(5)); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.until"))); tb.add(endDateChooser); timeGranularityModel = new ListComboBoxModel<ResPlanController.TimeGranularity>( controller.getTimeGranularityOptions()); tb.addSeparator(); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.granularity"))); timeGranularityComboBox = new JComboBox(timeGranularityModel); tb.add(timeGranularityComboBox); timeGranularityComboBox .setMaximumSize(Orientation.VERTICAL.updateExtent(timeGranularityComboBox.getPreferredSize(), 20)); tb.addSeparator(); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.resourceFilter"))); searchFilterComboBox = new JComboBox(); searchFilterComboBox.setRenderer(new SearchFilterListCellRenderer()); refreshSearchFilter(); tb.add(searchFilterComboBox); searchFilterComboBox .setMaximumSize(Orientation.VERTICAL.updateExtent(searchFilterComboBox.getPreferredSize(), 20)); tb.add(Box.createGlue()); infoButton = new JButton(infoAction); infoButton.setVisible(false); tb.add(infoButton); tb.add(Box.createHorizontalStrut(3)); initJResPlan(); ActionListener dateChooserListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { timeHorzionChanged(); } }; startDateChooser.addActionListener(dateChooserListener); endDateChooser.addActionListener(dateChooserListener); timeGranularityComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Runnable runnable = createScrollToCurrentAreaRunnable(); ResPlanController.TimeGranularity granularity = timeGranularityModel.getSelectedItem(); resPlan.setTimeModel(granularity.getTimeModel()); resPlan.getTimelineHeader().setCategoryModel(granularity.getHeaderCategories()); SwingUtilities.invokeLater(runnable); } } }); searchFilterComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { EntitySearchFilter filter = (EntitySearchFilter) searchFilterComboBox.getSelectedItem(); if (filter instanceof NewCustomSearchFilter) { runCustomSearch(); return; } setSearchCondition(filter.getSearchCondition()); } } }); scrollPane = new JScrollPane(resPlan); JButton corner = new JButton(switchOrientationAction); corner.setBorderPainted(false); scrollPane.setCorner(JScrollPane.LOWER_RIGHT_CORNER, corner); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); add(tb, BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); resPlan.setTimeHorizon(this.timeHorizon); resPlan.invalidate(); setFocusable(true); setFocusCycleRoot(true); getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("DELETE"), "delete"); //getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("control F"), "find"); getActionMap().put("delete", removeAction); //getActionMap().put("find", findAction); KeyBindingProvider.bindActionToComponent(KeyBindingProvider.ACTIVATE_SEARCH_PANEL_2, findAction, this); }
From source file:org.openmicroscopy.shoola.agents.measurement.view.IntensityView.java
/** Builds and lays out the UI. */ private void buildGUI() { JPanel scrollPanel = new JPanel(); JPanel containerPanel = new JPanel(); containerPanel.setLayout(new BoxLayout(containerPanel, BoxLayout.X_AXIS)); JPanel tPanel = tablePanel(); containerPanel.add(zSlider);//from w ww . ja va 2 s .c om containerPanel.add(tPanel); JPanel cPanel = new JPanel(); cPanel.setLayout(new BoxLayout(cPanel, BoxLayout.Y_AXIS)); cPanel.add(containerPanel); cPanel.add(tSlider); JPanel buttonPanel = createButtonPanel(); scrollPanel.setLayout(new BoxLayout(scrollPanel, BoxLayout.X_AXIS)); scrollPanel.add(cPanel); scrollPanel.add(buttonPanel); scrollPanel.add(Box.createGlue()); this.setLayout(new BorderLayout()); this.add(scrollPanel, BorderLayout.CENTER); intensityDialog = new IntensityValuesDialog(view, tableModel, channelSelection); }
From source file:org.pentaho.ui.xul.swing.SwingElement.java
public void layout() { super.layout(); double totalFlex = 0.0; if (isVisible() == false) { resetContainer();//from w w w . j ava 2 s. c o m return; } for (Element comp : getChildNodes()) { // if (comp.getManagedObject() == null) { // continue; // } if (((XulComponent) comp).getFlex() > 0) { flexLayout = true; totalFlex += ((XulComponent) comp).getFlex(); } } double currentFlexTotal = 0.0; Align alignment = (getAlign() != null) ? Align.valueOf(this.getAlign().toUpperCase()) : null; for (int i = 0; i < getChildNodes().size(); i++) { XulComponent comp = (XulComponent) getChildNodes().get(i); gc.fill = GridBagConstraints.BOTH; if (comp instanceof XulSplitter) { JPanel prevContainer = container; container = new ScrollablePanel(new GridBagLayout()); container.setOpaque(false); final JSplitPane splitter = new JSplitPane( (this.getOrientation() == Orient.VERTICAL) ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT, prevContainer, container); splitter.setContinuousLayout(true); final double splitterSize = currentFlexTotal / totalFlex; splitter.setResizeWeight(splitterSize); if (totalFlex > 0) { splitter.addComponentListener(new ComponentListener() { public void componentHidden(ComponentEvent arg0) { } public void componentMoved(ComponentEvent arg0) { } public void componentShown(ComponentEvent arg0) { } public void componentResized(ComponentEvent arg0) { splitter.setDividerLocation(splitterSize); splitter.removeComponentListener(this); } }); } if (!flexLayout) { if (this.getOrientation() == Orient.VERTICAL) { // VBox and such gc.weighty = 1.0; } else { gc.weightx = 1.0; } prevContainer.add(Box.createGlue(), gc); } setManagedObject(splitter); } Object maybeComponent = comp.getManagedObject(); if (maybeComponent == null || !(maybeComponent instanceof Component)) { continue; } if (this.getOrientation() == Orient.VERTICAL) { // VBox and such gc.gridheight = comp.getFlex() + 1; gc.gridwidth = GridBagConstraints.REMAINDER; gc.weighty = (totalFlex == 0) ? 0 : (comp.getFlex() / totalFlex); } else { gc.gridwidth = comp.getFlex() + 1; gc.gridheight = GridBagConstraints.REMAINDER; gc.weightx = (totalFlex == 0) ? 0 : (comp.getFlex() / totalFlex); } currentFlexTotal += comp.getFlex(); if (this.getOrientation() == Orient.VERTICAL) { // VBox and such if (alignment != null) { gc.fill = GridBagConstraints.NONE; switch (alignment) { case START: gc.anchor = GridBagConstraints.WEST; break; case CENTER: gc.anchor = GridBagConstraints.CENTER; break; case END: gc.anchor = GridBagConstraints.EAST; break; } } } else { if (alignment != null) { gc.fill = GridBagConstraints.NONE; switch (alignment) { case START: gc.anchor = GridBagConstraints.NORTH; break; case CENTER: gc.anchor = GridBagConstraints.CENTER; break; case END: gc.anchor = GridBagConstraints.SOUTH; break; } } } Component component = (Component) maybeComponent; if (comp.getWidth() > 0 || comp.getHeight() > 0) { Dimension minSize = component.getMinimumSize(); Dimension prefSize = component.getPreferredSize(); if (comp.getWidth() > 0) { minSize.width = comp.getWidth(); prefSize.width = comp.getWidth(); } if (comp.getHeight() > 0) { minSize.height = comp.getHeight(); prefSize.height = comp.getHeight(); } component.setMinimumSize(minSize); component.setPreferredSize(prefSize); } container.add(component, gc); if (i + 1 == getChildNodes().size() && !flexLayout) { if (this.getOrientation() == Orient.VERTICAL) { // VBox and such gc.weighty = 1.0; } else { gc.weightx = 1.0; } container.add(Box.createGlue(), gc); } } }
From source file:org.pentaho.ui.xul.swing.tags.SwingGrid.java
@Override public void layout() { if (this.getChildNodes().size() < 2) { logger.warn("Grid does not contain Column and Row children"); return;/*from w w w .j a va 2s.c o m*/ } XulComponent columns = this.getChildNodes().get(0); XulComponent rows = this.getChildNodes().get(1); int colCount = 0; int rowCount = 0; float colFlexTotal = 0; float rowTotalFlex = 0; for (XulComponent col : columns.getChildNodes()) { if (col.getFlex() > 0) { colFlexTotal += col.getFlex(); } colCount++; } for (XulComponent row : rows.getChildNodes()) { if (row.getFlex() > 0) { rowTotalFlex += row.getFlex(); } rowCount++; } for (XulComponent row : rows.getChildNodes()) { gc.gridx = 0; for (XulComponent xulComp : row.getChildNodes()) { gc.weightx = 0.0; gc.gridwidth = 1; gc.gridheight = 1; gc.weighty = 0.0; gc.anchor = GridBagConstraints.NORTHWEST; gc.fill = GridBagConstraints.NONE; Component comp = (Component) xulComp.getManagedObject(); float colFlex = columns.getChildNodes().get(gc.gridx).getFlex(); int rowFlex = row.getFlex(); Align colAlignment = null; Align rowAlignment = null; String colAlignmentStr = xulComp.getAlign(); String rowAlignStr = row.getAlign(); if (colAlignmentStr != null) { colAlignment = Align.valueOf(colAlignmentStr); } if (rowAlignStr != null) { rowAlignment = Align.valueOf(rowAlignStr); } if (colFlex > 0) { gc.weightx = (colFlex / colFlexTotal); } if (rowFlex > 0) { gc.weighty = (rowFlex / rowTotalFlex); } if (colAlignment == Align.STRETCH && xulComp.getFlex() > 0) { gc.fill = GridBagConstraints.BOTH; } else if (colAlignment == Align.STRETCH) { gc.fill = GridBagConstraints.HORIZONTAL; } else if (xulComp.getFlex() > 0) { gc.fill = GridBagConstraints.VERTICAL; } if (row.getChildNodes().indexOf(xulComp) + 1 == row.getChildNodes().size()) { gc.gridwidth = GridBagConstraints.REMAINDER; } else { gc.gridwidth = 1; } if (rows.getChildNodes().indexOf(row) + 1 == rows.getChildNodes().size()) { gc.gridheight = GridBagConstraints.REMAINDER; } else { gc.gridheight = 1; } // gc.gridheight = row.getFlex() + 1; if (colAlignment != null && rowAlignment != null) { switch (rowAlignment) { case START: switch (colAlignment) { case START: gc.anchor = GridBagConstraints.NORTHWEST; break; case CENTER: gc.anchor = GridBagConstraints.NORTH; break; case END: gc.anchor = GridBagConstraints.NORTHEAST; break; } break; case CENTER: switch (colAlignment) { case START: gc.anchor = GridBagConstraints.WEST; break; case CENTER: gc.anchor = GridBagConstraints.CENTER; break; case END: gc.anchor = GridBagConstraints.EAST; break; } break; case END: switch (colAlignment) { case START: gc.anchor = GridBagConstraints.SOUTHWEST; break; case CENTER: gc.anchor = GridBagConstraints.SOUTH; break; case END: gc.anchor = GridBagConstraints.SOUTHEAST; break; } } } else if (rowAlignment != null) { switch (rowAlignment) { case START: gc.anchor = GridBagConstraints.NORTHWEST; break; case CENTER: gc.anchor = GridBagConstraints.WEST; break; case END: gc.anchor = GridBagConstraints.SOUTHWEST; break; } } else if (colAlignment != null) { switch (colAlignment) { case START: gc.anchor = GridBagConstraints.NORTHWEST; break; case CENTER: gc.anchor = GridBagConstraints.NORTH; break; case END: gc.anchor = GridBagConstraints.NORTHEAST; break; } } if (comp.getWidth() > 0 || comp.getHeight() > 0) { Dimension minSize = comp.getMinimumSize(); Dimension prefSize = comp.getPreferredSize(); if (comp.getWidth() > 0) { minSize.width = comp.getWidth(); prefSize.width = comp.getWidth(); } if (comp.getHeight() > 0) { minSize.height = comp.getHeight(); prefSize.height = comp.getHeight(); } comp.setMinimumSize(minSize); comp.setPreferredSize(prefSize); } else { comp.setPreferredSize(comp.getMinimumSize()); } grid.add(comp, gc); gc.gridx++; } gc.gridy++; } if (rowTotalFlex == 0) { // Add in an extra row at the bottom to push others up gc.gridy++; gc.weighty = 1; gc.fill = gc.REMAINDER; grid.add(Box.createGlue(), gc); } this.initialized = true; }
From source file:org.rimudb.editor.DescriptorEditor.java
private JPanel createButtonPanel() { addColumnBtn = createMenuButtonVert("Add..."); addColumnBtn.setName("AddColumnBtn"); addColumnBtn.addActionListener(this); removeColumnBtn = createMenuButtonVert("Remove"); removeColumnBtn.setName("RemoveColumnBtn"); removeColumnBtn.setEnabled(false);//from ww w . j a v a2s. c o m removeColumnBtn.addActionListener(this); moveUpBtn = createMenuButtonVert("Move up"); moveUpBtn.setName("MoveUpBtn"); moveUpBtn.setEnabled(false); moveUpBtn.addActionListener(this); moveDownBtn = createMenuButtonVert("Move down"); moveDownBtn.setName("MoveDownBtn"); moveDownBtn.setEnabled(false); moveDownBtn.addActionListener(this); addPkBtn = createMenuButtonVert("Add..."); addPkBtn.setName("AddPkBtn"); addPkBtn.addActionListener(this); removePkBtn = createMenuButtonVert("Remove"); removePkBtn.setName("RemovePkBtn"); removePkBtn.setEnabled(false); removePkBtn.addActionListener(this); JPanel buttonPanel = new JPanel(); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0)); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS)); buttonPanel.add(addColumnBtn); buttonPanel.add(Box.createRigidArea(new Dimension(0, 5))); buttonPanel.add(removeColumnBtn); buttonPanel.add(Box.createRigidArea(new Dimension(0, 5))); buttonPanel.add(moveUpBtn); buttonPanel.add(Box.createRigidArea(new Dimension(0, 5))); buttonPanel.add(moveDownBtn); buttonPanel.add(Box.createRigidArea(new Dimension(0, 242))); buttonPanel.add(addPkBtn); buttonPanel.add(Box.createRigidArea(new Dimension(0, 5))); buttonPanel.add(removePkBtn); buttonPanel.add(Box.createGlue()); return buttonPanel; }
From source file:org.tinymediamanager.ui.MainWindow.java
/** * Create the application.//from w w w . j a v a2s. c o m * * @param name * the name */ public MainWindow(String name) { super(name); setName("mainWindow"); setMinimumSize(new Dimension(1000, 700)); instance = this; JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnTmm = new JMenu("tinyMediaManager"); mnTmm.setMnemonic(KeyEvent.VK_T); menuBar.add(mnTmm); if (!Globals.isDonator()) { mnTmm.add(new RegisterDonatorVersionAction()); } mnTmm.add(new SettingsAction()); mnTmm.addSeparator(); mnTmm.add(new LaunchUpdaterAction()); mnTmm.addSeparator(); mnTmm.add(new ExitAction()); initialize(); // tools menu JMenu tools = new JMenu(BUNDLE.getString("tmm.tools")); //$NON-NLS-1$ tools.setMnemonic(KeyEvent.VK_O); tools.add(new ClearDatabaseAction()); JMenu cache = new JMenu(BUNDLE.getString("tmm.cache")); //$NON-NLS-1$ cache.setMnemonic(KeyEvent.VK_C); tools.add(cache); JMenuItem clearImageCache = new JMenuItem(new ClearImageCacheAction()); clearImageCache.setMnemonic(KeyEvent.VK_I); cache.add(clearImageCache); JMenuItem rebuildImageCache = new JMenuItem(new RebuildImageCacheAction()); rebuildImageCache.setMnemonic(KeyEvent.VK_R); cache.add(rebuildImageCache); JMenuItem tmmFolder = new JMenuItem(BUNDLE.getString("tmm.gotoinstalldir")); //$NON-NLS-1$ tmmFolder.setMnemonic(KeyEvent.VK_I); tools.add(tmmFolder); tmmFolder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Path path = Paths.get(System.getProperty("user.dir")); try { // check whether this location exists if (Files.exists(path)) { TmmUIHelper.openFile(path); } } catch (Exception ex) { LOGGER.error("open filemanager", ex); MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, path, "message.erroropenfolder", new String[] { ":", ex.getLocalizedMessage() })); } } }); JMenuItem tmmLogs = new JMenuItem(BUNDLE.getString("tmm.errorlogs")); //$NON-NLS-1$ tmmLogs.setMnemonic(KeyEvent.VK_L); tools.add(tmmLogs); tmmLogs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JDialog logDialog = new LogDialog(); logDialog.setLocationRelativeTo(MainWindow.getActiveInstance()); logDialog.setVisible(true); } }); JMenuItem tmmMessages = new JMenuItem(BUNDLE.getString("tmm.messages")); //$NON-NLS-1$ tmmMessages.setMnemonic(KeyEvent.VK_L); tools.add(tmmMessages); tmmMessages.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JDialog messageDialog = MessageHistoryDialog.getInstance(); messageDialog.setVisible(true); } }); tools.addSeparator(); final JMenu menuWakeOnLan = new JMenu(BUNDLE.getString("tmm.wakeonlan")); //$NON-NLS-1$ menuWakeOnLan.setMnemonic(KeyEvent.VK_W); menuWakeOnLan.addMenuListener(new MenuListener() { @Override public void menuCanceled(MenuEvent arg0) { } @Override public void menuDeselected(MenuEvent arg0) { } @Override public void menuSelected(MenuEvent arg0) { menuWakeOnLan.removeAll(); for (final WolDevice device : Globals.settings.getWolDevices()) { JMenuItem item = new JMenuItem(device.getName()); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Utils.sendWakeOnLanPacket(device.getMacAddress()); } }); menuWakeOnLan.add(item); } } }); tools.add(menuWakeOnLan); // activate/deactivate WakeOnLan menu item tools.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { if (Globals.settings.getWolDevices().size() > 0) { menuWakeOnLan.setEnabled(true); } else { menuWakeOnLan.setEnabled(false); } } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); if (Globals.isDebug()) { final JMenu debugMenu = new JMenu("Debug"); //$NON-NLS-1$ JMenuItem trace = new JMenuItem("set Logger to TRACE"); //$NON-NLS-1$ trace.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); lc.getLogger("org.tinymediamanager").setLevel(Level.TRACE); MessageManager.instance.pushMessage(new Message("Trace levels set!", "")); LOGGER.trace("if you see that, we're now on TRACE logging level ;)"); } }); debugMenu.add(trace); tools.add(debugMenu); } menuBar.add(tools); mnTmm = new JMenu(BUNDLE.getString("tmm.contact")); //$NON-NLS-1$ mnTmm.setMnemonic(KeyEvent.VK_C); mnTmm.add(new FeedbackAction()).setMnemonic(KeyEvent.VK_F); mnTmm.add(new BugReportAction()).setMnemonic(KeyEvent.VK_B); menuBar.add(mnTmm); mnTmm = new JMenu(BUNDLE.getString("tmm.help")); //$NON-NLS-1$ mnTmm.setMnemonic(KeyEvent.VK_H); menuBar.add(mnTmm); mnTmm.add(new WikiAction()).setMnemonic(KeyEvent.VK_W); mnTmm.add(new FaqAction()).setMnemonic(KeyEvent.VK_F); mnTmm.add(new ForumAction()).setMnemonic(KeyEvent.VK_O); mnTmm.addSeparator(); mnTmm.add(new AboutAction()).setMnemonic(KeyEvent.VK_A); menuBar.add(Box.createGlue()); if (!Globals.isDonator()) { JButton btnDonate = new JButton(new DonateAction()); btnDonate.setBorderPainted(false); btnDonate.setFocusPainted(false); btnDonate.setContentAreaFilled(false); menuBar.add(btnDonate); } checkForUpdate(); }
From source file:phex.gui.dialogs.security.SecurityRuleDialog.java
@Override protected JPanel createDialogContentPanel() { initComponents();//from w w w . j a v a 2s .co m JPanel contentPanel = new JPanel(); FormLayout layout = new FormLayout("7dlu, d, 3dlu, d, 1dlu, d, 1dlu, d, fill:d:grow"); DefaultFormBuilder builder = new DefaultFormBuilder(layout, contentPanel); builder.setLeadingColumnOffset(1); builder.appendSeparator(Localizer.getString("SecurityRuleDialog_SecurityRule")); builder.append(Localizer.getString("SecurityRuleDialog_Description"), descriptionTF, 6); builder.append(disableRuleCkBx, 8); builder.appendSeparator(Localizer.getString("SecurityRuleDialog_NetworkAddress")); builder.append(Localizer.getString("SecurityRuleDialog_IP_CIDR"), ipTF); builder.append(Localizer.getString("SecurityRuleDialog_IP_CIDR_Separator"), cidrTF, true); builder.appendSeparator(Localizer.getString("SecurityRuleDialog_Options")); //builder.append( Localizer.getString( "SecurityRuleDialog_ActionType" ), // ruleTypeCBox, 5 ); builder.append(Localizer.getString("SecurityRuleDialog_Expires"), expiresCBox, 5); builder.append(Box.createGlue()); builder.append(createTimePanel(), 6); builder.append(Box.createGlue()); builder.append(isDeletedOnExpiryCkbx, 6); refreshExpiryDisplayState(); return contentPanel; }
From source file:ro.nextreports.designer.wizpublish.DownloadListWizardPanel.java
private void init() { setLayout(new GridBagLayout()); btnAdd.setIcon(ImageUtil.getImageIcon("add")); btnAdd.setPreferredSize(btnDim);/*from w w w .j a v a 2s . c o m*/ btnAdd.setMinimumSize(btnDim); btnAdd.setMaximumSize(btnDim); btnAdd.setToolTipText(I18NSupport.getString("listselectionpanel.add")); btnAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { add(); } }); btnRem.setIcon(ImageUtil.getImageIcon("delete")); btnRem.setPreferredSize(btnDim); btnRem.setMinimumSize(btnDim); btnRem.setMaximumSize(btnDim); btnRem.setToolTipText(I18NSupport.getString("listselectionpanel.remove")); btnRem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { remove(); } }); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { remove(); } } }); scrList.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrList.setMinimumSize(scrDim); scrList.setPreferredSize(scrDim); scrList.getViewport().add(list, null); list.setModel(listModel); JPanel btnPanel = new JPanel(); btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.Y_AXIS)); btnPanel.add(Box.createGlue()); btnPanel.add(btnAdd); btnPanel.add(Box.createRigidArea(new Dimension(5, 5))); btnPanel.add(btnRem); btnPanel.add(Box.createGlue()); add(scrList, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); add(btnPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); }
From source file:ro.nextreports.designer.wizpublish.SelectEntityWizardPanel.java
private void jbInit() { this.setLayout(new GridBagLayout()); banner.setTitle(I18NSupport.getString("wizard.publish.entities.select")); btnAdd.setIcon(ImageUtil.getImageIcon("add")); btnAdd.setPreferredSize(btnDim);//from ww w. j ava 2s.com btnAdd.setMinimumSize(btnDim); btnAdd.setMaximumSize(btnDim); btnAdd.setToolTipText(I18NSupport.getString("listselectionpanel.add")); btnAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { add(); } }); btnRem.setIcon(ImageUtil.getImageIcon("delete")); btnRem.setPreferredSize(btnDim); btnRem.setMinimumSize(btnDim); btnRem.setMaximumSize(btnDim); btnRem.setToolTipText(I18NSupport.getString("listselectionpanel.remove")); btnRem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { remove(); } }); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { remove(); } } }); scrList.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrList.setMinimumSize(scrDim); scrList.setPreferredSize(scrDim); scrList.getViewport().add(list, null); list.setModel(listModel); JPanel btnPanel = new JPanel(); btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.Y_AXIS)); btnPanel.add(Box.createGlue()); btnPanel.add(btnAdd); btnPanel.add(Box.createRigidArea(new Dimension(5, 5))); btnPanel.add(btnRem); btnPanel.add(Box.createGlue()); add(scrList, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); add(btnPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); }