List of usage examples for java.awt GridBagConstraints NONE
int NONE
To view the source code for java.awt GridBagConstraints NONE.
Click Source Link
From source file:com.choicemaker.cm.modelmaker.gui.panels.StatisticsHistogramPanel.java
private void layoutPanel() { GridBagLayout layout = new GridBagLayout(); setLayout(layout);// ww w.ja va 2 s . c o m GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 10, 5, 10); //Row 0.......................................................... //histo c.gridy = 0; c.gridx = 0; c.gridwidth = 5; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; add(histoPanel, c); //Row 1.......................................................... //binWidthLabel c.gridy = 1; c.gridx = 1; c.gridwidth = 1; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.EAST; layout.setConstraints(binWidthLabel, c); add(binWidthLabel); //binWidthField c.gridx = 2; c.ipadx = 10; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; layout.setConstraints(binWidthField, c); add(binWidthField); }
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;//from w ww. j a v a 2 s . co 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:gate.creole.kea.CorpusImporter.java
protected void initGUIComponents() { setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = 0;//from w ww .j ava 2s.co m constraints.gridx = GridBagConstraints.RELATIVE; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.BOTH; JPanel inputPanel = new JPanel(new GridBagLayout()); inputPanel.setBorder(BorderFactory.createTitledBorder("Input")); GridBagConstraints constraints2 = new GridBagConstraints(); constraints2.gridy = 0; constraints2.gridx = GridBagConstraints.RELATIVE; constraints2.weighty = 0; constraints2.weightx = 0; constraints2.fill = GridBagConstraints.BOTH; constraints2.insets = new Insets(2, 2, 2, 2); JLabel label = new JLabel("Source directory:"); inputPanel.add(label, constraints2); sourceDirTField = new JTextField(30); inputPanel.add(sourceDirTField, constraints2); JButton openButton = new JButton(new SelectDirectoryAction()); inputPanel.add(openButton, constraints2); constraints2.gridy = 1; label = new JLabel("Extension for text files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; textExtensionTField = new JTextField(".txt"); inputPanel.add(textExtensionTField, constraints2); constraints2.gridwidth = 1; constraints2.gridy = 2; label = new JLabel("Extension for keyphrase files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; keyExtensionTField = new JTextField(".key"); inputPanel.add(keyExtensionTField, constraints2); constraints2.gridwidth = 1; constraints2.gridy = 3; label = new JLabel("Encoding for input files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; encodingTField = new JTextField(""); inputPanel.add(encodingTField, constraints2); constraints2.gridwidth = 1; add(inputPanel, constraints); constraints.weightx = 1; add(Box.createHorizontalGlue(), constraints); constraints.weightx = 0; JPanel outputPanel = new JPanel(); outputPanel.setLayout(new GridBagLayout()); outputPanel.setBorder(BorderFactory.createTitledBorder("Output")); constraints2.gridy = 0; label = new JLabel("Corpus name:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; corpusNameTField = new JTextField("KEA Corpus"); constraints2.weightx = 0; outputPanel.add(corpusNameTField, constraints2); constraints2.gridy = 1; label = new JLabel("Output annotation set:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; annotationSetTField = new JTextField("Key"); constraints2.weightx = 0; outputPanel.add(annotationSetTField, constraints2); constraints2.gridy = 2; label = new JLabel("Keyphrase annotation type:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; annotationTypeTField = new JTextField("Keyphrase"); constraints2.weightx = 0; outputPanel.add(annotationTypeTField, constraints2); constraints.gridy = 1; add(outputPanel, constraints); constraints.gridy = 2; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; add(new JButton(new ImportCorpusAction()), constraints); constraints.gridy = 3; constraints.weighty = 1; add(Box.createVerticalGlue(), constraints); }
From source file:ro.nextreports.designer.wizpublish.PublishFileWizardPanel.java
private void init() { setLayout(new GridBagLayout()); nameTextField = new JTextField(); pathTextField = new JTextField(); pathTextField.setEditable(false);/*from www .ja va2s. c o m*/ pathTextField.setBackground(Color.WHITE); dataSourceTextField = new JTextField(); dataSourceTextField.setEditable(false); dataSourceTextField.setBackground(Color.WHITE); descriptionArea = new JTextArea(5, 20); scrArea = new JScrollPane(descriptionArea); selectDataSourceButton = new JButton(ImageUtil.getImageIcon("database")); selectDataSourceButton.setPreferredSize(buttonDim); selectDataSourceButton.setMaximumSize(buttonDim); selectDataSourceButton.setMinimumSize(buttonDim); selectDataSourceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createSelectionDialog(DBObject.DATABASE); } }); JButton selectPathButton = new JButton(ImageUtil.getImageIcon("folder")); selectPathButton.setPreferredSize(buttonDim); selectPathButton.setMaximumSize(buttonDim); selectPathButton.setMinimumSize(buttonDim); selectPathButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String entity = (String) context.getAttribute(WizardConstants.ENTITY); byte type; if (WizardConstants.ENTITY_REPORT.equals(entity)) { type = DBObject.REPORTS_GROUP; } else { type = DBObject.CHARTS_GROUP; } createSelectionDialog(type); } }); add(nameLabel = new JLabel(I18NSupport.getString("wizard.publish.file.name")), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0)); add(nameTextField, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 0), 0, 0)); add(pathLabel = new JLabel(I18NSupport.getString("wizard.publish.file.path")), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0)); add(pathTextField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 0), 0, 0)); add(selectPathButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 0), 0, 0)); add(sourceLabel = new JLabel(I18NSupport.getString("wizard.publish.file.source")), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0)); add(dataSourceTextField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 0), 0, 0)); add(selectDataSourceButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 0), 0, 0)); add(descriptionLabel = new JLabel(I18NSupport.getString("wizard.publish.file.description")), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); add(scrArea, new GridBagConstraints(1, 3, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 5, 0, 0), 0, 0)); }
From source file:org.jets3t.apps.cockpit.gui.StartupDialog.java
/** * Initialises all GUI elements.//from w ww. ja v a 2s . c o m */ private void initGui() { this.setResizable(false); this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); cancelButton = new JButton("Don't log in"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); storeCredentialsButton = new JButton("Store Credentials"); storeCredentialsButton.setActionCommand("StoreCredentials"); storeCredentialsButton.addActionListener(this); okButton = new JButton("Log in"); okButton.setActionCommand("LogIn"); okButton.addActionListener(this); // Set default ENTER and ESCAPE buttons. this.getRootPane().setDefaultButton(okButton); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() { private static final long serialVersionUID = -1742280851624947873L; public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } }); JPanel buttonsPanel = new JPanel(new GridBagLayout()); buttonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); buttonsPanel.add(storeCredentialsButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); buttonsPanel.add(okButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); loginPassphrasePanel = new LoginPassphrasePanel(hyperlinkListener); loginLocalFolderPanel = new LoginLocalFolderPanel(ownerFrame, hyperlinkListener); loginCredentialsPanel = new LoginCredentialsPanel(false, hyperlinkListener); // Target storage service selection targetS3 = new JRadioButton("Amazon S3"); targetS3.setSelected(true); targetGS = new JRadioButton("Google Storage"); ButtonGroup targetButtonGroup = new ButtonGroup(); targetButtonGroup.add(targetS3); targetButtonGroup.add(targetGS); JPanel targetServicePanel = new JPanel(new GridBagLayout()); targetServicePanel.add(targetS3, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); targetServicePanel.add(targetGS, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); // Tabbed Pane. tabbedPane = new JTabbedPane(); tabbedPane.addChangeListener(this); tabbedPane.add(loginPassphrasePanel, "Online"); tabbedPane.add(loginLocalFolderPanel, "Local Folder"); tabbedPane.add(loginCredentialsPanel, "Direct Login"); int row = 0; this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(targetServicePanel, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); this.getContentPane().add(tabbedPane, new GridBagConstraints(0, row++, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); this.getContentPane().add(buttonsPanel, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); this.pack(); this.setSize(500, 430); this.setLocationRelativeTo(this.getOwner()); }
From source file:com.frostwire.gui.bittorrent.PartialFilesDialog.java
private void setupOkButton() { GridBagConstraints c;/* w w w . j a va 2 s .c o m*/ _buttonOK = new JButton(I18n.tr("Download Selected Files Only")); _buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buttonOK_actionPerformed(e); } }); c = new GridBagConstraints(); c.insets = new Insets(4, 100, 8, 4); c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.RELATIVE; c.anchor = GridBagConstraints.EAST; c.ipadx = 20; c.weightx = 1.0; c.gridy = 4; panel.add(_buttonOK, c); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.TextualAnnotationsUI.java
/** Builds and lays out the UI. */ private void buildGUI() { removeAll();//from ww w.j a v a 2 s .com if (!model.isAnnotationLoaded()) return; pane = new JScrollPane(commentArea); pane.setBorder(null); setLayout(new GridBagLayout()); constraints = new GridBagConstraints(); constraints.insets = new Insets(2, 0, 2, 0); constraints.fill = GridBagConstraints.BOTH; constraints.anchor = GridBagConstraints.NORTHWEST; constraints.gridx = 0; constraints.gridy = 0; constraints.weightx = 1; constraints.weighty = 1; add(pane, constraints); constraints.gridy++; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; add(addButton, constraints); constraints.gridy++; constraints.weightx = 1; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.NORTHWEST; }
From source file:org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent.java
public void addViews() { this.textTotalHT.setOpaque(false); this.textTotalTVA.setOpaque(false); this.textTotalTTC.setOpaque(false); this.selectCommande = new ElementComboBox(); this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); // Champ Module c.gridx = 0;//from w w w . j a v a 2 s.c o m 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; // Numero JLabel labelNum = new JLabel(getLabelFor("NUMERO")); labelNum.setHorizontalAlignment(SwingConstants.RIGHT); this.add(labelNum, c); this.textNumeroUnique = new JUniqueTextField(16); c.gridx++; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; DefaultGridBagConstraints.lockMinimumSize(textNumeroUnique); this.add(this.textNumeroUnique, c); // Date c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; this.add(new JLabel(getLabelFor("DATE"), SwingConstants.RIGHT), c); JDate date = new JDate(true); c.gridx++; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(date, c); // Reference c.gridy++; c.gridx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c); c.gridx++; c.weightx = 1; this.add(this.textNom, c); if (getTable().contains("DATE_LIVRAISON")) { // Date livraison c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; this.add(new JLabel(getLabelFor("DATE_LIVRAISON"), SwingConstants.RIGHT), c); JDate dateLivraison = new JDate(true); c.gridx++; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(dateLivraison, c); this.addView(dateLivraison, "DATE_LIVRAISON"); } // Client JLabel labelClient = new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT); c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weighty = 0; this.add(labelClient, c); c.gridx++; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.comboClient = new ElementComboBox(); this.add(this.comboClient, c); if (getTable().contains("SPEC_LIVRAISON")) { // Date livraison c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; this.add(new JLabel(getLabelFor("SPEC_LIVRAISON"), SwingConstants.RIGHT), c); JTextField specLivraison = new JTextField(); c.gridx++; c.weightx = 0; c.weighty = 0; this.add(specLivraison, c); this.addView(specLivraison, "SPEC_LIVRAISON"); } final ElementComboBox boxTarif = new ElementComboBox(); this.comboClient.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (comboClient.getElement().getTable().contains("ID_TARIF")) { if (BonDeLivraisonSQLComponent.this.isFilling()) return; final SQLRow row = ((SQLRequestComboBox) evt.getSource()).getSelectedRow(); if (row != null) { // SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF"); // if (foreignRow.isUndefined() && // !row.getForeignRow("ID_DEVISE").isUndefined()) { // SQLRowValues rowValsD = new SQLRowValues(foreignRow.getTable()); // rowValsD.put("ID_DEVISE", row.getObject("ID_DEVISE")); // foreignRow = rowValsD; // // } // tableBonItem.setTarif(foreignRow, true); SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF"); if (!foreignRow.isUndefined() && (boxTarif.getSelectedRow() == null || boxTarif.getSelectedId() != foreignRow.getID()) && JOptionPane.showConfirmDialog(null, "Appliquer les tarifs associs au client?") == JOptionPane.YES_OPTION) { boxTarif.setValue(foreignRow.getID()); // SaisieVenteFactureSQLComponent.this.tableFacture.setTarif(foreignRow, // true); } else { boxTarif.setValue(foreignRow.getID()); } } } } }); // Bouton tout livrer JButton boutonAll = new JButton("Tout livrer"); boutonAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RowValuesTableModel m = BonDeLivraisonSQLComponent.this.tableBonItem.getModel(); // on livre tout les lments for (int i = 0; i < m.getRowCount(); i++) { SQLRowValues rowVals = m.getRowValuesAt(i); Object o = rowVals.getObject("QTE"); int qte = o == null ? 0 : ((Number) o).intValue(); m.putValue(qte, i, "QTE_LIVREE"); } } }); // Tarif if (this.getTable().getFieldsName().contains("ID_TARIF")) { // TARIF c.gridy++; c.gridx = 0; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; this.add(new JLabel("Tarif appliquer"), c); c.gridx++; c.gridwidth = 1; c.weightx = 1; this.add(boxTarif, c); this.addView(boxTarif, "ID_TARIF"); boxTarif.addModelListener("wantedID", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { SQLRow selectedRow = boxTarif.getRequest().getPrimaryTable().getRow(boxTarif.getWantedID()); tableBonItem.setTarif(selectedRow, !isFilling()); } }); } if (getTable().contains("A_ATTENTION")) { // Date livraison c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; this.add(new JLabel(getLabelFor("A_ATTENTION"), SwingConstants.RIGHT), c); JTextField specLivraison = new JTextField(); c.gridx++; c.weightx = 0; c.weighty = 0; this.add(specLivraison, c); this.addView(specLivraison, "A_ATTENTION"); } // Element du bon List<JButton> l = new ArrayList<JButton>(); l.add(boutonAll); this.tableBonItem = new BonDeLivraisonItemTable(l); c.gridx = 0; c.gridy++; c.weightx = 1; c.weighty = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; this.add(this.tableBonItem, c); c.anchor = GridBagConstraints.EAST; // Totaux reconfigure(this.textTotalHT); reconfigure(this.textTotalTVA); reconfigure(this.textTotalTTC); // Poids Total c.gridy++; c.gridx = 1; c.weightx = 0; c.weighty = 0; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; this.addSQLObject(this.textPoidsTotal, "TOTAL_POIDS"); this.addRequiredSQLObject(this.textTotalHT, "TOTAL_HT"); this.addRequiredSQLObject(this.textTotalTVA, "TOTAL_TVA"); this.addRequiredSQLObject(this.textTotalTTC, "TOTAL_TTC"); TotalPanel panelTotal = new TotalPanel(tableBonItem, textTotalHT, textTotalTVA, textTotalTTC, new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(), textPoidsTotal, null); c.gridx = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0; c.weighty = 0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; this.add(panelTotal, c); c.anchor = GridBagConstraints.WEST; /******************************************************************************************* * * INFORMATIONS COMPLEMENTAIRES ******************************************************************************************/ c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy++; TitledSeparator sep = new TitledSeparator("Informations complmentaires"); c.insets = new Insets(10, 2, 1, 2); this.add(sep, c); c.insets = new Insets(2, 2, 1, 2); ITextArea textInfos = new ITextArea(4, 4); c.gridx = 0; c.gridy++; c.gridheight = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.BOTH; final JScrollPane scrollPane = new JScrollPane(textInfos); this.add(scrollPane, c); textInfos.setBorder(null); DefaultGridBagConstraints.lockMinimumSize(scrollPane); c.gridx = 0; c.gridy++; c.gridheight = 1; c.gridwidth = 4; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; this.panelOO = new PanelOOSQLComponent(this); this.add(this.panelOO, c); this.addRequiredSQLObject(date, "DATE"); this.addSQLObject(textInfos, "INFOS"); this.addSQLObject(this.textNom, "NOM"); this.addSQLObject(this.selectCommande, "ID_COMMANDE_CLIENT"); this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO"); this.addRequiredSQLObject(this.comboClient, "ID_CLIENT"); // Doit etre lock a la fin DefaultGridBagConstraints.lockMinimumSize(comboClient); }
From source file:org.openconcerto.erp.core.finance.accounting.ui.CloturePanel.java
public CloturePanel() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.gridx = 0;//from w w w. jav a 2 s .c om c.gridy = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.weightx = 0; c.weighty = 0; JLabel rappel = new JLabelBold("Oprations effectuer avant de continuer: "); JLabel label = new JLabel("- report des charges et produits constats d'avance"); JLabel label2 = new JLabel("- report des charges payer et produits recevoir"); JLabel label3 = new JLabel("- impression du bilan, compte de rsultat, grand livre, journaux et balance"); JLabel label5 = new JLabel("- gnration les critures comptables des payes"); JLabel label4 = new JLabel("Il est prfrable de raliser une sauvegarde avant de continuer."); JLabel op = new JLabelBold("Oprations qui vont etre effectues: "); JLabel labelValid = new JLabel( "- validation de toutes les critures concernant la priode de l'exercice."); JLabel labelSoldeGestion = new JLabel("- soldes de tous les comptes de gestions 6* et 7*"); JLabel labelSoldeBilan = new JLabel("- soldes de tous les comptes de bilan"); JLabel labelAN = new JLabel("- report des nouveaux"); c.gridy = GridBagConstraints.RELATIVE; c.gridx = 0; // Date de l'ancien exercice Calendar dDebut = this.rowExercice.getDate("DATE_DEB"); Calendar dFin = this.rowExercice.getDate("DATE_FIN"); JLabel labelAncienExercice = new JLabel("Clture de l'exercice du " + dateFormat.format(dDebut.getTime()) + " au " + dateFormat.format(dFin.getTime())); this.add(labelAncienExercice, c); c.insets = new Insets(10, 2, 1, 2); this.add(rappel, c); this.add(label, c); this.add(label2, c); this.add(label3, c); this.add(label5, c); this.add(label4, c); c.insets = new Insets(15, 2, 1, 2); this.add(op, c); c.insets = new Insets(10, 2, 1, 2); this.add(labelValid, c); this.add(labelSoldeGestion, c); this.add(labelSoldeBilan, c); this.add(labelAN, c); // Date du prochain exercice c.gridwidth = 1; c.gridy = GridBagConstraints.RELATIVE; c.gridx = 0; c.gridx = GridBagConstraints.RELATIVE; c.fill = GridBagConstraints.NONE; this.add(new JLabel("Date du nouvel exercice du "), c); dDebut.set(Calendar.YEAR, dDebut.get(Calendar.YEAR) + 1); this.dateOuv.setValue(dDebut.getTime()); this.add(this.dateOuv, c); this.add(new JLabel("au"), c); dFin.set(Calendar.YEAR, dFin.get(Calendar.YEAR) + 1); this.dateFerm.setValue(dFin.getTime()); this.add(this.dateFerm, c); c.gridx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = 2; c.weightx = 1; this.add(this.opEnCours, c); c.gridwidth = 4; c.gridx = 0; c.weightx = 1; this.add(this.bar, c); // this.add(this.boxValid, c); // Button final JPanel buttonBar = new JPanel(); buttonBar.add(this.valider); buttonBar.add(this.annul); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; c.gridx = 0; this.add(buttonBar, c); final PropertyChangeListener listener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { CloturePanel.this.valider.setEnabled(isDateValid()); } }; this.dateFerm.addValueListener(listener); this.dateOuv.addValueListener(listener); // TODO afficher le deroulement de etapes apres validation this.valider.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { clotureExercice(); // show OK works fine Component comp = SwingUtilities.getRoot(CloturePanel.this); JOptionPane.showMessageDialog(CloturePanel.this, "Exercice cltur", "Fin de la clture", JOptionPane.INFORMATION_MESSAGE); ((JFrame) comp).dispose(); } catch (Exception ex) { ExceptionHandler.handle("Erreur lors de la clture", ex); } } }); this.valider.setEnabled(isDateValid()); this.boxValid.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CloturePanel.this.valider.setEnabled(isDateValid()); } }); this.annul.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ((JFrame) SwingUtilities.getRoot(CloturePanel.this)).dispose(); } }); }
From source file:org.eevolution.form.VCRP.java
private void jbInit() throws Exception { northPanel.setLayout(new java.awt.GridBagLayout()); resourceLabel.setText(Msg.translate(Env.getCtx(), "S_Resource_ID")); northPanel.add(resourceLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); northPanel.add(resource, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); dateFromLabel.setText(Msg.translate(Env.getCtx(), "DateFrom")); northPanel.add(dateFromLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); northPanel.add(dateFrom, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); chartPanel.setPreferredSize(new Dimension(750, 550)); centerPanel.add(chartPanel, BorderLayout.CENTER); confirmPanel.addActionListener(this); }