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:org.openconcerto.erp.core.finance.accounting.ui.PlanComptableGPanel.java
private void uiInit() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); this.setOpaque(false); this.panelCompte.setOpaque(false); this.panelInfosCompte.setOpaque(false); this.panelDetails.setOpaque(false); this.panelCompte.setLayout(new GridBagLayout()); this.panelInfosCompte.setLayout(new GridBagLayout()); this.panelDetails.setLayout(new GridBagLayout()); /******************************************************************************************* * * RadioButton Selection du mode d'affichage du PCG abrege, base ou developp Panel * Details//from w w w . ja v a2s. c om ******************************************************************************************/ this.panelDetails.add(this.radioCompteBase, c); this.radioCompteBase.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateCompteTable(); } }); c.gridy++; this.panelDetails.add(this.radioCompteAbrege, c); this.radioCompteAbrege.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateCompteTable(); } }); c.gridy++; this.panelDetails.add(this.radioCompteDeveloppe, c); this.radioCompteDeveloppe.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateCompteTable(); } }); ButtonGroup grp1 = new ButtonGroup(); grp1.add(this.radioCompteBase); grp1.add(this.radioCompteAbrege); grp1.add(this.radioCompteDeveloppe); this.radioCompteBase.setSelected(true); /******************************************************************************************* * ** Panel Compte ******************************************************************************************/ c.insets = new Insets(2, 2, 1, 2); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0; c.weighty = 0; this.panelDetails.setBorder(BorderFactory.createTitledBorder("Dtails")); this.panelCompte.add(this.panelDetails, c); /******************************************************************************************* * * Affichage du plan comptable ******************************************************************************************/ SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete(); SQLTable classeCompteTable = base.getTable("CLASSE_COMPTE"); SQLSelect selClasse = new SQLSelect(base); selClasse.addSelect(classeCompteTable.getField("ID")); selClasse.addSelect(classeCompteTable.getField("NOM")); selClasse.addSelect(classeCompteTable.getField("TYPE_NUMERO_COMPTE")); selClasse.addRawOrder("\"CLASSE_COMPTE\".\"TYPE_NUMERO_COMPTE\""); String reqClasse = selClasse.asString(); Object obClasse = base.getDataSource().execute(reqClasse, new ArrayListHandler()); List myListClasse = (List) obClasse; if (myListClasse.size() != 0) { for (int k = 0; k < myListClasse.size(); k++) { Object[] objTmp = (Object[]) myListClasse.get(k); ClasseCompte ccTmp = new ClasseCompte(Integer.parseInt(objTmp[0].toString()), objTmp[1].toString(), objTmp[2].toString()); this.classeComptes.add(ccTmp); JTable tab = creerJTable(ccTmp); this.tables.add(tab); this.tabbedClasse.add(ccTmp.getNom(), new JScrollPane(tab)); } } c.gridwidth = 4; c.gridheight = 6; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.gridx++; c.gridy = 0; this.panelCompte.add(this.tabbedClasse, c); /******************************************************************************************* * * Informations sur le compte selectionn Panel Infos Compte ******************************************************************************************/ c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.gridheight = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; c.weighty = 0; c.gridy = 0; c.gridx = 0; TitledSeparator sep = new TitledSeparator("Informations sur le compte"); this.panelInfosCompte.add(sep, c); GridBagConstraints cInfos = new GridBagConstraints(); cInfos.insets = new Insets(0, 0, 0, 0); cInfos.fill = GridBagConstraints.BOTH; cInfos.anchor = GridBagConstraints.NORTHWEST; cInfos.gridx = 0; cInfos.gridy = 0; cInfos.gridwidth = 1; cInfos.gridheight = 1; cInfos.weightx = 1; cInfos.weighty = 1; this.textInfos.setFont(this.getFont()); this.textInfos.setEditable(false); JPanel infos = new JPanel(new GridBagLayout()); infos.add(this.textInfos, cInfos); JScrollPane scrollInfos = new JScrollPane(infos); c.insets = new Insets(0, 0, 0, 0); c.gridx = 0; c.gridy++; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = GridBagConstraints.REMAINDER; this.panelInfosCompte.add(scrollInfos, c); this.panelInfosCompte.setMinimumSize(new Dimension(100, 80)); JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, this.panelCompte, this.panelInfosCompte); split.setBorder(null); this.add(split, c); }
From source file:com.intel.stl.ui.main.view.StaDetailsPanel.java
/** * Description:/*from ww w . jav a 2 s . c om*/ * * @param sourceName */ protected void initComponent() { setLayout(new BorderLayout(0, 10)); setOpaque(false); setBorder(BorderFactory.createTitledBorder((Border) null)); JPanel titlePanel = new JPanel(new BorderLayout(5, 1)); titlePanel.setOpaque(false); numberLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN); numberLabel.setHorizontalAlignment(JLabel.RIGHT); titlePanel.add(numberLabel, BorderLayout.CENTER); nameLabel = ComponentFactory.getH3Label("", Font.PLAIN); nameLabel.setHorizontalAlignment(JLabel.LEFT); nameLabel.setVerticalAlignment(JLabel.BOTTOM); titlePanel.add(nameLabel, BorderLayout.EAST); add(titlePanel, BorderLayout.NORTH); JPanel mainPanel = new JPanel(); mainPanel.setOpaque(false); mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); mainPanel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(2, 2, 2, 2); gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; gc.gridwidth = 1; gc.weighty = 0; failedChartPanel = new ChartPanel(null); failedChartPanel.setPreferredSize(new Dimension(60, 20)); mainPanel.add(failedChartPanel, gc); gc.fill = GridBagConstraints.BOTH; gc.weightx = 0; failedNumberLabel = ComponentFactory.getH2Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.BOLD); failedNumberLabel.setForeground(UIConstants.INTEL_DARK_RED); failedNumberLabel.setHorizontalAlignment(JLabel.CENTER); mainPanel.add(failedNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; failedNameLabel = ComponentFactory.getH5Label(STLConstants.K0020_FAILED.getValue(), Font.PLAIN); failedNameLabel.setVerticalAlignment(JLabel.BOTTOM); mainPanel.add(failedNameLabel, gc); gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; gc.gridwidth = 1; skippedChartPanel = new ChartPanel(null); skippedChartPanel.setPreferredSize(new Dimension(60, 20)); mainPanel.add(skippedChartPanel, gc); gc.fill = GridBagConstraints.BOTH; gc.weightx = 0; skippedNumberLabel = ComponentFactory.getH2Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.BOLD); skippedNumberLabel.setForeground(UIConstants.INTEL_DARK_ORANGE); skippedNumberLabel.setHorizontalAlignment(JLabel.CENTER); mainPanel.add(skippedNumberLabel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; skippedNameLabel = ComponentFactory.getH5Label(STLConstants.K0021_SKIPPED.getValue(), Font.PLAIN); skippedNameLabel.setVerticalAlignment(JLabel.BOTTOM); mainPanel.add(skippedNameLabel, gc); gc.weighty = 0; gc.fill = GridBagConstraints.NONE; gc.insets = new Insets(8, 2, 2, 2); gc.weightx = 1; gc.gridwidth = 1; gc.gridheight = types.length; typeChartPanel = new ChartPanel(null); typeChartPanel.setPreferredSize(new Dimension(80, 60)); mainPanel.add(typeChartPanel, gc); typeNumberLabels = new JLabel[types.length]; typeNameLabels = new JLabel[types.length]; gc.fill = GridBagConstraints.BOTH; gc.gridheight = 1; gc.insets = new Insets(12, 2, 2, 2); for (int i = 0; i < types.length; i++) { if (i == 1) { gc.insets = new Insets(2, 2, 2, 2); } gc.weightx = 0; gc.gridwidth = 1; typeNumberLabels[i] = createNumberLabel(); mainPanel.add(typeNumberLabels[i], gc); gc.gridwidth = GridBagConstraints.REMAINDER; typeNameLabels[i] = createNameLabel(types[i].getName()); mainPanel.add(typeNameLabels[i], gc); } gc.fill = GridBagConstraints.BOTH; mainPanel.add(Box.createGlue(), gc); add(mainPanel, BorderLayout.CENTER); }
From source file:org.webcat.plugintester.ui.MainFrameBuilder.java
/** * Creates and lays out the Swing components for the window. * * @param frame the JFrame instance that will contain the components *///from w ww.j a v a 2s.c om private void constructFrame(JFrame frame) { GridBagConstraints gridBagConstraints; fileChooser = new JFileChooser(); bottomPanel = new JPanel(); runButton = new JButton(); mainPanel = new JPanel(); JLabel webCatHomeLabel = new JLabel(); webCatHomeField = new JTextField(); webCatHomeBrowseButton = new JButton(); JSeparator jSeparator0 = new JSeparator(); JLabel submissionLabel = new JLabel(); submissionField = new JTextField(); submissionBrowseButton = new JButton(); JSeparator jSeparator1 = new JSeparator(); JLabel pluginsLabel = new JLabel(); JPanel pluginsPanel = new JPanel(); JScrollPane pluginsScrollPane = new JScrollPane(); pluginsTable = new JTable(); pluginAddButton = new JButton(); pluginRemoveButton = new JButton(); JSeparator jSeparator2 = new JSeparator(); JTabbedPane tabPane = new JTabbedPane(); propertiesPanel = new JPanel(); JScrollPane propertiesScrollPane = new JScrollPane(); propertiesEditor = new JEditorPane(); documentationPanel = new JPanel(); JScrollPane documentationScrollPane = new JScrollPane(); documentationEditor = new JEditorPane(); // File chooser fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); // Bottom panel bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4)); // Run button runButton.setText("Run Plug-ins"); runButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { runButtonActionPerformed(evt); } }); bottomPanel.add(runButton); frame.getContentPane().add(bottomPanel, BorderLayout.PAGE_END); // Main panel mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); mainPanel.setLayout(new GridBagLayout()); // Web-CAT Home field gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = GridBagConstraints.RELATIVE; gridBagConstraints.anchor = GridBagConstraints.LINE_START; webCatHomeLabel.setText("Web-CAT Home:"); mainPanel.add(webCatHomeLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; webCatHomeField.setTransferHandler(new WebCATHomeTransferHandler()); mainPanel.add(webCatHomeField, gridBagConstraints); // Web-CAT Home browse button webCatHomeBrowseButton.setText("Browse..."); webCatHomeBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { webCatHomeBrowseButtonActionPerformed(evt); } }); mainPanel.add(webCatHomeBrowseButton, new GridBagConstraints()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(jSeparator0, gridBagConstraints); // Submission field gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = GridBagConstraints.RELATIVE; gridBagConstraints.anchor = GridBagConstraints.LINE_START; submissionLabel.setText("Submission:"); mainPanel.add(submissionLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; submissionField.setTransferHandler(new SubmissionTransferHandler()); mainPanel.add(submissionField, gridBagConstraints); // Submission browse button submissionBrowseButton.setText("Browse..."); submissionBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { submissionBrowseButtonActionPerformed(evt); } }); mainPanel.add(submissionBrowseButton, new GridBagConstraints()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(jSeparator1, gridBagConstraints); // Plug-ins area pluginsLabel.setText("Plug-ins to run:"); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(pluginsLabel, gridBagConstraints); pluginsPanel.setPreferredSize(new Dimension(400, 80)); pluginsPanel.setLayout(new GridBagLayout()); pluginsModel = new PluginsTableModel(); pluginsTable.setModel(pluginsModel); pluginsTable.setColumnSelectionAllowed(true); pluginsTable.getTableHeader().setReorderingAllowed(false); pluginsScrollPane.setViewportView(pluginsTable); pluginsTable.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); pluginsTable.getColumnModel().getColumn(0).setResizable(false); pluginsScrollPane.setTransferHandler(new PluginsTransferHandler()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; pluginsPanel.add(pluginsScrollPane, gridBagConstraints); pluginAddButton.setText("Add..."); pluginAddButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pluginAddButtonActionPerformed(evt); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.PAGE_START; pluginsPanel.add(pluginAddButton, gridBagConstraints); pluginRemoveButton.setText("Remove"); pluginRemoveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pluginRemoveButtonActionPerformed(evt); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.PAGE_START; pluginsPanel.add(pluginRemoveButton, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.25; mainPanel.add(pluginsPanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(jSeparator2, gridBagConstraints); tabPane.setPreferredSize(new Dimension(466, 150)); propertiesPanel.setLayout(new GridBagLayout()); propertiesEditor.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { propertiesTimer.restart(); } }); propertiesTimer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { updateGradingProperties(); } }); propertiesScrollPane.setViewportView(propertiesEditor); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; propertiesPanel.add(propertiesScrollPane, gridBagConstraints); tabPane.addTab("Properties", propertiesPanel); documentationPanel.setLayout(new GridBagLayout()); documentationEditor.setContentType("text/html"); documentationEditor.setEditable(false); documentationScrollPane.setViewportView(documentationEditor); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; documentationPanel.add(documentationScrollPane, gridBagConstraints); tabPane.addTab("Documentation", documentationPanel); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; mainPanel.add(tabPane, gridBagConstraints); frame.getContentPane().add(mainPanel, BorderLayout.CENTER); frame.pack(); }
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
protected void createValid() { GridBagConstraints c = new GridBagConstraints(); JComponent label = new JLabel(getDetailsString()); Font f = label.getFont();/*from w ww. ja v a 2 s.co m*/ label.setFont(new Font(f.getName(), Font.BOLD, f.getSize())); c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; DETAILS.add(label, c); JTextArea text = newTextArea(LICENSE.getLicenseDescription(URN)); c.gridwidth = GridBagConstraints.RELATIVE; c.gridheight = 2; c.weighty = 1; c.weightx = .7; c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; DETAILS.add(text, c); if (LICENSE.getLicenseDeed(URN) != null) { label = new URLLabel(LICENSE.getLicenseDeed(URN), getDeedString()); } else { label = new JLabel(); label.setVisible(false); } c.gridwidth = GridBagConstraints.REMAINDER; c.gridheight = 1; c.weighty = 0; c.weightx = .3; c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(0, 0, 3, 0); DETAILS.add(label, c); label = new URLLabel(LICENSE.getLicenseURI(), getVerificationString()); DETAILS.add(label, c); }
From source file:de.codesourcery.jasm16.ide.ui.utils.UIUtils.java
public static JDialog createMessageDialog(Window parent, String title, String msg) { final JDialog dialog = new JDialog(parent, title); final JTextArea message = createMultiLineLabel(msg); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); final JPanel messagePanel = new JPanel(); messagePanel.setLayout(new GridBagLayout()); GridBagConstraints cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.weighty = 0;/*from www.jav a 2 s.c o m*/ cnstrs.gridheight = 1; messagePanel.add(message, cnstrs); final JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.gridheight = 1; cnstrs.weighty = 0; cnstrs.insets = new Insets(5, 2, 5, 2); // top,left,bottom,right panel.add(messagePanel, cnstrs); cnstrs = constraints(0, 1, true, true, GridBagConstraints.HORIZONTAL); cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.gridheight = 1; cnstrs.weighty = 0; cnstrs.insets = new Insets(0, 2, 10, 2); // top,left,bottom,right panel.add(buttonPanel, cnstrs); dialog.getContentPane().add(panel); dialog.pack(); return dialog; }
From source file:org.rdv.ui.channel.LocalChannelDialog.java
/** * Initialize the UI components.//from w ww . j a v a2 s .c o m */ private void initComponents() { RDV rdv = RDV.getInstance(RDV.class); JPanel container = new JPanel(); setContentPane(container); container.setLayout(new GridBagLayout()); GridBagConstraints c = createDefaultGridBagConstraints(); JLabel nameLabel = new JLabel(); nameLabel.setName("nameLabel"); nameLabel.setText(PROPERTY_REPO.getValue(NAME_KEY)); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(10, 10, 10, 5); container.add(nameLabel, c); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(10, 0, 10, 10); container.add(nameTextField, c); if (isChannelUpdateOperation()) { nameTextField.setEnabled(false); } JLabel unitLabel = new JLabel(); unitLabel.setName("unitLabel"); unitLabel.setText(PROPERTY_REPO.getValue(UNIT_KEY)); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 5); container.add(unitLabel, c); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 0, 10, 10); container.add(unitTextField, c); JLabel variablesLabel = new JLabel(); variablesLabel.setName("variablesLabel"); variablesLabel.setText(PROPERTY_REPO.getValue(VARIABLES_KEY)); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 3; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(variablesLabel, c); JPanel variablesPanel = buildVariablesPanel(); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 0; c.gridx = 0; c.gridy = 4; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 10); c.weightx = 1; c.weighty = 1; container.add(variablesPanel, c); JLabel formulaLabel = new JLabel(); formulaLabel.setName("formulaLabel"); formulaLabel.setText(PROPERTY_REPO.getValue(FORMULA_KEY)); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 0; c.gridx = 0; c.gridy = 5; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(formulaLabel, c); JScrollPane formulaScrollPane = new JScrollPane(formulaTextArea); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.gridx = 0; c.gridy = 6; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(formulaScrollPane, c); JPanel footerPanel = buildFooterPanel(); c = createDefaultGridBagConstraints(); c.fill = GridBagConstraints.NONE; c.weightx = 0.5; c.weighty = 0; c.gridx = 0; c.gridy = 7; c.gridwidth = GridBagConstraints.REMAINDER; ; c.anchor = GridBagConstraints.LINE_END; c.insets = new java.awt.Insets(0, 0, 10, 5); container.add(footerPanel, c); // bind keystrokes InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(KeyStroke.getKeyStroke("ENTER"), "addChannel"); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); // initially disable buttons removeVariableButton.setEnabled(false); pack(); setLocationByPlatform(true); setVisible(true); }
From source file:org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement.java
public SQLComponent createComponent() { return new BaseSQLComponent(this) { private JTextField nom; private DeviseField debit; private DeviseField credit; private JDate date; private ElementComboBox journal; public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); this.nom = new JTextField(); this.debit = new DeviseField(); this.credit = new DeviseField(); this.date = new JDate(); this.journal = new ElementComboBox(); // Mouvement /*/*from w ww. j a va2 s. c om*/ * JLabel labelMouvement = new JLabel("Mouvement"); this.add(labelMouvement, c); * * c.gridx ++; c.weightx = 1; this.add(idMouvement, c); */ // Journal JLabel labelJournal = new JLabel("Journal"); c.gridx = 0; this.add(labelJournal, c); c.gridx++; c.weightx = 1; this.add(this.journal, c); // Date JLabel labelDate = new JLabel("Date"); c.gridx++; this.add(labelDate, c); c.gridx++; c.weightx = 1; this.add(this.date, c); // libell JLabel labelNom = new JLabel("Libell"); c.gridy++; c.gridx = 0; this.add(labelNom, c); c.gridx++; c.weightx = 1; c.gridwidth = GridBagConstraints.REMAINDER; this.add(this.nom, c); // debit c.gridwidth = 1; JLabel labelDebit = new JLabel("Debit"); c.gridy++; c.gridx = 0; this.add(labelDebit, c); c.gridx++; c.weightx = 1; this.add(this.debit, c); this.debit.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if ((credit.getText().trim().length() != 0) && (debit.getText().trim().length() != 0)) { credit.setText(""); } } }); // Credit JLabel labelCredit = new JLabel("Credit"); c.gridx++; this.add(labelCredit, c); c.gridx++; c.weightx = 1; this.add(this.credit, c); this.credit.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if ((debit.getText().trim().length() != 0) && (credit.getText().trim().length() != 0)) { debit.setText(""); } } }); this.addSQLObject(this.nom, "NOM"); this.addSQLObject(this.debit, "DEBIT"); this.addSQLObject(this.credit, "CREDIT"); this.addRequiredSQLObject(this.date, "DATE"); this.addRequiredSQLObject(this.journal, "ID_JOURNAL"); } @Override public void select(SQLRowAccessor r) { super.select(r); if (r != null && r.getBoolean("VALIDE")) { this.nom.setEnabled(false); this.debit.setEnabled(false); this.credit.setEnabled(false); this.date.setEnabled(false); this.date.setEditable(false); this.journal.setEnabled(false); } } public void update() { SQLRow row = EcritureSQLElement.this.getTable().getRow(getSelectedID()); if (row.getBoolean("VALIDE")) { System.out.println("Impossible de modifier une ecriture valide"); } else { super.update(); } } }; }
From source file:savant.view.variation.swing.VariationModule.java
public VariationModule(VariationController vc) { super(new GridBagLayout()); controller = vc;/*from www .j a v a 2 s. co m*/ // Toolbar shared by all panels. JToolBar tools = new JToolBar(); tools.setFloatable(false); rangeField = new JTextField(); rangeField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String text = rangeField.getText(); try { Bookmark bm = new Bookmark(text, controller.getReference(), controller.getVisibleRange()); controller.setLocation(bm.getReference(), (Range) bm.getRange()); } catch (ParseException x) { DialogUtils.displayMessage(String.format("Unable to parse \"%s\" as a location.", text)); } } }); tools.add(rangeField); tools.addSeparator(); JButton zoomInButton = new JButton(); zoomInButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.ZOOMIN)); zoomInButton.setBorderPainted(false); zoomInButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { controller.zoomIn(); } }); tools.add(zoomInButton); JButton zoomOutButton = new JButton(); zoomOutButton.setIcon(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.ZOOMOUT)); zoomOutButton.setBorderPainted(false); zoomOutButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { controller.zoomOut(); } }); tools.add(zoomOutButton); tools.addSeparator(); JButton controlsButton = new JButton("Controls"); controlsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (controller.getTracks().length > 0) { new CaseControlDialog(controller).setVisible(true); frequencyPlot.repaint(); } else { Toolkit.getDefaultToolkit().beep(); } } }); tools.add(controlsButton); tabs = new JTabbedPane(); table = new RecordTable(new VariantTableModel(null)); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { if (me.getClickCount() == 2) { controller.navigateToRecord(controller.getData().get(table.getSelectedRow())); } } }); tabs.addTab("Table", new JScrollPane(table)); map = new VariantMap(controller); map.addMouseWheelListener(wheelListener); LocationController.getInstance().addListener(new Listener<LocationChangedEvent>() { @Override public void handleEvent(LocationChangedEvent event) { map.repaint(); } }); JPanel mapPanel = populatePanel(map); tabs.addTab("Map", mapPanel); frequencyPlot = new AlleleFrequencyPlot(controller); frequencyPlot.addMouseWheelListener(wheelListener); JPanel frequencyPanel = populatePanel(frequencyPlot); tabs.addTab("Allele Frequency", frequencyPanel); JPanel ldPanel = new JPanel(); ldPanel.setLayout(new GridBagLayout()); ActionListener redrawForcer = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { ldPlot.repaint(); } }; JRadioButton dPrimeButton = new JRadioButton("D\u2032", true); dPrimeButton.setActionCommand("true"); dPrimeButton.addActionListener(redrawForcer); JRadioButton rSquaredButton = new JRadioButton("r\u00B2", false); rSquaredButton.setActionCommand("false"); rSquaredButton.addActionListener(redrawForcer); methodGroup = new ButtonGroup(); JPanel methodPanel = new JPanel(); methodPanel.setBorder(BorderFactory.createTitledBorder("Calculation Method")); methodPanel.add(dPrimeButton); methodGroup.add(dPrimeButton); methodPanel.add(rSquaredButton); methodGroup.add(rSquaredButton); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.weighty = 0.0; ldPanel.add(methodPanel, gbc); ldPlot = new LDPlot(controller); JPanel lowerLDPanel = populatePanel(ldPlot); gbc.weighty = 1.0; ldPanel.add(lowerLDPanel, gbc); tabs.addTab("LD Plot", ldPanel); gbc.weighty = 0.0; add(tools, gbc); // Create the informative cards, but don't use them. messageLabel = new JLabel(); messageLabel.setFont(MESSAGE_FONT); messagePanel = populatePanel(messageLabel); progressPanel = new ProgressPanel(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { controller.cancelDataRequests(); } }); showCard(tabs, null); }
From source file:org.intermine.install.swing.BuildProjectDialog.java
/** * Common initialisation: lays out the child components and wires up the necessary * event listeners./*from w ww .ja v a2 s .c om*/ */ private void init() { setName("Build Project Dialog"); setTitle(Messages.getMessage("build.project.title")); releaseNumberLabel.setLabelFor(releaseNumberTextField); destinationLabel.setLabelFor(destinationTextField); Container cp = getContentPane(); GridBagConstraints cons = GridBagHelper.setup(cp); JLabel infoLabel = new JLabel(Messages.getMessage("build.project.info.message")); infoLabel.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); cons.gridwidth = 2; cons.weightx = 1; cp.add(infoLabel, cons); JPanel startPolicyPanel = new JPanel(); // startPolicyPanel.setBorder(BorderFactory.createLoweredBevelBorder()); GridBagConstraints startPolicyPanelCons = GridBagHelper.setup(startPolicyPanel); startPolicyPanelCons.gridwidth = GridBagConstraints.REMAINDER; startPolicyPanel.add(startPolicyLabel, startPolicyPanelCons); startPolicyPanelCons.gridy++; startPolicyPanelCons.gridwidth = 2; buildDbRadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); startPolicyPanel.add(buildDbRadioButton, startPolicyPanelCons); startPolicyPanelCons.gridy++; restart1RadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); startPolicyPanel.add(restart1RadioButton, startPolicyPanelCons); // startPolicyPanelCons.gridy++; // restart2RadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); // startPolicyPanel.add(restart2RadioButton, startPolicyPanelCons); // // startPolicyPanelCons.gridy++; // testRadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); // startPolicyPanel.add(testRadioButton, startPolicyPanelCons); cons.gridy++; cp.add(startPolicyPanel, cons); JPanel userDBPanel = new JPanel(); // userDBPanel.setBorder(BorderFactory.createLoweredBevelBorder()); GridBagConstraints userDBCons = GridBagHelper.setup(userDBPanel); userDBPanel.setAlignmentY(LEFT_ALIGNMENT); // cons.gridwidth = GridBagConstraints.REMAINDER; userDBPanel.add(userDBOptionsLabel, userDBCons); // userDBCons.gridy++; // nowriteUserDbRadio.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); // userDBPanel.add(nowriteUserDbRadio, userDBCons); // // userDBCons.gridy++; // writeUserDbRadio.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); // userDBPanel.add(writeUserDbRadio, userDBCons); // // userDBCons.gridy++; // overwriteUserDbRadio.setFont(infoLabel.getFont().deriveFont(Font.PLAIN)); // userDBPanel.add(overwriteUserDbRadio, userDBCons); // // cons.gridy++; // cp.add(userDBPanel, cons); cons.gridy++; cons.gridx = 0; cons.weightx = 0; cons.gridwidth = 1; cp.add(encodingLabel, cons); cons.gridx++; cons.weightx = 0.5; encodingDropdown = new JComboBox(encodings); cp.add(encodingDropdown, cons); //cp.add(encodingTextField, cons); // cons.gridy++; // cons.gridx = 0; // cons.gridwidth = 3; // cons.weightx = 1; // cp.add(serverBackupCheckBox, cons); // cons.gridy++; // cons.gridx = 0; // cons.weightx = 0; // cons.gridwidth = 1; // cp.add(destinationCheckBox, cons); // cons.gridy++; // cons.weightx = 0; // cons.gridwidth = 1; // cp.add(destinationLabel, cons); // cons.gridx++; // cons.weightx = 0.75; // cons.gridwidth = 2; // cp.add(destinationTextField, cons); cons.gridy++; cons.gridx = 0; cons.weightx = 0; cons.gridwidth = 1; cp.add(new JLabel(Messages.getMessage("build.project.dump.host")), cons); cons.gridx++; cons.weightx = 0.75; cons.gridwidth = 1; cp.add(hostTextField, cons); cons.gridy++; cons.gridx = 0; cons.weightx = 0; cons.gridwidth = 1; cp.add(new JLabel(Messages.getMessage("build.project.dump.prefix")), cons); cons.gridx++; cons.weightx = 0.75; cons.gridwidth = 1; cp.add(prefixTextField, cons); cons.gridy++; cons.gridx = 0; cp.add(releaseNumberCheckBox, cons); // cons.gridy++; // cons.weightx = 0; // cons.gridwidth = 1; // cp.add(releaseNumberLabel, cons); cons.gridx++; cons.weightx = 0.5; cp.add(releaseNumberTextField, cons); cons.gridy++; cons.gridwidth = GridBagConstraints.REMAINDER; cons.gridx = 0; cons.weightx = 1; cp.add(new ButtonPanel(buildAction, new CancelAction()), cons); // encodingTextField.setText("SQL_ASCII"); // releaseNumberLabel.setEnabled(false); releaseNumberTextField.setEnabled(false); // destinationLabel.setEnabled(false); // destinationTextField.setEnabled(false); /** * Create Button group for userdb radio buttons * @serial */ ButtonGroup userDBButtonGroup = new ButtonGroup(); userDBButtonGroup.add(writeUserDbRadio); userDBButtonGroup.add(overwriteUserDbRadio); userDBButtonGroup.add(nowriteUserDbRadio); ButtonGroup startPolicyGroup = new ButtonGroup(); startPolicyGroup.add(restart1RadioButton); startPolicyGroup.add(restart2RadioButton); startPolicyGroup.add(buildDbRadioButton); startPolicyGroup.add(testRadioButton); releaseNumberCheckBox.addActionListener( new LinkedFieldListener(releaseNumberCheckBox, releaseNumberLabel, releaseNumberTextField)); destinationCheckBox.addActionListener( new LinkedFieldListener(destinationCheckBox, destinationLabel, destinationTextField)); DocumentListener requiredTextListener = new RequiredTextListener(); releaseNumberTextField.getDocument().addDocumentListener(requiredTextListener); // destinationTextField.getDocument().addDocumentListener(requiredTextListener); hostTextField.getDocument().addDocumentListener(requiredTextListener); prefixTextField.getDocument().addDocumentListener(requiredTextListener); hostTextField.setToolTipText(Messages.getMessage("build.project.dump.host.tooltip")); hostTextField.setText("localhost"); pack(); progressDialog = new SystemProcessProgressDialog(this); progressDialog.setModalityType(ModalityType.APPLICATION_MODAL); progressDialog.setTitle(Messages.getMessage("build.project.title")); progressDialog.setInformationLabel(Messages.getMessage("build.project.message")); }
From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java
private JPanel initJournalPanel(final Journal jrnl) { final JPanel panelTmp = new JPanel(); long totalDebitJournal = 0; long totalCreditJournal = 0; panelTmp.setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 1, 2); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0;// w ww . ja va 2 s. co m c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 1; c.weighty = 0; String req = "SELECT DISTINCT EXTRACT(YEAR FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\")," + " SUM(\"" + baseName + "\".\"ECRITURE\".\"DEBIT\"), " + "SUM(\"" + baseName + "\".\"ECRITURE\".\"CREDIT\")" + " FROM \"" + baseName + "\".\"ECRITURE\" " + "WHERE (\"" + baseName + "\".\"ECRITURE\".\"ID\" != 1) " + "AND ((\"" + baseName + "\".\"ECRITURE\".\"ARCHIVE\" = 0) " + "AND (\"" + baseName + "\".\"ECRITURE\".\"ID_JOURNAL\" = " + jrnl.getId() + ")) " + "GROUP BY EXTRACT(YEAR FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\") " + "ORDER BY EXTRACT(YEAR FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\")"; System.out.println(req); Object ob = base.getDataSource().execute(req, new ArrayListHandler()); List myList = (List) ob; // System.err.println("TEST DATE " + t); if (myList.size() != 0) { for (int i = 0; i < myList.size(); i++) { Object[] objTmp = (Object[]) myList.get(i); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, 1); int month = (new Double(objTmp[1].toString()).intValue() - 1); System.err.println(jrnl.getNom() + " SET MONTH " + month); cal.set(Calendar.MONTH, month); System.err.println(month + " = " + cal.getTime()); cal.set(Calendar.YEAR, new Double(objTmp[0].toString()).intValue()); long debitMois = ((Number) objTmp[2]).longValue(); long creditMois = ((Number) objTmp[3]).longValue(); c.gridwidth = GridBagConstraints.REMAINDER; final JPanel creerJournalMoisPanel = creerJournalMoisPanel(cal.getTime(), debitMois, creditMois, jrnl); creerJournalMoisPanel.setOpaque(false); panelTmp.add(creerJournalMoisPanel, c); c.gridy++; totalDebitJournal += debitMois; totalCreditJournal += creditMois; } } c.gridx = 0; c.weighty = 1; c.gridwidth = 1; final JLabel label = new JLabel("Journal " + jrnl.getNom()); label.setOpaque(false); panelTmp.add(label, c); c.gridx = GridBagConstraints.RELATIVE; panelTmp.add(new JLabel(" Total dbit : " + GestionDevise.currencyToString(totalDebitJournal)), c); panelTmp.add(new JLabel(" Total crdit : " + GestionDevise.currencyToString(totalCreditJournal)), c); return panelTmp; }