List of usage examples for java.awt Insets Insets
public Insets(int top, int left, int bottom, int right)
From source file:es.mityc.firmaJava.libreria.pkcs7.ValidaTarjeta.java
/** * This method initializes jPanel // w w w.j a va2 s. c om * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); // Ttulo gridBagConstraints12.anchor = GridBagConstraints.WEST; gridBagConstraints12.gridx = 0; gridBagConstraints12.gridy = 0; gridBagConstraints12.gridwidth = 3; gridBagConstraints12.insets = new Insets(0, 10, 20, 0); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); // Botn Cancelar gridBagConstraints21.gridx = 2; gridBagConstraints21.gridy = 4; gridBagConstraints21.insets = new Insets(20, 10, 10, 10); gridBagConstraints21.anchor = GridBagConstraints.WEST; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); // Botn Aceptar gridBagConstraints11.gridx = 1; gridBagConstraints11.gridy = 4; gridBagConstraints11.insets = new Insets(20, 10, 10, 10); gridBagConstraints11.anchor = GridBagConstraints.EAST; GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); // Campo del PIN gridBagConstraints6.anchor = GridBagConstraints.WEST; gridBagConstraints6.gridy = 3; gridBagConstraints6.gridx = 1; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); // Etiqueta PIN gridBagConstraints5.anchor = GridBagConstraints.EAST; gridBagConstraints5.gridx = 0; gridBagConstraints5.gridy = 3; gridBagConstraints5.insets = new Insets(10, 10, 10, 10); GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); // Botn Examinar gridBagConstraints4.gridx = 3; gridBagConstraints4.gridy = 2; gridBagConstraints4.insets = new Insets(10, 10, 10, 10); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); // Campo Librera gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints3.gridy = 2; gridBagConstraints3.gridx = 1; gridBagConstraints3.gridwidth = 2; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); // Etiqueta Librera gridBagConstraints2.anchor = GridBagConstraints.EAST; gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 2; gridBagConstraints2.insets = new Insets(10, 10, 10, 10); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); // Selector de Tarjetas gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridy = 1; gridBagConstraints1.gridx = 1; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.gridwidth = 2; GridBagConstraints gridBagConstraints = new GridBagConstraints(); // Etiqueta Tarjetas gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(10, 10, 10, 10); jTituloLabel = new JLabel(); jTituloLabel.setText(I18n.getResource(LIBRERIAXADES_VALIDARTARJETA_TEXTO_6)); jPinLabel = new JLabel(); jPinLabel.setText(I18n.getResource(LIBRERIAXADES_VALIDARTARJETA_TEXTO_7)); jLibreriaLabel = new JLabel(); jLibreriaLabel.setText(I18n.getResource(LIBRERIAXADES_VALIDARTARJETA_TEXTO_8)); jTarjetaLabel = new JLabel(); jTarjetaLabel.setText(I18n.getResource(LIBRERIAXADES_VALIDARTARJETA_TEXTO_9)); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(jTarjetaLabel, gridBagConstraints); jPanel.add(getJTarjetaComboBox(), gridBagConstraints1); jPanel.add(jLibreriaLabel, gridBagConstraints2); jPanel.add(getJTextField(), gridBagConstraints3); jPanel.add(getJExaminarButton(), gridBagConstraints4); jPanel.add(jPinLabel, gridBagConstraints5); jPanel.add(getJPinPasswordField(), gridBagConstraints6); jPanel.add(getJAceptarButton(), gridBagConstraints11); jPanel.add(getJCancelarButton(), gridBagConstraints21); jPanel.add(jTituloLabel, gridBagConstraints12); } return jPanel; }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
private GridBagConstraints constraintsForFirstColumnCheckbox() { GridBagConstraints gbc;/*from w w w . ja v a2 s. com*/ gbc = new java.awt.GridBagConstraints(); gbc.gridx = 0; gbc.insets = new Insets(INNER_GAP, INDENT, 0, 0); gbc.anchor = GridBagConstraints.LINE_START; return gbc; }
From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java
protected JPanel createDeviceTypePanel() { JPanel panel = new JPanel(); panel.setOpaque(false);// w w w.j a va 2 s .c om panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); panel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(8, 2, 2, 2); gc.weighty = 0; gc.weightx = 1; gc.gridwidth = GridBagConstraints.REMAINDER; gc.gridheight = 1; deviceTypeChartPanel = new ChartPanel(null); deviceTypeChartPanel.setPreferredSize(new Dimension(80, 60)); panel.add(deviceTypeChartPanel, gc); typeNumberLabels = new JLabel[nodeTypes.length]; typeNameLabels = new JLabel[nodeTypes.length]; gc.fill = GridBagConstraints.BOTH; gc.insets = new Insets(2, 2, 2, 2); for (int i = 0; i < nodeTypes.length; i++) { gc.weightx = 1; gc.gridwidth = 1; typeNumberLabels[i] = createNumberLabel(); panel.add(typeNumberLabels[i], gc); gc.weightx = 0; gc.gridwidth = GridBagConstraints.REMAINDER; typeNameLabels[i] = createNameLabel(nodeTypes[i].getName()); panel.add(typeNameLabels[i], gc); } return panel; }
From source file:edu.ku.brc.specify.plugins.FishBase.java
public void initialize(final Properties properties, final boolean isViewMode) { textField = new JTextField(); Insets insets = textField.getBorder().getBorderInsets(textField); textField.setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom)); textField.setForeground(Color.BLACK); textField.setEditable(false);/*from w w w . j a v a2s . c o m*/ ColorWrapper viewFieldColor = AppPrefsCache.getColorWrapper("ui", "formatting", "viewfieldcolor"); if (viewFieldColor != null) { textField.setBackground(viewFieldColor.getColor()); } PanelBuilder builder = new PanelBuilder(new FormLayout("f:p:g,1px,p", "c:p"), this); CellConstraints cc = new CellConstraints(); builder.add(textField, cc.xy(1, 1)); infoBtn = new JButton(IconManager.getIcon("FishBase", IconManager.IconSize.Std16)); infoBtn.setFocusable(false); infoBtn.setMargin(new Insets(1, 1, 1, 1)); infoBtn.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); builder.add(infoBtn, cc.xy(3, 1)); setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); infoBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { createInfoFrame(); } }); } }); }
From source file:com.anrisoftware.prefdialog.fields.filechooser.FileChooserField.java
private void setupButton() { JButton button = getOpenFileChooser(); button.setContentAreaFilled(false);/*w w w . j ava 2 s . c o m*/ button.setBorderPainted(true); button.setMargin(new Insets(0, 4, 0, 4)); }
From source file:edu.harvard.mcz.imagecapture.SpecimenBrowser.java
/** * This method initializes jPanel //from w w w . j av a 2s.c o m * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.fill = GridBagConstraints.BOTH; gridBagConstraints4.gridy = 0; gridBagConstraints4.weightx = 1.0; gridBagConstraints4.gridx = 7; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 6; gridBagConstraints3.gridy = 0; jLabel3 = new JLabel(); jLabel3.setText("Drawer:"); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.fill = GridBagConstraints.BOTH; gridBagConstraints21.gridy = 0; gridBagConstraints21.weightx = 1.0; gridBagConstraints21.gridx = 5; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 4; gridBagConstraints11.gridy = 0; jLabel2 = new JLabel(); jLabel2.setText("Family:"); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 2; gridBagConstraints2.insets = new Insets(0, 5, 0, 0); gridBagConstraints2.gridy = 0; jLabel1 = new JLabel(); jLabel1.setText("Workflow:"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridx = 3; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jLabel = new JLabel(); jLabel.setText("Find Barcode:"); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(jLabel, new GridBagConstraints()); jPanel.add(getJTextField(), gridBagConstraints); jPanel.add(getJComboBox(), gridBagConstraints1); jPanel.add(jLabel1, gridBagConstraints2); jPanel.add(jLabel2, gridBagConstraints11); jPanel.add(getJTextFieldFamily(), gridBagConstraints21); jPanel.add(jLabel3, gridBagConstraints3); jPanel.add(getJTextFieldDrawerNumber(), gridBagConstraints4); } return jPanel; }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
private GridBagConstraints constraintsForGroupLabel(boolean first) { GridBagConstraints gbc = new java.awt.GridBagConstraints(); gbc.gridx = 0;/* ww w. j a v a 2s. c om*/ gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = (first) ? new Insets(OUTER_GAP, OUTER_GAP, 0, OUTER_GAP) : new Insets(GROUP_SPACE, OUTER_GAP, 0, OUTER_GAP); return gbc; }
From source file:org.nuclos.client.layout.wysiwyg.component.properties.PropertyChartPropertyDomainStep.java
@Override public void prepare() { super.prepare(); chart = model.getChart();//w w w.j a v a 2 s.c om wysiwygChart = model.getWYSIWYGChart(); String sPrefix = getChartProperty(Chart.PROPERTY_COMBINED_PREFIXES); combinedPrefixes = (sPrefix == null) ? new StringBuffer("") : new StringBuffer(sPrefix); panel = new JPanel(); panel.setLayout(new BorderLayout()); final ChartFunction chartFunction = getChartFunction(); if (!chartFunction.isCombinedChart()) { panel.add(getPanelComponent(chartFunction, ""), BorderLayout.CENTER); } else { JPanel editorType = new JPanel(); editorType.setLayout(new GridBagLayout()); JLabel propTypeValue = new JLabel( //SpringLocaleDelegate.getInstance().getMessage("wysiwyg.chart.wizard.domain.value", "Diagramm hinzufgen:"/*)*/); editorType.add(propTypeValue, new GridBagConstraints(0, 0, 0, 1, 1D, 1D, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 0), 0, 0)); final JComboBox propTypeComponent = new JComboBox(chartFunction.getCombinedChartFunctions()); editorType.add(propTypeComponent, new GridBagConstraints(0, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 15, 0), 0, 0)); final JTabbedPane tabbedPane = new JTabbedPane(); JButton removeButton = new JButton(iconRemove); removeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (tabbedPane.getSelectedIndex() != -1) { PanelComponent panelComponent = (PanelComponent) tabbedPane.getSelectedComponent(); combinedPrefixes = new StringBuffer( combinedPrefixes.toString().replaceAll(panelComponent.prefix, "")); tabbedPane.remove(panelComponent); } } }); editorType.add(removeButton, new GridBagConstraints(1, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0)); JButton addButton = new JButton(iconAdd); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ChartFunction cFunction = (ChartFunction) propTypeComponent.getSelectedItem(); String prefix = cFunction.name() + "." + (Math.random() + "").replaceAll("\\.", "") + ":"; combinedPrefixes.append(prefix); tabbedPane.add(cFunction.name(), getPanelComponent(cFunction, prefix)); tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1); } }); editorType.add(addButton, new GridBagConstraints(2, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0)); String[] prefixes = combinedPrefixes.toString().split(":"); for (String prefix : prefixes) { if (prefix.length() > 0) { try { ChartFunction cFunction = ChartFunction.valueOf(prefix.split("\\.")[0]); tabbedPane.add(cFunction.name(), getPanelComponent(cFunction, prefix + ":")); } catch (Exception e) { // ignore. } } } panel.add(editorType, BorderLayout.NORTH); panel.add(tabbedPane, BorderLayout.CENTER); } }
From source file:com.digitalgeneralists.assurance.ui.MainWindow.java
private void initializeComponent() { if (!this.initialized) { logger.info("Initializing the main window."); if (AssuranceUtils.getPlatform() == Platform.MAC) { System.setProperty("apple.laf.useScreenMenuBar", "true"); com.apple.eawt.Application macApplication = com.apple.eawt.Application.getApplication(); MacApplicationAdapter macAdapter = new MacApplicationAdapter(this); macApplication.addApplicationListener(macAdapter); macApplication.setEnabledPreferencesMenu(true); }/*from ww w .j a va 2s. c om*/ this.setTitle(Application.applicationShortName); this.setDefaultCloseOperation(EXIT_ON_CLOSE); GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); this.topArea = new JTabbedPane(); this.scanLaunchPanel.setPreferredSize(new Dimension(600, 150)); this.scanHistoryPanel.setPreferredSize(new Dimension(600, 150)); this.topArea.addTab("Scan", this.scanLaunchPanel); this.topArea.addTab("History", this.scanHistoryPanel); this.resultsPanel.setPreferredSize(new Dimension(600, 400)); this.topArea.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { resultsPanel.resetPanel(); // NOTE: This isn't ideal. It feels brittle. if (topArea.getSelectedIndex() == viewHistoryMenuItemIndex) { viewHistoryMenuItem.setSelected(true); } else { viewScanMenuItem.setSelected(true); } } }); GridBagConstraints topPanelConstraints = new GridBagConstraints(); topPanelConstraints.anchor = GridBagConstraints.NORTH; topPanelConstraints.fill = GridBagConstraints.BOTH; topPanelConstraints.gridx = 0; topPanelConstraints.gridy = 0; topPanelConstraints.weightx = 1.0; topPanelConstraints.weighty = 0.33; topPanelConstraints.gridheight = 1; topPanelConstraints.gridwidth = 1; topPanelConstraints.insets = new Insets(0, 0, 0, 0); this.getContentPane().add(this.topArea, topPanelConstraints); GridBagConstraints resultsPanelConstraints = new GridBagConstraints(); resultsPanelConstraints.anchor = GridBagConstraints.SOUTH; resultsPanelConstraints.fill = GridBagConstraints.BOTH; resultsPanelConstraints.gridx = 0; resultsPanelConstraints.gridy = 1; resultsPanelConstraints.weightx = 1.0; resultsPanelConstraints.weighty = 0.67; resultsPanelConstraints.gridheight = 1; resultsPanelConstraints.gridwidth = 1; resultsPanelConstraints.insets = new Insets(0, 0, 0, 0); this.getContentPane().add(this.resultsPanel, resultsPanelConstraints); this.applicationDelegate.addEventObserver(ScanStartedEvent.class, this); this.applicationDelegate.addEventObserver(ScanCompletedEvent.class, this); this.applicationDelegate.addEventObserver(SetScanDefinitionMenuStateEvent.class, this); this.applicationDelegate.addEventObserver(SetScanResultsMenuStateEvent.class, this); this.applicationDelegate.addEventObserver(ApplicationConfigurationLoadedEvent.class, this); JMenu menu; JMenuItem menuItem; menuBar = new JMenuBar(); StringBuilder accessiblityLabel = new StringBuilder(128); if (AssuranceUtils.getPlatform() != Platform.MAC) { menu = new JMenu(Application.applicationShortName); menu.getAccessibleContext().setAccessibleDescription(accessiblityLabel.append("Actions for ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.quitApplicationMenuLabel, KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription(accessiblityLabel.append("Close the ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuItem.addActionListener(this); menuItem.setActionCommand(AssuranceActions.quitApplicationAction); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(MainWindow.aboutApplicationMenuLabel); menuItem.getAccessibleContext().setAccessibleDescription( accessiblityLabel.append("Display information about this version of ") .append(Application.applicationShortName).append(".").toString()); accessiblityLabel.setLength(0); menuItem.addActionListener(this); menuItem.setActionCommand(AssuranceActions.aboutApplicationAction); menu.add(menuItem); } menu = new JMenu("Scan"); menu.setMnemonic(KeyEvent.VK_S); menu.getAccessibleContext().setAccessibleDescription("Actions for file scans"); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.newScanDefinitonMenuLabel, KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Create a new scan definition"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.newScanDefinitonAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.deleteScanDefinitonMenuLabel, KeyEvent.VK_D); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Delete the selected scan definition"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.deleteScanDefinitonAction); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(MainWindow.scanMenuLabel, KeyEvent.VK_S); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription("Launch a scan using the selected scan definition"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.scanAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.scanAndMergeMenuLabel, KeyEvent.VK_M); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription( "Launch a scan using the selected scan definition and merge the results"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.scanAndMergeAction); menu.add(menuItem); menu = new JMenu("Results"); menu.setMnemonic(KeyEvent.VK_R); menu.getAccessibleContext().setAccessibleDescription("Actions for scan results"); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.replaceSourceMenuLabel, KeyEvent.VK_O); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription("Replace the source file with the target file"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.replaceSourceAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.replaceTargetMenuLabel, KeyEvent.VK_T); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription("Replace the target file with the source file"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.replaceTargetAction); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(MainWindow.sourceAttributesMenuLabel); menuItem.getAccessibleContext().setAccessibleDescription("View the source file attributes"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.sourceAttributesAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.targetAttributesMenuLabel); menuItem.getAccessibleContext().setAccessibleDescription("View the target file attributes"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.targetAttributesAction); menu.add(menuItem); menu = new JMenu("View"); menu.setMnemonic(KeyEvent.VK_V); menu.getAccessibleContext().setAccessibleDescription( accessiblityLabel.append("Views within ").append(Application.applicationShortName).toString()); accessiblityLabel.setLength(0); menuBar.add(menu); ButtonGroup group = new ButtonGroup(); this.viewScanMenuItem = new JRadioButtonMenuItem(MainWindow.viewScanMenuLabel); this.viewScanMenuItem.addActionListener(this); this.viewScanMenuItem.setActionCommand(AssuranceActions.viewScanAction); this.viewScanMenuItem.setSelected(true); group.add(this.viewScanMenuItem); menu.add(this.viewScanMenuItem); this.viewHistoryMenuItem = new JRadioButtonMenuItem(MainWindow.viewHistoryMenuLabel); this.viewHistoryMenuItem.addActionListener(this); this.viewHistoryMenuItem.setActionCommand(AssuranceActions.viewHistoryAction); this.viewHistoryMenuItem.setSelected(true); group.add(this.viewHistoryMenuItem); menu.add(this.viewHistoryMenuItem); if (AssuranceUtils.getPlatform() != Platform.MAC) { menu = new JMenu("Tools"); menu.getAccessibleContext() .setAccessibleDescription(accessiblityLabel.append("Additional actions for ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.settingsMenuLabel, KeyEvent.VK_COMMA); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription(accessiblityLabel.append("Change settings for the ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuItem.addActionListener(this); menuItem.setActionCommand(AssuranceActions.displaySettingsAction); menu.add(menuItem); } this.setJMenuBar(menuBar); this.initialized = true; } }
From source file:com.sec.ose.osi.ui.frm.main.identification.autoidentify.JPanImportSPDX.java
private JPanel getJPanelForOption() { if (jPanelForOption == null) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.gridx = -1;// w ww. j a va 2s. c o m gridBagConstraints.gridy = -1; gridBagConstraints.gridwidth = 1; gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.0; gridBagConstraints.insets = new Insets(0, 0, 0, 15); jPanelForOption = new JPanel(); jPanelForOption.setLayout(new GridBagLayout()); jPanelForOption.setBorder(BorderFactory.createTitledBorder(null, "Identify Option", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelForOption.add(getJPanelOption(), gridBagConstraints); } return jPanelForOption; }