List of usage examples for java.awt GridBagLayout GridBagLayout
public GridBagLayout()
From source file:org.altusmetrum.altosuilib_2.AltosUIEnable.java
public AltosUIEnable() { il = new Insets(4, 4, 4, 4); ir = new Insets(4, 4, 4, 4); x = 0;// w w w. ja va 2 s. c o m y = 0; setLayout(new GridBagLayout()); add_units(); }
From source file:analysers.FilterValidatedDialog.java
/** * Create the dialog.//from www. j av a 2 s.com */ public FilterValidatedDialog() { setTitle("Validated Lineages: Export Filter"); setBounds(100, 100, 632, 348); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 160, 440, 0 }; gbl_contentPanel.rowHeights = new int[] { 1, 28, 28, 28, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE }; contentPanel.setLayout(gbl_contentPanel); { JLabel lblCriterion = new JLabel("Lineage Criterion"); lblCriterion.setFont(new Font("Lucida Grande", Font.BOLD, 13)); GridBagConstraints gbc_lblCriterion = new GridBagConstraints(); gbc_lblCriterion.insets = new Insets(0, 0, 5, 5); gbc_lblCriterion.gridx = 0; gbc_lblCriterion.gridy = 0; contentPanel.add(lblCriterion, gbc_lblCriterion); } { JLabel lblValue = new JLabel("Value"); lblValue.setFont(new Font("Lucida Grande", Font.BOLD, 13)); GridBagConstraints gbc_lblValue = new GridBagConstraints(); gbc_lblValue.insets = new Insets(0, 0, 5, 0); gbc_lblValue.gridx = 1; gbc_lblValue.gridy = 0; contentPanel.add(lblValue, gbc_lblValue); } { lblMinLineageLength = new JLabel("Min. Length (frames)"); GridBagConstraints gbc_lblMinLineageLength = new GridBagConstraints(); gbc_lblMinLineageLength.fill = GridBagConstraints.BOTH; gbc_lblMinLineageLength.insets = new Insets(0, 0, 5, 5); gbc_lblMinLineageLength.gridx = 0; gbc_lblMinLineageLength.gridy = 1; contentPanel.add(lblMinLineageLength, gbc_lblMinLineageLength); } { minLinLen = new JTextField(); GridBagConstraints gbc_minLinLen = new GridBagConstraints(); gbc_minLinLen.anchor = GridBagConstraints.NORTH; gbc_minLinLen.fill = GridBagConstraints.HORIZONTAL; gbc_minLinLen.insets = new Insets(0, 0, 5, 0); gbc_minLinLen.gridx = 1; gbc_minLinLen.gridy = 1; contentPanel.add(minLinLen, gbc_minLinLen); minLinLen.setText("1"); minLinLen.setColumns(3); } { lblStartFrameOf = new JLabel("Max. Start Frame"); GridBagConstraints gbc_lblStartFrameOf = new GridBagConstraints(); gbc_lblStartFrameOf.fill = GridBagConstraints.HORIZONTAL; gbc_lblStartFrameOf.insets = new Insets(0, 0, 5, 5); gbc_lblStartFrameOf.gridx = 0; gbc_lblStartFrameOf.gridy = 2; contentPanel.add(lblStartFrameOf, gbc_lblStartFrameOf); } { startLin = new JTextField(); GridBagConstraints gbc_startLin = new GridBagConstraints(); gbc_startLin.insets = new Insets(0, 0, 5, 0); gbc_startLin.fill = GridBagConstraints.HORIZONTAL; gbc_startLin.gridx = 1; gbc_startLin.gridy = 2; contentPanel.add(startLin, gbc_startLin); startLin.setText("-1"); startLin.setColumns(3); } { JButton btnPreview = new JButton("Preview"); btnPreview.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { preview.setText(makePreview()); } }); GridBagConstraints gbc_btnPreview = new GridBagConstraints(); gbc_btnPreview.insets = new Insets(0, 0, 5, 5); gbc_btnPreview.gridx = 0; gbc_btnPreview.gridy = 3; contentPanel.add(btnPreview, gbc_btnPreview); } { JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.insets = new Insets(0, 0, 5, 0); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 3; contentPanel.add(scrollPane, gbc_scrollPane); { preview = new JTextArea(); scrollPane.setViewportView(preview); preview.setEditable(false); preview.setColumns(10); preview.setTabSize(4); } } { JLabel lblOptions = new JLabel("Options"); GridBagConstraints gbc_lblOptions = new GridBagConstraints(); gbc_lblOptions.insets = new Insets(0, 0, 0, 5); gbc_lblOptions.gridx = 0; gbc_lblOptions.gridy = 4; contentPanel.add(lblOptions, gbc_lblOptions); } { JPanel panel = new JPanel(); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.anchor = GridBagConstraints.NORTH; gbc_panel.fill = GridBagConstraints.HORIZONTAL; gbc_panel.gridx = 1; gbc_panel.gridy = 4; contentPanel.add(panel, gbc_panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 69, 169, 162, 0 }; gbl_panel.rowHeights = new int[] { 23, 23, 0 }; gbl_panel.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); { rdbtnExportMeanIntensity = new JRadioButton("Export Mean Intensity"); rdbtnExportMeanIntensity.setSelected(true); buttonGroup.add(rdbtnExportMeanIntensity); GridBagConstraints gbc_rdbtnExportMeanIntensity = new GridBagConstraints(); gbc_rdbtnExportMeanIntensity.anchor = GridBagConstraints.NORTHWEST; gbc_rdbtnExportMeanIntensity.insets = new Insets(0, 0, 5, 5); gbc_rdbtnExportMeanIntensity.gridx = 1; gbc_rdbtnExportMeanIntensity.gridy = 0; panel.add(rdbtnExportMeanIntensity, gbc_rdbtnExportMeanIntensity); } { rdbtnExportMaxIntensity = new JRadioButton("Export Max Intensity"); buttonGroup.add(rdbtnExportMaxIntensity); GridBagConstraints gbc_rdbtnExportMaxIntensity = new GridBagConstraints(); gbc_rdbtnExportMaxIntensity.anchor = GridBagConstraints.NORTHWEST; gbc_rdbtnExportMaxIntensity.insets = new Insets(0, 0, 5, 0); gbc_rdbtnExportMaxIntensity.gridx = 2; gbc_rdbtnExportMaxIntensity.gridy = 0; panel.add(rdbtnExportMaxIntensity, gbc_rdbtnExportMaxIntensity); } { chckbxExportPositions = new JCheckBox("Export Cell Positions and Areas in CSV"); GridBagConstraints gbc_chckbxExportPositions = new GridBagConstraints(); gbc_chckbxExportPositions.anchor = GridBagConstraints.NORTH; gbc_chckbxExportPositions.gridwidth = 2; gbc_chckbxExportPositions.gridx = 1; gbc_chckbxExportPositions.gridy = 1; panel.add(chckbxExportPositions, gbc_chckbxExportPositions); } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (validateFields()) { Prefs.set("TrackApp.FilterValidatedDialog.startLin", valStartLin); Prefs.set("TrackApp.FilterValidatedDialog.minLinLen", valMinLinLen); Prefs.set("TrackApp.FilterValidatedDialog.exportMean", doExportMean); Prefs.set("TrackApp.FilterValidatedDialog.exportPositions", doExportPositions); Prefs.savePreferences(); dispose(); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
From source file:org.bench4Q.console.ui.section.LW_ConfigLoadShowSection.java
/** * @param resources/*from w w w . j av a2 s . com*/ * @param processControl * @param dispatcherFactory * @param configModel * @param configLoadSection * @throws ConsoleException */ public LW_ConfigLoadShowSection(Resources resources, ProcessControl processControl, SwingDispatcherFactory dispatcherFactory, ConfigModel configModel, LW_ConfigLoadSection configLoadSection) throws ConsoleException { m_resources = resources; m_processControl = processControl; m_swingDispatcherFactory = dispatcherFactory; m_configModel = configModel; m_args = m_configModel.getArgs(); this.setLayout(new GridBagLayout()); this.setPreferredSize(new Dimension(683, 475)); this.setMinimumSize(new Dimension(683, 475)); picPanel = new PicPanel(m_args); // JPanel picPanel = new JPanel(); this.add(picPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); m_configModel.addListener(new ConfigModel.AbstractListener() { public void isArgsChanged() { resetConfig(); } }); configLoadSection.addListener(new LW_ConfigLoadSection.AbstractListener() { public void isArgsChanged() { resetConfig(); } }); }
From source file:interpolation.InterpolantFileChooser.java
public InterpolantFileChooser() { final JFrame frame = new JFrame("Welcome to the Regression fits"); Track = new JButton("Choose file"); panelCont.add(panelIntro, "1"); /* Instantiation */ final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints c = new GridBagConstraints(); panelIntro.setLayout(layout);//from w ww. j a v a2 s .c om final Label LoadtrackText = new Label("Input the .txt file of time-series"); LoadtrackText.setBackground(new Color(1, 0, 1)); LoadtrackText.setForeground(new Color(255, 255, 255)); final Checkbox Simplemode = new Checkbox("Open simple time-series file", Simplefile); /* Location */ c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1.5; ++c.gridy; c.insets = new Insets(10, 10, 10, 0); panelIntro.add(LoadtrackText, c); ++c.gridy; c.insets = new Insets(10, 10, 10, 0); panelIntro.add(Track, c); panelIntro.setVisible(true); Track.addActionListener(new OpenTrackListener(frame)); Simplemode.addItemListener(new SimpleListener(frame)); frame.addWindowListener(new FrameListener(frame)); frame.add(panelCont, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:com.sec.ose.osi.ui.frm.main.identification.JPanMatchTypeSelection.java
private void init() { GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 3;/*from w w w. j a v a2s .c o m*/ gridBagConstraints12.ipadx = 5; gridBagConstraints12.gridy = 0; jLabelArrow2 = new JLabel(); jLabelArrow2.setText(""); GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 1; gridBagConstraints11.ipadx = 5; gridBagConstraints11.gridy = 0; jLabelArrow1 = new JLabel(); jLabelArrow1.setText(""); GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.ipadx = 10; gridBagConstraints8.insets = new Insets(10, 0, 10, 10); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.gridx = 4; gridBagConstraints7.ipadx = 5; gridBagConstraints7.gridy = 0; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.gridx = 2; gridBagConstraints4.ipadx = 18; gridBagConstraints4.insets = new Insets(0, 0, 0, 10); gridBagConstraints4.gridy = 0; this.setLayout(new GridBagLayout()); this.add(getJButtonStringSearch(), gridBagConstraints8); this.add(getJButtonCodeMatch(), gridBagConstraints4); this.add(getJButtonPatternMatch(), gridBagConstraints7); this.add(jLabelArrow1, gridBagConstraints11); this.add(jLabelArrow2, gridBagConstraints12); }
From source file:it.cnr.icar.eric.client.ui.swing.DiscoveryPanel.java
/** * Class Constructor./* w w w . j a va2 s . co m*/ */ public DiscoveryPanel() throws JAXRException { GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); findParamsPanel = new FindParamsPanel(this); JPanel findResultsPanel = createFindResultsPanel(); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, findParamsPanel, findResultsPanel); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(splitPane, c); add(splitPane); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:de.codesourcery.eve.skills.ui.components.impl.CharacterSheetComponent.java
@Override protected JPanel createPanel() { final JPanel result = new JPanel(); result.setLayout(new GridBagLayout()); textArea.setRows(10);//from w w w . j av a 2 s. co m textArea.setColumns(35); setMonospacedFont(textArea); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); textArea.setEditable(false); final JScrollPane pane = new JScrollPane(textArea); result.add(pane, constraints(0, 0).resizeBoth().useRemainingSpace().end()); return result; }
From source file:com.adito.upgrade.GUIUpgrader.java
public GUIUpgrader() { super(new BorderLayout()); JPanel info = new JPanel(new BorderLayout(2, 2)); // info.setBackground(Color.white); // info.setForeground(Color.black); // info.setOpaque(true); info.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); JLabel l = new JLabel("<html><p>This utility upgrades configuration from " + "one version 0.1.16 installation to another " + "0.2.5+ installation. You may choose which resources you " + "wish to be copied. If resources with the same name already " + "exist they will be left as is."); l.setIcon(new ImageIcon(GUIUpgrader.class.getResource("upgrader-48x48.png"))); info.add(l, BorderLayout.CENTER); info.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); mainPanel = new JPanel(new BorderLayout()); add(info, BorderLayout.NORTH); add(mainPanel, BorderLayout.CENTER); // Installations panel JPanel installations = new JPanel(new GridBagLayout()); installations.setBorder(BorderFactory.createTitledBorder("Installations")); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 2.0;/* ww w . jav a 2 s .com*/ UIUtil.jGridBagAdd(installations, new JLabel("Source"), gbc, GridBagConstraints.REMAINDER); gbc.weightx = 1.0; source = new JTextField(); source.getDocument().addDocumentListener(this); UIUtil.jGridBagAdd(installations, source, gbc, GridBagConstraints.RELATIVE); browseSource = new JButton("Browse"); browseSource.setMnemonic('b'); browseSource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(source.getText()); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setDialogTitle("Select source installation directory (0.16.1)"); if (chooser.showOpenDialog(GUIUpgrader.this) == JFileChooser.APPROVE_OPTION) { source.setText(chooser.getSelectedFile().getAbsolutePath()); } } }); gbc.weightx = 0.0; UIUtil.jGridBagAdd(installations, browseSource, gbc, GridBagConstraints.REMAINDER); gbc.weightx = 2.0; UIUtil.jGridBagAdd(installations, new JLabel("Target"), gbc, GridBagConstraints.REMAINDER); gbc.weightx = 1.0; target = new JTextField(System.getProperty("user.dir")); target.getDocument().addDocumentListener(this); UIUtil.jGridBagAdd(installations, target, gbc, GridBagConstraints.RELATIVE); browseTarget = new JButton("Browse"); browseTarget.setMnemonic('r'); browseTarget.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(target.getText()); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setDialogTitle("Select target installation directory (0.2.5+)"); if (chooser.showOpenDialog(GUIUpgrader.this) == JFileChooser.APPROVE_OPTION) { target.setText(chooser.getSelectedFile().getAbsolutePath()); } } }); gbc.weightx = 0.0; UIUtil.jGridBagAdd(installations, browseTarget, gbc, GridBagConstraints.REMAINDER); mainPanel.add(installations, BorderLayout.NORTH); // Upgrade selection upgradeSelectionPanel = new JPanel(); upgradeSelectionPanel.setBorder(BorderFactory.createTitledBorder("Upgrades")); upgradeSelectionPanel.setLayout(new BoxLayout(upgradeSelectionPanel, BoxLayout.Y_AXIS)); mainPanel.add(upgradeSelectionPanel, BorderLayout.CENTER); }
From source file:medsavant.enrichment.app.OntologyAggregatePanel.java
public OntologyAggregatePanel(String page) { super(page);/*from w ww . jav a2 s.com*/ setLayout(new GridBagLayout()); chooser = new JComboBox(OntologyListItem.DEFAULT_ITEMS); chooser.setMaximumSize(new Dimension(400, chooser.getMaximumSize().height)); progress = new JProgressBar(); progress.setPreferredSize(new Dimension(600, progress.getMaximumSize().height)); progress.setStringPainted(true); JPanel banner = new JPanel(); banner.setLayout(new GridBagLayout()); banner.setBackground(new Color(245, 245, 245)); banner.setBorder(BorderFactory.createTitledBorder("Ontology")); tree = new TreeTable(); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.WEST; banner.add(chooser, gbc); gbc.anchor = GridBagConstraints.EAST; banner.add(progress, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; add(banner, gbc); gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; add(new JScrollPane(tree), gbc); chooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (termFetcher != null) { termFetcher.cancel(true); termFetcher = null; } recalculate(); } }); tree.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { createPopup().show(e.getComponent(), e.getX(), e.getY()); } } }); }
From source file:net.daboross.outputtablesclient.gui.OutputInterface.java
public OutputInterface(final Application application) { this.application = application; // persistEnabled JSONObject parentObj = application.getPersist().getStorageObject(); JSONObject tempPersistEnabled = parentObj.optJSONObject("last-shown-panels"); if (tempPersistEnabled == null) { tempPersistEnabled = new JSONObject(); parentObj.put("last-shown-panels", tempPersistEnabled); }/*from ww w.j a v a2 s . c o m*/ persistEnabled = tempPersistEnabled; // constraints toggleButtonConstraints = new GBC().ipadx(2).ipady(2).gridx(0).gridy(-1) .fill(GridBagConstraints.HORIZONTAL); tablePanelConstraints = new GBC().gridx(0).gridy(-1).weightx(1).weighty(0).anchor(GridBagConstraints.EAST) .fill(GridBagConstraints.HORIZONTAL); // mainTabPanel mainTabPanel = new JPanel(); mainTabPanel.setLayout(new GridBagLayout()); application.getRoot().getMainPanel().add(mainTabPanel, new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(0).gridy(1)); // toggleButtonPanel toggleButtonPanel = new JPanel(); toggleButtonPanel.setLayout(new GridBagLayout()); mainTabPanel.add(toggleButtonPanel, new GBC().weightx(0).weighty(0).gridx(0).gridy(0) .insets(new Insets(0, 0, 10, 10)).anchor(GridBagConstraints.NORTHWEST)); // tableRootPanel tableRootPanel = new JPanel(new GridBagLayout()); mainTabPanel.add(tableRootPanel, new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(2) .gridy(0).anchor(GridBagConstraints.EAST)); // maps tableKeyToTableButton = new TreeMap<>(); tableKeyToTableEnabled = new TreeMap<>(); tableKeyToTablePanel = new HashMap<>(); tableKeyAndKeyToValuePanel = new HashMap<>(); tableKeyAndKeyToValueLabel = new HashMap<>(); tableKeyToTableTitledBoarder = new HashMap<>(); }