List of usage examples for java.awt GridBagConstraints BOTH
int BOTH
To view the source code for java.awt GridBagConstraints BOTH.
Click Source Link
From source file:com.digitalgeneralists.assurance.ui.components.ScanDefinitionPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.definition == null) { mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Scan Definition"; this.definition = new ScanDefinition(); } else {//from ww w . j av a 2 s.co m mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Scan Definition"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel optionsPanel = new JPanel(); optionsPanel.setLayout(new GridBagLayout()); Border optionsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); optionsBorder = BorderFactory.createTitledBorder(optionsBorder, "Merge Options", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints nameTextFieldConstraints = new GridBagConstraints(); nameTextFieldConstraints.anchor = GridBagConstraints.NORTH; nameTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; nameTextFieldConstraints.gridx = 0; nameTextFieldConstraints.gridy = 0; nameTextFieldConstraints.weightx = 1.0; nameTextFieldConstraints.weighty = 1.0; nameTextFieldConstraints.gridheight = 1; nameTextFieldConstraints.gridwidth = 2; nameTextFieldConstraints.insets = new Insets(10, 5, 0, 5); this.nameTextField.setText(this.definition.getName()); this.nameTextField.getDocument().addDocumentListener(this.textPropertyValidationListener); this.add(this.nameTextField, nameTextFieldConstraints); Border existingScanMappingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); existingScanMappingsPanelBorder = BorderFactory.createTitledBorder(existingScanMappingsPanelBorder, "Paths", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints existingScanMappingsPanelConstraints = new GridBagConstraints(); existingScanMappingsPanelConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsPanelConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsPanelConstraints.gridx = 0; existingScanMappingsPanelConstraints.gridy = 1; existingScanMappingsPanelConstraints.weightx = 1.0; existingScanMappingsPanelConstraints.weighty = 1.0; existingScanMappingsPanelConstraints.gridheight = 1; existingScanMappingsPanelConstraints.gridwidth = 2; existingScanMappingsPanelConstraints.insets = new Insets(5, 5, 0, 5); JPanel existingScanMappingsPanel = new JPanel(); GridBagLayout panelGridbag = new GridBagLayout(); existingScanMappingsPanel.setLayout(panelGridbag); existingScanMappingsPanel.setBorder(existingScanMappingsPanelBorder); this.add(existingScanMappingsPanel, existingScanMappingsPanelConstraints); GridBagConstraints existingScanMappingsListConstraints = new GridBagConstraints(); existingScanMappingsListConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsListConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsListConstraints.gridx = 0; existingScanMappingsListConstraints.gridy = 0; existingScanMappingsListConstraints.weightx = 1.0; existingScanMappingsListConstraints.weighty = 0.9; existingScanMappingsListConstraints.gridheight = 1; existingScanMappingsListConstraints.gridwidth = 2; existingScanMappingsListConstraints.insets = new Insets(5, 5, 5, 5); this.definition = (ScanDefinition) ModelUtils.initializeEntity(this.definition, ScanDefinition.SCAN_MAPPING_PROPERTY); this.scanMappingsList = new ListInputPanel<ScanMappingDefinition>(this.definition, this); existingScanMappingsPanel.add(this.scanMappingsList, existingScanMappingsListConstraints); GridBagConstraints optionsPanelConstraints = new GridBagConstraints(); optionsPanelConstraints.anchor = GridBagConstraints.SOUTH; optionsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; optionsPanelConstraints.gridx = 0; optionsPanelConstraints.gridy = 3; optionsPanelConstraints.weightx = 1.0; optionsPanelConstraints.weighty = 1.0; optionsPanelConstraints.gridheight = 1; optionsPanelConstraints.gridwidth = 2; optionsPanelConstraints.insets = new Insets(5, 5, 5, 5); optionsPanel.setBorder(optionsBorder); this.add(optionsPanel, optionsPanelConstraints); GridBagConstraints strategyLabelConstraints = new GridBagConstraints(); strategyLabelConstraints.anchor = GridBagConstraints.WEST; strategyLabelConstraints.fill = GridBagConstraints.BOTH; strategyLabelConstraints.gridx = 0; strategyLabelConstraints.gridy = 0; strategyLabelConstraints.weightx = 1.0; strategyLabelConstraints.weighty = 1.0; strategyLabelConstraints.gridheight = 1; strategyLabelConstraints.gridwidth = 1; strategyLabelConstraints.insets = new Insets(5, 5, 0, 5); final JLabel strategyLabel = new JLabel("Strategy", SwingConstants.RIGHT); optionsPanel.add(strategyLabel, strategyLabelConstraints); GridBagConstraints strategyComboBoxConstraints = new GridBagConstraints(); strategyComboBoxConstraints.anchor = GridBagConstraints.WEST; strategyComboBoxConstraints.fill = GridBagConstraints.VERTICAL; strategyComboBoxConstraints.gridx = 1; strategyComboBoxConstraints.gridy = 0; strategyComboBoxConstraints.weightx = 1.0; strategyComboBoxConstraints.weighty = 1.0; strategyComboBoxConstraints.gridheight = 1; strategyComboBoxConstraints.gridwidth = 1; strategyComboBoxConstraints.insets = new Insets(5, 5, 0, 5); String[] strategyLabels = { "Source", "Target", "Both" }; this.strategyComboBox = new JComboBox<String>(strategyLabels); // NOTE: We should have better validation of the data state for these controls. // We could run into problems as the application versions over time. this.strategyComboBox.setSelectedIndex(this.definition.getMergeStrategy().ordinal()); this.strategyComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { validateFormState(); } }); optionsPanel.add(this.strategyComboBox, strategyComboBoxConstraints); GridBagConstraints autoMergeCheckBoxConstraints = new GridBagConstraints(); autoMergeCheckBoxConstraints.gridx = 0; autoMergeCheckBoxConstraints.gridy = 1; autoMergeCheckBoxConstraints.weightx = 1.0; autoMergeCheckBoxConstraints.weighty = 1.0; autoMergeCheckBoxConstraints.gridheight = 1; autoMergeCheckBoxConstraints.gridwidth = 2; autoMergeCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.autoMergeCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.autoMergeCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.autoMergeCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.autoMergeCheckBox, autoMergeCheckBoxConstraints); GridBagConstraints includeNonCreationTimestampsCheckBoxConstraints = new GridBagConstraints(); includeNonCreationTimestampsCheckBoxConstraints.gridx = 0; includeNonCreationTimestampsCheckBoxConstraints.gridy = 2; includeNonCreationTimestampsCheckBoxConstraints.weightx = 1.0; includeNonCreationTimestampsCheckBoxConstraints.weighty = 1.0; includeNonCreationTimestampsCheckBoxConstraints.gridheight = 1; includeNonCreationTimestampsCheckBoxConstraints.gridwidth = 2; includeNonCreationTimestampsCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeNonCreationTimestampCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeNonCreationTimestampCheckBox.setSelected(this.definition.getIncludeNonCreationTimestamps()); this.includeNonCreationTimestampCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeNonCreationTimestampCheckBox, includeNonCreationTimestampsCheckBoxConstraints); GridBagConstraints advancedAttributesCheckBoxConstraints = new GridBagConstraints(); advancedAttributesCheckBoxConstraints.gridx = 0; advancedAttributesCheckBoxConstraints.gridy = 3; advancedAttributesCheckBoxConstraints.weightx = 1.0; advancedAttributesCheckBoxConstraints.weighty = 1.0; advancedAttributesCheckBoxConstraints.gridheight = 1; advancedAttributesCheckBoxConstraints.gridwidth = 2; advancedAttributesCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeAdvancedAttributesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeAdvancedAttributesCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.includeAdvancedAttributesCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeAdvancedAttributesCheckBox, advancedAttributesCheckBoxConstraints); this.scanMappingsList.loadData(); if (this.getMode() == AssuranceDialogMode.EDIT) { this.validateFormState(); } this.initialized = true; } }
From source file:com.rapidminer.gui.new_plotter.gui.dialog.AddParallelLineDialog.java
/** * Setup the GUI./*from w w w . j a va 2 s . com*/ */ private void setupGUI() { JPanel mainPanel = new JPanel(); this.setContentPane(mainPanel); // start layout mainPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 2, 5); horizontalLineRadiobutton = new JRadioButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.horizontal.label")); horizontalLineRadiobutton.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.horizontal.tip")); horizontalLineRadiobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setHorizontalLineSelected(); } }); horizontalLineRadiobutton.setSelected(true); this.add(horizontalLineRadiobutton, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.EAST; verticalLineRadiobutton = new JRadioButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.vertical.label")); verticalLineRadiobutton .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.vertical.tip")); verticalLineRadiobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVerticalLineSelected(); } }); this.add(verticalLineRadiobutton, gbc); ButtonGroup group = new ButtonGroup(); group.add(horizontalLineRadiobutton); group.add(verticalLineRadiobutton); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.CENTER; rangeAxisSelectionCombobox = new JComboBox(); rangeAxisSelectionCombobox.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.range_axis_combobox.tip")); rangeAxisSelectionCombobox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateYFieldValue(); } }); this.add(rangeAxisSelectionCombobox, gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 2, 5); JLabel xLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.width.label")); this.add(xLabel, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.insets = new Insets(2, 5, 2, 5); gbc.fill = GridBagConstraints.HORIZONTAL; xField = new JTextField(); xField.setText(String.valueOf(x)); xField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyYInput(input); } }); xField.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.width.tip")); xField.setEnabled(false); this.add(xField, gbc); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.NONE; JLabel yLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.height.label")); this.add(yLabel, gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; yField = new JTextField(); yField.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.height.tip")); yField.setText(String.valueOf(y)); yField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyXInput(input); } }); this.add(yField, gbc); gbc.gridx = 0; gbc.gridy = 4; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets(10, 5, 0, 5); modifyLineButton = new JButton(); modifyLineButton.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.modify_line.tip")); modifyLineButton.setIcon(SwingTools.createIcon( "16/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.modify_line.icon"))); modifyLineButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { modifyLine(); } }); this.add(modifyLineButton, gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(15, 5, 5, 5); this.add(new JSeparator(), gbc); gbc.gridx = 0; gbc.gridy = 6; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); okButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.label")); okButton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.tip")); okButton.setIcon(SwingTools .createIcon("24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.icon"))); okButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.mne").toCharArray()[0]); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean successful = addSpecifiedLine(); // don't dispose dialog if not successful if (!successful) { return; } AddParallelLineDialog.this.dispose(); } }); okButton.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { okButton.doClick(); } } }); this.add(okButton, gbc); gbc.gridx = 1; gbc.gridy = 6; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; cancelButton = new JButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.label")); cancelButton .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.tip")); cancelButton.setIcon(SwingTools.createIcon( "24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.icon"))); cancelButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.mne").toCharArray()[0]); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // cancel requested, close dialog AddParallelLineDialog.this.dispose(); } }); this.add(cancelButton, gbc); // misc settings this.setMinimumSize(new Dimension(300, 250)); // center dialog this.setLocationRelativeTo(null); this.setTitle(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.title.label")); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setModal(true); this.addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { okButton.requestFocusInWindow(); } }); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.CommentsTaskPaneUI.java
/** Builds and lays out the UI. */ private void buildGUI() { removeAll();// w ww. ja v a 2 s . c o m bgColor = UIUtilities.BACKGROUND_COLOUR_ODD; 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:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java
/** * This method initializes this/*from w w w . j a va2 s. co m*/ * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 0; gridBagConstraints12.anchor = GridBagConstraints.WEST; gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints12.gridwidth = 2; gridBagConstraints12.weightx = 0.0; gridBagConstraints12.gridy = 1; GridBagConstraints gridBagConstraints23 = new GridBagConstraints(); gridBagConstraints23.fill = GridBagConstraints.BOTH; gridBagConstraints23.weighty = 1.0; gridBagConstraints23.gridwidth = 1; gridBagConstraints23.weightx = 1.0; jLabelComponentForOpt1 = new JLabel(); jLabelComponentForOpt1.setText("(Option) Component :"); jLabelComponentForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelLicenseForOpt1 = new JLabel(); jLabelLicenseForOpt1.setText("License :"); jLabelLicenseForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelRepresentativeLicenseForOpt2 = new JLabel(); jLabelRepresentativeLicenseForOpt2.setText("Representative License :"); jLabelRepresentativeLicenseForOpt2.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelNoticeForOpt1 = new JLabel(); jLabelNoticeForOpt1.setText( "Note) If you don't choose a component, it will be identified by \"DECLARED_STRING_MATCH_LICENSE_\" + \"License Name\"."); jLabelNoticeForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12)); this.setSize(570, 480); this.setLayout(new GridBagLayout()); this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); // matched code view & license match info table this.add(getJSplitPaneCodeAndTable(), gridBagConstraints23); // option this.add(getJScrollPanelOptions(), gridBagConstraints12); }
From source file:org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent.java
public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); // Numero du commande c.gridx = 0;// w w w . j a v a2 s . co m this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c); this.numeroUniqueCommande = new JUniqueTextField(16); c.fill = GridBagConstraints.NONE; c.gridx++; c.weightx = 1; this.add(this.numeroUniqueCommande, c); // Date JLabel labelDate = new JLabel(getLabelFor("DATE")); labelDate.setHorizontalAlignment(SwingConstants.RIGHT); c.gridx = 2; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; this.add(labelDate, c); JDate dateCommande = new JDate(true); c.gridx++; c.fill = GridBagConstraints.NONE; this.add(dateCommande, c); // Champ Module c.gridx = 0; c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; final JPanel addP = ComptaSQLConfElement.createAdditionalPanel(); this.setAdditionalFieldsPanel(new FormLayouter(addP, 2)); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; this.add(addP, c); c.gridy++; c.gridwidth = 1; this.comboDevis = new ElementComboBox(); // Reference c.gridx = 0; c.gridy++; c.gridwidth = 1; c.gridwidth = 1; c.gridheight = 1; c.fill = GridBagConstraints.HORIZONTAL; JLabel labelObjet = new JLabel(getLabelFor("NOM")); labelObjet.setHorizontalAlignment(SwingConstants.RIGHT); c.weightx = 0; this.add(labelObjet, c); c.gridx++; c.weightx = 1; c.fill = GridBagConstraints.BOTH; this.add(this.textObjet, c); String field; field = "ID_COMMERCIAL"; c.fill = GridBagConstraints.HORIZONTAL; // Commercial JLabel labelCommercial = new JLabel(getLabelFor(field)); labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT); c.gridx++; c.weightx = 0; this.add(labelCommercial, c); this.comboCommercial = new ElementComboBox(false, 25); this.comboCommercial.setListIconVisible(false); c.gridx++; c.fill = GridBagConstraints.NONE; c.weightx = 1; this.add(this.comboCommercial, c); addRequiredSQLObject(this.comboCommercial, field); // Ligne 3: Client c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), c); this.comboClient = new ElementComboBox(); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 3; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(this.comboClient, c); final ElementComboBox boxTarif = new ElementComboBox(); this.comboClient.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (!isFilling() && comboClient.getValue() != null) { Integer id = comboClient.getValue(); if (id > 1) { SQLRow row = comboClient.getElement().getTable().getRow(id); if (comboClient.getElement().getTable().getFieldsName().contains("ID_TARIF")) { 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()); } // 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; // // } // table.setTarif(foreignRow, true); } } } } }); // 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 = GridBagConstraints.REMAINDER; 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()); table.setTarif(selectedRow, false); } }); } // Table d'lment this.table = new CommandeClientItemTable(); c.fill = GridBagConstraints.BOTH; c.gridy++; c.gridx = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = GridBagConstraints.REMAINDER; this.add(this.table, c); DeviseField textPortHT = new DeviseField(); DeviseField textRemiseHT = new DeviseField(); // INfos c.gridx = 0; c.gridy++; c.gridheight = 1; c.weighty = 0; c.weightx = 1; c.anchor = GridBagConstraints.WEST; c.gridwidth = 2; this.add(new TitledSeparator(getLabelFor("INFOS")), c); c.gridy++; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.BOTH; final JScrollPane scrollPane = new JScrollPane(this.infos); scrollPane.setBorder(null); this.add(scrollPane, c); // Poids c.gridwidth = 1; DefaultProps props = DefaultNXProps.getInstance(); Boolean b = props.getBooleanValue("ArticleShowPoids"); final JTextField textPoidsTotal = new JTextField(8); if (b) { JPanel panel = new JPanel(); panel.add(new JLabel(getLabelFor("T_POIDS")), c); textPoidsTotal.setEnabled(false); textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT); textPoidsTotal.setDisabledTextColor(Color.BLACK); panel.add(textPoidsTotal, c); panel.setOpaque(false); DefaultGridBagConstraints.lockMinimumSize(panel); c.gridx = 2; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTHEAST; this.add(panel, c); } // Total DeviseField fieldHT = new DeviseField(); DeviseField fieldTVA = new DeviseField(); DeviseField fieldTTC = new DeviseField(); DeviseField fieldDevise = new DeviseField(); DeviseField fieldService = new DeviseField(); DeviseField fieldHA = new DeviseField(); fieldHT.setOpaque(false); fieldHA.setOpaque(false); fieldTVA.setOpaque(false); fieldTTC.setOpaque(false); fieldService.setOpaque(false); addSQLObject(fieldDevise, "T_DEVISE"); addRequiredSQLObject(fieldHT, "T_HT"); addRequiredSQLObject(fieldTVA, "T_TVA"); addRequiredSQLObject(fieldTTC, "T_TTC"); addRequiredSQLObject(fieldService, "T_SERVICE"); if (getTable().contains("PREBILAN")) { addSQLObject(fieldHA, "PREBILAN"); } else if (getTable().contains("T_HA")) { addSQLObject(fieldHA, "T_HA"); } JTextField poids = new JTextField(); // addSQLObject(poids, "T_POIDS"); final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null); c.gridx = GridBagConstraints.RELATIVE; c.gridy--; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 2; c.anchor = GridBagConstraints.NORTHEAST; c.fill = GridBagConstraints.NONE; c.weighty = 0; this.add(totalTTC, c); this.panelOO = new PanelOOSQLComponent(this); c.gridwidth = 1; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; c.gridx = 0; c.gridy += 3; c.weightx = 0; c.gridwidth = GridBagConstraints.REMAINDER; this.add(this.panelOO, c); textPortHT.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void removeUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void insertUpdate(DocumentEvent e) { totalTTC.updateTotal(); } }); textRemiseHT.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void removeUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void insertUpdate(DocumentEvent e) { totalTTC.updateTotal(); } }); addRequiredSQLObject(this.comboClient, "ID_CLIENT"); addSQLObject(this.textObjet, "NOM"); addSQLObject(textPoidsTotal, "T_POIDS"); addRequiredSQLObject(dateCommande, "DATE"); // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS"); addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO"); addSQLObject(this.infos, "INFOS"); addSQLObject(this.comboDevis, "ID_DEVIS"); this.numeroUniqueCommande .setText(NumerotationAutoSQLElement.getNextNumero(CommandeClientSQLElement.class, new Date())); this.table.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { textPoidsTotal.setText(String.valueOf(CommandeClientSQLComponent.this.table.getPoidsTotal())); } }); DefaultGridBagConstraints.lockMinimumSize(comboClient); DefaultGridBagConstraints.lockMinimumSize(comboCommercial); DefaultGridBagConstraints.lockMinimumSize(comboDevis); DefaultGridBagConstraints.lockMinimumSize(totalTTC); DefaultGridBagConstraints.lockMaximumSize(totalTTC); DefaultGridBagConstraints.lockMinimumSize(numeroUniqueCommande); }
From source file:org.pentaho.reporting.engine.classic.core.modules.gui.commonswing.ExceptionDialog.java
private void init() { messages = new Messages(getLocale(), SwingCommonModule.BUNDLE_NAME, ObjectUtilities.getClassLoader(SwingCommonModule.class)); setModal(true);/*w ww .jav a2 s .c om*/ detailsAction = new DetailsAction(); messageLabel = new JLabel(); backtraceArea = new JTextArea(); scroller = new JScrollPane(backtraceArea); scroller.setVisible(false); final JPanel detailPane = new JPanel(); detailPane.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 0; final JLabel icon = new JLabel(UIManager.getDefaults().getIcon("OptionPane.errorIcon")); //$NON-NLS-1$ icon.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); detailPane.add(icon, gbc); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 1; gbc.weighty = 1; gbc.gridx = 1; gbc.gridy = 0; detailPane.add(messageLabel); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.SOUTH; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 2; detailPane.add(createButtonPane(), gbc); filler = new JPanel(); filler.setPreferredSize(new Dimension(0, 0)); filler.setBackground(Color.green); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; gbc.weighty = 5; gbc.gridx = 0; gbc.gridy = 3; gbc.gridwidth = 2; detailPane.add(filler, gbc); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.SOUTHWEST; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1; gbc.weighty = 5; gbc.gridx = 0; gbc.gridy = 4; gbc.gridwidth = 2; detailPane.add(scroller, gbc); setContentPane(detailPane); }
From source file:com.game.ui.views.PlayerEditor.java
public void doGui() { // setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setLayout(new GridBagLayout()); GridBagConstraints c1 = new GridBagConstraints(); c1.fill = GridBagConstraints.NONE; c1.anchor = GridBagConstraints.WEST; c1.insets = new Insets(10, 5, 10, 5); c1.weightx = 0;//from w w w.j av a2s. c o m c1.weighty = 0; JLabel noteLbl = new JLabel("Pls select a value to choose a Player or you can create a new " + "Player entity below. Once selected a Player character, its' details will be available below"); add(noteLbl, c1); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (GameCharacter character : GameBean.playerDetails) { model.addElement(((Player) character).getType()); } c1.gridy = 1; comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(comboBox, c1); JPanel wrapperPanel = new JPanel(new GridLayout(1, 2, 10, 10)); wrapperPanel.setBorder(LineBorder.createGrayLineBorder()); leftPanel = new JPanel(); leftPanel.setAlignmentX(0); leftPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel enemyDtlLbl = new JLabel("Enemy Character Details : "); enemyDtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); leftPanel.add(enemyDtlLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); leftPanel.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); leftPanel.add(name, c); c.gridx = 0; c.gridy = 2; JLabel imageLbl = new JLabel("Image Path : "); leftPanel.add(imageLbl, c); c.gridx = 1; JTextField image = new JTextField(""); image.setColumns(20); leftPanel.add(image, c); c.gridx = 0; c.gridy = 3; JLabel healthLbl = new JLabel("Health Pts : "); leftPanel.add(healthLbl, c); c.gridx = 1; JTextField health = new JTextField(""); health.setColumns(20); leftPanel.add(health, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); leftPanel.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); leftPanel.add(attackPts, c); c.gridx = 0; c.gridy = 5; JLabel armoursPtsLbl = new JLabel("Armour Points : "); leftPanel.add(armoursPtsLbl, c); c.gridx = 1; JTextField armourPts = new JTextField(""); armourPts.setColumns(20); leftPanel.add(armourPts, c); c.gridx = 0; c.gridy = 6; JLabel attackRngeLbl = new JLabel("Attack Range : "); leftPanel.add(attackRngeLbl, c); c.gridx = 1; JTextField attackRnge = new JTextField(""); attackRnge.setColumns(20); leftPanel.add(attackRnge, c); c.gridx = 0; c.gridy = 7; JLabel movementLbl = new JLabel("Movement : "); leftPanel.add(movementLbl, c); c.gridx = 1; JTextField movement = new JTextField(""); movement.setColumns(20); leftPanel.add(movement, c); c.gridx = 0; c.gridy = 8; JLabel typeLbl = new JLabel("Type : "); leftPanel.add(typeLbl, c); c.gridx = 1; JTextField typeTxt = new JTextField(""); typeTxt.setColumns(20); leftPanel.add(typeTxt, c); c.gridx = 0; c.gridy = 9; JLabel weaponLbl = new JLabel("Equipped Weapon : "); leftPanel.add(weaponLbl, c); c.gridx = 1; DefaultComboBoxModel weapon = new DefaultComboBoxModel(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { weapon.addElement(((Weapon) item).getName()); } } JComboBox weaponDrpDown = new JComboBox(weapon); weaponDrpDown.setSelectedIndex(-1); weaponDrpDown.setMaximumSize(new Dimension(100, 30)); leftPanel.add(weaponDrpDown, c); c.gridx = 0; c.gridy = 10; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); leftPanel.add(submit, c); wrapperPanel.add(leftPanel); lvlPanel = new LevelPanel(true, null); wrapperPanel.add(lvlPanel); c1.gridy = 2; c1.fill = GridBagConstraints.BOTH; add(wrapperPanel, c1); c1.fill = GridBagConstraints.NONE; validationMess = new JLabel("Pls enter all the fields or pls choose a character from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); c1.gridy = 3; add(validationMess, c1); c1.weightx = 1; c1.fill = GridBagConstraints.BOTH; c1.weighty = 1; c1.gridy = 4; add(new JPanel(), c1); }
From source file:edu.harvard.mcz.imagecapture.SpecimenBrowser.java
/** * This method initializes jPanel //from w w w.j a va 2s . com * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.fill = GridBagConstraints.BOTH; gridBagConstraints4.gridy = 0; gridBagConstraints4.weightx = 1.0; gridBagConstraints4.gridx = 7; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 6; gridBagConstraints3.gridy = 0; jLabel3 = new JLabel(); jLabel3.setText("Drawer:"); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.fill = GridBagConstraints.BOTH; gridBagConstraints21.gridy = 0; gridBagConstraints21.weightx = 1.0; gridBagConstraints21.gridx = 5; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 4; gridBagConstraints11.gridy = 0; jLabel2 = new JLabel(); jLabel2.setText("Family:"); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 2; gridBagConstraints2.insets = new Insets(0, 5, 0, 0); gridBagConstraints2.gridy = 0; jLabel1 = new JLabel(); jLabel1.setText("Workflow:"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridx = 3; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; jLabel = new JLabel(); jLabel.setText("Find Barcode:"); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(jLabel, new GridBagConstraints()); jPanel.add(getJTextField(), gridBagConstraints); jPanel.add(getJComboBox(), gridBagConstraints1); jPanel.add(jLabel1, gridBagConstraints2); jPanel.add(jLabel2, gridBagConstraints11); jPanel.add(getJTextFieldFamily(), gridBagConstraints21); jPanel.add(jLabel3, gridBagConstraints3); jPanel.add(getJTextFieldDrawerNumber(), gridBagConstraints4); } return jPanel; }
From source file:IconDemoApplet.java
public void init() { //Parse the applet parameters pictures = parseParameters();//from w w w . ja va2 s . c o m //If the applet tag doesn't provide an "IMAGE0" parameter, //display an error message. if (pictures.size() == 0) { captionLabel = new JLabel("No images listed in applet tag."); captionLabel.setHorizontalAlignment(JLabel.CENTER); getContentPane().add(captionLabel); return; } //NOW CREATE THE GUI COMPONENTS //A label to identify XX of XX. numberLabel = new JLabel("Picture " + (current + 1) + " of " + pictures.size()); numberLabel.setHorizontalAlignment(JLabel.LEFT); numberLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 5)); //A label for the caption. final Photo first = (Photo) pictures.firstElement(); captionLabel = new JLabel(first.caption); captionLabel.setHorizontalAlignment(JLabel.CENTER); captionLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); //A label for displaying the photographs. photographLabel = new JLabel("Loading first image..."); photographLabel.setHorizontalAlignment(JLabel.CENTER); photographLabel.setVerticalAlignment(JLabel.CENTER); photographLabel.setVerticalTextPosition(JLabel.CENTER); photographLabel.setHorizontalTextPosition(JLabel.CENTER); photographLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); photographLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0), photographLabel.getBorder())); //Set the preferred size for the picture, //with room for the borders. Insets i = photographLabel.getInsets(); photographLabel.setPreferredSize( new Dimension(widthOfWidest + i.left + i.right, heightOfTallest + i.bottom + i.top)); //Create the next and previous buttons. ImageIcon nextIcon = new ImageIcon(getURL(imagedir + "right.gif")); ImageIcon dimmedNextIcon = new ImageIcon(getURL(imagedir + "dimmedRight.gif")); ImageIcon previousIcon = new ImageIcon(getURL(imagedir + "left.gif")); ImageIcon dimmedPreviousIcon = new ImageIcon(getURL(imagedir + "dimmedLeft.gif")); previousButton = new JButton("Previous Picture", previousIcon); previousButton.setDisabledIcon(dimmedPreviousIcon); previousButton.setVerticalTextPosition(AbstractButton.CENTER); previousButton.setHorizontalTextPosition(AbstractButton.RIGHT); previousButton.setMnemonic(KeyEvent.VK_P); previousButton.setActionCommand("previous"); previousButton.addActionListener(this); previousButton.setEnabled(false); nextButton = new JButton("Next Picture", nextIcon); nextButton.setDisabledIcon(dimmedNextIcon); nextButton.setVerticalTextPosition(AbstractButton.CENTER); nextButton.setHorizontalTextPosition(AbstractButton.LEFT); nextButton.setMnemonic(KeyEvent.VK_N); nextButton.setActionCommand("next"); nextButton.addActionListener(this); //Lay out the GUI. GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); Container contentPane = getContentPane(); contentPane.setLayout(layout); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(numberLabel, c); contentPane.add(numberLabel); layout.setConstraints(captionLabel, c); contentPane.add(captionLabel); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; layout.setConstraints(photographLabel, c); contentPane.add(photographLabel); c.gridwidth = GridBagConstraints.RELATIVE; c.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(previousButton, c); contentPane.add(previousButton); c.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(nextButton, c); contentPane.add(nextButton); //Start loading the image for the first photograph now. //The loadImage method uses a SwingWorker //to load the image in a separate thread. loadImage(imagedir + first.filename, current); }
From source file:com.att.aro.ui.view.menu.tools.RegexWizard.java
public void init() { GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendViews("VideoParserWizard"); setDefaultCloseOperation(RegexWizard.DISPOSE_ON_CLOSE); enableCheckBoxes(true);// w ww.ja va 2 s .c o m this.setSize(815, 800); this.setMaximumSize(new Dimension(815, 800)); this.setMinimumSize(new Dimension(815, 700)); this.setModal(false); this.setTitle(resourceBundle.getString("videoParser.wizard.title")); this.setLocationRelativeTo(getOwner()); this.setAlwaysOnTop(true); this.setResizable(false); setLayout(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.fill = GridBagConstraints.BOTH; constraint.gridx = 0; constraint.gridy = 0; constraint.weightx = 1; constraint.weighty = 0.6; constraint.gridwidth = 2; add(getFieldPanel(), constraint); constraint.gridy = 1; constraint.gridwidth = 1; constraint.weighty = 0.38; constraint.weightx = 0.4; constraint.insets = new Insets(0, 2, 0, 5); add(getMatcherPanel(), constraint); constraint.weightx = 0.5; constraint.gridx = 1; constraint.insets = new Insets(0, 1, 0, 2); add(getResultPanel(), constraint); constraint.weightx = 1; constraint.gridy = 2; constraint.gridx = 0; constraint.weighty = 0.02; constraint.gridwidth = 2; add(getBottomPanel(), constraint); this.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent e) { clear(); } }); pack(); }