List of usage examples for java.awt GridBagLayout GridBagLayout
public GridBagLayout()
From source file:com.geometrycloud.happydonut.ui.ChartFilterPanel.java
/** * Inicializa los componentes.//from w ww. j a va2 s . c o m */ private void initComponents() { fromPicker.addActionListener(this); toPicker.addActionListener(this); chart = new ChartPanel(createChart()); setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.insets.set(5, 5, 5, 5); constraints.gridx = 0; constraints.gridy = 0; constraints.fill = GridBagConstraints.NONE; constraints.weightx = 0; constraints.weighty = 0; constraints.gridwidth = 1; add(fromLabel, constraints); constraints.gridx = 1; constraints.gridy = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1; constraints.weighty = 1; constraints.gridwidth = 1; add((JComponent) fromPicker, constraints); constraints.gridx = 2; constraints.gridy = 0; constraints.fill = GridBagConstraints.NONE; constraints.weightx = 0; constraints.weighty = 0; constraints.gridwidth = 1; add(toLabel, constraints); constraints.gridx = 3; constraints.gridy = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1; constraints.weighty = 1; constraints.gridwidth = 1; add((JComponent) toPicker, constraints); constraints.gridx = 0; constraints.gridy = 1; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1; constraints.weighty = 1; constraints.gridwidth = GridBagConstraints.REMAINDER; add(chart, constraints); }
From source file:chisquarecalculator.ChisqCal.java
public ChisqCal() { final JFrame jfrm = new JFrame("Chi Square Calculator"); jfrm.setSize(400, 550);/*from www . j av a2 s. co m*/ jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jfrm.setResizable(false); // panel 1 JPanel pn1 = new JPanel(); pn1.setOpaque(true); pn1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "2 x 2")); JLabel jlab1 = new JLabel("class 1"); JLabel jlab2 = new JLabel("class 2"); JLabel jlab3 = new JLabel("case"); JLabel jlab4 = new JLabel("control"); jtf1 = new JTextField(); jtf2 = new JTextField(); jtf3 = new JTextField(); jtf4 = new JTextField(); // pn1 layout all GridBagLayout CalLayout1 = new GridBagLayout(); GridBagConstraints gbc1 = new GridBagConstraints(); pn1.setLayout(CalLayout1); gbc1.weightx = 1.0; //default 0.0 gbc1.weighty = 1.0; //default 0.0 gbc1.insets = new Insets(4, 4, 4, 4); // Add some space gbc1.fill = GridBagConstraints.BOTH; gbc1.gridwidth = 1; gbc1.gridx = 1; gbc1.gridy = 0; CalLayout1.setConstraints(jlab1, gbc1); gbc1.gridx = 2; gbc1.gridy = 0; CalLayout1.setConstraints(jlab2, gbc1); gbc1.gridx = 0; gbc1.gridy = 1; CalLayout1.setConstraints(jlab3, gbc1); gbc1.gridx = 1; gbc1.gridy = 1; CalLayout1.setConstraints(jtf1, gbc1); gbc1.gridx = 2; gbc1.gridy = 1; CalLayout1.setConstraints(jtf2, gbc1); gbc1.gridx = 0; gbc1.gridy = 2; CalLayout1.setConstraints(jlab4, gbc1); gbc1.gridx = 1; gbc1.gridy = 2; CalLayout1.setConstraints(jtf3, gbc1); gbc1.gridx = 2; gbc1.gridy = 2; CalLayout1.setConstraints(jtf4, gbc1); pn1.add(jlab1); pn1.add(jlab2); pn1.add(jlab3); pn1.add(jlab4); pn1.add(jtf1); pn1.add(jtf2); pn1.add(jtf3); pn1.add(jtf4); // panel 2 JPanel pn2 = new JPanel(); pn2.setOpaque(true); pn2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "2 x 3")); JLabel jlab5 = new JLabel("class 1"); JLabel jlab6 = new JLabel("class 2"); JLabel jlab7 = new JLabel("class 3"); JLabel jlab8 = new JLabel("case"); JLabel jlab9 = new JLabel("control"); jtf5 = new JTextField(); jtf6 = new JTextField(); jtf7 = new JTextField(); jtf8 = new JTextField(); jtf9 = new JTextField(); jtf10 = new JTextField(); // pn2 layout all GridBagLayout CalLayout2 = new GridBagLayout(); GridBagConstraints gbc2 = new GridBagConstraints(); pn2.setLayout(CalLayout2); gbc2.weightx = 1.0; //default 0.0 gbc2.weighty = 1.0; //default 0.0 gbc2.insets = new Insets(4, 4, 4, 4); // Add some space gbc2.fill = GridBagConstraints.BOTH; gbc2.gridwidth = 1; gbc2.gridx = 1; gbc2.gridy = 0; CalLayout2.setConstraints(jlab5, gbc2); gbc2.gridx = 2; gbc2.gridy = 0; CalLayout2.setConstraints(jlab6, gbc2); gbc2.gridx = 3; gbc2.gridy = 0; CalLayout2.setConstraints(jlab7, gbc2); gbc2.gridx = 0; gbc2.gridy = 1; CalLayout2.setConstraints(jlab8, gbc2); gbc2.gridx = 1; gbc2.gridy = 1; CalLayout2.setConstraints(jtf5, gbc2); gbc2.gridx = 2; gbc2.gridy = 1; CalLayout2.setConstraints(jtf6, gbc2); gbc2.gridx = 3; gbc2.gridy = 1; CalLayout2.setConstraints(jtf7, gbc2); gbc2.gridx = 0; gbc2.gridy = 2; CalLayout2.setConstraints(jlab9, gbc2); gbc2.gridx = 1; gbc2.gridy = 2; CalLayout2.setConstraints(jtf8, gbc2); gbc2.gridx = 2; gbc2.gridy = 2; CalLayout2.setConstraints(jtf9, gbc2); gbc2.gridx = 3; gbc2.gridy = 2; CalLayout2.setConstraints(jtf10, gbc2); pn2.add(jlab5); pn2.add(jlab6); pn2.add(jlab7); pn2.add(jlab8); pn2.add(jlab9); pn2.add(jtf5); pn2.add(jtf6); pn2.add(jtf7); pn2.add(jtf8); pn2.add(jtf9); pn2.add(jtf10); // panel 3 JPanel pn3 = new JPanel(); pn3.setOpaque(true); pn3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "statistic")); JLabel jlab10 = new JLabel("chi-square"); JLabel jlab11 = new JLabel("degree of freedom"); jtf11 = new JTextField(); jtf12 = new JTextField(); GridBagLayout CalLayout3 = new GridBagLayout(); GridBagConstraints gbc3 = new GridBagConstraints(); pn3.setLayout(CalLayout3); gbc3.weightx = 1.0; //default 0.0 gbc3.weighty = 1.0; //default 0.0 gbc3.insets = new Insets(4, 4, 4, 4); // Add some space gbc3.fill = GridBagConstraints.BOTH; gbc3.gridwidth = 1; gbc3.gridx = 0; gbc3.gridy = 0; CalLayout3.setConstraints(jlab10, gbc3); gbc3.gridwidth = 3; gbc3.gridx = 1; gbc3.gridy = 0; CalLayout3.setConstraints(jtf11, gbc3); gbc3.gridwidth = 2; gbc3.gridx = 0; gbc3.gridy = 1; CalLayout3.setConstraints(jlab11, gbc3); gbc3.gridx = 2; gbc3.gridy = 1; CalLayout3.setConstraints(jtf12, gbc3); pn3.add(jlab10); pn3.add(jlab11); pn3.add(jtf11); pn3.add(jtf12); JPanel pn4 = new JPanel(); pn4.setOpaque(true); pn4.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "result")); JLabel jlab12 = new JLabel("p-value"); final JLabel jlab13 = new JLabel("odds ratio"); final JLabel jlab14 = new JLabel("standard error"); final JLabel jlab15 = new JLabel("confidence interval 95%"); jtf13 = new JTextField(); jtf14 = new JTextField(); jtf15 = new JTextField(); jtf16 = new JTextField(); jtf17 = new JTextField(); jlab13.setEnabled(false); jlab14.setEnabled(false); jlab15.setEnabled(false); jtf14.setEnabled(false); jtf15.setEnabled(false); jtf16.setEnabled(false); jtf17.setEnabled(false); JButton jbtn1 = new JButton("Run 2x2"); jbtn1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { long number1, number2, number3, number4; try { number1 = Long.parseLong(jtf1.getText()); number2 = Long.parseLong(jtf2.getText()); number3 = Long.parseLong(jtf3.getText()); number4 = Long.parseLong(jtf4.getText()); } catch (Exception ne) { JOptionPane.showMessageDialog(jfrm, "Error: Bad input, only integer is acceptable!"); return; } long[][] obs = new long[2][2]; obs[0][0] = number1; obs[0][1] = number2; obs[1][0] = number3; obs[1][1] = number4; ChiSquareTest mychiSquare = new ChiSquareTest(); final java.text.DecimalFormat mydf = new java.text.DecimalFormat("0.0000"); double stats = mychiSquare.chiSquare(obs); jtf11.setText(String.valueOf(mydf.format(stats))); jtf12.setText(String.valueOf(1)); double pvalue = mychiSquare.chiSquareTest(obs); jtf13.setText(String.valueOf(pvalue)); jtf5.setText(""); jtf6.setText(""); jtf7.setText(""); jtf8.setText(""); jtf9.setText(""); jtf10.setText(""); jlab13.setEnabled(true); jlab14.setEnabled(true); jlab15.setEnabled(true); jtf14.setEnabled(true); jtf15.setEnabled(true); jtf16.setEnabled(true); jtf17.setEnabled(true); double or = (double) (number2 * number3) / (number1 * number4); double se = Math.sqrt( (double) 1 / number1 + (double) 1 / number2 + (double) 1 / number3 + (double) 1 / number4); double logOR = Math.log(or); double logU95 = logOR + 1.96 * se; double logL95 = logOR - 1.96 * se; double U95 = Math.exp(logU95); double L95 = Math.exp(logL95); jtf14.setText(String.valueOf(mydf.format(or))); jtf15.setText(String.valueOf(mydf.format(se))); jtf16.setText(String.valueOf(mydf.format(L95))); jtf17.setText(String.valueOf(mydf.format(U95))); } }); JButton jbtn2 = new JButton("Run 2x3"); jbtn2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { long number1, number2, number3, number4, number5, number6; try { number1 = Long.parseLong(jtf5.getText()); number2 = Long.parseLong(jtf6.getText()); number3 = Long.parseLong(jtf7.getText()); number4 = Long.parseLong(jtf8.getText()); number5 = Long.parseLong(jtf9.getText()); number6 = Long.parseLong(jtf10.getText()); } catch (Exception ne) { JOptionPane.showMessageDialog(jfrm, "Error: Bad input, only integer is acceptable!"); return; } long[][] obs = new long[2][3]; obs[0][0] = number1; obs[0][1] = number2; obs[0][2] = number3; obs[1][0] = number4; obs[1][1] = number5; obs[1][2] = number6; ChiSquareTest mychiSquare = new ChiSquareTest(); final java.text.DecimalFormat mydf = new java.text.DecimalFormat("0.0000"); double stats = mychiSquare.chiSquare(obs); jtf11.setText(String.valueOf(mydf.format(stats))); jtf12.setText(String.valueOf(2)); double pvalue = mychiSquare.chiSquareTest(obs); jtf13.setText(String.valueOf(pvalue)); jtf1.setText(""); jtf2.setText(""); jtf3.setText(""); jtf4.setText(""); jtf14.setText(""); jtf15.setText(""); jtf16.setText(""); jtf17.setText(""); jlab13.setEnabled(false); jlab14.setEnabled(false); jlab15.setEnabled(false); jtf14.setEnabled(false); jtf15.setEnabled(false); jtf16.setEnabled(false); jtf17.setEnabled(false); } }); JButton jbtn3 = new JButton("Run Statistic"); jbtn3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { double stat, df; try { stat = Double.parseDouble(jtf11.getText()); df = Double.parseDouble(jtf12.getText()); } catch (Exception ne) { JOptionPane.showMessageDialog(jfrm, "Error: Bad input, only number is acceptable!"); return; } ChiSquaredDistribution distribution = new ChiSquaredDistribution(df); double pvalue = 1 - distribution.cumulativeProbability(stat); jtf13.setText(String.valueOf(pvalue)); jtf1.setText(""); jtf2.setText(""); jtf3.setText(""); jtf4.setText(""); jtf5.setText(""); jtf6.setText(""); jtf7.setText(""); jtf8.setText(""); jtf9.setText(""); jtf10.setText(""); jtf14.setText(""); jtf15.setText(""); jtf16.setText(""); jtf17.setText(""); jlab13.setEnabled(false); jlab14.setEnabled(false); jlab15.setEnabled(false); jtf14.setEnabled(false); jtf15.setEnabled(false); jtf16.setEnabled(false); jtf17.setEnabled(false); } }); JButton jbtn4 = new JButton("clear"); jbtn4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { jtf1.setText(""); jtf2.setText(""); jtf3.setText(""); jtf4.setText(""); jtf5.setText(""); jtf6.setText(""); jtf7.setText(""); jtf8.setText(""); jtf9.setText(""); jtf10.setText(""); jtf11.setText(""); jtf12.setText(""); jtf13.setText(""); jtf14.setText(""); jtf15.setText(""); jtf16.setText(""); jtf17.setText(""); jlab13.setEnabled(false); jlab14.setEnabled(false); jlab15.setEnabled(false); jtf14.setEnabled(false); jtf15.setEnabled(false); jtf16.setEnabled(false); jtf17.setEnabled(false); } }); GridBagLayout CalLayout4 = new GridBagLayout(); GridBagConstraints gbc4 = new GridBagConstraints(); pn4.setLayout(CalLayout4); gbc4.weightx = 1.0; //default 0.0 gbc4.weighty = 1.0; //default 0.0 // gbc4.insets = new Insets(4, 4, 4, 4); // Add some space gbc4.insets = new Insets(1, 1, 1, 1); gbc4.fill = GridBagConstraints.BOTH; gbc4.gridwidth = 1; gbc4.gridx = 0; gbc4.gridy = 0; CalLayout4.setConstraints(jbtn1, gbc4); gbc4.gridx = 1; gbc4.gridy = 0; CalLayout4.setConstraints(jbtn2, gbc4); gbc4.gridx = 2; gbc4.gridy = 0; CalLayout4.setConstraints(jbtn3, gbc4); gbc4.gridx = 3; gbc4.gridy = 0; CalLayout4.setConstraints(jbtn4, gbc4); gbc4.gridx = 0; gbc4.gridy = 1; CalLayout4.setConstraints(jlab12, gbc4); gbc4.gridwidth = 3; gbc4.gridx = 1; gbc4.gridy = 1; CalLayout4.setConstraints(jtf13, gbc4); gbc4.gridwidth = 2; gbc4.gridx = 0; gbc4.gridy = 2; CalLayout4.setConstraints(jlab13, gbc4); gbc4.gridx = 2; gbc4.gridy = 2; CalLayout4.setConstraints(jtf14, gbc4); gbc4.gridx = 0; gbc4.gridy = 3; CalLayout4.setConstraints(jlab14, gbc4); gbc4.gridx = 2; gbc4.gridy = 3; CalLayout4.setConstraints(jtf15, gbc4); gbc4.gridx = 0; gbc4.gridy = 4; CalLayout4.setConstraints(jlab15, gbc4); gbc4.gridwidth = 1; gbc4.gridx = 2; gbc4.gridy = 4; CalLayout4.setConstraints(jtf16, gbc4); gbc4.gridx = 3; gbc4.gridy = 4; CalLayout4.setConstraints(jtf17, gbc4); pn4.add(jlab12); pn4.add(jlab13); pn4.add(jlab14); pn4.add(jlab15); pn4.add(jtf13); pn4.add(jtf14); pn4.add(jtf15); pn4.add(jtf16); pn4.add(jtf17); pn4.add(jbtn1); pn4.add(jbtn2); pn4.add(jbtn3); pn4.add(jbtn4); // jfrm layout all GridBagLayout CalLayout = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); jfrm.setLayout(CalLayout); gbc.weightx = 1.0; //default 0.0 gbc.weighty = 1.0; //default 0.0 gbc.insets = new Insets(4, 4, 4, 4); // Add some space gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = 4; gbc.gridx = 0; gbc.gridy = 0; CalLayout.setConstraints(pn1, gbc); gbc.gridx = 0; gbc.gridy = 1; CalLayout.setConstraints(pn2, gbc); gbc.gridx = 0; gbc.gridy = 2; CalLayout.setConstraints(pn3, gbc); gbc.gridx = 0; gbc.gridy = 3; CalLayout.setConstraints(pn4, gbc); jfrm.add(pn1); jfrm.add(pn2); jfrm.add(pn3); jfrm.add(pn4); // Help Menu Bar JMenuBar jmb = new JMenuBar(); JMenu jmh = new JMenu("Help"); JMenuItem jmiAbout = new JMenuItem("About"); jmiAbout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JOptionPane.showMessageDialog(jfrm, "Name: Chi Square Calculator\n" + "Version: 1.0\n" + "Author: Felix Yanhui Fan\n" + "EMail: felixfanyh@gmail.com\n" + "Website: http://felixfan.github.io/ChiSquareCalculator\n"); } }); JMenuItem jmiLisence = new JMenuItem("Lisence"); jmiLisence.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(jfrm, "This program is licensed under the terms of \n" + "the GNU General Public License version 3 \n" + "Available online under: \n" + "http://www.gnu.org/licenses/gpl-3.0.html\n"); } }); jmh.add(jmiAbout); jmh.add(jmiLisence); jmb.add(Box.createHorizontalGlue()); // Aligning JMenu on the right corner of JMenuBar jmb.add(jmh); jfrm.setJMenuBar(jmb); jfrm.setVisible(true); }
From source file:de.codesourcery.eve.skills.ui.components.impl.ByLabelFilterComponent.java
@Override protected JPanel createPanel() { final JPanel result = new JPanel(); result.setLayout(new GridBagLayout()); result.setBorder(BorderFactory.createTitledBorder(title)); // textfield//from www. j a v a2 s. co m this.nameField.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { labelProvider.viewFilterChanged(getViewFilter()); } @Override public void insertUpdate(DocumentEvent e) { labelProvider.viewFilterChanged(getViewFilter()); } @Override public void removeUpdate(DocumentEvent e) { labelProvider.viewFilterChanged(getViewFilter()); } }); nameField.setColumns(20); result.add(nameField, constraints(0, 0).resizeHorizontally().useRelativeWidth().end()); // button clearButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { nameField.setText(""); } }); result.add(clearButton, constraints(1, 0).noResizing().useRemainingWidth().end()); return result; }
From source file:com.digitalgeneralists.assurance.ui.components.ExclusionsPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.exclusion == null) { this.mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Exclusion"; this.exclusion = new FileReference(); } else {//from w w w. j av a 2s. c o m this.mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Exclusion"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel exclusionPathPanel = new JPanel(); exclusionPathPanel.setLayout(new GridBagLayout()); Border exclusionPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); exclusionPanelBorder = BorderFactory.createTitledBorder(exclusionPanelBorder, "Exclusion", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints exclusionPathPanelConstraints = new GridBagConstraints(); exclusionPathPanelConstraints.anchor = GridBagConstraints.NORTH; exclusionPathPanelConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathPanelConstraints.gridx = 0; exclusionPathPanelConstraints.gridy = 0; exclusionPathPanelConstraints.weightx = 1.0; exclusionPathPanelConstraints.weighty = 1.0; exclusionPathPanelConstraints.gridheight = 1; exclusionPathPanelConstraints.gridwidth = 2; exclusionPathPanelConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.setBorder(exclusionPanelBorder); this.add(exclusionPathPanel, exclusionPathPanelConstraints); GridBagConstraints exclusionPathFieldConstraints = new GridBagConstraints(); exclusionPathFieldConstraints.anchor = GridBagConstraints.NORTH; exclusionPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathFieldConstraints.gridx = 0; exclusionPathFieldConstraints.gridy = 1; exclusionPathFieldConstraints.weightx = 1.0; exclusionPathFieldConstraints.weighty = 1.0; exclusionPathFieldConstraints.gridheight = 1; exclusionPathFieldConstraints.gridwidth = 1; exclusionPathFieldConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.add(this.exclusionPathTextFieldPicker, exclusionPathFieldConstraints); if (this.exclusion != null) { File exclusionPath = exclusion.getFile(); if (exclusionPath != null) { this.exclusionPathTextFieldPicker.setValue(exclusionPath.getPath()); } else { this.exclusionPathTextFieldPicker.setValue(""); } } this.initialized = true; } }
From source file:dk.dma.epd.common.prototype.notification.StrategicRouteNotificationDetailPanelCommon.java
/** * {@inheritDoc}//from w ww . j av a2 s . c o m */ @Override protected void buildGUI() { setLayout(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // Create the transaction and status labels Insets insets5 = new Insets(5, 5, 5, 5); add(bold(new JLabel("Transaction ID:")), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); add(transactionTxt, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); add(bold(new JLabel("Latest status:")), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); add(statusTxt, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); // Create the info panel JPanel infoPanel = createInfoPanel(); add(infoPanel, new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); // Create the messages panel JScrollPane scrollPane = new JScrollPane(messagesPanel); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBorder(new MatteBorder(1, 1, 1, 1, UIManager.getColor("Separator.shadow"))); messagesPanel.setBackground(UIManager.getColor("List.background")); add(scrollPane, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0, WEST, BOTH, insets5, 0, 0)); }
From source file:edu.scripps.fl.pubchem.xmltool.gui.PubChemXMLExtractorGUI.java
public PubChemXMLExtractorGUI(Boolean isInternal) { DOMConfigurator.configure(PubChemXMLExtractorGUI.class.getClassLoader().getResource("log4j.config.xml")); this.isInternal = isInternal; setBorder(BorderFactory.createTitledBorder("PubChem XML Extractor")); setLayout(new GridBagLayout()); setUpGUIComponents();/*from w w w. j av a2 s. co m*/ add(jlbFileXML, gbc01); add(jtfFileXML, gbc02); add(jbnFileXML, gbc03); add(jbnRunExtractor, gbc04); add(jbnCreateReport, gbc05); addMouseListener(this); }
From source file:algorithm.OaiOreSubmissionInformationPackage.java
private void createConfigurationPanel() { panel = new GUIPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0;//from w w w. j av a 2 s . co m constraints.gridy = 0; constraints.anchor = GridBagConstraints.NORTHWEST; panel.add(new JLabel("Choose archiving technique:"), constraints); constraints.gridx++; ButtonGroup archivingGroup = new ButtonGroup(); archivingGroup.add(tarButton); archivingGroup.add(zipButton); zipButton.setSelected(true); panel.add(zipButton, constraints); constraints.gridy++; panel.add(tarButton, constraints); constraints.gridx = 0; constraints.gridy++; }
From source file:org.broad.igv.peaks.PeakTimePlotFrame.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license dialogPane = new JPanel(); contentPanel = new JPanel(); buttonBar = new JPanel(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {/* ww w .j a v a 2 s .c o m*/ dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new BorderLayout()); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonBar.setLayout(new GridBagLayout()); ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] { 0, 80 }; ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] { 1.0, 0.0 }; } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(495, 455); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.xtructure.xevolution.gui.components.CollectArgsDialog.java
/** * Creates a new {@link CollectArgsDialog} * // w w w . ja v a2 s. c om * @param frame * the parent JFrame for the new {@link CollectArgsDialog} * @param statusBar * the {@link StatusBar} to update (can be null) * @param title * the title of the new {@link CollectArgsDialog} * @param xOptions * the {@link Collection} of {@link XOption}s for which to * collect user input */ public CollectArgsDialog(JFrame frame, final StatusBar statusBar, String title, final Collection<XOption<?>> xOptions) { super(frame, title, true); argComponents = new ArrayList<JComponent>(); final CollectArgsDialog dialog = this; JPanel panel = new JPanel(new GridBagLayout()); getContentPane().add(panel); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(3, 3, 3, 3); c.fill = GridBagConstraints.BOTH; int row = 0; for (XOption<?> xOption : xOptions) { if (xOption.getName() == null) { continue; } if (xOption.hasArg()) { JLabel label = new JLabel(xOption.getName()); JTextField textField = new JTextField(); textField.setName(xOption.getOpt()); textField.setToolTipText(xOption.getDescription()); argComponents.add(textField); c.gridx = 0; c.gridy = row; panel.add(label, c); c.gridx = 1; c.gridy = row; panel.add(textField, c); } else { JCheckBox checkBox = new JCheckBox(xOption.getName()); checkBox.setName(xOption.getOpt()); checkBox.setToolTipText(xOption.getDescription()); argComponents.add(checkBox); c.gridx = 0; c.gridy = row; panel.add(checkBox, c); } row++; } JPanel buttonPanel = new JPanel(); c.gridx = 1; c.gridy = row; panel.add(buttonPanel, c); JButton okButton = new JButton(new AbstractAction("OK") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { dialog.setVisible(false); if (statusBar != null) { statusBar.setMessage("building args..."); } ArrayList<String> args = new ArrayList<String>(); for (JComponent component : argComponents) { if (component instanceof JCheckBox) { JCheckBox checkbox = (JCheckBox) component; String opt = checkbox.getName(); if (checkbox.isSelected()) { args.add("-" + opt); } } if (component instanceof JTextField) { JTextField textField = (JTextField) component; String opt = textField.getName(); String text = textField.getText().trim(); if (!text.isEmpty()) { args.add("-" + opt); args.add("\"" + text + "\""); } } } if (statusBar != null) { statusBar.setMessage("parsing args..."); } try { Options options = new Options(); for (XOption<?> xOpt : xOptions) { options.addOption(xOpt); } XOption.parseArgs(options, args.toArray(new String[0])); dialog.success = true; } catch (ParseException e1) { e1.printStackTrace(); dialog.success = false; } if (statusBar != null) { statusBar.clearMessage(); } } }); buttonPanel.add(okButton); getRootPane().setDefaultButton(okButton); buttonPanel.add(new JButton(new AbstractAction("Cancel") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { dialog.setVisible(false); if (statusBar != null) { statusBar.clearMessage(); } } })); pack(); setLocationRelativeTo(frame); setVisible(true); }
From source file:biomine.bmvis2.pipeline.NodeLabelOperation.java
public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) { JPanel ret = new JPanel(); ret.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1;/* w ww . j a v a 2 s. c om*/ c.weighty = 0; c.gridy = 0; final Set<String> avail = graph.getAvailableNodeLabels(); for (final String str : avail) { final JCheckBox box = new JCheckBox(); box.setSelected(enabledLabels.contains(str)); box.setAction(new AbstractAction(str) { public void actionPerformed(ActionEvent arg0) { if (box.isSelected() != enabledLabels.contains(str)) { if (box.isSelected()) enabledLabels.add(str); else enabledLabels.remove(str); v.settingsChanged(false); } } }); ret.add(box, c); c.gridy++; } return ret; }