List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
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); }/*www . j a v a2s.co m*/ 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:es.mityc.firmaJava.libreria.pkcs7.ValidaTarjeta.java
/** * This method initializes jPanel //from w w w. ja v a 2 s . com * * @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.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;/*from w w w . j av a2 s .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; }
From source file:com.xtructure.xevolution.gui.XEvolutionGui.java
/** * Creates a new {@link XEvolutionGui}./*w ww. j a v a 2 s.com*/ * * @param title * the base string for the title of the gui * @param visualizeData * the visualize data * @param dataTracker * the data tracker */ public XEvolutionGui(String title, VisualizeData visualizeData, DataTracker<?, ?> dataTracker) { this.title = title; frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); populationFiles = new ArrayList<File>(); menuBar = new MenuBar(this, frame, title); frame.setJMenuBar(menuBar); tabbedPane = new JTabbedPane(); tabbedPane.setPreferredSize(new Dimension(600, 400)); frame.getContentPane().add(tabbedPane); statusBar = new StatusBar(); frame.add(statusBar, BorderLayout.PAGE_END); graphPanel = new JPanel(); graphPanel.setLayout(new GridLayout(0, 1)); bufferSize = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(); bufferCount = 3; // max,avg,min graphsMap = new HashMap<XValId<?>, Graph>(); tabbedPane.addTab("Graphs", graphPanel); generationsPanel = new JPanel(); generationsPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 0.5; c.weighty = 0.5; populationPanel = new PopulationPanel(popLock); genomePanel = new GenomePanel(); genomePanel.addSortByAttributeId(Genome.FITNESS_ATTRIBUTE_ID); genomePanel.addSortByAttributeId(Genome.COMPLEXITY_ATTRIBUTE_ID); genomePanel.getSortComboBox().setSelectedItem(Genome.FITNESS_ATTRIBUTE_ID); c.gridx = 0; c.gridy = 0; generationsPanel.add(populationPanel, c); c.gridx = 1; c.gridy = 0; generationsPanel.add(genomePanel, c); tabbedPane.addTab("Generations", generationsPanel); genealogyPanel = new GenealogyPanel(dataTracker); tabbedPane.addTab("Genealogy", genealogyPanel); addGraph(Genome.FITNESS_ATTRIBUTE_ID); addGraph(Genome.COMPLEXITY_ATTRIBUTE_ID); this.dataTracker = dataTracker; new GuiListener(populationPanel, genomePanel, genealogyPanel, visualizeData, dataTracker); frame.setResizable(true); frame.pack(); frame.setVisible(true); catchUp(); }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java
private CollapsablePanel newThrobber(final String string) { final CollapsablePanel throbber = ThrobberFactory.getCollapsableThrobber(string, 2, 2); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0;//from w w w .j a v a 2 s . co m c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = throbberCount++; throbberPanel.add(throbber, c); return throbber; }
From source file:de.codesourcery.threadwatcher.ui.StatisticsPanel.java
public StatisticsPanel(FileReader reader) { this.reader = reader; table.setDefaultRenderer(TableEntry.class, new CellRenderer()); table.addMouseMotionListener(mouseListener); table.setBackground(Color.WHITE); table.setFillsViewportHeight(true);/* w ww.j a va2 s. c o m*/ setLayout(new GridBagLayout()); GridBagConstraints cnstrs = new GridBagConstraints(); cnstrs.gridheight = GridBagConstraints.REMAINDER; cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.fill = GridBagConstraints.BOTH; cnstrs.weightx = 1.0; cnstrs.weighty = 1.0; JScrollPane pane = new JScrollPane(table); pane.setBackground(Color.WHITE); add(pane, cnstrs); }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void createGraghTab() { JPanel cntlPanel = new JPanel(); JPanel plotPanel = createGraphPlotPanel(cntlPanel); add(plotPanel, "<html><div style='text-align: center;'>C<br>h<br>a<br>r<br>t</div></html>"); GridBagLayout gbl_cntlPanel = new GridBagLayout(); gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_cntlPanel.rowHeights = new int[] { 0, 0 }; gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };/*from w ww .j a va 2s. c om*/ gbl_cntlPanel.rowWeights = new double[] { 0 }; cntlPanel.setLayout(gbl_cntlPanel); GridBagConstraints gbc_check = new GridBagConstraints(); gbc_check.insets = insets2; gbc_check.gridx = 0; gbc_check.gridy = 0; checkBoxMafRpmData = new JCheckBox("MafV/RPM"); checkBoxMafRpmData.setActionCommand("mafrpm"); checkBoxMafRpmData.addActionListener(this); cntlPanel.add(checkBoxMafRpmData, gbc_check); gbc_check.gridx++; checkBoxRunData = new JCheckBox("AFR Error"); checkBoxRunData.setActionCommand("rdata"); checkBoxRunData.addActionListener(this); cntlPanel.add(checkBoxRunData, gbc_check); gbc_check.gridx++; createGraphCommonControls(cntlPanel, gbc_check.gridx); createChart(plotPanel, Y2AxisName); createMafSmoothingPanel(plotPanel); }
From source file:cool.pandora.modeller.ui.jpanel.iiif.PatchListFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*from ww w . ja va 2s . co m*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchListFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Lists"))); titlePaneContainer.add(titlePane.getControl()); titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH); pageControl.add(titlePaneContainer, BorderLayout.NORTH); final JPanel contentPane = new JPanel(); final DefaultBag bag = bagView.getBag(); if (bag != null) { map = bag.getInfo().getFieldMap(); } final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label")); urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description")); final JTextField urlField = new JTextField(""); final URI uri = IIIFObjectURI.getListContainerURI(map); try { urlField.setText(uri != null ? uri.toString() : null); } catch (final Exception e) { log.error("Failed to set url label", e); } final JLabel listServiceLabel = new JLabel(bagView.getPropertyMessage("listServiceLabel" + ".label")); listServiceLabel.setToolTipText(bagView.getPropertyMessage("listServiceLabel.description")); listServiceField = new JTextField(""); final String listService = IIIFObjectURI.getListServiceBaseURI(map); try { listServiceField.setText(listService); } catch (final Exception e) { log.error("Failed to set list service label", e); } final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints glbc = new GridBagConstraints(); final JPanel panel = new JPanel(layout); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); int row = 0; row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(urlLabel, glbc); panel.add(urlLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(urlField, glbc); panel.add(urlField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(listServiceLabel, glbc); panel.add(listServiceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(listServiceField, glbc); panel.add(listServiceField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GuiStandardUtils.attachDialogBorder(contentPane); pageControl.add(panel); final JComponent buttonBar = createButtonBar(); pageControl.add(buttonBar, BorderLayout.SOUTH); this.pack(); return pageControl; }
From source file:cool.pandora.modeller.ui.jpanel.text.CreateAreasFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();//from w ww . j a v a 2s . c o m final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreateAreasFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Areas in:"))); titlePaneContainer.add(titlePane.getControl()); titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH); pageControl.add(titlePaneContainer, BorderLayout.NORTH); final JPanel contentPane = new JPanel(); final DefaultBag bag = bagView.getBag(); if (bag != null) { map = bag.getInfo().getFieldMap(); } final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label")); urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description")); final JTextField urlField = new JTextField(""); final URI uri = TextObjectURI.getAreaContainerURI(map); try { urlField.setText(uri != null ? uri.toString() : null); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label")); hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description")); hocrResourceField = new JTextField(""); final String hocrResource = TextObjectURI.gethOCRResourceURI(map); try { hocrResourceField.setText(hocrResource); } catch (Exception e) { log.error("Failed to set hocrResource label", e); } final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints glbc = new GridBagConstraints(); final JPanel panel = new JPanel(layout); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); int row = 0; row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(urlLabel, glbc); panel.add(urlLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(urlField, glbc); panel.add(urlField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(hocrResourceLabel, glbc); panel.add(hocrResourceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hocrResourceField, glbc); panel.add(hocrResourceField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GuiStandardUtils.attachDialogBorder(contentPane); pageControl.add(panel); final JComponent buttonBar = createButtonBar(); pageControl.add(buttonBar, BorderLayout.SOUTH); this.pack(); return pageControl; }
From source file:cool.pandora.modeller.ui.jpanel.text.PatchPagesFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*from ww w.j a v a 2 s . com*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("PatchPagesFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Pages in:"))); titlePaneContainer.add(titlePane.getControl()); titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH); pageControl.add(titlePaneContainer, BorderLayout.NORTH); final JPanel contentPane = new JPanel(); final DefaultBag bag = bagView.getBag(); if (bag != null) { map = bag.getInfo().getFieldMap(); } final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label")); urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description")); final JTextField urlField = new JTextField(""); final URI uri = TextObjectURI.getPageContainerURI(map); try { assert uri != null; urlField.setText(uri.toString()); } catch (Exception e) { log.error("Failed to set url label", e); } final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label")); hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description")); hocrResourceField = new JTextField(""); final String hocrResource = TextObjectURI.gethOCRResourceURI(map); try { hocrResourceField.setText(hocrResource); } catch (Exception e) { log.error("Failed to set hocrResource label", e); } final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints glbc = new GridBagConstraints(); final JPanel panel = new JPanel(layout); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); int row = 0; row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(urlLabel, glbc); panel.add(urlLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(urlField, glbc); panel.add(urlField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(hocrResourceLabel, glbc); panel.add(hocrResourceLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(hocrResourceField, glbc); panel.add(hocrResourceField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GuiStandardUtils.attachDialogBorder(contentPane); pageControl.add(panel); final JComponent buttonBar = createButtonBar(); pageControl.add(buttonBar, BorderLayout.SOUTH); this.pack(); return pageControl; }