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.game.ui.views.CharacterEditor.java
/** * This method draws up the gui on the panel. *//*from w ww.ja v a2 s. c o m*/ public void doGui() { JPanel outerPane = new JPanel(); outerPane.setLayout(new GridBagLayout()); // setLayout(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel(lblContent); noteLbl.setAlignmentX(0); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.NONE; c.insets = new Insets(5, 5, 5, 5); c.gridwidth = 4; c.gridy = 0; c.gridx = 0; outerPane.add(noteLbl, c); System.out.println(c.gridy); c.gridy++; System.out.println(c.gridy); c.gridx = 0; c.gridwidth = 1; comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setAlignmentX(0); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); outerPane.add(comboBox, c); c.gridy++; JLabel nameLbl = new JLabel("Name : "); outerPane.add(nameLbl, c); c.gridx++; name = new JTextField(); name.setColumns(20); outerPane.add(name, c); c.gridx = 0; c.gridy++; JLabel imageLbl = new JLabel("Image Path : "); outerPane.add(imageLbl, c); c.gridx++; imgPath = new JTextField(); imgPath.setColumns(20); outerPane.add(imgPath, c); c.gridx = 0; c.gridy++; JLabel hitPtsLbl = new JLabel("Hit Points : "); outerPane.add(hitPtsLbl, c); c.gridx++; hitPoints = new JTextField(); hitPoints.setColumns(20); outerPane.add(hitPoints, c); c.gridx = 0; c.gridy++; JLabel lvl = new JLabel("Level : "); outerPane.add(lvl, c); c.gridx++; level = new JTextField(); level.setColumns(20); /*if(!isEnemy){ level.setText("1"); level.setEnabled(false); }*/ outerPane.add(level, c); c.gridx = 0; c.gridy++; JLabel mlWpn = new JLabel("Melee Weapon : "); outerPane.add(mlWpn, c); c.gridx++; model = new DefaultComboBoxModel(); LinkedList<String> meleeWpnList = new LinkedList<String>(); LinkedList<String> rngdWpnList = new LinkedList<String>(); for (Item item : GameBean.weaponDetails) { Weapon wpn = (Weapon) item; if (wpn.getWeaponType().equalsIgnoreCase(Configuration.weaponTypes[0])) { meleeWpnList.add(wpn.getName()); } else { rngdWpnList.add(wpn.getName()); } weaponMap.put(wpn.getName(), wpn); } meleeWeapon = new JComboBox(new DefaultComboBoxModel(meleeWpnList.toArray())); meleeWeapon.setSelectedIndex(-1); meleeWeapon.setMaximumSize(new Dimension(100, 30)); outerPane.add(meleeWeapon, c); c.gridx++; JLabel rngdWpn = new JLabel("Ranged Weapon : "); outerPane.add(rngdWpn, c); c.gridx++; rangedWeapon = new JComboBox(new DefaultComboBoxModel(rngdWpnList.toArray())); rangedWeapon.setSelectedIndex(-1); rangedWeapon.setMaximumSize(new Dimension(100, 30)); outerPane.add(rangedWeapon, c); c.gridy++; c.gridx = 0; JLabel armourLbl = new JLabel("Armour : "); outerPane.add(armourLbl, c); c.gridx++; LinkedList<String> armourList = new LinkedList<String>(); LinkedList<String> shildList = new LinkedList<String>(); for (Item item : GameBean.armourDetails) { Armour temp = (Armour) item; if (temp.getArmourType() != null) { if (temp.getArmourType().equalsIgnoreCase(Configuration.armourTypes[1])) { armourList.add(temp.getName()); } else { shildList.add(temp.getName()); } } else { armourList.add(temp.getName()); // else if(temp.getArmourType().equalsIgnoreCase(Configuration.armourTypes[2])) shildList.add(temp.getName()); } armorMap.put(temp.getName(), temp); } armour = new JComboBox(new DefaultComboBoxModel(armourList.toArray())); armour.setSelectedIndex(-1); armour.setMaximumSize(new Dimension(100, 30)); outerPane.add(armour, c); c.gridx++; JLabel shieldLbl = new JLabel("Shield : "); outerPane.add(shieldLbl, c); c.gridx++; shield = new JComboBox(new DefaultComboBoxModel(shildList.toArray())); shield.setSelectedIndex(-1); shield.setMaximumSize(new Dimension(100, 30)); outerPane.add(shield, c); ta = new JTextArea(10, 50); ta.setRows(40); ta.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); JScrollPane scrollPane = new JScrollPane(ta); scrollPane.setPreferredSize(new Dimension(600, 250)); c.gridx = 0; c.gridy++; c.fill = GridBagConstraints.BOTH; c.gridwidth = 4; c.gridheight = 4; c.weightx = .5; c.weighty = 1; outerPane.add(scrollPane, c); c.gridy += 4; c.gridx = 0; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.gridheight = 1; c.gridwidth = 1; JButton generate = new JButton("Generate"); JButton submit = new JButton("Submit"); outerPane.add(generate, c); submit.addActionListener(this); generate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { ta.setText(""); HashSet<Integer> set = new HashSet<Integer>(); int strength = getUniqueVal(set); int constitution = getUniqueVal(set); int dext = getUniqueVal(set); int intel = getUniqueVal(set); int charisma = getUniqueVal(set); int wisdom = getUniqueVal(set); if (character == null) { builder = new CharacterBuilder(isEnemy); } else { builder = new CharacterBuilder(character); } builder.setStrength(strength); builder.setConstitution(constitution); builder.setDexterity(dext); builder.setIntelligence(intel); builder.setCharisma(charisma); builder.setWisdom(wisdom); int strModifier = GameUtils.calculateAbilityModifier(strength); int conModifier = GameUtils.calculateAbilityModifier(constitution); int dexModifier = GameUtils.calculateAbilityModifier(dext); int wisModifier = GameUtils.calculateAbilityModifier(wisdom); int intModifier = GameUtils.calculateAbilityModifier(intel); int chaModifier = GameUtils.calculateAbilityModifier(charisma); builder.setStrengthModifier(strModifier); builder.setConstitutionModifier(conModifier); builder.setCharismaModifier(chaModifier); builder.setWisdomModifier(wisModifier); builder.setIntelligenceModifier(intModifier); builder.setDexterityModifier(dexModifier); String type = null; if (constitution < strength && constitution > dext) { type = "Bully"; builder.setType("Bully"); } else if (dext > constitution && constitution > strength) { builder.setType("Nimble"); type = "Nimble"; } else { builder.setType("Tank"); type = "Tank"; } ta.append("Strength : " + strength); ta.append("\nDexterity : " + dexModifier); ta.append("\nConstitution : " + constitution); ta.append("\nIntelligence : " + intel); ta.append("\nCharisma: " + charisma); ta.append("\nWisdom : " + wisdom); ta.append("\nType :" + type); ta.append("\nStrength Modifier :" + strModifier); ta.append("\nConstitution Modifier :" + conModifier); ta.append("\nDexterity Modifier :" + dexModifier); generated = true; if (character != null) { character = builder.build(); } } }); c.gridx++; outerPane.add(submit, c); validationMess = new JLabel(); validationMess.setForeground(Color.red); // validationMess.setVisible(false); c.gridy++; c.gridx = 0; c.gridwidth = 4; outerPane.add(validationMess, c); JScrollPane outerScrollPane = new JScrollPane(outerPane); setLayout(new BorderLayout()); add(outerScrollPane, BorderLayout.CENTER); }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void LoadMainForm() { this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //load entry/*from w w w . j a v a 2 s .c om*/ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 15, 10, 15); this.cbEntry.setRenderer(new ComboBoxRender()); this.cbSupervisor1.setRenderer(new ComboBoxRender()); this.cbSupervisor2.setRenderer(new ComboBoxRender()); this.cbSupervisor3.setRenderer(new ComboBoxRender()); this.cbTechnician1.setRenderer(new ComboBoxRender()); this.cbTechnician2.setRenderer(new ComboBoxRender()); this.cbTechnician3.setRenderer(new ComboBoxRender()); this.cbWorker1.setRenderer(new ComboBoxRender()); this.cbWorker2.setRenderer(new ComboBoxRender()); this.cbWorker3.setRenderer(new ComboBoxRender()); this.cbProductAdditive1.setRenderer(new ComboBoxRender()); this.cbProductAdditive2.setRenderer(new ComboBoxRender()); this.cbProductAdditive3.setRenderer(new ComboBoxRender()); this.cbProductPolymer.setRenderer(new ComboBoxRender()); }
From source file:net.sf.jasperreports.swing.JRViewerPanel.java
private void initComponents() { scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlTabs = new javax.swing.JTabbedPane(); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); addComponentListener(new java.awt.event.ComponentAdapter() { @Override// w w w . j av a2s.c o m public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlTabs.addChangeListener(new javax.swing.event.ChangeListener() { @Override public void stateChanged(javax.swing.event.ChangeEvent evt) { pnlTabsStateChanged(evt); } }); add(pnlTabs, java.awt.BorderLayout.CENTER); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setLayout(new java.awt.BorderLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); jPanel4.setLayout(new java.awt.GridBagLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); pnlLinks.setLayout(null); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } @Override public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { @Override public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setBackground(java.awt.Color.gray); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setBackground(java.awt.Color.gray); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); add(scrollPane, java.awt.BorderLayout.CENTER); }
From source file:mineria.UI.java
public UI() { this.setLayout(new GridBagLayout()); Label lblnodatos = new Label("NoDatos: "); Label label = new Label("BD: "); JTextField filename = new JTextField("/Users/eduardomartinez/Documents/mineria/representacion.txt"); JTextField nodatos = new JTextField(); nodatos.setText("500"); JTextField funcion = new JTextField("6"); JTextField individuos = new JTextField("200"); JTextField enteros = new JTextField("1"); JTextField decimales = new JTextField("40"); JTextField variables = new JTextField("6"); JTextField Pc = new JTextField("0.9"); JTextField Pm = new JTextField("0.01"); JTextField generaciones = new JTextField("100"); JTextField minimiza = new JTextField("0"); Label lblfuncion = new Label("funcion: "); Label lblindividuos = new Label("individuos: "); Label lblenteros = new Label("enteros: "); Label lbldecimales = new Label("decimales: "); Label lblvariables = new Label("variables: "); Label lblpc = new Label("Pc: "); Label lblpm = new Label("Pm: "); Label lblgeneraciones = new Label("generaciones: "); Label lblminimiza = new Label("[0 Min/1 Max] : "); /*//from www . j ava 2 s. co m FN=funcion; N =individuos; E =bits_enteros; D =bits_decimales; V =variables; Pc=porcentaje_cruza; Pm=porcentaje_muta; G =generaciones; MM=minimiza; */ JButton openBtn = new JButton("Open BD"); JButton ejecutarEGA = new JButton("Ejecutar EGA"); JTextField resultado = new JTextField(); Label fitness = new Label("fitness: "); XYSeriesCollection datosSerie = new XYSeriesCollection(); AGF agf = new AGF(2); EGA ega = new EGA(); JFreeChart chart = ChartFactory.createScatterPlot("Scatter Plot", // chart title "X", // x axis label "Y", // y axis label datosSerie, // data ***-----PROBLEM------*** PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // create and display a frame... ChartPanel panelChart = new ChartPanel(chart); //leer BD openBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { //datosSerie.removeAllSeries(); if (filename.getText().length() > 0) { agf.LeerDatos(filename.getText(), Integer.parseInt(nodatos.getText())); createDataset(datosSerie, agf.data, "Datos"); chart.fireChartChanged(); } else { JFileChooser openFile = new JFileChooser(); int rVal = openFile.showOpenDialog(null); if (rVal == JFileChooser.APPROVE_OPTION) { filename.setText(openFile.getSelectedFile().getAbsolutePath()); agf.LeerDatos(filename.getText(), Integer.parseInt(nodatos.getText())); //createDataset(datosSerie, agf.data, "Datos"); //chart.fireChartChanged(); } if (rVal == JFileChooser.CANCEL_OPTION) { filename.setText(""); //dir.setText(""); } } } }); ejecutarEGA.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { //datosSerie.removeAllSeries(); if (datosSerie.getSeriesCount() > 1) datosSerie.removeSeries(1); int fn = Integer.parseInt(funcion.getText()); int n = Integer.parseInt(individuos.getText()); int e = Integer.parseInt(enteros.getText()); int d = Integer.parseInt(decimales.getText()); int v = Integer.parseInt(variables.getText()); double pc = Double.parseDouble(Pc.getText()); double pm = Double.parseDouble(Pm.getText()); int g = Integer.parseInt(generaciones.getText()); int mm = Integer.parseInt(minimiza.getText()); ega.setParams(fn, n, e, d, v, pc, pm, g, mm); Resultado res = ega.ejecutarAlgoritmoGenetico(agf); resultado.setText(String.valueOf(res.getFitnessSemental())); res.creaArchivo(); createDataset(datosSerie, res.getFenotipoSemental(), "Centros"); Shape cross = ShapeUtilities.createDiagonalCross(5, 1); XYPlot xyPlot = (XYPlot) chart.getPlot(); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); XYItemRenderer renderer = xyPlot.getRenderer(); renderer.setSeriesShape(1, cross); renderer.setSeriesPaint(1, Color.blue); chart.fireChartChanged(); } }); //ejecutar AG GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblnodatos, gbc); gbc.gridx = 3; gbc.gridy = 0; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(nodatos, gbc); gbc.gridx = 2; gbc.gridy = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(filename, gbc); gbc.gridx = 3; gbc.gridy = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(openBtn, gbc); gbc.gridx = 2; gbc.gridy = 2; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(fitness, gbc); gbc.gridx = 3; gbc.gridy = 2; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(resultado, gbc); gbc.gridx = 2; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(ejecutarEGA, gbc); //-----------------PARAMETROS gbc.gridx = 0; gbc.gridy = 0; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblfuncion, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(funcion, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblindividuos, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(individuos, gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblenteros, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(enteros, gbc); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lbldecimales, gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(decimales, gbc); gbc.gridx = 0; gbc.gridy = 4; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblvariables, gbc); gbc.gridx = 1; gbc.gridy = 4; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(variables, gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblpc, gbc); gbc.gridx = 1; gbc.gridy = 5; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(Pc, gbc); gbc.gridx = 0; gbc.gridy = 6; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblpm, gbc); gbc.gridx = 1; gbc.gridy = 6; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(Pm, gbc); gbc.gridx = 0; gbc.gridy = 7; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblgeneraciones, gbc); gbc.gridx = 1; gbc.gridy = 7; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(generaciones, gbc); gbc.gridx = 0; gbc.gridy = 8; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(lblminimiza, gbc); gbc.gridx = 1; gbc.gridy = 8; gbc.fill = GridBagConstraints.HORIZONTAL; this.add(minimiza, gbc); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy = 9; gbc.gridheight = 2; gbc.gridwidth = 4; this.add(panelChart, gbc); this.setTitle("File Chooser"); this.pack(); }
From source file:org.fhcrc.cpl.viewer.quant.gui.ProteinQuantSummaryFrame.java
License:asdf
/** * Initialize the GUI components//from w ww . j a v a 2s . c o m */ protected void initGUI() { //Global stuff setSize(fullWidth, fullHeight); eventPropertiesTable = new QuantEvent.QuantEventPropertiesTable(); eventPropertiesTable.setVisible(true); JScrollPane eventPropsScrollPane = new JScrollPane(); eventPropsScrollPane.setViewportView(eventPropertiesTable); eventPropsScrollPane.setSize(propertiesWidth, propertiesHeight); eventPropertiesDialog = new JDialog(this, "Event Properties"); eventPropertiesDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); eventPropertiesDialog.setSize(propertiesWidth, propertiesHeight); eventPropertiesDialog.setContentPane(eventPropsScrollPane); ListenerHelper helper = new ListenerHelper(this); setTitle("Protein Summary"); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(5, 5, 5, 5); gbc.weighty = 1; gbc.weightx = 1; try { (getOwner()).setIconImage(ImageIO.read(WorkbenchFrame.class.getResourceAsStream("icon.gif"))); } catch (Exception e) { } try { Localizer.renderSwixml("org/fhcrc/cpl/viewer/quant/gui/ProteinQuantSummaryFrame.xml", this); assert null != contentPanel; setContentPane(contentPanel); } catch (Exception x) { ApplicationContext.errorMessage("error creating dialog", x); throw new RuntimeException(x); } buttonSelectAllVisible.setEnabled(false); helper.addListener(buttonSelectAllVisible, "buttonSelectAllVisible_actionPerformed"); buttonDeselectAll.setEnabled(false); helper.addListener(buttonDeselectAll, "buttonDeselectAll_actionPerformed"); buildTurkHITsButton.setEnabled(false); helper.addListener(buildTurkHITsButton, "buttonBuildTurkHITs_actionPerformed"); loadSelectedEventsButton.setEnabled(false); helper.addListener(loadSelectedEventsButton, "buttonLoadSelected_actionPerformed"); autoAssessSelectedEventsButton.setEnabled(false); helper.addListener(autoAssessSelectedEventsButton, "buttonAutoAssess_actionPerformed"); showPropertiesButton.setEnabled(false); helper.addListener(showPropertiesButton, "buttonShowProperties_actionPerformed"); showProteinRatiosButton.setEnabled(false); helper.addListener(showProteinRatiosButton, "buttonShowProteinRatios_actionPerformed"); //summary panel summaryPanel.setBorder(BorderFactory.createLineBorder(Color.gray)); summaryPanel.setPreferredSize(new Dimension(fullWidth, summaryPanelHeight)); summaryPanel.setMinimumSize(new Dimension(200, summaryPanelHeight)); gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; summaryPanel.add(buttonSelectAllVisible, gbc); summaryPanel.add(buttonDeselectAll, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; summaryPanel.add(showPropertiesButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; summaryPanel.add(showProteinRatiosButton, gbc); gbc.gridwidth = 1; summaryPanel.add(loadSelectedEventsButton, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; summaryPanel.add(autoAssessSelectedEventsButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; summaryPanel.add(buildTurkHITsButton, gbc); gbc.fill = GridBagConstraints.BOTH; eventsScrollPane = new JScrollPane(); eventsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); eventsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); eventsPanel = new JPanel(); eventsPanel.setLayout(new GridBagLayout()); eventsTable = new QuantEventsSummaryTable(); eventsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); eventsTable.getSelectionModel().addListSelectionListener(new EventsTableListSelectionHandler()); eventsScrollPane.setViewportView(eventsTable); eventsScrollPane.setMinimumSize(new Dimension(400, 400)); gbc.insets = new Insets(0, 0, 0, 0); mainPanel.add(eventsScrollPane, gbc); logRatioHistogramPanel = new PanelWithLogRatioHistAndFields(); logRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios")); logRatioHistogramPanel.setPreferredSize(new Dimension(width - 10, 300)); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 100; gbc.gridwidth = GridBagConstraints.REMAINDER; add(logRatioHistogramPanel, gbc); //status message messageLabel = new JLabel(); messageLabel.setBackground(Color.WHITE); messageLabel.setFont(Font.decode("verdana plain 12")); messageLabel.setText(" "); statusPanel = new JPanel(); gbc.weighty = 1; statusPanel.setPreferredSize(new Dimension(width - 10, 50)); statusPanel.add(messageLabel, gbc); add(statusPanel, gbc); //per-protein event summary table; disembodied //todo: move this into its own class? it's getting kind of complicated proteinRatiosTable = new JTable(); proteinRatiosTable.setVisible(true); ListSelectionModel proteinTableSelectionModel = proteinRatiosTable.getSelectionModel(); proteinTableSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); proteinTableSelectionModel.addListSelectionListener(new ProteinTableListSelectionHandler()); JScrollPane proteinRatiosScrollPane = new JScrollPane(); proteinRatiosScrollPane.setViewportView(proteinRatiosTable); proteinRatiosScrollPane.setPreferredSize(new Dimension(proteinDialogWidth, proteinDialogHeight - PROTEINTABLE_HISTPANEL_HEIGHT - PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT - 70)); proteinRatiosDialog = new JDialog(this, "Protein Ratios"); proteinRatiosDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); proteinRatiosDialog.setSize(proteinDialogWidth, proteinDialogHeight); JPanel proteinRatiosContentPanel = new JPanel(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; proteinRatiosContentPanel.add(proteinRatiosScrollPane, gbc); proteinRatiosDialog.setContentPane(proteinRatiosContentPanel); perProteinLogRatioHistogramPanel = new PanelWithLogRatioHistAndFields(); perProteinLogRatioHistogramPanel.addRangeUpdateListener(new ProteinTableLogRatioHistogramListener()); perProteinLogRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios")); perProteinLogRatioHistogramPanel .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_HISTPANEL_HEIGHT)); gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = GridBagConstraints.REMAINDER; proteinRatiosDialog.add(perProteinLogRatioHistogramPanel, gbc); perProteinPeptideLogRatioPanel = new JPanel(); perProteinPeptideLogRatioPanel.setBorder(BorderFactory.createTitledBorder("By Peptide")); perProteinPeptideLogRatioPanel .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT)); proteinRatiosDialog.add(perProteinPeptideLogRatioPanel, gbc); }
From source file:org.openmicroscopy.shoola.agents.metadata.rnd.GraphicsPane.java
/** * Builds hosting the various sliders/*from www .ja va2 s .c o m*/ * * @return See above. */ private JPanel buildGeneralPane() { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); content.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 2, 2, 0); c.gridy = 0; c.gridx = 0; if (model.isGeneralIndex()) { content.add(previewToolBar, c); c.gridy++; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.HORIZONTAL; content.add(new JSeparator(), c); c.gridy++; } content.add(controlsBar, c); c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE;//reset to default c.weightx = 0.0; Iterator<ChannelSlider> i = sliders.iterator(); while (i.hasNext()) { c.gridy++; content.add(i.next(), c); } c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; //end row c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; content.add(viewedBy, c); JPanel p = UIUtilities.buildComponentPanel(content); p.setBackground(content.getBackground()); return p; }
From source file:br.com.jinsync.view.FrmJInSync.java
/** * Initialize the contents of the frame. *//*w w w. j a v a 2 s. co m*/ private void initialize() { Language.loadParameters(); setBounds(100, 100, 1136, 665); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0, 0 }; gridBagLayout.rowHeights = new int[] { 600, 53, 0, 0 }; gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { 1.0, 0.0, 0.0, Double.MIN_VALUE }; getContentPane().setLayout(gridBagLayout); grpFontes = new JTabbedPane(SwingConstants.TOP); GridBagConstraints gbc_grpFontes = new GridBagConstraints(); gbc_grpFontes.insets = new Insets(0, 0, 5, 0); gbc_grpFontes.fill = GridBagConstraints.BOTH; gbc_grpFontes.gridx = 0; gbc_grpFontes.gridy = 0; getContentPane().add(grpFontes, gbc_grpFontes); tabCopybook = new JPanel(); tabCopybook.setBackground(Color.WHITE); grpFontes.addTab(Language.tabCopy, null, tabCopybook, null); GridBagLayout gbl_tabCopybook = new GridBagLayout(); gbl_tabCopybook.columnWidths = new int[] { 10, 1, 0, 349, 0, 0, 62, 28, 71, 0, 0, 0 }; gbl_tabCopybook.rowHeights = new int[] { 1, 0, 0, 0 }; gbl_tabCopybook.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_tabCopybook.rowWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE }; tabCopybook.setLayout(gbl_tabCopybook); JLabel lblCopybook = new JLabel(Language.txtFilePds); GridBagConstraints gbc_lblCopybook = new GridBagConstraints(); gbc_lblCopybook.anchor = GridBagConstraints.EAST; gbc_lblCopybook.insets = new Insets(0, 0, 5, 5); gbc_lblCopybook.gridx = 1; gbc_lblCopybook.gridy = 1; tabCopybook.add(lblCopybook, gbc_lblCopybook); txtPath = new JTextField(); GridBagConstraints gbc_txtPath = new GridBagConstraints(); gbc_txtPath.gridwidth = 4; gbc_txtPath.insets = new Insets(0, 0, 5, 5); gbc_txtPath.fill = GridBagConstraints.HORIZONTAL; gbc_txtPath.gridx = 2; gbc_txtPath.gridy = 1; tabCopybook.add(txtPath, gbc_txtPath); txtPath.setColumns(10); JButton btnDiretorio = new JButton(""); btnDiretorio.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png"))); btnDiretorio.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { openDirectory(); } }); GridBagConstraints gbc_btnDiretorio = new GridBagConstraints(); gbc_btnDiretorio.insets = new Insets(0, 0, 5, 5); gbc_btnDiretorio.gridx = 6; gbc_btnDiretorio.gridy = 1; tabCopybook.add(btnDiretorio, gbc_btnDiretorio); btnClearCopy = new JButton(""); btnClearCopy.setEnabled(false); btnClearCopy.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { tableCopy = new JTable(); scrCopy.setViewportView(tableCopy); tableString = new JTable(); scrTableString.setViewportView(tableString); btnExcelString.setEnabled(false); btnClearString.setEnabled(false); textAreaString.setText(""); console.removeAllElements(); btnExcel.setEnabled(false); btnClearCopy.setEnabled(false); grpFontes.setEnabledAt(1, false); tableFile = new JTable(); scrFile.setViewportView(tableFile); btnExcelFile.setEnabled(false); btnClearFile.setEnabled(false); grpFontes.setEnabledAt(2, false); } }); btnClearCopy.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png"))); GridBagConstraints gbc_btnLimpar = new GridBagConstraints(); gbc_btnLimpar.fill = GridBagConstraints.BOTH; gbc_btnLimpar.insets = new Insets(0, 0, 5, 5); gbc_btnLimpar.gridx = 9; gbc_btnLimpar.gridy = 1; tabCopybook.add(btnClearCopy, gbc_btnLimpar); JButton btnProcessarBook = new JButton(""); btnProcessarBook.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadData(); btnClearCopy.setEnabled(true); grpFontes.setEnabledAt(1, true); grpFontes.setEnabledAt(2, true); } }); btnProcessarBook.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png"))); GridBagConstraints gbc_btnProcessarBook = new GridBagConstraints(); gbc_btnProcessarBook.fill = GridBagConstraints.VERTICAL; gbc_btnProcessarBook.insets = new Insets(0, 0, 5, 5); gbc_btnProcessarBook.gridx = 7; gbc_btnProcessarBook.gridy = 1; tabCopybook.add(btnProcessarBook, gbc_btnProcessarBook); btnExcel = new JButton(""); btnExcel.setEnabled(false); btnExcel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { expExcelBook(); // exportarExcelBook(tableCopy, txtPath.getText(), // "Horizontal"); } }); btnExcel.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png"))); GridBagConstraints gbc_btnExcel = new GridBagConstraints(); gbc_btnExcel.insets = new Insets(0, 0, 5, 5); gbc_btnExcel.gridx = 8; gbc_btnExcel.gridy = 1; tabCopybook.add(btnExcel, gbc_btnExcel); // JScrollPane scrCopy = new JScrollPane(); gbc_scrCopy = new GridBagConstraints(); gbc_scrCopy.gridwidth = 9; gbc_scrCopy.insets = new Insets(0, 0, 0, 5); gbc_scrCopy.fill = GridBagConstraints.BOTH; gbc_scrCopy.gridx = 1; gbc_scrCopy.gridy = 2; // tabCopybook.add(scrCopy, gbc_scrCopy); panelConsole = new Panel(); GridBagConstraints gbc_panelConsole = new GridBagConstraints(); gbc_panelConsole.insets = new Insets(0, 0, 5, 0); gbc_panelConsole.fill = GridBagConstraints.BOTH; gbc_panelConsole.gridx = 0; gbc_panelConsole.gridy = 1; getContentPane().add(panelConsole, gbc_panelConsole); panelConsole.setLayout(new BorderLayout(0, 0)); listTerminal = new JList<String>(); listTerminal.setFont(new Font("Courier New", Font.PLAIN, 11)); listTerminal.setModel(console); scrConsole = new JScrollPane(listTerminal); panelConsole.add(scrConsole); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnNewMenu = new JMenu(Language.menuParam); menuBar.add(mnNewMenu); JMenuItem mnItemUsuario = new JMenuItem(Language.menuParamUser); mnItemUsuario.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { FrmUser frmUsuar = new FrmUser(); frmUsuar.setLocationRelativeTo(null); frmUsuar.setVisible(true); setUser(); } }); mnNewMenu.add(mnItemUsuario); JMenuItem mnItemFtp = new JMenuItem(Language.menuParamFtp); mnItemFtp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { FrmFtp frmFtp = new FrmFtp(); frmFtp.setLocationRelativeTo(null); frmFtp.setVisible(true); setFtp(); } }); mnNewMenu.add(mnItemFtp); JMenu mnAjuda = new JMenu(Language.menuHelp); menuBar.add(mnAjuda); JMenuItem mntmNewMenuItem = new JMenuItem(Language.menuHelpAbout); mntmNewMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { FrmAbout frmSobre = new FrmAbout(); frmSobre.setLocationRelativeTo(null); frmSobre.setVisible(true); } }); mnAjuda.add(mntmNewMenuItem); tabCopybook.setFont(new Font("Arial", Font.PLAIN, 12)); tabCopybook.add(scrCopy, gbc_scrCopy); tabString = new JPanel(); tabString.setFont(new Font("Arial", Font.PLAIN, 12)); tabString.setBackground(Color.WHITE); grpFontes.addTab(Language.tabString, null, tabString, null); grpFontes.setEnabledAt(1, false); GridBagLayout gbl_tabString = new GridBagLayout(); gbl_tabString.columnWidths = new int[] { 10, 1, 346, 349, 0, 0, 62, 28, 71, 0, 0, 0 }; gbl_tabString.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0 }; gbl_tabString.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_tabString.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; tabString.setLayout(gbl_tabString); JLabel lblString = new JLabel("String:"); GridBagConstraints gbc_lblString = new GridBagConstraints(); gbc_lblString.anchor = GridBagConstraints.WEST; gbc_lblString.insets = new Insets(0, 0, 5, 5); gbc_lblString.gridx = 1; gbc_lblString.gridy = 1; tabString.add(lblString, gbc_lblString); textAreaString = new JTextArea(); JScrollPane scrStringData = new JScrollPane(textAreaString); GridBagConstraints gbc_scrString = new GridBagConstraints(); gbc_scrString.gridheight = 3; gbc_scrString.gridwidth = 8; gbc_scrString.insets = new Insets(0, 0, 5, 5); gbc_scrString.fill = GridBagConstraints.BOTH; gbc_scrString.gridx = 1; gbc_scrString.gridy = 2; tabString.add(scrStringData, gbc_scrString); btnClearString = new JButton(""); btnClearString.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scrTableString.setViewportView(tableString); btnExcelString.setEnabled(false); btnClearString.setEnabled(false); textAreaString.setText(""); tableString = new JTable(); scrTableString.setViewportView(tableString); } }); btnExcelString = new JButton(""); btnExcelString.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { expExcelString(); } }); JButton btnProcessarArq = new JButton(""); btnProcessarArq.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { processString(); } }); btnProcessarArq.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png"))); GridBagConstraints gbc_btnProcessarArq = new GridBagConstraints(); gbc_btnProcessarArq.fill = GridBagConstraints.VERTICAL; gbc_btnProcessarArq.insets = new Insets(0, 0, 5, 5); gbc_btnProcessarArq.gridx = 9; gbc_btnProcessarArq.gridy = 2; tabString.add(btnProcessarArq, gbc_btnProcessarArq); btnExcelString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png"))); btnExcelString.setEnabled(false); GridBagConstraints gbc_btnExcelString = new GridBagConstraints(); gbc_btnExcelString.fill = GridBagConstraints.VERTICAL; gbc_btnExcelString.insets = new Insets(0, 0, 5, 5); gbc_btnExcelString.gridx = 9; gbc_btnExcelString.gridy = 3; tabString.add(btnExcelString, gbc_btnExcelString); btnClearString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png"))); btnClearString.setEnabled(false); GridBagConstraints gbc_btnClearString = new GridBagConstraints(); gbc_btnClearString.fill = GridBagConstraints.VERTICAL; gbc_btnClearString.insets = new Insets(0, 0, 5, 5); gbc_btnClearString.gridx = 9; gbc_btnClearString.gridy = 4; tabString.add(btnClearString, gbc_btnClearString); JLabel lblSaida = new JLabel(Language.txtOutput); GridBagConstraints gbc_lblSaida = new GridBagConstraints(); gbc_lblSaida.insets = new Insets(0, 0, 5, 5); gbc_lblSaida.gridx = 1; gbc_lblSaida.gridy = 5; tabString.add(lblSaida, gbc_lblSaida); GridBagConstraints gbc_scrArquivo = new GridBagConstraints(); gbc_scrArquivo.fill = GridBagConstraints.BOTH; gbc_scrArquivo.gridwidth = 9; gbc_scrArquivo.insets = new Insets(0, 0, 0, 5); gbc_scrArquivo.gridx = 1; gbc_scrArquivo.gridy = 6; tabString.add(scrTableString, gbc_scrArquivo); tabFile = new JPanel(); tabFile.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub if (isProcessStarted) { int key = e.getKeyCode(); if (key == KeyEvent.VK_ESCAPE) { int opc = JOptionPane.showConfirmDialog(null, Language.msgCancelProcess, Language.msgInf, JOptionPane.OK_CANCEL_OPTION); if (opc == JOptionPane.OK_OPTION) { escProcessFile(); } } } } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } }); tabFile.setFont(new Font("Arial", Font.PLAIN, 12)); tabFile.setBackground(Color.WHITE); grpFontes.addTab(Language.tabFile, null, tabFile, null); grpFontes.setEnabledAt(2, false); GridBagLayout gbl_tabFile = new GridBagLayout(); gbl_tabFile.columnWidths = new int[] { 10, 1, 49, 459, 0, 0, 62, 28, 0, 71, 0, 0, 0, 0 }; gbl_tabFile.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0, 0 }; gbl_tabFile.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_tabFile.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE }; tabFile.setLayout(gbl_tabFile); JLabel lblFile = new JLabel(Language.txtFilePds); GridBagConstraints gbc_lblFile = new GridBagConstraints(); gbc_lblFile.anchor = GridBagConstraints.EAST; gbc_lblFile.insets = new Insets(0, 0, 5, 5); gbc_lblFile.gridx = 1; gbc_lblFile.gridy = 1; tabFile.add(lblFile, gbc_lblFile); txtFile = new JTextField(); txtFile.setColumns(10); GridBagConstraints gbc_txtFile = new GridBagConstraints(); gbc_txtFile.gridwidth = 5; gbc_txtFile.insets = new Insets(0, 0, 5, 5); gbc_txtFile.fill = GridBagConstraints.HORIZONTAL; gbc_txtFile.gridx = 2; gbc_txtFile.gridy = 1; tabFile.add(txtFile, gbc_txtFile); btnClearFile = new JButton(""); btnClearFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { tableFile = new JTable(); scrFile.setViewportView(tableFile); btnExcelFile.setEnabled(false); btnClearFile.setEnabled(false); progressBar.setStringPainted(true); progressBar.setValue(0); progressBar.setString(""); } }); btnExcelFile = new JButton(""); btnExcelFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { expExcelFile(); } }); btnProcFile = new JButton(""); btnProcFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadFile(); } }); btnDirFile = new JButton(""); btnDirFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openDirFile(); } }); btnDirFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png"))); GridBagConstraints gbc_btnDirFile = new GridBagConstraints(); gbc_btnDirFile.fill = GridBagConstraints.VERTICAL; gbc_btnDirFile.insets = new Insets(0, 0, 5, 5); gbc_btnDirFile.gridx = 7; gbc_btnDirFile.gridy = 1; tabFile.add(btnDirFile, gbc_btnDirFile); btnProcFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png"))); GridBagConstraints gbc_btnProcFile = new GridBagConstraints(); gbc_btnProcFile.fill = GridBagConstraints.VERTICAL; gbc_btnProcFile.insets = new Insets(0, 0, 5, 5); gbc_btnProcFile.gridx = 8; gbc_btnProcFile.gridy = 1; tabFile.add(btnProcFile, gbc_btnProcFile); btnExcelFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png"))); btnExcelFile.setEnabled(false); GridBagConstraints gbc_btnExcelFile = new GridBagConstraints(); gbc_btnExcelFile.insets = new Insets(0, 0, 5, 5); gbc_btnExcelFile.gridx = 9; gbc_btnExcelFile.gridy = 1; tabFile.add(btnExcelFile, gbc_btnExcelFile); btnClearFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png"))); btnClearFile.setEnabled(false); GridBagConstraints gbc_btnLimparFile = new GridBagConstraints(); gbc_btnLimparFile.fill = GridBagConstraints.VERTICAL; gbc_btnLimparFile.insets = new Insets(0, 0, 5, 5); gbc_btnLimparFile.gridx = 10; gbc_btnLimparFile.gridy = 1; tabFile.add(btnClearFile, gbc_btnLimparFile); JLabel lblTamanho = new JLabel(Language.txtFileLength); GridBagConstraints gbc_lblTamanho = new GridBagConstraints(); gbc_lblTamanho.anchor = GridBagConstraints.WEST; gbc_lblTamanho.insets = new Insets(0, 0, 5, 5); gbc_lblTamanho.gridx = 1; gbc_lblTamanho.gridy = 2; tabFile.add(lblTamanho, gbc_lblTamanho); txtLength = new JTextField(); GridBagConstraints gbc_txtTamanho = new GridBagConstraints(); gbc_txtTamanho.fill = GridBagConstraints.HORIZONTAL; gbc_txtTamanho.insets = new Insets(0, 0, 5, 5); gbc_txtTamanho.gridx = 2; gbc_txtTamanho.gridy = 2; tabFile.add(txtLength, gbc_txtTamanho); txtLength.setColumns(10); JLabel label_1 = new JLabel(Language.txtOutput); GridBagConstraints gbc_label_1 = new GridBagConstraints(); gbc_label_1.anchor = GridBagConstraints.WEST; gbc_label_1.insets = new Insets(0, 0, 5, 5); gbc_label_1.gridx = 1; gbc_label_1.gridy = 3; tabFile.add(label_1, gbc_label_1); GridBagConstraints gbc_scrFile = new GridBagConstraints(); gbc_scrFile.gridheight = 3; gbc_scrFile.fill = GridBagConstraints.BOTH; gbc_scrFile.gridwidth = 10; gbc_scrFile.insets = new Insets(0, 0, 5, 5); gbc_scrFile.gridx = 1; gbc_scrFile.gridy = 4; tabFile.add(scrFile, gbc_scrFile); progressBar = new JProgressBar(); GridBagConstraints gbc_progressBar = new GridBagConstraints(); gbc_progressBar.fill = GridBagConstraints.HORIZONTAL; gbc_progressBar.gridwidth = 10; gbc_progressBar.insets = new Insets(0, 0, 0, 5); gbc_progressBar.gridx = 1; gbc_progressBar.gridy = 7; tabFile.add(progressBar, gbc_progressBar); JLabel lblNewLabel = new JLabel(Language.txtDeveloped + " Rodrigo Augusto Silva dos Santos - 2016"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 2; getContentPane().add(lblNewLabel, gbc_lblNewLabel); loadParameters(); }
From source file:edu.harvard.mcz.imagecapture.VerbatimClassifyDialog.java
protected void init() { setTitle("Interpret verbatim data into fields."); setBounds(100, 100, 1203, 899);//from w w w. jav a2 s .c o m getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); { JPanel panelVerbatimValues = new JPanel(); contentPanel.add(panelVerbatimValues); GridBagLayout gbl_panelVerbatimValues = new GridBagLayout(); gbl_panelVerbatimValues.columnWidths = new int[] { 70, 0, 0, 0, 35, 0, 58, 0, 0, 0 }; gbl_panelVerbatimValues.rowHeights = new int[] { 15, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 0 }; gbl_panelVerbatimValues.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0 }; gbl_panelVerbatimValues.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; panelVerbatimValues.setLayout(gbl_panelVerbatimValues); { lblCount = new JLabel("New label"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.gridwidth = 2; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.anchor = GridBagConstraints.SOUTHWEST; gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 0; panelVerbatimValues.add(lblCount, gbc_lblNewLabel); } JButton buttonFillFromLast = new JButton("Fill From Last"); GridBagConstraints gbc_buttonFillFromLast = new GridBagConstraints(); gbc_buttonFillFromLast.anchor = GridBagConstraints.SOUTH; gbc_buttonFillFromLast.insets = new Insets(0, 0, 5, 5); gbc_buttonFillFromLast.gridx = 3; gbc_buttonFillFromLast.gridy = 0; panelVerbatimValues.add(buttonFillFromLast, gbc_buttonFillFromLast); { JLabel lblNewLabel_1 = new JLabel("Field values to apply to all records."); GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints(); gbc_lblNewLabel_1.anchor = GridBagConstraints.SOUTHEAST; gbc_lblNewLabel_1.gridwidth = 4; gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_1.gridx = 4; gbc_lblNewLabel_1.gridy = 0; panelVerbatimValues.add(lblNewLabel_1, gbc_lblNewLabel_1); } { JLabel lblNewLabel_2 = new JLabel("Verbatim Locality"); GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints(); gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_2.gridx = 0; gbc_lblNewLabel_2.gridy = 1; panelVerbatimValues.add(lblNewLabel_2, gbc_lblNewLabel_2); } { textFieldVerbLocality = new JTextArea(); textFieldVerbLocality.setEditable(false); textFieldVerbLocality.setRows(5); GridBagConstraints gbc_textField = new GridBagConstraints(); gbc_textField.gridheight = 3; gbc_textField.insets = new Insets(0, 0, 5, 5); gbc_textField.fill = GridBagConstraints.BOTH; gbc_textField.gridx = 1; gbc_textField.gridy = 1; panelVerbatimValues.add(textFieldVerbLocality, gbc_textField); textFieldVerbLocality.setColumns(30); } JLabel lblNewLabel = new JLabel("HigherGeography"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.anchor = GridBagConstraints.EAST; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 3; gbc_lblNewLabel.gridy = 1; panelVerbatimValues.add(lblNewLabel, gbc_lblNewLabel); GridBagConstraints gbc_textFieldHigherGeography = new GridBagConstraints(); gbc_textFieldHigherGeography.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldHigherGeography.gridwidth = 5; gbc_textFieldHigherGeography.insets = new Insets(0, 0, 5, 5); gbc_textFieldHigherGeography.gridx = 4; gbc_textFieldHigherGeography.gridy = 1; panelVerbatimValues.add(getComboBoxHighGeog(), gbc_textFieldHigherGeography); JButton btnCopyLocality = new JButton(">"); btnCopyLocality.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (textFieldSpecificLocality.getText().isEmpty()) { textFieldSpecificLocality.setText(textFieldVerbLocality.getText().replace("\n", "").trim()); } } }); GridBagConstraints gbc_btnCopyLocality = new GridBagConstraints(); gbc_btnCopyLocality.insets = new Insets(0, 0, 5, 5); gbc_btnCopyLocality.gridx = 2; gbc_btnCopyLocality.gridy = 2; panelVerbatimValues.add(btnCopyLocality, gbc_btnCopyLocality); JLabel lblSpecificLocality = new JLabel("Specific Locality"); GridBagConstraints gbc_lblSpecificLocality = new GridBagConstraints(); gbc_lblSpecificLocality.anchor = GridBagConstraints.EAST; gbc_lblSpecificLocality.insets = new Insets(0, 0, 5, 5); gbc_lblSpecificLocality.gridx = 3; gbc_lblSpecificLocality.gridy = 2; panelVerbatimValues.add(lblSpecificLocality, gbc_lblSpecificLocality); JLabel lblElevation = new JLabel("Elevation"); GridBagConstraints gbc_lblElevation = new GridBagConstraints(); gbc_lblElevation.anchor = GridBagConstraints.EAST; gbc_lblElevation.insets = new Insets(0, 0, 5, 5); gbc_lblElevation.gridx = 3; gbc_lblElevation.gridy = 3; panelVerbatimValues.add(lblElevation, gbc_lblElevation); textFieldMinElevation = new JTextField(); textFieldMinElevation.setMinimumSize(new Dimension(60, 19)); GridBagConstraints gbc_textFieldMinElevation = new GridBagConstraints(); gbc_textFieldMinElevation.insets = new Insets(0, 0, 5, 5); gbc_textFieldMinElevation.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldMinElevation.gridx = 4; gbc_textFieldMinElevation.gridy = 3; panelVerbatimValues.add(textFieldMinElevation, gbc_textFieldMinElevation); textFieldMinElevation.setColumns(4); JLabel lblTo = new JLabel("to"); GridBagConstraints gbc_lblTo = new GridBagConstraints(); gbc_lblTo.anchor = GridBagConstraints.EAST; gbc_lblTo.insets = new Insets(0, 0, 5, 5); gbc_lblTo.gridx = 5; gbc_lblTo.gridy = 3; panelVerbatimValues.add(lblTo, gbc_lblTo); textFieldMaxElevation = new JTextField(); textFieldMaxElevation.setMinimumSize(new Dimension(60, 19)); GridBagConstraints gbc_textFieldMaxElevation = new GridBagConstraints(); gbc_textFieldMaxElevation.anchor = GridBagConstraints.WEST; gbc_textFieldMaxElevation.insets = new Insets(0, 0, 5, 5); gbc_textFieldMaxElevation.gridx = 6; gbc_textFieldMaxElevation.gridy = 3; panelVerbatimValues.add(textFieldMaxElevation, gbc_textFieldMaxElevation); textFieldMaxElevation.setColumns(5); comboBoxElevUnits = new JComboBox(); GridBagConstraints gbc_comboBoxElevUnits = new GridBagConstraints(); gbc_comboBoxElevUnits.insets = new Insets(0, 0, 5, 5); gbc_comboBoxElevUnits.fill = GridBagConstraints.HORIZONTAL; gbc_comboBoxElevUnits.gridx = 7; gbc_comboBoxElevUnits.gridy = 3; panelVerbatimValues.add(comboBoxElevUnits, gbc_comboBoxElevUnits); { JLabel lblVerbatimdate = new JLabel("VerbatimDate"); GridBagConstraints gbc_lblVerbatimdate = new GridBagConstraints(); gbc_lblVerbatimdate.anchor = GridBagConstraints.EAST; gbc_lblVerbatimdate.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimdate.gridx = 0; gbc_lblVerbatimdate.gridy = 4; panelVerbatimValues.add(lblVerbatimdate, gbc_lblVerbatimdate); } textFieldVerbDate = new JTextField(); GridBagConstraints gbc_textFieldVerbDate = new GridBagConstraints(); gbc_textFieldVerbDate.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbDate.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldVerbDate.gridx = 1; gbc_textFieldVerbDate.gridy = 4; panelVerbatimValues.add(textFieldVerbDate, gbc_textFieldVerbDate); textFieldVerbDate.setColumns(30); JButton btnCopyDate = new JButton(">"); btnCopyDate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (textFieldISODate.getText().isEmpty()) { Map<String, String> extractResult = DateUtils .extractDateFromVerbatim(textFieldVerbDate.getText().trim()); if (extractResult.containsKey("result")) { textFieldISODate.setText(extractResult.get("result")); } if (extractResult.containsKey("resultState")) { // TODO: Report suspect etc } } } }); GridBagConstraints gbc_btnCopyDate = new GridBagConstraints(); gbc_btnCopyDate.insets = new Insets(0, 0, 5, 5); gbc_btnCopyDate.gridx = 2; gbc_btnCopyDate.gridy = 4; panelVerbatimValues.add(btnCopyDate, gbc_btnCopyDate); JLabel lblNewLabel_3 = new JLabel("ISO Date"); GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints(); gbc_lblNewLabel_3.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_3.gridx = 3; gbc_lblNewLabel_3.gridy = 4; panelVerbatimValues.add(lblNewLabel_3, gbc_lblNewLabel_3); textFieldISODate = new JTextField(); textFieldISODate.setInputVerifier( MetadataRetriever.getInputVerifier(Specimen.class, "ISODate", textFieldISODate)); textFieldISODate.setToolTipText(MetadataRetriever.getFieldHelp(Specimen.class, "ISODate")); GridBagConstraints gbc_textFieldISODate = new GridBagConstraints(); gbc_textFieldISODate.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldISODate.gridwidth = 5; gbc_textFieldISODate.insets = new Insets(0, 0, 5, 5); gbc_textFieldISODate.gridx = 4; gbc_textFieldISODate.gridy = 4; panelVerbatimValues.add(textFieldISODate, gbc_textFieldISODate); textFieldISODate.setColumns(10); textFieldSpecificLocality = new JTextField(); GridBagConstraints gbc_textFieldSpecificLocality = new GridBagConstraints(); gbc_textFieldSpecificLocality.gridwidth = 5; gbc_textFieldSpecificLocality.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldSpecificLocality.insets = new Insets(0, 0, 5, 5); gbc_textFieldSpecificLocality.gridx = 4; gbc_textFieldSpecificLocality.gridy = 2; panelVerbatimValues.add(textFieldSpecificLocality, gbc_textFieldSpecificLocality); textFieldSpecificLocality.setColumns(25); { JLabel lblVerbatimCollector = new JLabel("Verbatim Collector"); GridBagConstraints gbc_lblVerbatimCollector = new GridBagConstraints(); gbc_lblVerbatimCollector.anchor = GridBagConstraints.EAST; gbc_lblVerbatimCollector.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimCollector.gridx = 0; gbc_lblVerbatimCollector.gridy = 6; panelVerbatimValues.add(lblVerbatimCollector, gbc_lblVerbatimCollector); } textFieldVerbCollector = new JTextArea(); textFieldVerbCollector.setEditable(false); textFieldVerbCollector.setRows(3); GridBagConstraints gbc_textFieldVerbCollector = new GridBagConstraints(); gbc_textFieldVerbCollector.gridheight = 2; gbc_textFieldVerbCollector.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbCollector.fill = GridBagConstraints.BOTH; gbc_textFieldVerbCollector.gridx = 1; gbc_textFieldVerbCollector.gridy = 6; panelVerbatimValues.add(textFieldVerbCollector, gbc_textFieldVerbCollector); textFieldVerbCollector.setColumns(30); JLabel lblCollectors = new JLabel("Collector(s)"); GridBagConstraints gbc_lblCollectors = new GridBagConstraints(); gbc_lblCollectors.anchor = GridBagConstraints.EAST; gbc_lblCollectors.insets = new Insets(0, 0, 5, 5); gbc_lblCollectors.gridx = 3; gbc_lblCollectors.gridy = 6; panelVerbatimValues.add(lblCollectors, gbc_lblCollectors); JButton btnAddCollector = new JButton("+"); btnAddCollector.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { ((CollectorTableModel) jTableCollectors.getModel()).addCollector(new Collector(null, "")); } }); GridBagConstraints gbc_btnAddCollector = new GridBagConstraints(); gbc_btnAddCollector.anchor = GridBagConstraints.EAST; gbc_btnAddCollector.insets = new Insets(0, 0, 5, 5); gbc_btnAddCollector.gridx = 3; gbc_btnAddCollector.gridy = 7; panelVerbatimValues.add(btnAddCollector, gbc_btnAddCollector); GridBagConstraints gbc_collectorTable = new GridBagConstraints(); gbc_collectorTable.insets = new Insets(0, 0, 5, 5); gbc_collectorTable.fill = GridBagConstraints.BOTH; gbc_collectorTable.gridx = 4; gbc_collectorTable.gridy = 6; gbc_collectorTable.gridheight = 2; gbc_collectorTable.gridwidth = 5; panelVerbatimValues.add(getJScrollPaneCollectors(), gbc_collectorTable); JLabel lblVerbatimCollection = new JLabel("Verbatim Collection"); GridBagConstraints gbc_lblVerbatimCollection = new GridBagConstraints(); gbc_lblVerbatimCollection.anchor = GridBagConstraints.EAST; gbc_lblVerbatimCollection.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimCollection.gridx = 0; gbc_lblVerbatimCollection.gridy = 8; panelVerbatimValues.add(lblVerbatimCollection, gbc_lblVerbatimCollection); textFieldVerbCollection = new JTextArea(); textFieldVerbCollection.setEditable(false); textFieldVerbCollection.setRows(3); GridBagConstraints gbc_textFieldVerbCollection = new GridBagConstraints(); gbc_textFieldVerbCollection.gridheight = 2; gbc_textFieldVerbCollection.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbCollection.fill = GridBagConstraints.BOTH; gbc_textFieldVerbCollection.gridx = 1; gbc_textFieldVerbCollection.gridy = 8; panelVerbatimValues.add(textFieldVerbCollection, gbc_textFieldVerbCollection); textFieldVerbCollection.setColumns(30); JLabel lblCollection = new JLabel("Collection"); GridBagConstraints gbc_lblCollection = new GridBagConstraints(); gbc_lblCollection.anchor = GridBagConstraints.EAST; gbc_lblCollection.insets = new Insets(0, 0, 5, 5); gbc_lblCollection.gridx = 3; gbc_lblCollection.gridy = 8; panelVerbatimValues.add(lblCollection, gbc_lblCollection); GridBagConstraints gbc_textFieldCollection = new GridBagConstraints(); gbc_textFieldCollection.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldCollection.gridwidth = 5; gbc_textFieldCollection.insets = new Insets(0, 0, 5, 5); gbc_textFieldCollection.gridx = 4; gbc_textFieldCollection.gridy = 8; panelVerbatimValues.add(getJComboBoxCollection(), gbc_textFieldCollection); JLabel lblVerbatimNumbers = new JLabel("Verbatim Numbers"); GridBagConstraints gbc_lblVerbatimNumbers = new GridBagConstraints(); gbc_lblVerbatimNumbers.anchor = GridBagConstraints.EAST; gbc_lblVerbatimNumbers.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimNumbers.gridx = 0; gbc_lblVerbatimNumbers.gridy = 10; panelVerbatimValues.add(lblVerbatimNumbers, gbc_lblVerbatimNumbers); textFieldVerbNumbers = new JTextArea(); textFieldVerbNumbers.setRows(3); textFieldVerbNumbers.setEditable(false); GridBagConstraints gbc_textFieldVerbNumbers = new GridBagConstraints(); gbc_textFieldVerbNumbers.gridheight = 2; gbc_textFieldVerbNumbers.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbNumbers.fill = GridBagConstraints.BOTH; gbc_textFieldVerbNumbers.gridx = 1; gbc_textFieldVerbNumbers.gridy = 10; panelVerbatimValues.add(textFieldVerbNumbers, gbc_textFieldVerbNumbers); textFieldVerbNumbers.setColumns(30); JLabel lblNumbers = new JLabel("Numbers"); GridBagConstraints gbc_lblNumbers = new GridBagConstraints(); gbc_lblNumbers.anchor = GridBagConstraints.EAST; gbc_lblNumbers.insets = new Insets(0, 0, 5, 5); gbc_lblNumbers.gridx = 3; gbc_lblNumbers.gridy = 10; panelVerbatimValues.add(lblNumbers, gbc_lblNumbers); JButton btnAddNumber = new JButton("+"); btnAddNumber.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { ((NumberTableModel) jTableNumbers.getModel()) .addNumber(new edu.harvard.mcz.imagecapture.data.Number(null, "", "")); } }); GridBagConstraints gbc_btnAddNumber = new GridBagConstraints(); gbc_btnAddNumber.anchor = GridBagConstraints.EAST; gbc_btnAddNumber.insets = new Insets(0, 0, 5, 5); gbc_btnAddNumber.gridx = 3; gbc_btnAddNumber.gridy = 11; panelVerbatimValues.add(btnAddNumber, gbc_btnAddNumber); GridBagConstraints gbc_numberTable = new GridBagConstraints(); gbc_numberTable.insets = new Insets(0, 0, 5, 5); gbc_numberTable.fill = GridBagConstraints.BOTH; gbc_numberTable.gridx = 4; gbc_numberTable.gridy = 10; gbc_numberTable.gridheight = 2; gbc_numberTable.gridwidth = 5; panelVerbatimValues.add(this.getJScrollPaneNumbers(), gbc_numberTable); JLabel lblVerbatimOtherText = new JLabel("Verbatim Other Text"); GridBagConstraints gbc_lblVerbatimOtherText = new GridBagConstraints(); gbc_lblVerbatimOtherText.anchor = GridBagConstraints.EAST; gbc_lblVerbatimOtherText.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimOtherText.gridx = 0; gbc_lblVerbatimOtherText.gridy = 12; panelVerbatimValues.add(lblVerbatimOtherText, gbc_lblVerbatimOtherText); textFieldVerbUnclassifiedText = new JTextArea(); textFieldVerbUnclassifiedText.setEditable(false); textFieldVerbUnclassifiedText.setRows(5); GridBagConstraints gbc_textFieldVerbUnclassifiedText = new GridBagConstraints(); gbc_textFieldVerbUnclassifiedText.gridheight = 3; gbc_textFieldVerbUnclassifiedText.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbUnclassifiedText.fill = GridBagConstraints.BOTH; gbc_textFieldVerbUnclassifiedText.gridx = 1; gbc_textFieldVerbUnclassifiedText.gridy = 12; panelVerbatimValues.add(textFieldVerbUnclassifiedText, gbc_textFieldVerbUnclassifiedText); textFieldVerbUnclassifiedText.setColumns(30); JLabel lblHabitat = new JLabel("Habitat"); GridBagConstraints gbc_lblHabitat = new GridBagConstraints(); gbc_lblHabitat.anchor = GridBagConstraints.EAST; gbc_lblHabitat.insets = new Insets(0, 0, 5, 5); gbc_lblHabitat.gridx = 3; gbc_lblHabitat.gridy = 12; panelVerbatimValues.add(lblHabitat, gbc_lblHabitat); textFieldHabitat = new JTextField(); GridBagConstraints gbc_textFieldHabitat = new GridBagConstraints(); gbc_textFieldHabitat.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldHabitat.gridwidth = 4; gbc_textFieldHabitat.insets = new Insets(0, 0, 5, 5); gbc_textFieldHabitat.gridx = 4; gbc_textFieldHabitat.gridy = 12; panelVerbatimValues.add(textFieldHabitat, gbc_textFieldHabitat); textFieldHabitat.setColumns(10); JLabel lblMicrohabitat = new JLabel("Microhabitat"); GridBagConstraints gbc_lblMicrohabitat = new GridBagConstraints(); gbc_lblMicrohabitat.anchor = GridBagConstraints.EAST; gbc_lblMicrohabitat.insets = new Insets(0, 0, 5, 5); gbc_lblMicrohabitat.gridx = 3; gbc_lblMicrohabitat.gridy = 13; panelVerbatimValues.add(lblMicrohabitat, gbc_lblMicrohabitat); textFieldMicrohabitat = new JTextField(); GridBagConstraints gbc_textFieldMicrohabitat = new GridBagConstraints(); gbc_textFieldMicrohabitat.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldMicrohabitat.gridwidth = 4; gbc_textFieldMicrohabitat.insets = new Insets(0, 0, 5, 5); gbc_textFieldMicrohabitat.gridx = 4; gbc_textFieldMicrohabitat.gridy = 13; panelVerbatimValues.add(textFieldMicrohabitat, gbc_textFieldMicrohabitat); textFieldMicrohabitat.setColumns(10); JLabel lblNewLabel_4 = new JLabel("Workflow Status"); GridBagConstraints gbc_lblNewLabel_4 = new GridBagConstraints(); gbc_lblNewLabel_4.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_4.gridx = 3; gbc_lblNewLabel_4.gridy = 15; panelVerbatimValues.add(lblNewLabel_4, gbc_lblNewLabel_4); comboBoxWorkflowStatus = new JComboBox(WorkFlowStatus.getVerbatimClassifiedWorkFlowStatusValues()); comboBoxWorkflowStatus.setSelectedItem(WorkFlowStatus.STAGE_CLASSIFIED); GridBagConstraints gbc_comboBoxWorkflowStatus = new GridBagConstraints(); gbc_comboBoxWorkflowStatus.gridwidth = 4; gbc_comboBoxWorkflowStatus.fill = GridBagConstraints.HORIZONTAL; gbc_comboBoxWorkflowStatus.insets = new Insets(0, 0, 5, 5); gbc_comboBoxWorkflowStatus.gridx = 4; gbc_comboBoxWorkflowStatus.gridy = 15; panelVerbatimValues.add(comboBoxWorkflowStatus, gbc_comboBoxWorkflowStatus); JButton btnApplyToAll = new JButton("Apply To All Records"); GridBagConstraints gbc_btnApplyToAll = new GridBagConstraints(); gbc_btnApplyToAll.gridwidth = 4; gbc_btnApplyToAll.insets = new Insets(0, 0, 5, 5); gbc_btnApplyToAll.gridx = 4; gbc_btnApplyToAll.gridy = 16; panelVerbatimValues.add(btnApplyToAll, gbc_btnApplyToAll); btnApplyToAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveChanges(); } }); } { JPanel panelRelatedData = new JPanel(); contentPanel.add(panelRelatedData); GridBagLayout gbl_panelRelatedData = new GridBagLayout(); gbl_panelRelatedData.maximumLayoutSize(panelRelatedData); gbl_panelRelatedData.columnWidths = new int[] { 20, 33, 1, 0 }; gbl_panelRelatedData.rowHeights = new int[] { 25, 0 }; gbl_panelRelatedData.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE }; gbl_panelRelatedData.rowWeights = new double[] { 1.0, Double.MIN_VALUE }; panelRelatedData.setLayout(gbl_panelRelatedData); { JLabel lblTaxa = new JLabel("Taxa"); GridBagConstraints gbc_lblTaxa = new GridBagConstraints(); gbc_lblTaxa.anchor = GridBagConstraints.NORTHEAST; gbc_lblTaxa.insets = new Insets(0, 0, 0, 5); gbc_lblTaxa.gridx = 0; gbc_lblTaxa.gridy = 0; panelRelatedData.add(lblTaxa, gbc_lblTaxa); } JScrollPane scrollPane = new JScrollPane(); // scrollPane.setPreferredSize(new Dimension(1000,100)); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.anchor = GridBagConstraints.NORTH; gbc_scrollPane.insets = new Insets(0, 0, 0, 5); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 0; panelRelatedData.add(scrollPane, gbc_scrollPane); tableTaxa = new JTable(); SpecimenLifeCycle sls = new SpecimenLifeCycle(); tableTaxa.setModel(new CountValueTableModel(sls.findTaxaFromVerbatim(this.verbatimData), "Current Idenfifications for these verbatim values.")); scrollPane.setViewportView(tableTaxa); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton cancelButton = new JButton("Close"); cancelButton.setActionCommand("Close"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); buttonPane.add(cancelButton); } } }
From source file:org.archiviststoolkit.plugin.utils.CodeViewerDialog.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(); scrollPane1 = new JScrollPane(); messageTextArea = new JTextArea(); buttonBar = new JPanel(); recordTestPanel = new JPanel(); storeButton = new JButton(); testButton = new JButton(); label1 = new JLabel(); testHostUrlTextField = new JTextField(); deleteButton = new JButton(); okButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle("Code Viewer"); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {//from w w w .j av a2s . co m dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new BorderLayout()); //======== scrollPane1 ======== { //---- messageTextArea ---- messageTextArea.setRows(4); messageTextArea.setEditable(false); scrollPane1.setViewportView(messageTextArea); } contentPanel.add(scrollPane1, BorderLayout.SOUTH); } 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 }; //======== recordTestPanel ======== { recordTestPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- storeButton ---- storeButton.setText("Store"); storeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { storeButtonActionPerformed(); } }); recordTestPanel.add(storeButton, cc.xy(1, 1)); //---- testButton ---- testButton.setText("Test"); testButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testButtonActionPerformed(); } }); recordTestPanel.add(testButton, cc.xy(3, 1)); //---- label1 ---- label1.setText("Url"); recordTestPanel.add(label1, cc.xy(5, 1)); recordTestPanel.add(testHostUrlTextField, cc.xy(7, 1)); //---- deleteButton ---- deleteButton.setText("Delete"); deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteButtonActionPerformed(); } }); recordTestPanel.add(deleteButton, cc.xy(9, 1)); } buttonBar.add(recordTestPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); //---- okButton ---- okButton.setText("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButtonActionPerformed(); } }); buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:edu.harvard.mcz.imagecapture.PositionTemplateEditor.java
/** * This method initializes jPanel /*from w ww.ja v a2 s . co m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints24 = new GridBagConstraints(); gridBagConstraints24.fill = GridBagConstraints.BOTH; gridBagConstraints24.gridy = 10; gridBagConstraints24.weightx = 1.0; gridBagConstraints24.anchor = GridBagConstraints.WEST; gridBagConstraints24.gridx = 1; GridBagConstraints gridBagConstraints113 = new GridBagConstraints(); gridBagConstraints113.gridx = 0; gridBagConstraints113.anchor = GridBagConstraints.EAST; gridBagConstraints113.gridy = 10; jLabel9 = new JLabel(); jLabel9.setText("Taxon Name Barcode"); GridBagConstraints gridBagConstraints23 = new GridBagConstraints(); gridBagConstraints23.fill = GridBagConstraints.BOTH; gridBagConstraints23.gridy = 13; gridBagConstraints23.weightx = 1.0; gridBagConstraints23.anchor = GridBagConstraints.WEST; gridBagConstraints23.gridx = 1; GridBagConstraints gridBagConstraints112 = new GridBagConstraints(); gridBagConstraints112.gridx = 0; gridBagConstraints112.gridy = 13; GridBagConstraints gridBagConstraints22 = new GridBagConstraints(); gridBagConstraints22.fill = GridBagConstraints.BOTH; gridBagConstraints22.gridy = 12; gridBagConstraints22.weightx = 1.0; gridBagConstraints22.anchor = GridBagConstraints.WEST; gridBagConstraints22.gridx = 1; GridBagConstraints gridBagConstraints111 = new GridBagConstraints(); gridBagConstraints111.gridx = 0; gridBagConstraints111.gridy = 12; GridBagConstraints gridBagConstraints110 = new GridBagConstraints(); gridBagConstraints110.gridx = 1; gridBagConstraints110.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints110.gridwidth = 1; gridBagConstraints110.anchor = GridBagConstraints.NORTH; gridBagConstraints110.gridy = 14; jLabelFeedback = new JLabel(); jLabelFeedback.setText(" "); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.fill = GridBagConstraints.BOTH; gridBagConstraints21.gridy = 0; gridBagConstraints21.weightx = 2.0; gridBagConstraints21.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints21.gridx = 1; GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); gridBagConstraints13.gridx = 0; gridBagConstraints13.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints13.gridy = 0; jLabel8 = new JLabel(); jLabel8.setText("ImageFile"); GridBagConstraints gridBagConstraints18 = new GridBagConstraints(); gridBagConstraints18.fill = GridBagConstraints.BOTH; gridBagConstraints18.gridy = 9; gridBagConstraints18.weightx = 1.0; gridBagConstraints18.anchor = GridBagConstraints.WEST; gridBagConstraints18.gridx = 1; GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); gridBagConstraints17.fill = GridBagConstraints.BOTH; gridBagConstraints17.gridy = 8; gridBagConstraints17.weightx = 1.0; gridBagConstraints17.anchor = GridBagConstraints.WEST; gridBagConstraints17.gridx = 1; GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); gridBagConstraints16.fill = GridBagConstraints.BOTH; gridBagConstraints16.gridy = 7; gridBagConstraints16.weightx = 1.0; gridBagConstraints16.anchor = GridBagConstraints.WEST; gridBagConstraints16.gridx = 1; GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); gridBagConstraints15.fill = GridBagConstraints.BOTH; gridBagConstraints15.gridy = 6; gridBagConstraints15.weightx = 1.0; gridBagConstraints15.anchor = GridBagConstraints.WEST; gridBagConstraints15.gridx = 1; GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.fill = GridBagConstraints.BOTH; gridBagConstraints14.gridy = 5; gridBagConstraints14.weightx = 1.0; gridBagConstraints14.anchor = GridBagConstraints.WEST; gridBagConstraints14.gridx = 1; GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.fill = GridBagConstraints.BOTH; gridBagConstraints12.gridy = 3; gridBagConstraints12.weightx = 1.0; gridBagConstraints12.anchor = GridBagConstraints.WEST; gridBagConstraints12.gridx = 1; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.anchor = GridBagConstraints.EAST; gridBagConstraints11.gridy = 9; jLabel7 = new JLabel(); jLabel7.setText("Specimen"); jLabel7.setForeground(Color.ORANGE); GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); gridBagConstraints10.gridx = 0; gridBagConstraints10.anchor = GridBagConstraints.EAST; gridBagConstraints10.gridy = 8; jLabel6 = new JLabel(); jLabel6.setText("Tray Labels"); jLabel6.setForeground(Color.CYAN); GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 0; gridBagConstraints9.anchor = GridBagConstraints.EAST; gridBagConstraints9.gridy = 7; jLabel5 = new JLabel(); jLabel5.setText("Pin Labels"); jLabel5.setForeground(Color.MAGENTA); GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.gridx = 0; gridBagConstraints8.anchor = GridBagConstraints.EAST; gridBagConstraints8.insets = new Insets(0, 3, 0, 0); gridBagConstraints8.gridy = 6; jLabel4 = new JLabel(); jLabel4.setText("Taxon Name Label"); jLabel4.setForeground(Color.BLUE); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.gridx = 0; gridBagConstraints7.anchor = GridBagConstraints.EAST; gridBagConstraints7.gridy = 5; jLabel3 = new JLabel(); jLabel3.setText("Barcode"); jLabel3.setForeground(Color.RED); GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.gridx = 0; gridBagConstraints6.anchor = GridBagConstraints.EAST; gridBagConstraints6.gridy = 3; jLabel2 = new JLabel(); jLabel2.setText("Image Size"); GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.fill = GridBagConstraints.BOTH; gridBagConstraints5.gridy = 2; gridBagConstraints5.weightx = 1.0; gridBagConstraints5.anchor = GridBagConstraints.WEST; gridBagConstraints5.gridx = 1; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.fill = GridBagConstraints.BOTH; gridBagConstraints4.gridy = 1; gridBagConstraints4.weightx = 1.0; gridBagConstraints4.anchor = GridBagConstraints.WEST; gridBagConstraints4.gridx = 1; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.anchor = GridBagConstraints.EAST; gridBagConstraints2.gridy = 2; jLabel1 = new JLabel(); jLabel1.setText("Name"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.anchor = GridBagConstraints.EAST; gridBagConstraints1.gridy = 1; jLabel = new JLabel(); jLabel.setText("Template ID"); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 11; jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(getJButtonSave(), gridBagConstraints); jPanel.add(jLabel, gridBagConstraints1); jPanel.add(jLabel1, gridBagConstraints2); jPanel.add(getJTextFieldTemplateId(), gridBagConstraints4); jPanel.add(getJTextFieldName(), gridBagConstraints5); jPanel.add(jLabel2, gridBagConstraints6); jPanel.add(jLabel3, gridBagConstraints7); jPanel.add(jLabel4, gridBagConstraints8); jPanel.add(jLabel5, gridBagConstraints9); jPanel.add(jLabel6, gridBagConstraints10); jPanel.add(jLabel7, gridBagConstraints11); jPanel.add(getJTextField2(), gridBagConstraints12); jPanel.add(getJTextField3(), gridBagConstraints14); jPanel.add(getJTextField4(), gridBagConstraints15); jPanel.add(getJTextField5(), gridBagConstraints16); jPanel.add(getJTextField6(), gridBagConstraints17); jPanel.add(getJTextField7(), gridBagConstraints18); jPanel.add(jLabel8, gridBagConstraints13); jPanel.add(getJTextField8(), gridBagConstraints21); jPanel.add(jLabelFeedback, gridBagConstraints110); jPanel.add(getJButton(), gridBagConstraints111); jPanel.add(getJTextFieldBarcodeScan(), gridBagConstraints22); jPanel.add(getJButton1(), gridBagConstraints112); jPanel.add(getJTextField(), gridBagConstraints23); jPanel.add(jLabel9, gridBagConstraints113); jPanel.add(getJTextField9(), gridBagConstraints24); } return jPanel; }