List of usage examples for java.awt GridBagConstraints REMAINDER
int REMAINDER
To view the source code for java.awt GridBagConstraints REMAINDER.
Click Source Link
From source file:savant.ucscexplorer.UCSCExplorerPlugin.java
private void buildUI() { topLevelPanel.removeAll();//w w w . ja v a2 s .com topLevelPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); try { UCSCDataSourcePlugin ucsc = getUCSCPlugin(); ucsc.getConnection(); JLabel cladeLabel = new JLabel("Clade:"); gbc.anchor = GridBagConstraints.EAST; topLevelPanel.add(cladeLabel, gbc); cladeCombo = new JComboBox(); cladeCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { UCSCDataSourcePlugin ucsc = getUCSCPlugin(); String clade = (String) cladeCombo.getSelectedItem(); genomeCombo.setModel(new DefaultComboBoxModel(ucsc.getCladeGenomes(clade))); genomeCombo.setSelectedItem(ucsc.getCurrentGenome(clade)); } }); gbc.anchor = GridBagConstraints.WEST; topLevelPanel.add(cladeCombo, gbc); JLabel genomeLabel = new JLabel("Genome:"); gbc.anchor = GridBagConstraints.EAST; topLevelPanel.add(genomeLabel, gbc); genomeCombo = new JComboBox(); genomeCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { buildProgressUI(); new GroupsFetcher(getUCSCPlugin(), (GenomeDef) genomeCombo.getSelectedItem()) { @Override public void done(List<GroupDef> groups) { if (groups != null) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; for (GroupDef g : groups) { groupsPanel.add(new GroupPanel(g), gbc); } // Add a filler panel to force everything to the top. gbc.weighty = 1.0; groupsPanel.add(new JPanel(), gbc); loadButton.setEnabled(true); topLevelPanel.validate(); } } @Override public void showProgress(double value) { updateProgress(progressMessage, value); } }.execute(); } }); gbc.anchor = GridBagConstraints.WEST; topLevelPanel.add(genomeCombo, gbc); loadButton = new JButton("Load Selected Tracks"); loadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { try { loadSelectedTracks(); } catch (Throwable x) { DialogUtils.displayException(getTitle(), "Unable to load selected tracks.", x); } } }); gbc.anchor = GridBagConstraints.EAST; gbc.gridwidth = GridBagConstraints.REMAINDER; topLevelPanel.add(loadButton, gbc); groupsPanel = new GroupsPanel(); groupsPanel.setLayout(new GridBagLayout()); JScrollPane groupsScroller = new JScrollPane(groupsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; topLevelPanel.add(groupsScroller, gbc); buildProgressUI(); GenomeUtils.addGenomeChangedListener(new Listener<GenomeChangedEvent>() { @Override public void handleEvent(GenomeChangedEvent event) { UCSCDataSourcePlugin ucsc = getUCSCPlugin(); ucsc.selectGenomeDB(null); GenomeAdapter newGenome = event.getNewGenome(); GenomeDef g = new GenomeDef(newGenome.getName(), null); String newClade = ucsc.findCladeForGenome(g); // newClade could be null if the user has opened a genome which has no UCSC equivalent. if (newClade != null) { cladeCombo.setSelectedItem(newClade); } } }); ucsc.selectGenomeDB(null); new CladesFetcher(getUCSCPlugin()) { @Override public void done(String selectedClade) { cladeCombo.setModel(new DefaultComboBoxModel(UCSCDataSourcePlugin.STANDARD_CLADES)); if (selectedClade != null) { cladeCombo.setSelectedItem(selectedClade); } else { cladeCombo.setSelectedIndex(0); } } @Override public void showProgress(double value) { updateProgress(progressMessage, value); } }.execute(); } catch (Exception x) { LOG.error("Unable to connect to UCSC database.", x); topLevelPanel.removeAll(); gbc.anchor = GridBagConstraints.CENTER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0.0; gbc.weighty = 0.0; topLevelPanel.add(new JLabel("Unable to connect to UCSC database."), gbc); JLabel error = new JLabel(MiscUtils.getMessage(x)); Font f = topLevelPanel.getFont(); f = f.deriveFont(Font.ITALIC, f.getSize() - 2.0f); error.setFont(f); topLevelPanel.add(error, gbc); } }
From source file:org.intermine.install.swing.NewDerivedTypeDialog.java
/** * Common initialisation: lays out the child components and wires up the necessary * event listeners. // w w w. j a va 2 s .co m */ private void init() { setName("New Derived Type Dialog"); setTitle(Messages.getMessage("source.derived.title")); progressDialog.setTitle(Messages.getMessage("makesource.title")); nameField.setEnabled(false); typeField.setEnabled(false); buttonPanel = new ButtonPanel(createAction, new CancelAction()); progressDialog.setInformationLabel(Messages.getMessage("makesource.message")); progressDialog.pack(); Container cp = getContentPane(); GridBagConstraints cons = GridBagHelper.setup(cp); cp.add(new JLabel(Messages.getMessage("source.name")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("source.derived.parent")), cons); cons.gridy++; cp.add(new JLabel(Messages.getMessage("source.derived.type")), cons); cons.gridy = 0; cons.gridx++; cons.weightx = 1; cp.add(nameField, cons); cons.gridy++; cp.add(typeField, cons); cons.gridy++; cp.add(derivedTypeField, cons); cons.gridx = 0; cons.gridy++; cons.gridwidth = GridBagConstraints.REMAINDER; cons.weighty = 1; cons.fill = GridBagConstraints.BOTH; cp.add(spacerPanel, cons); cons.gridy++; cons.weighty = 0; cons.fill = GridBagConstraints.HORIZONTAL; cp.add(buttonPanel, cons); derivedTypeField.getDocument().addDocumentListener(new DerivedTypeDocumentListener()); pack(); }
From source file:org.executequery.gui.ExportResultSetPanel.java
private void init() throws Exception { fileNameField = WidgetFactory.createTextField(); connectionsCombo = WidgetFactory.createComboBox(); String[] delims = { "|", ",", ";", "#" }; delimiterCombo = WidgetFactory.createComboBox(delims); delimiterCombo.setEditable(true);/*from w w w . jav a 2 s .c o m*/ combosGroup = new TableSelectionCombosGroup(connectionsCombo); includeColumNamesCheck = new JCheckBox("Include column names as first row"); sqlText = new SimpleSqlTextPanel(); // sqlText.getTextPane().setBackground(Color.WHITE); sqlText.setBorder(null); sqlText.setScrollPaneBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, UIUtils.getDefaultBorderColour())); statusBar = new SqlTextPaneStatusBar(); JPanel sqlPanel = new JPanel(new BorderLayout()); sqlPanel.add(sqlText, BorderLayout.CENTER); sqlPanel.add(statusBar, BorderLayout.SOUTH); statusBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); outputPanel = new LoggingOutputPanel(); FlatSplitPane splitPane = new FlatSplitPane(JSplitPane.VERTICAL_SPLIT, sqlPanel, outputPanel); splitPane.setResizeWeight(0.5); splitPane.setDividerLocation(0.8); splitPane.setDividerSize(5); JButton button = WidgetFactory.createInlineFieldButton("Browse"); button.setActionCommand("browse"); button.addActionListener(this); button.setMnemonic('r'); JPanel mainPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0; gbc.gridx = 0; gbc.gridheight = 1; gbc.insets.top = 5; gbc.insets.bottom = 5; gbc.insets.right = 5; gbc.insets.left = 5; gbc.anchor = GridBagConstraints.NORTHWEST; mainPanel.add(new JLabel("Connection:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(connectionsCombo, gbc); gbc.insets.left = 5; gbc.gridy++; gbc.gridx = 0; gbc.weightx = 0; gbc.gridwidth = 1; gbc.insets.top = 0; mainPanel.add(new JLabel("Data Delimiter:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(delimiterCombo, gbc); gbc.gridy++; gbc.gridx = 0; gbc.weightx = 0; gbc.gridwidth = 1; gbc.insets.top = 2; mainPanel.add(new JLabel("Output File:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(fileNameField, gbc); gbc.gridx = 2; gbc.weightx = 0; gbc.insets.left = 0; gbc.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(button, gbc); gbc.gridy++; gbc.gridx = 0; gbc.weightx = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets.top = 2; gbc.insets.left = 5; mainPanel.add(includeColumNamesCheck, gbc); gbc.gridy++; gbc.insets.bottom = 10; mainPanel.add(new JLabel(instructionNote()), gbc); gbc.gridy++; gbc.gridx = 0; gbc.weighty = 1.0; gbc.weightx = 1.0; gbc.insets.top = 0; gbc.insets.left = 5; gbc.insets.bottom = 5; gbc.fill = GridBagConstraints.BOTH; mainPanel.add(splitPane, gbc); mainPanel.setBorder(BorderFactory.createEtchedBorder()); int minimumButtonWidth = 85; executeButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Execute", "executeAndExport"); stopButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Stop", "stop"); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 5)); buttonPanel.add(executeButton); buttonPanel.add(stopButton); stopButton.setEnabled(false); add(mainPanel, BorderLayout.CENTER); add(buttonPanel, BorderLayout.SOUTH); setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); // register as a keyword and connection listener EventMediator.registerListener(this); JTextPane textPane = sqlText.getTextPane(); ActionMap actionMap = textPane.getActionMap(); String actionKey = "executeQueryAction"; actionMap.put(actionKey, executeQueryAction); InputMap inputMap = textPane.getInputMap(); inputMap.put(EXECUTE_KEYSTROKE, actionKey); JPopupMenu popupMenu = sqlText.getPopup(); popupMenu.addSeparator(); popupMenu.add(executeQueryAction); }
From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java
private void addResultPanel() { GridBagConstraints c = new GridBagConstraints(); c.gridx = 0;/*from www . ja v a 2 s. c o m*/ c.gridy = ++row; c.fill = GridBagConstraints.BOTH; c.weightx = 0.01; c.weighty = 0.01; c.anchor = GridBagConstraints.SOUTHEAST; c.gridwidth = GridBagConstraints.REMAINDER; resultPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); resultPanel.setDividerLocation(200); resultPanel.setBorder(null); runListModel = new DefaultListModel(); runList = new JList(runListModel); runList.setBorder(new EmptyBorder(5, 5, 5, 5)); runList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); runListPanel = new JPanel(new BorderLayout()); runListPanel.setBorder(LineBorder.createGrayLineBorder()); JLabel worklflowRunsLabel = new JLabel("Workflow Runs"); worklflowRunsLabel.setBorder(new EmptyBorder(5, 5, 5, 5)); removeCaGridRunsButton = new JButton("Remove"); // button to remove previous workflow runs removeCaGridRunsButton.setAlignmentX(JComponent.RIGHT_ALIGNMENT); removeCaGridRunsButton.setEnabled(false); removeCaGridRunsButton.setToolTipText("Remove caGrid run(s)"); removeCaGridRunsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] selected = runList.getSelectedIndices(); for (int i = selected.length - 1; i >= 0; i--) { CaGridRun cr = (CaGridRun) runListModel.get(selected[i]); //delete the EPR file File file = new File(new File(System.getProperty("user.home")), cr.workflowid + ".epr"); file.delete(); System.out.println(cr.workflowid + ".epr deleted"); runListModel.remove(selected[i]); } // Set the first item as selected - if there is one if (runListModel.size() > 0) { runList.setSelectedIndex(0); } else { resultText.setText(""); resultText.revalidate(); } } }); runListPanel.add(worklflowRunsLabel, BorderLayout.NORTH); runListPanel.add(removeCaGridRunsButton, BorderLayout.BEFORE_FIRST_LINE); JScrollPane scrollPane = new JScrollPane(runList); scrollPane.setBorder(null); runListPanel.add(scrollPane, BorderLayout.CENTER); // loadWorkflowRunsFromStoredEPRFiles(): add CaGridRun to runList for each EPR // add two buttons: remove and refresh status runList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { Object selection = runList.getSelectedValue(); if (selection instanceof CaGridRun) { removeCaGridRunsButton.setEnabled(true); CaGridRun dataflowRun = (CaGridRun) selection; // update status and refresh outputPanel String resultDisplayString = updateResultDisplayString(dataflowRun); resultText.setText(resultDisplayString); resultText.setLineWrap(true); resultText.setEditable(false); outputPanel.revalidate(); revalidate(); } else { removeCaGridRunsButton.setEnabled(false); revalidate(); } } } }); resultPanel.setTopComponent(runListPanel); //each output should be a (xml) string outputPanel = new JScrollPane(); resultText = new JTextArea(); outputPanel = new JScrollPane(resultText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); //outputPanel = new JPanel(new BorderLayout()); outputPanel.setBorder(LineBorder.createGrayLineBorder()); outputPanel.setBackground(Color.WHITE); //outputPanel.add(new JLabel("Workflow Execution Outputs shows here.", JLabel.CENTER), null); resultPanel.setBottomComponent(outputPanel); add(resultPanel, c); //add runComponent to the GUI ArrayList<CaGridRun> loadedRunList = loadWorkflowRunsFromStoredEPRFiles(null, (String) services.getSelectedItem()); if (loadedRunList != null) { for (int m = 0; m < loadedRunList.size(); m++) { CaGridRun cr = (CaGridRun) loadedRunList.get(m); runListModel.add(0, cr); } System.out.println(loadedRunList.size() + " EPR loaded."); runList.setSelectedIndex(0); } }
From source file:org.executequery.gui.drivers.AbstractDriverPanel.java
private void init() { ReflectiveAction action = new ReflectiveAction(this); JButton browseButton = new DefaultButton(action, getString("AbstractDriverPanel.addLibraryButton"), "browseDrivers"); JButton removeButton = new DefaultButton(action, getString("AbstractDriverPanel.addRemoveButton"), "removeDrivers"); JButton findButton = new DefaultInlineFieldButton(action); findButton.setText(getString("AbstractDriverPanel.addFindButton")); findButton.setActionCommand("findDriverClass"); jarPathListModel = new DefaultListModel(); nameField = textFieldWithKey("AbstractDriverPanel.driverNameToolTip"); descField = textFieldWithKey("AbstractDriverPanel.descriptionToolTip"); // classField = textFieldWithKey("AbstractDriverPanel.classNameToolTip"); classComboModel = new DynamicComboBoxModel(); classField = WidgetFactory.createComboBox(classComboModel); classField.setToolTipText(getString("AbstractDriverPanel.classNameToolTip")); classField.setEditable(true);//w w w .j a v a 2 s . c o m jarPathList = new JList(jarPathListModel); jarPathList.setToolTipText(getString("AbstractDriverPanel.pathToolTip")); JScrollPane jarPathListScrollPane = new JScrollPane(jarPathList) { private int height = 120; @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); size.height = height; return size; } @Override public Dimension getMinimumSize() { Dimension size = super.getMinimumSize(); size.height = height; return size; } }; nameField.addFocusListener(new DriverNameFieldListener(this)); databaseNameCombo = WidgetFactory.createComboBox(createDatabaseComboValues()); databaseNameCombo.setToolTipText(getString("AbstractDriverPanel.databaseToolTip")); databaseNameCombo.addItemListener(this); urlComboModel = new DynamicComboBoxModel(); driverUrlCombo = WidgetFactory.createComboBox(urlComboModel); driverUrlCombo.setToolTipText(getString("AbstractDriverPanel.jdbcUrlToolTip")); driverUrlCombo.setEditable(true); JPanel base = new TextFieldPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy++; gbc.insets = new Insets(10, 10, 5, 0); gbc.anchor = GridBagConstraints.NORTHWEST; base.add(labelWithKey("AbstractDriverPanel.driverNameLabel"), gbc); gbc.gridy++; gbc.insets.top = 0; base.add(labelWithKey("AbstractDriverPanel.descriptionLabel"), gbc); gbc.gridy++; base.add(labelWithKey("AbstractDriverPanel.databaseLabel"), gbc); gbc.gridy++; base.add(labelWithKey("AbstractDriverPanel.jdbcUrlLabel"), gbc); gbc.gridy++; base.add(labelWithKey("AbstractDriverPanel.pathLabel"), gbc); gbc.gridy += 4; base.add(labelWithKey("AbstractDriverPanel.classNameLabel"), gbc); gbc.gridy = 0; gbc.gridx = 1; gbc.insets.right = 10; gbc.insets.top = 10; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridwidth = GridBagConstraints.REMAINDER; base.add(nameField, gbc); gbc.gridy++; gbc.insets.top = 0; base.add(descField, gbc); gbc.gridy++; base.add(databaseNameCombo, gbc); gbc.gridy++; base.add(driverUrlCombo, gbc); gbc.gridy++; gbc.gridwidth = 1; gbc.insets.right = 0; gbc.gridheight = 2; gbc.insets.top = 5; base.add(jarPathListScrollPane, gbc); gbc.gridx = 2; gbc.weightx = 0; gbc.insets.right = 10; gbc.gridheight = 1; gbc.insets.left = 5; gbc.fill = GridBagConstraints.HORIZONTAL; base.add(browseButton, gbc); gbc.gridy++; gbc.insets.top = 0; base.add(removeButton, gbc); gbc.gridy += 3; gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.right = 0; gbc.insets.left = 10; gbc.insets.top = 0; base.add(classField, gbc); gbc.gridx = 2; gbc.weightx = 0; gbc.weighty = 1.0; gbc.insets.right = 10; gbc.insets.left = 5; gbc.fill = GridBagConstraints.HORIZONTAL; base.add(findButton, gbc); add(base, BorderLayout.CENTER); }
From source file:tufts.vue.EditLibraryPanel.java
private void layoutConfig() { if (DEBUG.BOXES) { cui.setBorder(BorderFactory.createLineBorder(Color.green)); this.setBorder(BorderFactory.createLineBorder(Color.red)); }/*ww w .ja v a 2 s. c o m*/ final GridBagConstraints gbc = new GridBagConstraints(); final GridBagLayout gridbag = new GridBagLayout(); setLayout(gridbag); // Set up common GBC config: gbc.insets = (Insets) tufts.vue.gui.GUI.WidgetInsets.clone(); gbc.insets.bottom = 0; gbc.weightx = 1; gbc.weighty = 0; //------------------------------------------------------- // Add ConfigurationUI //------------------------------------------------------- gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.gridy = 0; add(cui, gbc); //------------------------------------------------------- // Add Save button //------------------------------------------------------- gbc.gridwidth = 1; gbc.gridy = 1; gbc.ipadx = 15; // this actually makes the button wider gbc.anchor = GridBagConstraints.NORTHEAST; gbc.fill = GridBagConstraints.NONE; add(updateButton, gbc); //------------------------------------------------------- // Add a default vertical expander so above content // will float to top. //------------------------------------------------------- gbc.ipadx = 0; gbc.gridy = 2; gbc.weighty = 1; // this is the key for the expander to work (non-zero y-weight) gbc.fill = GridBagConstraints.BOTH; gbc.gridheight = GridBagConstraints.REMAINDER; gbc.gridwidth = 0; final JComponent fill; if (DEBUG.BOXES) { fill = new JLabel(VueResources.getString("jlabel.fill"), JLabel.CENTER); fill.setBackground(Color.gray); fill.setOpaque(true); } else { fill = new JPanel(); } add(fill, gbc); }
From source file:org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent.java
public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); // Numero du commande c.gridx = 0;/* w w w .j a va2 s . c o m*/ c.weightx = 0; this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c); this.numeroUniqueCommande = new JUniqueTextField(16); c.gridx++; c.weightx = 1; c.fill = GridBagConstraints.NONE; DefaultGridBagConstraints.lockMinimumSize(numeroUniqueCommande); this.add(this.numeroUniqueCommande, c); // Date JLabel labelDate = new JLabel(getLabelFor("DATE")); labelDate.setHorizontalAlignment(SwingConstants.RIGHT); c.gridx = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(labelDate, c); JDate dateCommande = new JDate(true); c.gridx++; c.fill = GridBagConstraints.NONE; this.add(dateCommande, c); // Fournisseur c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_FOURNISSEUR"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(this.fourn, c); if (!getTable().getFieldsName().contains("LIVRER")) { // Commande en cours JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS")); c.gridx = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; this.add(boxEnCours, c); c.gridwidth = 1; this.addRequiredSQLObject(boxEnCours, "EN_COURS"); } // Fournisseur if (getTable().contains("ID_CONTACT_FOURNISSEUR")) { c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_CONTACT_FOURNISSEUR"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; final ElementComboBox boxContactFournisseur = new ElementComboBox(); final SQLElement contactElement = Configuration.getInstance().getDirectory() .getElement("CONTACT_FOURNISSEUR"); boxContactFournisseur.init(contactElement, contactElement.getComboRequest(true)); this.add(boxContactFournisseur, c); this.addView(boxContactFournisseur, "ID_CONTACT_FOURNISSEUR", REQ); fourn.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { // TODO Raccord de mthode auto-gnr if (fourn.getSelectedRow() != null) { boxContactFournisseur.getRequest() .setWhere(new Where(contactElement.getTable().getField("ID_FOURNISSEUR"), "=", fourn.getSelectedRow().getID())); } else { boxContactFournisseur.getRequest().setWhere(null); } } }); } // Adresse de livraison if (getTable().getFieldsName().contains("ID_ADRESSE")) { if (getTable().getFieldsName().contains("LIVRAISON_F")) { c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_ADRESSE")), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; // c.gridy++; this.addView("ID_ADRESSE"); final DefaultElementSQLObject comp = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp(); if (getTable().getFieldsName().contains("LIVRAISON_F")) { final JCheckBox boxLivr = new JCheckBox("Livr par le fournisseur"); this.add(boxLivr, c); this.addSQLObject(boxLivr, "LIVRAISON_F"); boxLivr.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (boxLivr.isSelected() && !comp.isCreated()) { comp.setCreated(true); if (CommandeSQLComponent.this.getTable().contains("ID_AFFAIRE")) { SQLRowValues rowVals = getLivraisonAdr( ((ElementComboBox) CommandeSQLComponent.this.getView("ID_AFFAIRE") .getComp()).getSelectedRow()); comp.setValue(rowVals); } } else { if (!boxLivr.isSelected()) { comp.setCreated(false); } } } }); } c.gridy++; this.add(comp, c); this.add(this.getView("ID_ADRESSE").getComp(), c); } else { c.gridy++; c.gridx = 0; this.add(new JLabel("Livraison"), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; this.add(boxLivrClient, c); c.gridwidth = 1; final GridBagConstraints cAdr = new DefaultGridBagConstraints(); panelAdrSpec.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), cAdr); final ElementComboBox boxClient = new ElementComboBox(true); cAdr.weightx = 1; cAdr.gridx++; panelAdrSpec.add(boxClient, cAdr); this.addView(boxClient, "ID_CLIENT"); cAdr.gridy++; cAdr.weightx = 0; cAdr.gridx = 0; panelAdrSpec.add(new JLabel("Adresse", SwingConstants.RIGHT), cAdr); final SQLRequestComboBox boxAdr = new SQLRequestComboBox(true); boxAdr.uiInit(Configuration.getInstance().getDirectory().getElement(getTable().getTable("ADRESSE")) .getComboRequest(true)); boxClient.addModelListener("wantedID", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (boxClient.getSelectedRow() != null && !boxClient.getSelectedRow().isUndefined()) { Where w = new Where(boxAdr.getRequest().getPrimaryTable().getField("ID_CLIENT"), "=", boxClient.getSelectedRow().getID()); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE"))); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE_F"))); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE_L"))); boxAdr.getRequest().setWhere(w); } else { boxAdr.getRequest().setWhere(null); } } }); cAdr.weightx = 1; cAdr.gridx++; panelAdrSpec.add(boxAdr, cAdr); cAdr.gridx = 0; cAdr.gridy++; cAdr.weightx = 0; if (getMode() == Mode.MODIFICATION) { panelAdrSpec.add(new JLabel(getLabelFor("ID_ADRESSE")), cAdr); } cAdr.gridx++; cAdr.gridwidth = GridBagConstraints.REMAINDER; this.addView("ID_ADRESSE"); compAdr = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp(); cAdr.gridy++; if (getMode() == Mode.MODIFICATION) { panelAdrSpec.add(compAdr, cAdr); } boxAdr.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { SQLRow row = boxAdr.getSelectedRow(); if (row != null && !row.isUndefined()) { compAdr.setCreated(true); SQLRowValues asRowValues = new SQLRowValues(row.asRowValues()); compAdr.setValue(asRowValues); } } }); c.gridy++; c.gridx = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; this.add(panelAdrSpec, c); c.gridwidth = 1; c.weightx = 0; boxLivrClient.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panelAdrSpec.setVisible(boxLivrClient.isSelected()); if (!boxLivrClient.isSelected()) { boxClient.setValue((Integer) null); boxAdr.setValue((Integer) null); compAdr.setCreated(false); } } }); panelAdrSpec.setVisible(false); } } c.gridwidth = 1; // Champ Module c.gridx = 0; c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; final JPanel addP = ComptaSQLConfElement.createAdditionalPanel(); this.setAdditionalFieldsPanel(new FormLayouter(addP, 2)); this.add(addP, c); c.gridy++; c.gridwidth = 1; final ElementComboBox boxDevise = new ElementComboBox(); if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false)) { // Devise c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_DEVISE"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(boxDevise, c); this.addView(boxDevise, "ID_DEVISE"); } // Reference c.gridx = 0; c.gridy++; c.gridwidth = 1; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.EAST; this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c); final JTextField textNom = new JTextField(); c.gridx++; c.weightx = 1; this.add(textNom, c); String field; field = "ID_COMMERCIAL"; // Commercial c.weightx = 0; c.gridx++; this.add(new JLabel(getLabelFor(field), SwingConstants.RIGHT), c); ElementComboBox commSel = new ElementComboBox(false, 25); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; this.add(commSel, c); addRequiredSQLObject(commSel, field); // Table d'lment c.fill = GridBagConstraints.BOTH; c.gridy++; c.gridx = 0; c.weightx = 0; c.weighty = 1; c.gridwidth = 4; this.add(this.table, c); if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false)) { boxDevise.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { table.setDevise(boxDevise.getSelectedRow()); } }); } this.fourn.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { table.setFournisseur(fourn.getSelectedRow()); } }); // Bottom c.gridy++; c.weighty = 0; this.add(getBottomPanel(), c); c.gridx = 0; c.gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; JPanel panelOO = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panelOO.add(this.checkImpression, c); panelOO.add(this.checkVisu, c); c.gridwidth = GridBagConstraints.REMAINDER; this.add(panelOO, c); addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR"); addSQLObject(textNom, "NOM"); addRequiredSQLObject(dateCommande, "DATE"); // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS"); addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO"); addSQLObject(this.infos, "INFOS"); this.numeroUniqueCommande.setText(NumerotationAutoSQLElement.getNextNumero(CommandeSQLElement.class)); // radioEtat.setValue(EtatDevisSQLElement.EN_ATTENTE); // this.numeroUniqueDevis.addLabelWarningMouseListener(new MouseAdapter() { // public void mousePressed(MouseEvent e) { // // if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { // numeroUniqueDevis.setText(NumerotationAutoSQLElement.getNextNumeroDevis()); // } // } // }); DefaultGridBagConstraints.lockMinimumSize(this.fourn); DefaultGridBagConstraints.lockMinimumSize(commSel); }
From source file:savant.chromatogram.ChromatogramPlugin.java
@Override public void init(JPanel panel) { NavigationUtils.addLocationChangedListener(new Listener<LocationChangedEvent>() { @Override// w w w .j av a2 s .c om public void handleEvent(LocationChangedEvent event) { updateChromatogram(); } }); GenomeUtils.addGenomeChangedListener(new Listener<GenomeChangedEvent>() { @Override public void handleEvent(GenomeChangedEvent event) { updateChromatogram(); } }); panel.setLayout(new GridBagLayout()); panel.setBorder(BorderFactory.createEtchedBorder()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0; gbc.anchor = GridBagConstraints.EAST; panel.add(new JLabel("File:"), gbc); pathField = new JTextField(); gbc.gridwidth = 3; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; panel.add(pathField, gbc); JButton browseButton = new JButton("Browse\u2026"); browseButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { File f = DialogUtils.chooseFileForOpen("Chromatogram File", null, null); if (f != null) { try { pathField.setText(f.getAbsolutePath()); if (canvas != null) { canvas.getParent().remove(canvas); canvas = null; } chromatogram = ChromatogramFactory.create(f); updateEndField(); updateChromatogram(); } catch (UnsupportedChromatogramFormatException x) { DialogUtils.displayMessage("Unable to Open Chromatogram", String.format( "<html><i>%s</i> does not appear to be a valid chromatogram file.<br><br><small>Supported formats are ABI and SCF.</small></html>", f.getName())); } catch (Exception x) { DialogUtils.displayException("Unable to Open Chromatogram", String.format("<html>There was an error opening <i>%s</i>.</html>", f.getName()), x); } } } }); gbc.weightx = 0.0; gbc.fill = GridBagConstraints.NONE; panel.add(browseButton, gbc); JLabel startLabel = new JLabel("Start Base:"); gbc.gridy++; gbc.gridwidth = 1; gbc.anchor = GridBagConstraints.EAST; panel.add(startLabel, gbc); startField = new JTextField("0"); startField.setColumns(12); startField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { updateEndField(); } }); gbc.weightx = 0.5; gbc.anchor = GridBagConstraints.WEST; panel.add(startField, gbc); JLabel endLabel = new JLabel("End Base:"); gbc.weightx = 0.0; gbc.anchor = GridBagConstraints.EAST; panel.add(endLabel, gbc); endField = new JTextField(); endField.setColumns(12); endField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { try { NumberFormat numberParser = NumberFormat.getIntegerInstance(); int endBase = numberParser.parse(endField.getText()).intValue(); if (chromatogram != null) { int startBase = endBase - chromatogram.getSequenceLength(); startField.setText(String.valueOf(startBase)); if (canvas != null) { canvas.updatePos(startBase); } } } catch (ParseException x) { Toolkit.getDefaultToolkit().beep(); } } }); gbc.weightx = 0.5; gbc.anchor = GridBagConstraints.WEST; panel.add(endField, gbc); JCheckBox fillCheck = new JCheckBox("Fill Background"); fillCheck.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { canvas.updateFillbackground(((JCheckBox) ae.getSource()).isSelected()); } }); gbc.gridy++; gbc.gridx = 1; gbc.weightx = 0.0; panel.add(fillCheck, gbc); // Add a filler panel at the bottom to force our components to the top. gbc.gridy++; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 1.0; panel.add(new JPanel(), gbc); }
From source file:FontChooser.java
private void createUserInterface() { final JPanel content = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); setContentPane(content);/*from w ww.j a v a 2 s . co m*/ content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = gbc.gridy = 0; content.add(new JLabel("Font"), gbc); ++gbc.gridx; content.add(new JLabel("Size"), gbc); if (_selectStyles) { ++gbc.gridx; content.add(new JLabel("Style"), gbc); } ++gbc.gridy; gbc.gridx = 0; _fontNamesCmb = new JComboBox( GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); content.add(_fontNamesCmb, gbc); ++gbc.gridx; _fontSizesCmb.setEditable(true); content.add(_fontSizesCmb, gbc); if (_selectStyles) { ++gbc.gridx; content.add(_boldChk, gbc); ++gbc.gridy; content.add(_italicChk, gbc); } gbc.gridx = 0; ++gbc.gridy; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.CENTER; content.add(createPreviewPanel(), gbc); ++gbc.gridy; gbc.fill = GridBagConstraints.HORIZONTAL; content.add(createButtonsPanel(), gbc); pack(); setResizable(true); }
From source file:com.apatar.ui.JPublishToApatarDialog.java
private void createDialog() { GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); this.setLayout(gridbag); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0;// w w w .jav a 2 s .c om c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; //c.insets = new Insets(5, 5, 5, 5); JPanel panelLogin = new JPanel(); panelLogin.setBorder(new EmptyBorder(10, 10, 0, 10)); panelLogin.setLayout(new BoxLayout(panelLogin, BoxLayout.X_AXIS)); panelLogin.add(new JLabel("User Name")); panelLogin.add(Box.createHorizontalStrut(5)); panelLogin.add(username); username.setComponentPopupMenu(new JDefaultContextMenu(username)); panelLogin.add(Box.createHorizontalStrut(5)); panelLogin.add(new JLabel("Password")); panelLogin.add(Box.createHorizontalStrut(5)); panelLogin.add(password); JPanel panelForgotPassLink = new JPanel(); panelForgotPassLink.setBorder(new EmptyBorder(10, 10, 0, 10)); panelForgotPassLink.setLayout(new BoxLayout(panelForgotPassLink, BoxLayout.X_AXIS)); panelForgotPassLink.add(new JLabel("Lost your password? ")); panelForgotPassLink.add(Box.createHorizontalStrut(5)); panelForgotPassLink.add(forgotPassLinkLabel); forgotPassLinkLabel.setFont(UiUtils.NORMAL_SIZE_12_FONT); forgotPassLinkLabel.addMouseListener(new MouseHyperLinkEvent()); forgotPassLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); forgotPassLinkLabel.setText( "<html><a href='http://www.apatarforge.org/profile/lostpassword.html'>Click here to retrieve it</a></html>"); JPanel panelFile = new JPanel(); panelFile.setBorder(new EmptyBorder(10, 10, 0, 10)); panelFile.setLayout(new BoxLayout(panelFile, BoxLayout.X_AXIS)); panelFile.add(selectFromFile); panelFile.add(Box.createHorizontalStrut(5)); panelFile.add(new JLabel("New File ")); panelFile.add(Box.createHorizontalStrut(5)); panelFile.add(nameFile); panelFile.add(Box.createHorizontalStrut(5)); panelFile.add(browse); nameFile.setEnabled(false); nameFile.setComponentPopupMenu(new JDefaultContextMenu(nameFile)); browse.setEnabled(false); JPanel panelLocation = new JPanel(); panelLocation.setBorder(new EmptyBorder(10, 10, 0, 10)); panelLocation.setLayout(new BoxLayout(panelLocation, BoxLayout.X_AXIS)); panelLocation.add(new JLabel("Suggest Location:")); panelLocation.add(Box.createHorizontalStrut(5)); panelLocation.add(location); JPanel panelDMName = new JPanel(); panelDMName.setBorder(new EmptyBorder(10, 10, 0, 10)); panelDMName.setLayout(new BoxLayout(panelDMName, BoxLayout.X_AXIS)); JLabel datamapNameLabel = new JLabel("DataMap Name:"); datamapNameLabel.setBorder(new EmptyBorder(0, 0, 0, 10)); panelDMName.add(datamapNameLabel); panelDMName.add(Box.createHorizontalStrut(5)); panelDMName.add(dataMapName); dataMapName.setComponentPopupMenu(new JDefaultContextMenu(dataMapName)); JPanel panelDMDescription = new JPanel(); panelDMDescription.setBorder(new EmptyBorder(10, 10, 0, 10)); panelDMDescription.setLayout(new BoxLayout(panelDMDescription, BoxLayout.X_AXIS)); panelDMDescription.add(new JLabel("DataMap Description (16000 Chars)")); panelDMDescription.add(Box.createHorizontalStrut(5)); //JScrollPane scroll = new JScrollPane(dataMapDescription); //scroll.setSize(300, 50); dataMapDescription.setLineWrap(true); dataMapDescription.setWrapStyleWord(true); panelDMDescription.add(new JScrollPane(dataMapDescription)); JPanel panelDMShortDescription = new JPanel(); panelDMShortDescription.setBorder(new EmptyBorder(10, 10, 0, 10)); panelDMShortDescription.setLayout(new BoxLayout(panelDMShortDescription, BoxLayout.X_AXIS)); JLabel labelShort = new JLabel("Short Description:"); labelShort.setBorder(new EmptyBorder(0, 0, 0, 85)); panelDMShortDescription.add(labelShort); panelDMShortDescription.add(Box.createHorizontalStrut(5)); shortDescription.setLineWrap(true); shortDescription.setWrapStyleWord(true); panelDMShortDescription.add(new JScrollPane(shortDescription)); setEnableShortDescription(false); // ------------- JPanel panelTitleForTags = new JPanel(); panelTitleForTags.setBorder(new EmptyBorder(10, 10, 0, 10)); panelTitleForTags.setLayout(new BoxLayout(panelTitleForTags, BoxLayout.X_AXIS)); panelTitleForTags.add(new JLabel("Add tags associated with your DataMap:")); // ------------- JPanel panelListAddedTags = new JPanel(); panelListAddedTags.setBorder(new EmptyBorder(0, 10, 10, 10)); panelListAddedTags.setLayout(new BoxLayout(panelListAddedTags, BoxLayout.X_AXIS)); // -- JPanel panelFrom = new JPanel(); panelFrom.setLayout(new BoxLayout(panelFrom, BoxLayout.Y_AXIS)); JPanel panelMiddle = new JPanel(); panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.X_AXIS)); JPanel panelTo = new JPanel(); panelTo.setLayout(new BoxLayout(panelTo, BoxLayout.Y_AXIS)); // -- JPanel panelAddNewTag = new JPanel(); panelAddNewTag.setLayout(new BoxLayout(panelAddNewTag, BoxLayout.X_AXIS)); panelAddNewTag.add(new JLabel("Add new tag:")); panelAddNewTag.add(Box.createHorizontalStrut(5)); textfieldAddNewTag = new JTextField(); textfieldAddNewTag.setComponentPopupMenu(new JDefaultContextMenu(textfieldAddNewTag)); panelAddNewTag.add(textfieldAddNewTag); panelAddNewTag.add(Box.createHorizontalStrut(5)); JButton buttonAddTag = new JButton("Add"); buttonAddTag.addActionListener(addNewTagMouseListener); panelAddNewTag.add(buttonAddTag); // -- JPanel panelDeleteTags = new JPanel(); panelDeleteTags.setLayout(new BoxLayout(panelDeleteTags, BoxLayout.X_AXIS)); panelDeleteTags.add(new JLabel("Delete selected tag(s):")); panelDeleteTags.add(Box.createHorizontalStrut(5)); JButton buttonDeleteTag = new JButton("Delete"); buttonDeleteTag.addActionListener(deleteTagMouseListener); panelDeleteTags.add(buttonDeleteTag); panelDeleteTags.add(new JPanel()); // -- JButton moveTag = new JButton(UiUtils.ARROW_ICON); moveTag.addActionListener(addTagsMouseListener); panelMiddle.add(moveTag); tblModelFrom = new DefaultTableModel(); tblModelTo = new DefaultTableModel(); tblModelFrom.addColumn("Tag Name"); tblModelTo.addColumn("Tag Name"); tagsTableFrom = new JTable(tblModelFrom); tagsTableTo = new JTable(tblModelTo); tagsTableFrom.setOpaque(false); tagsTableFrom.setBackground(null); tagsTableFrom.setBorder(null); tagsTableFrom.setShowGrid(false); tagsTableTo.setOpaque(false); tagsTableTo.setBackground(null); tagsTableTo.setBorder(null); tagsTableTo.setShowGrid(false); tagsTableFrom.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField())); tagsTableTo.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField())); fillTableTags(); tagsTableFrom.setComponentPopupMenu(new JDefaultContextMenu(tagsTableFrom)); tagsTableTo.setComponentPopupMenu(new JDefaultContextMenu(tagsTableTo)); JScrollPane srollPane = new JScrollPane(tagsTableFrom); srollPane.setBorder(null); JScrollPane srollPane2 = new JScrollPane(tagsTableTo); srollPane.setBorder(null); panelFrom.add(srollPane); panelFrom.add(Box.createVerticalStrut(5)); panelFrom.add(panelAddNewTag); panelTo.add(srollPane2); panelTo.add(Box.createVerticalStrut(5)); panelTo.add(panelDeleteTags); panelListAddedTags.add(panelFrom); panelListAddedTags.add(Box.createHorizontalStrut(5)); panelListAddedTags.add(panelMiddle); panelListAddedTags.add(Box.createHorizontalStrut(5)); panelListAddedTags.add(panelTo); // ------- JPanel panelButton = new JPanel(); panelButton.setLayout(new BoxLayout(panelButton, BoxLayout.X_AXIS)); panelButton.add(Box.createHorizontalGlue()); panelButton.add(bOk); panelButton.add(Box.createHorizontalStrut(5)); panelButton.add(bCancel); panelButton.add(Box.createHorizontalStrut(5)); ComponentBuilder.makeComponent(new JCommentPanel(), gridbag, c, getContentPane()); ComponentBuilder.makeComponent(panelLogin, gridbag, c, getContentPane()); ComponentBuilder.makeComponent(panelForgotPassLink, gridbag, c, getContentPane()); ComponentBuilder.makeComponent(panelFile, gridbag, c, getContentPane()); ComponentBuilder.makeComponent(panelLocation, gridbag, c, getContentPane()); ComponentBuilder.makeComponent(panelDMName, gridbag, c, getContentPane()); c.fill = GridBagConstraints.BOTH; c.weighty = 2.0; ComponentBuilder.makeComponent(panelDMDescription, gridbag, c, getContentPane()); c.weighty = 0.0; ComponentBuilder.makeComponent(autoGenerateShortDescription, gridbag, c, getContentPane()); c.weighty = 1.0; ComponentBuilder.makeComponent(panelDMShortDescription, gridbag, c, getContentPane()); c.weighty = 1.0; ComponentBuilder.makeComponent(panelTitleForTags, gridbag, c, getContentPane()); c.weighty = 3.0; ComponentBuilder.makeComponent(panelListAddedTags, gridbag, c, getContentPane()); c.weighty = 0.0; ComponentBuilder.makeComponent(new JSeparator(), gridbag, c, getContentPane()); c.weighty = 1.0; ComponentBuilder.makeComponent(panelButton, gridbag, c, getContentPane()); }