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:edu.harvard.mcz.imagecapture.PositionTemplateEditor.java
/** * This method initializes jPanel2 /*from w ww .j a v a 2 s . com*/ * * @return javax.swing.JPanel */ private JPanel getJPanel2() { if (jPanel2 == null) { GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.anchor = GridBagConstraints.NORTH; gridBagConstraints3.weightx = 1.0; jPanel2 = new JPanel(); jPanel2.setLayout(new GridBagLayout()); jPanel2.add(getJScrollPane(), gridBagConstraints3); } return jPanel2; }
From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java
/** * This method initializes jPanel, laying out the UI components. * // www .ja v a 2s. c om * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraintsImgCount = new GridBagConstraints(); gridBagConstraintsImgCount.fill = GridBagConstraints.BOTH; gridBagConstraintsImgCount.gridy = 6; gridBagConstraintsImgCount.weightx = 1.0; gridBagConstraintsImgCount.anchor = GridBagConstraints.WEST; gridBagConstraintsImgCount.gridwidth = 4; gridBagConstraintsImgCount.insets = new Insets(0, 3, 5, 0); gridBagConstraintsImgCount.ipadx = 3; gridBagConstraintsImgCount.gridx = 4; GridBagConstraints gridBagConstraints124 = new GridBagConstraints(); gridBagConstraints124.insets = new Insets(0, 0, 0, 5); gridBagConstraints124.gridx = 0; gridBagConstraints124.anchor = GridBagConstraints.EAST; gridBagConstraints124.gridy = 20; GridBagConstraints gridBagConstraints38 = new GridBagConstraints(); gridBagConstraints38.insets = new Insets(0, 0, 0, 5); gridBagConstraints38.gridx = 0; gridBagConstraints38.anchor = GridBagConstraints.EAST; gridBagConstraints38.gridy = 27; GridBagConstraints gridBagConstraints215 = new GridBagConstraints(); gridBagConstraints215.insets = new Insets(0, 0, 0, 5); gridBagConstraints215.gridx = 0; gridBagConstraints215.anchor = GridBagConstraints.EAST; gridBagConstraints215.gridy = 26; GridBagConstraints gridBagConstraints120 = new GridBagConstraints(); gridBagConstraints120.insets = new Insets(0, 0, 0, 5); gridBagConstraints120.gridx = 3; gridBagConstraints120.weightx = 1.0; gridBagConstraints120.gridy = 25; jLabel44 = new JLabel(); jLabel44.setText("yyyy/mm/dd"); GridBagConstraints gridBagConstraints49 = new GridBagConstraints(); gridBagConstraints49.insets = new Insets(0, 0, 0, 0); gridBagConstraints49.fill = GridBagConstraints.BOTH; gridBagConstraints49.weighty = 1.0; gridBagConstraints49.weightx = 1.0; gridBagConstraints49.gridx = 1; gridBagConstraints49.gridwidth = 7; gridBagConstraints49.gridy = 35; GridBagConstraints gridBagConstraints214 = new GridBagConstraints(); gridBagConstraints214.gridwidth = 3; gridBagConstraints214.insets = new Insets(0, 0, 0, 5); gridBagConstraints214.anchor = GridBagConstraints.EAST; gridBagConstraints214.gridx = 4; gridBagConstraints214.gridy = 42; gridBagConstraints214.weightx = 0.0; gridBagConstraints214.weighty = 0.0; gridBagConstraints214.fill = GridBagConstraints.NONE; GridBagConstraints gridBagConstraints119 = new GridBagConstraints(); gridBagConstraints119.insets = new Insets(0, 0, 0, 0); gridBagConstraints119.anchor = GridBagConstraints.WEST; gridBagConstraints119.gridx = 7; gridBagConstraints119.gridy = 42; gridBagConstraints119.weightx = 0.0; gridBagConstraints119.weighty = 0.0; gridBagConstraints119.fill = GridBagConstraints.NONE; GridBagConstraints gridBagConstraints213 = new GridBagConstraints(); gridBagConstraints213.insets = new Insets(0, 0, 0, 0); gridBagConstraints213.fill = GridBagConstraints.BOTH; gridBagConstraints213.gridy = 31; gridBagConstraints213.weightx = 0.0; gridBagConstraints213.gridwidth = 7; gridBagConstraints213.anchor = GridBagConstraints.WEST; gridBagConstraints213.gridx = 1; GridBagConstraints gridBagConstraints118 = new GridBagConstraints(); gridBagConstraints118.insets = new Insets(0, 0, 0, 5); gridBagConstraints118.gridx = 0; gridBagConstraints118.anchor = GridBagConstraints.EAST; gridBagConstraints118.gridwidth = 1; gridBagConstraints118.gridy = 31; jLabel31 = new JLabel(); jLabel31.setText("Publications"); GridBagConstraints gridBagConstraints212 = new GridBagConstraints(); gridBagConstraints212.insets = new Insets(0, 0, 0, 5); gridBagConstraints212.gridx = 3; gridBagConstraints212.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints212.gridwidth = 4; gridBagConstraints212.gridy = 15; GridBagConstraints gridBagConstraints117 = new GridBagConstraints(); gridBagConstraints117.insets = new Insets(0, 0, 0, 0); gridBagConstraints117.fill = GridBagConstraints.BOTH; gridBagConstraints117.gridy = 25; gridBagConstraints117.weightx = 0.0; gridBagConstraints117.gridwidth = 4; gridBagConstraints117.anchor = GridBagConstraints.WEST; gridBagConstraints117.gridx = 4; GridBagConstraints gridBagConstraints211 = new GridBagConstraints(); gridBagConstraints211.insets = new Insets(0, 0, 0, 5); gridBagConstraints211.gridx = 3; gridBagConstraints211.gridwidth = 4; gridBagConstraints211.weighty = 1.0; gridBagConstraints211.gridy = 44; GridBagConstraints gridBagConstraintsMS = new GridBagConstraints(); gridBagConstraintsMS.fill = GridBagConstraints.BOTH; gridBagConstraintsMS.gridx = 0; gridBagConstraintsMS.gridwidth = 8; gridBagConstraintsMS.weighty = 1.0; gridBagConstraintsMS.gridy = 45; gridBagConstraintsMS.gridx = 0; GridBagConstraints gridBagConstraints116 = new GridBagConstraints(); gridBagConstraints116.gridwidth = 3; gridBagConstraints116.insets = new Insets(0, 0, 0, 5); gridBagConstraints116.gridx = 4; gridBagConstraints116.anchor = GridBagConstraints.EAST; gridBagConstraints116.gridy = 41; GridBagConstraints gridBagConstraintsInfer = new GridBagConstraints(); gridBagConstraintsInfer.insets = new Insets(0, 0, 0, 0); gridBagConstraintsInfer.fill = GridBagConstraints.BOTH; gridBagConstraintsInfer.gridy = 36; gridBagConstraintsInfer.weightx = 1.0; gridBagConstraintsInfer.anchor = GridBagConstraints.WEST; gridBagConstraintsInfer.gridwidth = 7; gridBagConstraintsInfer.gridx = 1; GridBagConstraints gridBagConstraints56 = new GridBagConstraints(); gridBagConstraints56.insets = new Insets(0, 0, 0, 5); gridBagConstraints56.gridx = 0; gridBagConstraints56.anchor = GridBagConstraints.EAST; gridBagConstraints56.gridy = 36; jLabel43 = new JLabel(); jLabel43.setText("Inferences"); GridBagConstraints gridBagConstraints48 = new GridBagConstraints(); gridBagConstraints48.insets = new Insets(0, 0, 0, 0); gridBagConstraints48.fill = GridBagConstraints.VERTICAL; gridBagConstraints48.gridy = 0; gridBagConstraints48.weightx = 1.0; gridBagConstraints48.anchor = GridBagConstraints.WEST; gridBagConstraints48.gridwidth = 4; gridBagConstraints48.gridx = 4; GridBagConstraints gridBagConstraints37 = new GridBagConstraints(); gridBagConstraints37.insets = new Insets(0, 0, 0, 5); gridBagConstraints37.fill = GridBagConstraints.VERTICAL; gridBagConstraints37.gridx = 3; gridBagConstraints37.anchor = GridBagConstraints.EAST; gridBagConstraints37.gridy = 0; jLabel42 = new JLabel(); jLabel42.setText("Collection"); GridBagConstraints gridBagConstraints29 = new GridBagConstraints(); gridBagConstraints29.insets = new Insets(0, 0, 0, 5); gridBagConstraints29.fill = GridBagConstraints.BOTH; gridBagConstraints29.gridy = 41; gridBagConstraints29.weightx = 1.0; gridBagConstraints29.anchor = GridBagConstraints.WEST; gridBagConstraints29.gridwidth = 3; gridBagConstraints29.gridx = 1; GridBagConstraints gridBagConstraints115 = new GridBagConstraints(); gridBagConstraints115.insets = new Insets(0, 0, 0, 5); gridBagConstraints115.gridx = 0; gridBagConstraints115.gridy = 41; jLabel41 = new JLabel(); jLabel41.setText("Workflow Status"); GridBagConstraints gridBagConstraints172 = new GridBagConstraints(); gridBagConstraints172.insets = new Insets(0, 0, 0, 0); gridBagConstraints172.fill = GridBagConstraints.BOTH; gridBagConstraints172.gridy = 33; gridBagConstraints172.weightx = 1.0; gridBagConstraints172.anchor = GridBagConstraints.WEST; gridBagConstraints172.gridwidth = 4; gridBagConstraints172.gridx = 4; GridBagConstraints gridBagConstraints162 = new GridBagConstraints(); gridBagConstraints162.insets = new Insets(0, 0, 0, 5); gridBagConstraints162.fill = GridBagConstraints.BOTH; gridBagConstraints162.gridy = 33; gridBagConstraints162.weightx = 1.0; gridBagConstraints162.anchor = GridBagConstraints.WEST; gridBagConstraints162.gridwidth = 2; gridBagConstraints162.gridx = 1; GridBagConstraints gridBagConstraints142 = new GridBagConstraints(); gridBagConstraints142.insets = new Insets(0, 0, 0, 5); gridBagConstraints142.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints142.gridy = 42; gridBagConstraints142.weightx = 1.0; gridBagConstraints142.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints142.gridwidth = 3; gridBagConstraints142.ipady = 2; gridBagConstraints142.gridx = 1; GridBagConstraints gridBagConstraints133 = new GridBagConstraints(); gridBagConstraints133.insets = new Insets(0, 0, 0, 5); gridBagConstraints133.gridx = 0; gridBagConstraints133.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints133.gridy = 42; jLabel40 = new JLabel(); jLabel40.setText("Questions"); GridBagConstraints gridBagConstraints123 = new GridBagConstraints(); gridBagConstraints123.insets = new Insets(0, 0, 0, 5); gridBagConstraints123.gridx = 3; gridBagConstraints123.anchor = GridBagConstraints.EAST; gridBagConstraints123.gridy = 33; jLabel39 = new JLabel(); jLabel39.setText("Habitat"); GridBagConstraints gridBagConstraints114 = new GridBagConstraints(); gridBagConstraints114.insets = new Insets(0, 0, 0, 5); gridBagConstraints114.gridx = 0; gridBagConstraints114.anchor = GridBagConstraints.EAST; gridBagConstraints114.gridy = 33; jLabel38 = new JLabel(); jLabel38.setText("Associated Taxon"); GridBagConstraints gridBagConstraints94 = new GridBagConstraints(); gridBagConstraints94.gridwidth = 3; gridBagConstraints94.insets = new Insets(0, 0, 0, 5); gridBagConstraints94.gridx = 4; gridBagConstraints94.anchor = GridBagConstraints.WEST; gridBagConstraints94.gridy = 18; jLabel36 = new JLabel(); jLabel36.setText("Valid Dist."); GridBagConstraints gridBagConstraints83 = new GridBagConstraints(); gridBagConstraints83.gridx = 3; gridBagConstraints83.anchor = GridBagConstraints.EAST; gridBagConstraints83.insets = new Insets(0, 0, 0, 5); gridBagConstraints83.weightx = 1.0; gridBagConstraints83.gridy = 18; GridBagConstraints gridBagConstraints65 = new GridBagConstraints(); gridBagConstraints65.insets = new Insets(0, 0, 0, 5); gridBagConstraints65.gridx = 0; gridBagConstraints65.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints65.gridy = 35; jLabel35 = new JLabel(); jLabel35.setText("Specimen Notes"); GridBagConstraints gridBagConstraints47 = new GridBagConstraints(); gridBagConstraints47.insets = new Insets(0, 0, 0, 5); gridBagConstraints47.gridx = 0; gridBagConstraints47.fill = GridBagConstraints.VERTICAL; gridBagConstraints47.ipady = 12; gridBagConstraints47.gridy = 5; jLabel34 = new JLabel(); jLabel34.setText(" "); GridBagConstraints gridBagConstraints19 = new GridBagConstraints(); gridBagConstraints19.insets = new Insets(0, 0, 0, 0); gridBagConstraints19.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints19.gridy = 23; gridBagConstraints19.weightx = 1.0; gridBagConstraints19.anchor = GridBagConstraints.NORTH; gridBagConstraints19.gridwidth = 5; gridBagConstraints19.gridx = 3; GridBagConstraints gridBagConstraints18 = new GridBagConstraints(); gridBagConstraints18.insets = new Insets(0, 0, 0, 5); gridBagConstraints18.fill = GridBagConstraints.BOTH; gridBagConstraints18.gridy = 19; gridBagConstraints18.weightx = 1.0; gridBagConstraints18.anchor = GridBagConstraints.WEST; gridBagConstraints18.gridx = 4; GridBagConstraints gbc_jLabelElevation = new GridBagConstraints(); gbc_jLabelElevation.insets = new Insets(0, 0, 0, 5); gbc_jLabelElevation.gridx = 3; gbc_jLabelElevation.anchor = GridBagConstraints.EAST; gbc_jLabelElevation.gridy = 19; jLabelElevation = new JLabel(); jLabelElevation.setText("Elevation"); jLabel25 = new JLabel(); jLabel25.setText("Text"); jLabel26 = new JLabel(); jLabel26.setText("Text"); jLabel28 = new JLabel(); jLabel28.setText("Rank"); GridBagConstraints gridBagConstraints161 = new GridBagConstraints(); gridBagConstraints161.gridx = 0; GridBagConstraints gridBagConstraints151 = new GridBagConstraints(); gridBagConstraints151.insets = new Insets(0, 0, 0, 5); gridBagConstraints151.fill = GridBagConstraints.BOTH; gridBagConstraints151.gridy = 27; gridBagConstraints151.weightx = 1.0; gridBagConstraints151.gridx = 1; GridBagConstraints gridBagConstraints141 = new GridBagConstraints(); gridBagConstraints141.insets = new Insets(0, 0, 0, 5); gridBagConstraints141.fill = GridBagConstraints.BOTH; gridBagConstraints141.gridy = 26; gridBagConstraints141.weightx = 1.0; gridBagConstraints141.gridx = 1; GridBagConstraints gridBagConstraints132 = new GridBagConstraints(); gridBagConstraints132.gridwidth = 3; gridBagConstraints132.insets = new Insets(0, 0, 0, 5); gridBagConstraints132.fill = GridBagConstraints.BOTH; gridBagConstraints132.gridy = 27; gridBagConstraints132.weightx = 1.0; gridBagConstraints132.gridx = 4; GridBagConstraints gridBagConstraints122 = new GridBagConstraints(); gridBagConstraints122.gridwidth = 3; gridBagConstraints122.insets = new Insets(0, 0, 0, 5); gridBagConstraints122.fill = GridBagConstraints.BOTH; gridBagConstraints122.gridy = 26; gridBagConstraints122.weightx = 1.0; gridBagConstraints122.gridx = 4; GridBagConstraints gridBagConstraints113 = new GridBagConstraints(); gridBagConstraints113.insets = new Insets(0, 0, 0, 5); gridBagConstraints113.gridx = 3; gridBagConstraints113.anchor = GridBagConstraints.EAST; gridBagConstraints113.gridy = 27; GridBagConstraints gridBagConstraints103 = new GridBagConstraints(); gridBagConstraints103.insets = new Insets(0, 0, 0, 5); gridBagConstraints103.gridx = 3; gridBagConstraints103.anchor = GridBagConstraints.EAST; gridBagConstraints103.gridy = 26; GridBagConstraints gridBagConstraints93 = new GridBagConstraints(); gridBagConstraints93.insets = new Insets(0, 0, 0, 5); gridBagConstraints93.fill = GridBagConstraints.BOTH; gridBagConstraints93.gridy = 12; gridBagConstraints93.weightx = 1.0; gridBagConstraints93.gridx = 1; GridBagConstraints gridBagConstraints84 = new GridBagConstraints(); gridBagConstraints84.gridwidth = 3; gridBagConstraints84.fill = GridBagConstraints.BOTH; gridBagConstraints84.gridy = 12; gridBagConstraints84.weightx = 1.0; gridBagConstraints84.anchor = GridBagConstraints.WEST; gridBagConstraints84.insets = new Insets(0, 0, 0, 5); gridBagConstraints84.gridx = 4; GridBagConstraints gridBagConstraints74 = new GridBagConstraints(); gridBagConstraints74.insets = new Insets(0, 0, 0, 5); gridBagConstraints74.gridx = 3; gridBagConstraints74.anchor = GridBagConstraints.EAST; gridBagConstraints74.weightx = 0.0; gridBagConstraints74.gridy = 12; // GridBagConstraints gridBagConstraints64 = new GridBagConstraints(); // gridBagConstraints64.fill = GridBagConstraints.BOTH; // gridBagConstraints64.gridy = 14; // gridBagConstraints64.weightx = 1.0; // gridBagConstraints64.gridx = 3; GridBagConstraints gridBagConstraints55 = new GridBagConstraints(); gridBagConstraints55.gridx = 2; gridBagConstraints55.gridy = 14; //jLabel31 = new JLabel(); //jLabel31.setText("Qual."); GridBagConstraints gridBagConstraints46 = new GridBagConstraints(); gridBagConstraints46.insets = new Insets(0, 0, 0, 5); gridBagConstraints46.fill = GridBagConstraints.BOTH; gridBagConstraints46.gridy = 14; gridBagConstraints46.weightx = 1.0; gridBagConstraints46.anchor = GridBagConstraints.WEST; gridBagConstraints46.gridx = 1; gridBagConstraints46.gridwidth = 2; GridBagConstraints gridBagConstraints36 = new GridBagConstraints(); gridBagConstraints36.insets = new Insets(0, 0, 0, 5); gridBagConstraints36.gridx = 0; gridBagConstraints36.anchor = GridBagConstraints.EAST; gridBagConstraints36.gridy = 14; jLabel30 = new JLabel(); jLabel30.setText("Unnamed Form"); GridBagConstraints gridBagConstraints210 = new GridBagConstraints(); gridBagConstraints210.insets = new Insets(0, 0, 0, 5); gridBagConstraints210.fill = GridBagConstraints.BOTH; gridBagConstraints210.gridy = 13; gridBagConstraints210.weightx = 1.0; gridBagConstraints210.anchor = GridBagConstraints.WEST; gridBagConstraints210.gridwidth = 2; gridBagConstraints210.gridx = 1; GridBagConstraints gridBagConstraints112 = new GridBagConstraints(); gridBagConstraints112.insets = new Insets(0, 0, 0, 5); gridBagConstraints112.gridx = 0; gridBagConstraints112.anchor = GridBagConstraints.EAST; gridBagConstraints112.gridy = 13; jLabel29 = new JLabel(); jLabel29.setText("Author"); GridBagConstraints gridBagConstraints110 = new GridBagConstraints(); gridBagConstraints110.insets = new Insets(0, 0, 0, 5); gridBagConstraints110.gridx = 0; gridBagConstraints110.gridy = 12; jLabel27 = new JLabel(); jLabel27.setText("Infrasubspecifc Name"); GridBagConstraints gridBagConstraints63 = new GridBagConstraints(); gridBagConstraints63.insets = new Insets(0, 0, 0, 5); gridBagConstraints63.fill = GridBagConstraints.BOTH; gridBagConstraints63.gridy = 25; gridBagConstraints63.weightx = 1.0; gridBagConstraints63.anchor = GridBagConstraints.WEST; gridBagConstraints63.gridx = 1; GridBagConstraints gridBagConstraints35 = new GridBagConstraints(); gridBagConstraints35.insets = new Insets(0, 0, 0, 5); gridBagConstraints35.gridx = 0; gridBagConstraints35.anchor = GridBagConstraints.EAST; gridBagConstraints35.gridy = 25; jLabel22 = new JLabel(); jLabel22.setText("Verbatim Date"); GridBagConstraints gridBagConstraints27 = new GridBagConstraints(); gridBagConstraints27.insets = new Insets(0, 0, 0, 5); gridBagConstraints27.fill = GridBagConstraints.BOTH; gridBagConstraints27.gridy = 30; gridBagConstraints27.weightx = 1.0; gridBagConstraints27.anchor = GridBagConstraints.WEST; gridBagConstraints27.gridx = 1; GridBagConstraints gridBagConstraints102 = new GridBagConstraints(); gridBagConstraints102.insets = new Insets(0, 0, 0, 0); gridBagConstraints102.fill = GridBagConstraints.VERTICAL; gridBagConstraints102.gridy = 30; gridBagConstraints102.weightx = 1.0; gridBagConstraints102.anchor = GridBagConstraints.WEST; gridBagConstraints102.gridwidth = 4; gridBagConstraints102.gridx = 4; GridBagConstraints gridBagConstraints92 = new GridBagConstraints(); gridBagConstraints92.insets = new Insets(0, 0, 0, 5); gridBagConstraints92.gridx = 3; gridBagConstraints92.anchor = GridBagConstraints.EAST; gridBagConstraints92.gridy = 30; jLabel21 = new JLabel(); jLabel21.setText("Sex"); GridBagConstraints gridBagConstraints82 = new GridBagConstraints(); gridBagConstraints82.insets = new Insets(0, 0, 0, 5); gridBagConstraints82.gridx = 0; gridBagConstraints82.anchor = GridBagConstraints.EAST; gridBagConstraints82.gridy = 30; jLabel20 = new JLabel(); jLabel20.setText("LifeStage"); GridBagConstraints gridBagConstraints62 = new GridBagConstraints(); gridBagConstraints62.insets = new Insets(0, 0, 0, 0); gridBagConstraints62.fill = GridBagConstraints.BOTH; gridBagConstraints62.gridy = 7; gridBagConstraints62.weightx = 1.0; gridBagConstraints62.anchor = GridBagConstraints.WEST; gridBagConstraints62.gridwidth = 4; gridBagConstraints62.gridx = 4; GridBagConstraints gridBagConstraints53 = new GridBagConstraints(); gridBagConstraints53.insets = new Insets(0, 0, 0, 5); gridBagConstraints53.fill = GridBagConstraints.BOTH; gridBagConstraints53.gridy = 7; gridBagConstraints53.weightx = 1.0; gridBagConstraints53.anchor = GridBagConstraints.WEST; gridBagConstraints53.gridwidth = 1; gridBagConstraints53.gridx = 1; GridBagConstraints gridBagConstraints44 = new GridBagConstraints(); gridBagConstraints44.insets = new Insets(0, 0, 0, 5); gridBagConstraints44.fill = GridBagConstraints.BOTH; gridBagConstraints44.gridy = 6; gridBagConstraints44.weightx = 1.0; gridBagConstraints44.anchor = GridBagConstraints.WEST; gridBagConstraints44.gridwidth = 3; gridBagConstraints44.gridx = 1; GridBagConstraints gbc_jLabelTribe = new GridBagConstraints(); gbc_jLabelTribe.insets = new Insets(0, 0, 0, 5); gbc_jLabelTribe.gridx = 3; gbc_jLabelTribe.anchor = GridBagConstraints.EAST; gbc_jLabelTribe.gridy = 7; jLabelTribe = new JLabel(); jLabelTribe.setText("Tribe"); GridBagConstraints gridBagConstraints26 = new GridBagConstraints(); gridBagConstraints26.insets = new Insets(0, 0, 0, 5); gridBagConstraints26.gridx = 0; gridBagConstraints26.anchor = GridBagConstraints.EAST; gridBagConstraints26.gridy = 7; jLabel17 = new JLabel(); jLabel17.setText("Subfamily"); GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); gridBagConstraints16.insets = new Insets(0, 0, 0, 5); gridBagConstraints16.gridx = 0; gridBagConstraints16.anchor = GridBagConstraints.EAST; gridBagConstraints16.gridy = 6; jLabel16 = new JLabel(); jLabel16.setText("Family"); GridBagConstraints gridBagConstraints131 = new GridBagConstraints(); gridBagConstraints131.insets = new Insets(0, 0, 0, 5); gridBagConstraints131.fill = GridBagConstraints.BOTH; gridBagConstraints131.gridy = 19; gridBagConstraints131.weightx = 1.0; gridBagConstraints131.anchor = GridBagConstraints.WEST; gridBagConstraints131.gridwidth = 2; gridBagConstraints131.gridx = 1; GridBagConstraints gridBagConstraints121 = new GridBagConstraints(); gridBagConstraints121.insets = new Insets(0, 0, 0, 5); gridBagConstraints121.fill = GridBagConstraints.BOTH; gridBagConstraints121.gridy = 18; gridBagConstraints121.weightx = 1.0; gridBagConstraints121.anchor = GridBagConstraints.WEST; gridBagConstraints121.gridwidth = 1; gridBagConstraints121.gridx = 1; GridBagConstraints gridBagConstraints111 = new GridBagConstraints(); gridBagConstraints111.insets = new Insets(0, 0, 0, 0); gridBagConstraints111.fill = GridBagConstraints.BOTH; gridBagConstraints111.gridy = 16; gridBagConstraints111.weightx = 1.0; gridBagConstraints111.anchor = GridBagConstraints.WEST; gridBagConstraints111.gridwidth = 7; gridBagConstraints111.gridx = 1; GridBagConstraints gridBagConstraints101 = new GridBagConstraints(); gridBagConstraints101.insets = new Insets(0, 0, 0, 5); gridBagConstraints101.gridx = 0; gridBagConstraints101.anchor = GridBagConstraints.EAST; gridBagConstraints101.gridy = 19; jLabel15 = new JLabel(); jLabel15.setText("State/Province"); GridBagConstraints gridBagConstraints91 = new GridBagConstraints(); gridBagConstraints91.insets = new Insets(0, 0, 0, 5); gridBagConstraints91.gridx = 0; gridBagConstraints91.anchor = GridBagConstraints.EAST; gridBagConstraints91.gridy = 18; jLabel14 = new JLabel(); jLabel14.setText("Country"); GridBagConstraints gridBagConstraints81 = new GridBagConstraints(); gridBagConstraints81.insets = new Insets(0, 0, 0, 5); gridBagConstraints81.gridx = 0; gridBagConstraints81.anchor = GridBagConstraints.EAST; gridBagConstraints81.gridy = 16; jLabel13 = new JLabel(); jLabel13.setText("Verbatim Locality"); GridBagConstraints gridBagConstraints71 = new GridBagConstraints(); gridBagConstraints71.insets = new Insets(0, 0, 0, 5); gridBagConstraints71.fill = GridBagConstraints.BOTH; gridBagConstraints71.gridy = 15; gridBagConstraints71.weightx = 1.0; gridBagConstraints71.anchor = GridBagConstraints.WEST; gridBagConstraints71.gridx = 1; GridBagConstraints gridBagConstraints61 = new GridBagConstraints(); gridBagConstraints61.insets = new Insets(0, 0, 0, 5); gridBagConstraints61.gridx = 0; gridBagConstraints61.anchor = GridBagConstraints.EAST; gridBagConstraints61.gridy = 15; jLabel12 = new JLabel(); jLabel12.setText("DrawerNumber"); GridBagConstraints gridBagConstraints52 = new GridBagConstraints(); gridBagConstraints52.insets = new Insets(0, 0, 0, 0); gridBagConstraints52.fill = GridBagConstraints.BOTH; gridBagConstraints52.gridy = 43; gridBagConstraints52.weightx = 1.0; gridBagConstraints52.weighty = 1.0; gridBagConstraints52.gridwidth = 8; gridBagConstraints52.gridx = 0; GridBagConstraints gridBagConstraints43 = new GridBagConstraints(); gridBagConstraints43.gridheight = 2; gridBagConstraints43.gridx = 0; gridBagConstraints43.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints43.ipady = 0; gridBagConstraints43.insets = new Insets(0, 0, 0, 5); gridBagConstraints43.gridy = 23; GridBagConstraints gridBagConstraints33 = new GridBagConstraints(); gridBagConstraints33.insets = new Insets(0, 0, 0, 5); gridBagConstraints33.gridx = 0; gridBagConstraints33.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints33.gridy = 4; GridBagConstraints gridBagConstraints25 = new GridBagConstraints(); gridBagConstraints25.insets = new Insets(0, 0, 0, 5); gridBagConstraints25.fill = GridBagConstraints.BOTH; gridBagConstraints25.gridy = 3; gridBagConstraints25.weightx = 1.0; gridBagConstraints25.weighty = 0.0; gridBagConstraints25.gridheight = 3; gridBagConstraints25.gridwidth = 6; gridBagConstraints25.gridx = 1; GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); gridBagConstraints15.insets = new Insets(0, 0, 0, 5); gridBagConstraints15.gridx = 0; gridBagConstraints15.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints15.gridy = 3; jLabel11 = new JLabel(); jLabel11.setText("Numbers"); GridBagConstraints gridBagConstraints42 = new GridBagConstraints(); gridBagConstraints42.insets = new Insets(0, 0, 0, 5); gridBagConstraints42.gridx = 3; gridBagConstraints42.anchor = GridBagConstraints.EAST; gridBagConstraints42.gridy = 37; jLabel10 = new JLabel(); jLabel10.setText("Date Created"); GridBagConstraints gridBagConstraints32 = new GridBagConstraints(); gridBagConstraints32.insets = new Insets(0, 0, 0, 0); gridBagConstraints32.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints32.gridy = 37; gridBagConstraints32.weightx = 1.0; gridBagConstraints32.anchor = GridBagConstraints.WEST; gridBagConstraints32.gridwidth = 4; gridBagConstraints32.gridx = 4; GridBagConstraints gridBagConstraints24 = new GridBagConstraints(); gridBagConstraints24.insets = new Insets(0, 0, 0, 5); gridBagConstraints24.gridx = 0; gridBagConstraints24.anchor = GridBagConstraints.EAST; gridBagConstraints24.gridy = 37; jLabel9 = new JLabel(); jLabel9.setText("CreatedBy"); GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.insets = new Insets(0, 0, 0, 5); gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints14.gridy = 37; gridBagConstraints14.weightx = 1.0; gridBagConstraints14.anchor = GridBagConstraints.WEST; gridBagConstraints14.gridx = 1; GridBagConstraints gridBagConstraints23 = new GridBagConstraints(); gridBagConstraints23.insets = new Insets(0, 0, 0, 0); gridBagConstraints23.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints23.gridy = 39; gridBagConstraints23.weightx = 1.0; gridBagConstraints23.anchor = GridBagConstraints.WEST; gridBagConstraints23.gridwidth = 4; gridBagConstraints23.gridx = 4; GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); gridBagConstraints13.insets = new Insets(0, 0, 0, 5); gridBagConstraints13.gridx = 3; gridBagConstraints13.anchor = GridBagConstraints.EAST; gridBagConstraints13.gridy = 39; jLabel8 = new JLabel(); jLabel8.setText("Last Updated"); GridBagConstraints gridBagConstraints22 = new GridBagConstraints(); gridBagConstraints22.insets = new Insets(0, 0, 0, 5); gridBagConstraints22.gridx = 0; gridBagConstraints22.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints22.gridy = 22; jLabel7 = new JLabel(); jLabel7.setText("Collectors"); GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.insets = new Insets(0, 0, 0, 5); gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints12.gridy = 39; gridBagConstraints12.weightx = 1.0; gridBagConstraints12.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints12.gridx = 1; GridBagConstraints gridBagConstraints51 = new GridBagConstraints(); gridBagConstraints51.insets = new Insets(0, 0, 0, 5); gridBagConstraints51.fill = GridBagConstraints.BOTH; gridBagConstraints51.gridy = 22; gridBagConstraints51.weightx = 1.0; gridBagConstraints51.anchor = GridBagConstraints.WEST; gridBagConstraints51.gridheight = 3; gridBagConstraints51.gridwidth = 2; gridBagConstraints51.gridx = 1; GridBagConstraints gridBagConstraints41 = new GridBagConstraints(); gridBagConstraints41.insets = new Insets(0, 0, 0, 5); gridBagConstraints41.gridx = 0; gridBagConstraints41.fill = GridBagConstraints.NONE; gridBagConstraints41.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints41.gridy = 39; jLabel6 = new JLabel(); jLabel6.setText("LastUpdatedBy"); GridBagConstraints gridBagConstraints31 = new GridBagConstraints(); gridBagConstraints31.insets = new Insets(0, 0, 0, 5); gridBagConstraints31.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints31.gridy = 21; gridBagConstraints31.weightx = 1.0; gridBagConstraints31.anchor = GridBagConstraints.WEST; gridBagConstraints31.gridwidth = 6; gridBagConstraints31.gridx = 1; GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.insets = new Insets(0, 0, 0, 5); gridBagConstraints21.gridx = 0; gridBagConstraints21.anchor = GridBagConstraints.SOUTHEAST; gridBagConstraints21.gridy = 21; jLabel5 = new JLabel(); jLabel5.setText("Collection"); GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); gridBagConstraints10.insets = new Insets(0, 0, 0, 0); gridBagConstraints10.gridx = 7; gridBagConstraints10.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints10.gridy = 41; gridBagConstraints10.weighty = 0.0; GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.insets = new Insets(0, 0, 0, 5); gridBagConstraints9.gridx = 0; gridBagConstraints9.anchor = GridBagConstraints.EAST; gridBagConstraints9.gridy = 11; jLabel4 = new JLabel(); jLabel4.setText("Subspecies"); GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.insets = new Insets(0, 0, 0, 5); gridBagConstraints8.gridx = 0; gridBagConstraints8.anchor = GridBagConstraints.EAST; gridBagConstraints8.gridy = 10; jLabel3 = new JLabel(); jLabel3.setText("Species"); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.insets = new Insets(0, 0, 0, 0); gridBagConstraints7.fill = GridBagConstraints.BOTH; gridBagConstraints7.gridy = 20; gridBagConstraints7.weightx = 1.0; gridBagConstraints7.anchor = GridBagConstraints.WEST; gridBagConstraints7.gridwidth = 7; gridBagConstraints7.gridx = 1; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.insets = new Insets(0, 0, 0, 5); gridBagConstraints5.fill = GridBagConstraints.BOTH; gridBagConstraints5.gridy = 11; gridBagConstraints5.weightx = 1.0; gridBagConstraints5.anchor = GridBagConstraints.WEST; gridBagConstraints5.gridwidth = 2; gridBagConstraints5.gridx = 1; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.insets = new Insets(0, 0, 0, 5); gridBagConstraints4.fill = GridBagConstraints.BOTH; gridBagConstraints4.gridy = 10; gridBagConstraints4.weightx = 1.0; gridBagConstraints4.anchor = GridBagConstraints.WEST; gridBagConstraints4.gridwidth = 2; gridBagConstraints4.gridx = 1; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.insets = new Insets(0, 0, 0, 5); gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.gridy = 9; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.anchor = GridBagConstraints.WEST; gridBagConstraints3.gridwidth = 2; gridBagConstraints3.gridx = 1; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.insets = new Insets(0, 0, 0, 5); gridBagConstraints2.gridx = 0; gridBagConstraints2.anchor = GridBagConstraints.EAST; gridBagConstraints2.gridy = 9; jLabel2 = new JLabel(); jLabel2.setText("Genus"); GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.gridy = 1; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.insets = new Insets(0, 0, 0, 5); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridx = 1; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(0, 0, 0, 5); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridy = 0; jLabel = new JLabel(); jLabel.setText("Barcode"); jPanel = new JPanel(); GridBagLayout gbl_jPanel = new GridBagLayout(); gbl_jPanel.rowWeights = new double[] { 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.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, 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 }; gbl_jPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_jPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_jPanel.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0 }; jPanel.setLayout(gbl_jPanel); jPanel.add(jLabel, gridBagConstraints); jPanel.add(getJTextFieldBarcode(), gridBagConstraints1); jPanel.add(jLabel2, gridBagConstraints2); jPanel.add(getJTextField1(), gridBagConstraints3); GridBagConstraints gbc_lblNatureofid = new GridBagConstraints(); gbc_lblNatureofid.anchor = GridBagConstraints.EAST; gbc_lblNatureofid.insets = new Insets(0, 0, 0, 5); gbc_lblNatureofid.gridx = 3; gbc_lblNatureofid.gridy = 9; jPanel.add(getLblNatureofid(), gbc_lblNatureofid); jComboBoxNatureOfId = getJComboBoxNatureOfId(); GridBagConstraints gbc_jTextFieldNatureOfID = new GridBagConstraints(); gbc_jTextFieldNatureOfID.gridwidth = 4; gbc_jTextFieldNatureOfID.insets = new Insets(0, 0, 0, 0); gbc_jTextFieldNatureOfID.fill = GridBagConstraints.HORIZONTAL; gbc_jTextFieldNatureOfID.gridx = 4; gbc_jTextFieldNatureOfID.gridy = 9; jPanel.add(jComboBoxNatureOfId, gbc_jTextFieldNatureOfID); jPanel.add(getJTextField12(), gridBagConstraints4); GridBagConstraints gbc_lblIdDate = new GridBagConstraints(); gbc_lblIdDate.anchor = GridBagConstraints.EAST; gbc_lblIdDate.insets = new Insets(0, 0, 0, 5); gbc_lblIdDate.gridx = 3; gbc_lblIdDate.gridy = 10; jPanel.add(getLblIdDate(), gbc_lblIdDate); jTextFieldDateDetermined = getJTextFieldDateDetermined(); GridBagConstraints gbc_jTextFieldDateDetermined = new GridBagConstraints(); gbc_jTextFieldDateDetermined.gridwidth = 4; gbc_jTextFieldDateDetermined.insets = new Insets(0, 0, 0, 0); gbc_jTextFieldDateDetermined.fill = GridBagConstraints.HORIZONTAL; gbc_jTextFieldDateDetermined.gridx = 4; gbc_jTextFieldDateDetermined.gridy = 10; jPanel.add(jTextFieldDateDetermined, gbc_jTextFieldDateDetermined); jTextFieldDateDetermined.setColumns(10); jPanel.add(getJTextField2(), gridBagConstraints5); JLabel lblIdBy = new JLabel("Id By"); GridBagConstraints gbc_lblIdBy = new GridBagConstraints(); gbc_lblIdBy.anchor = GridBagConstraints.EAST; gbc_lblIdBy.insets = new Insets(0, 0, 0, 5); gbc_lblIdBy.gridx = 3; gbc_lblIdBy.gridy = 11; jPanel.add(lblIdBy, gbc_lblIdBy); jCBDeterminer = getJCBDeterminer(); GridBagConstraints gbc_jTextFieldDeterminer = new GridBagConstraints(); gbc_jTextFieldDeterminer.gridwidth = 4; gbc_jTextFieldDeterminer.insets = new Insets(0, 0, 0, 0); gbc_jTextFieldDeterminer.fill = GridBagConstraints.HORIZONTAL; gbc_jTextFieldDeterminer.gridx = 4; gbc_jTextFieldDeterminer.gridy = 11; jPanel.add(jCBDeterminer, gbc_jTextFieldDeterminer); GridBagConstraints gbc_lblIdRemarks = new GridBagConstraints(); gbc_lblIdRemarks.anchor = GridBagConstraints.EAST; gbc_lblIdRemarks.insets = new Insets(0, 0, 0, 5); gbc_lblIdRemarks.gridx = 3; gbc_lblIdRemarks.gridy = 13; jPanel.add(getLblIdRemarks(), gbc_lblIdRemarks); jTextFieldIdRemarks = getJTextFieldIdRemarks(); GridBagConstraints gbc_jTextFieldIdRemarks = new GridBagConstraints(); gbc_jTextFieldIdRemarks.insets = new Insets(0, 0, 0, 0); gbc_jTextFieldIdRemarks.fill = GridBagConstraints.HORIZONTAL; gbc_jTextFieldIdRemarks.gridx = 4; gbc_jTextFieldIdRemarks.gridy = 13; gbc_jTextFieldIdRemarks.gridwidth = 4; jPanel.add(jTextFieldIdRemarks, gbc_jTextFieldIdRemarks); jTextFieldIdRemarks.setColumns(10); GridBagConstraints gbc_lblTypestatus = new GridBagConstraints(); gbc_lblTypestatus.anchor = GridBagConstraints.EAST; gbc_lblTypestatus.insets = new Insets(0, 0, 0, 5); gbc_lblTypestatus.gridx = 3; gbc_lblTypestatus.gridy = 14; jPanel.add(getLblTypestatus(), gbc_lblTypestatus); cbTypeStatus = getCbTypeStatus(); GridBagConstraints gbc_cbTypeStatus = new GridBagConstraints(); gbc_cbTypeStatus.gridwidth = 4; gbc_cbTypeStatus.insets = new Insets(0, 0, 0, 5); gbc_cbTypeStatus.fill = GridBagConstraints.HORIZONTAL; gbc_cbTypeStatus.gridx = 4; gbc_cbTypeStatus.gridy = 14; jPanel.add(cbTypeStatus, gbc_cbTypeStatus); GridBagConstraints gbc_lblHigherGeography = new GridBagConstraints(); gbc_lblHigherGeography.anchor = GridBagConstraints.EAST; gbc_lblHigherGeography.insets = new Insets(0, 0, 0, 5); gbc_lblHigherGeography.gridx = 0; gbc_lblHigherGeography.gridy = 17; jPanel.add(getLblHigherGeography(), gbc_lblHigherGeography); GridBagConstraints gbc_comboBoxElevUnits = new GridBagConstraints(); gbc_comboBoxElevUnits.insets = new Insets(0, 0, 0, 0); gbc_comboBoxElevUnits.gridwidth = 7; gbc_comboBoxElevUnits.fill = GridBagConstraints.HORIZONTAL; gbc_comboBoxElevUnits.gridx = 1; gbc_comboBoxElevUnits.gridy = 17; jPanel.add(getComboBoxHighGeog(), gbc_comboBoxElevUnits); GridBagConstraints gbc_lblTo = new GridBagConstraints(); gbc_lblTo.insets = new Insets(0, 0, 0, 5); gbc_lblTo.anchor = GridBagConstraints.EAST; gbc_lblTo.gridx = 5; gbc_lblTo.gridy = 19; jPanel.add(getLblTo(), gbc_lblTo); GridBagConstraints gbc_textFieldMaxElev = new GridBagConstraints(); gbc_textFieldMaxElev.insets = new Insets(0, 0, 0, 5); gbc_textFieldMaxElev.fill = GridBagConstraints.BOTH; gbc_textFieldMaxElev.gridx = 6; gbc_textFieldMaxElev.gridy = 19; jPanel.add(getTextFieldMaxElev(), gbc_textFieldMaxElev); GridBagConstraints gbc_comboBoxMaxElev = new GridBagConstraints(); gbc_comboBoxMaxElev.insets = new Insets(0, 0, 0, 0); gbc_comboBoxMaxElev.fill = GridBagConstraints.HORIZONTAL; gbc_comboBoxMaxElev.gridx = 7; gbc_comboBoxMaxElev.gridy = 19; jPanel.add(getComboBoxElevUnits(), gbc_comboBoxMaxElev); jPanel.add(getJTextField3(), gridBagConstraints7); jPanel.add(jLabel3, gridBagConstraints8); jPanel.add(jLabel4, gridBagConstraints9); GridBagConstraints gridBagConstraints28 = new GridBagConstraints(); gridBagConstraints28.gridwidth = 4; gridBagConstraints28.insets = new Insets(0, 0, 0, 5); gridBagConstraints28.gridx = 3; gridBagConstraints28.anchor = GridBagConstraints.WEST; gridBagConstraints28.fill = GridBagConstraints.NONE; gridBagConstraints28.gridy = 22; jLabel33 = new JLabel(); jLabel33.setText("Collecting Method"); jPanel.add(jLabel33, gridBagConstraints28); GridBagConstraints gbc_georef = new GridBagConstraints(); gbc_georef.insets = new Insets(0, 0, 0, 0); gbc_georef.gridwidth = 5; gbc_georef.fill = GridBagConstraints.HORIZONTAL; gbc_georef.gridx = 3; gbc_georef.gridy = 24; GridBagConstraints gridBagConstraints72 = new GridBagConstraints(); gridBagConstraints72.insets = new Insets(0, 0, 0, 5); gridBagConstraints72.gridx = 0; gridBagConstraints72.anchor = GridBagConstraints.EAST; gridBagConstraints72.gridy = 28; jLabel19 = new JLabel(); jLabel19.setText("Features"); jPanel.add(jLabel19, gridBagConstraints72); GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); gridBagConstraints17.insets = new Insets(0, 0, 0, 5); gridBagConstraints17.fill = GridBagConstraints.VERTICAL; gridBagConstraints17.gridy = 28; gridBagConstraints17.weightx = 1.0; gridBagConstraints17.anchor = GridBagConstraints.WEST; gridBagConstraints17.gridx = 1; jPanel.add(getJComboBoxFeatures(), gridBagConstraints17); GridBagConstraints gridBagConstraints104 = new GridBagConstraints(); gridBagConstraints104.insets = new Insets(0, 0, 0, 5); gridBagConstraints104.gridx = 3; gridBagConstraints104.anchor = GridBagConstraints.EAST; gridBagConstraints104.gridy = 28; jLabel37 = new JLabel(); jLabel37.setText("Prep Type"); jPanel.add(jLabel37, gridBagConstraints104); GridBagConstraints gridBagConstraints152 = new GridBagConstraints(); gridBagConstraints152.insets = new Insets(0, 0, 0, 0); gridBagConstraints152.fill = GridBagConstraints.BOTH; gridBagConstraints152.gridy = 28; gridBagConstraints152.weightx = 1.0; gridBagConstraints152.anchor = GridBagConstraints.WEST; gridBagConstraints152.gridwidth = 4; gridBagConstraints152.gridx = 4; jPanel.add(getJTextFieldPrepType(), gridBagConstraints152); GridBagConstraints gridBagConstraintsPR = new GridBagConstraints(); gridBagConstraintsPR.insets = new Insets(0, 0, 0, 0); gridBagConstraintsPR.gridx = 0; gridBagConstraintsPR.fill = GridBagConstraints.BOTH; gridBagConstraintsPR.gridwidth = 8; gridBagConstraintsPR.weighty = 1.0; gridBagConstraintsPR.gridy = 29; jPanel.add(getJScrollPaneSpecimenParts(), gridBagConstraintsPR); GridBagConstraints gbc_lblMicrohabitat = new GridBagConstraints(); gbc_lblMicrohabitat.anchor = GridBagConstraints.EAST; gbc_lblMicrohabitat.insets = new Insets(0, 0, 0, 5); gbc_lblMicrohabitat.gridx = 0; gbc_lblMicrohabitat.gridy = 34; jPanel.add(getLblMicrohabitat(), gbc_lblMicrohabitat); GridBagConstraints gbc_textField = new GridBagConstraints(); gbc_textField.insets = new Insets(0, 0, 0, 5); gbc_textField.fill = GridBagConstraints.HORIZONTAL; gbc_textField.gridx = 1; gbc_textField.gridy = 34; jPanel.add(getTextField(), gbc_textField); jPanel.add(getJButton(), gridBagConstraints10); jPanel.add(jLabel5, gridBagConstraints21); jPanel.add(getJTextFieldCollection(), gridBagConstraints31); jPanel.add(jLabel6, gridBagConstraints41); jPanel.add(getJTextField14(), gridBagConstraints12); jPanel.add(getJScrollPaneCollectors(), gridBagConstraints51); jPanel.add(jLabel7, gridBagConstraints22); jPanel.add(jLabel8, gridBagConstraints13); jPanel.add(getJTextFieldDateUpdated(), gridBagConstraints23); jPanel.add(getJTextField22(), gridBagConstraints14); jPanel.add(jLabel9, gridBagConstraints24); jPanel.add(getJTextField32(), gridBagConstraints32); jPanel.add(jLabel10, gridBagConstraints42); jPanel.add(jLabel11, gridBagConstraints15); jPanel.add(getJScrollPaneNumbers(), gridBagConstraints25); jPanel.add(getJButtonNumbersAdd(), gridBagConstraints33); jPanel.add(getJButtonCollsAdd(), gridBagConstraints43); jPanel.add(getJScrollPaneWarn(), gridBagConstraints52); jPanel.add(jLabel12, gridBagConstraints61); jPanel.add(getJTextField(), gridBagConstraints71); jPanel.add(jLabel13, gridBagConstraints81); jPanel.add(jLabel14, gridBagConstraints91); jPanel.add(jLabel15, gridBagConstraints101); jPanel.add(getJTextField4(), gridBagConstraints111); jPanel.add(getJTextField13(), gridBagConstraints121); jPanel.add(getJTextField23(), gridBagConstraints131); jPanel.add(jLabel16, gridBagConstraints16); jPanel.add(jLabel17, gridBagConstraints26); jPanel.add(jLabelTribe, gbc_jLabelTribe); jPanel.add(getJTextField5(), gridBagConstraints44); jPanel.add(getJTextFieldSubfamily(), gridBagConstraints53); jPanel.add(getJTextFieldTribe(), gridBagConstraints62); jPanel.add(jLabel20, gridBagConstraints82); jPanel.add(jLabel21, gridBagConstraints92); jPanel.add(getJComboBoxSex(), gridBagConstraints102); jPanel.add(getJComboBoxLifeStage(), gridBagConstraints27); jPanel.add(jLabel22, gridBagConstraints35); jPanel.add(getJTextFieldVerbatimDate(), gridBagConstraints63); jPanel.add(jLabel27, gridBagConstraints110); jPanel.add(jLabel29, gridBagConstraints112); jPanel.add(getJTextFieldAuthorship(), gridBagConstraints210); jPanel.add(jLabel30, gridBagConstraints36); jPanel.add(getJTextFieldUnnamedForm(), gridBagConstraints46); jPanel.add(jLabel28, gridBagConstraints74); jPanel.add(getJTextFieldInfraspecificRank(), gridBagConstraints84); jPanel.add(getJTextFieldInfraspecificName(), gridBagConstraints93); jPanel.add(jLabel25, gridBagConstraints103); jPanel.add(jLabel26, gridBagConstraints113); jPanel.add(getJTextFieldDateEmergedIndicator(), gridBagConstraints122); jPanel.add(getJTextFieldDateCollectedIndicator(), gridBagConstraints132); jPanel.add(getJTextFieldDateEmerged(), gridBagConstraints141); jPanel.add(getJTextFieldDateCollected(), gridBagConstraints151); jPanel.add(jLabelElevation, gbc_jLabelElevation); jPanel.add(getJTextField11(), gridBagConstraints18); jPanel.add(getJTextFieldCollectingMethod(), gridBagConstraints19); jPanel.add(getJButtonGeoreference(), gbc_georef); jPanel.add(jLabel34, gridBagConstraints47); jPanel.add(jLabel35, gridBagConstraints65); jPanel.add(getJCheckBox(), gridBagConstraints83); jPanel.add(jLabel36, gridBagConstraints94); jPanel.add(jLabel38, gridBagConstraints114); jPanel.add(jLabel39, gridBagConstraints123); jPanel.add(jLabel40, gridBagConstraints133); jPanel.add(getJTextField20(), gridBagConstraints142); jPanel.add(getJTextField26(), gridBagConstraints162); jPanel.add(getJTextFieldHabitat(), gridBagConstraints172); jPanel.add(jLabel41, gridBagConstraints115); jPanel.add(getJComboBoxWorkflowStatus(), gridBagConstraints29); jPanel.add(jLabel42, gridBagConstraints37); jPanel.add(getJComboBox2(), gridBagConstraints48); jPanel.add(jLabel43, gridBagConstraints56); jPanel.add(getJTextFieldInferences(), gridBagConstraintsInfer); jPanel.add(getJButton1(), gridBagConstraints116); jPanel.add(getJPanel1(), gridBagConstraints211); jPanel.add(getJTextFieldISODate(), gridBagConstraints117); jPanel.add(getJButtonDets(), gridBagConstraints212); jPanel.add(jLabel31, gridBagConstraints118); jPanel.add(getJTextField9(), gridBagConstraints213); jPanel.add(getJButtonNext(), gridBagConstraints119); jPanel.add(getJButtonPrevious(), gridBagConstraints214); jPanel.add(getJScrollPaneNotes(), gridBagConstraints49); jPanel.add(jLabel44, gridBagConstraints120); jPanel.add(getJButton13(), gridBagConstraints215); jPanel.add(getJButton2(), gridBagConstraints38); jPanel.add(getJButtonSpecificLocality(), gridBagConstraints124); jPanel.add(getJTextFieldImgCount(), gridBagConstraintsImgCount); jPanel.add(getJLabelMigrationStatus(), gridBagConstraintsMS); } return jPanel; }
From source file:edu.harvard.mcz.imagecapture.PositionTemplateEditor.java
/** * This method initializes jPanel1 /* w ww. j a v a 2 s. c o m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel1() { if (jPanel1 == null) { GridBagConstraints gridBagConstraints19 = new GridBagConstraints(); gridBagConstraints19.fill = GridBagConstraints.BOTH; gridBagConstraints19.weighty = 1.0; gridBagConstraints19.gridx = 2; gridBagConstraints19.gridy = 1; gridBagConstraints19.weightx = 1.0; jPanel1 = new JPanel(); jPanel1.setLayout(new GridBagLayout()); GridBagConstraints g1 = new GridBagConstraints(); g1.gridx = 1; g1.anchor = GridBagConstraints.NORTHEAST; g1.weightx = 0.1; g1.weighty = 0.75; g1.fill = GridBagConstraints.HORIZONTAL; g1.gridy = 1; GridBagConstraints g2 = new GridBagConstraints(); g2.gridx = 1; g2.anchor = GridBagConstraints.NORTH; g2.fill = GridBagConstraints.BOTH; g2.gridwidth = 2; g2.weighty = 0.2; g2.weightx = 0.0; g2.gridy = 0; jPanel1.add(getJPanel(), g1); jPanel1.add(getJPanel2(), g2); jPanel1.add(getJScrollPane1(), gridBagConstraints19); } return jPanel1; }
From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java
/** * @return/*from w w w. j a va2s . c o m*/ */ private JPanel createSchemeComboBoxPanel() { JPanel schemeListPanel = new JPanel(new GridBagLayout()); // create categories configuration panel { GridBagConstraints itemConstraint = new GridBagConstraints(); // Add active scheme label JLabel actviceSchemeLabel = new ResourceLabel( "plotter.configuration_dialog.color_scheme_dialog.active_scheme"); { itemConstraint.fill = GridBagConstraints.HORIZONTAL; itemConstraint.anchor = GridBagConstraints.WEST; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; itemConstraint.insets = new Insets(0, 5, 5, 5); itemConstraint.weightx = 1.0; actviceSchemeLabel.setBackground(Color.red); schemeListPanel.add(actviceSchemeLabel, itemConstraint); } // add button panel { JPanel buttonPanel = new JPanel(new GridBagLayout()); // rename scheme button { renameSchemeButton = new JButton(new ResourceAction(true, "plotter.configuration_dialog.color_scheme_dialog.rename_scheme_button") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { String newName = createNameDialog(currentActiveColorSchemeName); if (newName != null && !newName.equals(currentActiveColorSchemeName)) { renameColorSchemeAction(newName); } } }); itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.RELATIVE; itemConstraint.fill = GridBagConstraints.NONE; buttonPanel.add(renameSchemeButton, itemConstraint); } // remove scheme button { removeSchemeButton = new JButton(new ResourceAction(true, "plotter.configuration_dialog.color_scheme_dialog.remove_scheme_button") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { ConfirmDialog dialog = new ConfirmDialog( SwingUtilities.getWindowAncestor((Component) e.getSource()), "plotter.configuration_dialog.confirm_color_scheme_delete", ConfirmDialog.YES_NO_OPTION, false); dialog.setLocationRelativeTo((Component) e.getSource()); dialog.setVisible(true); if (dialog.getReturnOption() == ConfirmDialog.YES_OPTION) { removeColorSchemeAction((ColorScheme) colorSchemeComboBox.getSelectedItem()); } } }); itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.fill = GridBagConstraints.NONE; buttonPanel.add(removeSchemeButton, itemConstraint); } itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.fill = GridBagConstraints.NONE; itemConstraint.anchor = GridBagConstraints.EAST; itemConstraint.insets = new Insets(0, 5, 5, 5); schemeListPanel.add(buttonPanel, itemConstraint); } { colorSchemeComboBox = new JComboBox(colorSchemeComboBoxModel); actviceSchemeLabel.setLabelFor(colorSchemeComboBox); colorSchemeComboBox.setRenderer(new ColorSchemeComboBoxRenderer()); colorSchemeComboBox.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { return; } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { Object selectedValue = colorSchemeComboBox.getSelectedItem(); if (selectedValue instanceof ColorScheme) { ColorScheme selection = (ColorScheme) selectedValue; if (selection != null) { if (!currentActiveColorSchemeName.equals(selection.getName())) { currentActiveColorSchemeName = selection.getName(); adaptModels(); } } } else { String newName = I18N.getGUILabel("plotter.new_color_scheme_name.label"); String suffix = ""; int counter = 1; while (currentColorSchemes.get(newName + suffix) != null) { suffix = "_" + counter; counter++; } newName += suffix; String userSelectedName = createNameDialog(newName); if (userSelectedName == null) { colorSchemeComboBox.setSelectedItem(getCurrentActiveColorScheme()); return; } addNewColorSchemeAction(userSelectedName); } } @Override public void popupMenuCanceled(PopupMenuEvent e) { return; } }); itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 0.0; itemConstraint.weighty = 0.0; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; schemeListPanel.add(colorSchemeComboBox, itemConstraint); } } return schemeListPanel; }
From source file:org.languagetool.gui.Main.java
private void tagTextAndDisplayResults() { JLanguageTool langTool = ltSupport.getLanguageTool(); // tag text// w w w. j a v a 2 s.c o m List<String> sentences = langTool.sentenceTokenize(textArea.getText()); StringBuilder sb = new StringBuilder(); if (taggerShowsDisambigLog) { sb.append("<table>"); sb.append("<tr>"); sb.append("<td><b>"); sb.append(messages.getString("token")); sb.append("</b></td>"); sb.append("<td><b>"); sb.append(messages.getString("disambiguatorLog")); sb.append("</b></td>"); sb.append("</tr>"); boolean odd = true; try { for (String sent : sentences) { AnalyzedSentence analyzed = langTool.getAnalyzedSentence(sent); odd = appendTagsWithDisambigLog(sb, analyzed, odd); } } catch (Exception e) { sb.append(getStackTraceAsHtml(e)); } sb.append("</table>"); } else { try { for (String sent : sentences) { AnalyzedSentence analyzed = langTool.getAnalyzedSentence(sent); String analyzedString = StringTools.escapeHTML(analyzed.toString(",")) .replace("<S>", "<S><br>").replace("[", "<font color='" + TAG_COLOR + "'>[") .replace("]", "]</font><br>"); sb.append(analyzedString).append('\n'); } } catch (Exception e) { sb.append(getStackTraceAsHtml(e)); } } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (taggerDialog == null) { taggerDialog = new JDialog(frame); taggerDialog.setTitle(messages.getString("taggerWindowTitle")); taggerDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); taggerDialog.setResizable(true); taggerDialog.setSize(640, 480); taggerDialog.setLocationRelativeTo(frame); KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); ActionListener actionListener = actionEvent -> taggerDialog.setVisible(false); taggerDialog.getRootPane().registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); JPanel panel = new JPanel(new GridBagLayout()); taggerDialog.add(panel); taggerArea = new JTextPane(); taggerArea.setContentType("text/html"); taggerArea.setEditable(false); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridwidth = 2; c.gridy = 0; c.weightx = 1.0; c.weighty = 1.0; c.insets = new Insets(8, 8, 4, 8); c.fill = GridBagConstraints.BOTH; panel.add(new JScrollPane(taggerArea), c); c.gridwidth = 1; c.gridx = 0; c.gridy = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = new Insets(4, 8, 8, 8); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; JCheckBox showDisAmbig = new JCheckBox(messages.getString("ShowDisambiguatorLog")); showDisAmbig.setSelected(taggerShowsDisambigLog); showDisAmbig.addItemListener((ItemEvent e) -> { taggerShowsDisambigLog = e.getStateChange() == ItemEvent.SELECTED; ltSupport.getConfig().setTaggerShowsDisambigLog(taggerShowsDisambigLog); }); panel.add(showDisAmbig, c); c.gridx = 1; JButton closeButton = new JButton(messages.getString("guiCloseButton")); closeButton.addActionListener(actionListener); panel.add(closeButton, c); } // orientation each time should be set as language may is changed taggerDialog.applyComponentOrientation( ComponentOrientation.getOrientation(languageBox.getSelectedLanguage().getLocale())); taggerDialog.setVisible(true); taggerArea.setText(HTML_FONT_START + sb + HTML_FONT_END); } }); }
From source file:com.juanhg.angularmdisk.AngularMDiskApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTiempo = new JPanel(); panelTiempo.setToolTipText(""); panelTiempo.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); btnPhase1 = new JButton("Lanzar Insecto"); btnPhase1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnPhase1Event();// w ww .j a va 2 s . c o m } }); btnPhase1.setEnabled(false); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblDiskW = new JLabel("Velocidad Disco:"); lblDiskW.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblDiskWValue = new JLabel(); lblDiskWValue.setText("0"); lblDiskWValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblCriticRadius = new JLabel("Radio Cr\u00EDtico:"); lblCriticRadius.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblCriticRadiusValue = new JLabel(); lblCriticRadiusValue.setText("0"); lblCriticRadiusValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblCriticRadius, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE) .addGap(6)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblDiskW, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(26))) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblDiskWValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE) .addComponent(lblCriticRadiusValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)) .addContainerGap(112, Short.MAX_VALUE))); gl_panelOutputs .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblDiskW).addComponent(lblDiskWValue)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblCriticRadius, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblCriticRadiusValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(121))); panelOutputs.setLayout(gl_panelOutputs); panel_1 = new JPanel(); panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup() .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 396, GroupLayout.PREFERRED_SIZE) .addComponent(panelOutputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE) .addComponent(panelTiempo, GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)) .addGap(18)) .addGroup(gl_panel_control.createSequentialGroup() .addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 397, GroupLayout.PREFERRED_SIZE) .addContainerGap(17, Short.MAX_VALUE))))); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelTiempo, GroupLayout.PREFERRED_SIZE, 210, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 15, Short.MAX_VALUE).addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panel_1.add(lblNewLabel); rdbtnCam1 = new JRadioButton("C\u00E1mara Fija"); rdbtnCam1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { rdbtnCam1Event(); } }); rdbtnCam1.setSelected(true); rdbtnCam2 = new JRadioButton("C\u00E1mara M\u00F3vil"); rdbtnCam2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { rdbtnCam2Event(); } }); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); btnPauseContinue = new JButton("Pausar"); btnPauseContinue.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnPauseContinue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnPauseContinueEvent(event); } }); panel = new JPanel(); panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); label = new JLabel("Datos de la Simulaci\u00F3n"); label.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(label); GroupLayout gl_panelTiempo = new GroupLayout(panelTiempo); gl_panelTiempo.setHorizontalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup().addContainerGap() .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING, false) .addComponent(btnPhase1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING).addGroup(gl_panelTiempo .createSequentialGroup().addGap(52) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(rdbtnCam2).addComponent(rdbtnCam1, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(21).addComponent( btnPauseContinue, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))) .addContainerGap(47, Short.MAX_VALUE)) .addComponent(panel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)); gl_panelTiempo.setVerticalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE).addGap(22) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup().addComponent(rdbtnCam1) .addPreferredGap(ComponentPlacement.RELATED).addComponent(rdbtnCam2)) .addComponent(btnPhase1, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(btnPauseContinue, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)))); panelTiempo.setLayout(gl_panelTiempo); JLabel LabelBugMass = new JLabel("Masa del Insecto"); LabelBugMass.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelFallRadio = new JLabel("Radio de Ca\u00EDda"); labelFallRadio.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelBugVelocity = new JLabel("Velocidad del Insecto"); labelBugVelocity.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelDiskVelocity = new JLabel("Velocidad del Disco"); labelDiskVelocity.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblFallRadiusValue = new JLabel("10"); lblFallRadiusValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblBugVelocityValue = new JLabel("1"); lblBugVelocityValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVelocityValue = new JLabel("0.5"); lblVelocityValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblInitMassValue = new JLabel("30"); lblInitMassValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderBugInitMass = new JSlider(); sliderBugInitMass.setValue(30); sliderBugInitMass.setMinimum(20); sliderBugInitMass.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderBugInitMassEvent(); } }); sliderBugInitMass.setMaximum(70); sliderFallRadius = new JSlider(); sliderFallRadius.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderFallRadiusEvent(); } }); sliderFallRadius.setValue(10); sliderFallRadius.setMinorTickSpacing(1); sliderFallRadius.setMaximum(20); sliderBugVelocity = new JSlider(); sliderBugVelocity.setValue(10); sliderBugVelocity.setMaximum(20); sliderBugVelocity.setMinimum(5); sliderBugVelocity.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderBugVelocityEvent(); } }); sliderBugVelocity.setMinorTickSpacing(1); sliderDiskVelocity = new JSlider(); sliderDiskVelocity.setMaximum(10); sliderDiskVelocity.setMinimum(1); sliderDiskVelocity.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderDiskVelocityEvent(); } }); sliderDiskVelocity.setValue(5); sliderDiskVelocity.setMinorTickSpacing(1); JLabel lblCoeficienteDeRozamiento = new JLabel("Coef de Rozamiento"); lblCoeficienteDeRozamiento.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblFrictionValue = new JLabel("0.25"); lblFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderFriction = new JSlider(); sliderFriction.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderFrictionEvent(); } }); sliderFriction.setValue(25); sliderFriction.setMinorTickSpacing(1); sliderFriction.setMinimum(1); sliderFriction.setMaximum(90); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelBugVelocity, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelBugMass, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelFallRadio, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblInitMassValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblFallRadiusValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblBugVelocityValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(sliderFallRadius, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderBugInitMass, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderBugVelocity, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderDiskVelocity, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE)) .addGap(26)) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addComponent(lblCoeficienteDeRozamiento, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE) .addComponent(labelDiskVelocity, GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup() .addComponent(lblVelocityValue, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE) .addGap(204)) .addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup() .addComponent(lblFrictionValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(sliderFriction, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addGap(26)))) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(8) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelBugMass).addComponent(lblInitMassValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderBugInitMass, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelFallRadio).addComponent(lblFallRadiusValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderFallRadius, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup( gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelBugVelocity) .addComponent(lblBugVelocityValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderBugVelocity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelDiskVelocity).addComponent(lblVelocityValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderDiskVelocity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addGap(12) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblCoeficienteDeRozamiento, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblFrictionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelInputs.createSequentialGroup() .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(sliderFriction, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGap(47))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 432, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 560, GroupLayout.PREFERRED_SIZE) .addContainerGap(32, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE) .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 598, Short.MAX_VALUE)) .addContainerGap())); GridBagLayout gbl_panel_visualizar = new GridBagLayout(); gbl_panel_visualizar.columnWidths = new int[] { 0, 0 }; gbl_panel_visualizar.rowHeights = new int[] { 0, 0, 0 }; gbl_panel_visualizar.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_panel_visualizar.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; panel_visualizar.setLayout(gbl_panel_visualizar); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); GridBagConstraints gbc_tabbedPane = new GridBagConstraints(); gbc_tabbedPane.gridheight = 2; gbc_tabbedPane.fill = GridBagConstraints.BOTH; gbc_tabbedPane.gridx = 0; gbc_tabbedPane.gridy = 0; panel_visualizar.add(tabbedPane, gbc_tabbedPane); panelSimulation = new JPanelGrafica(); tabbedPane.addTab("Simulacin", null, panelSimulation, null); panelSimulation.setBackground(Color.WHITE); getContentPane().setLayout(groupLayout); }
From source file:net.sf.jabref.gui.JabRefFrame.java
private void initLayout() { tabbedPane.putClientProperty(Options.NO_CONTENT_BORDER_KEY, Boolean.TRUE); setProgressBarVisible(false);//w w w .j av a 2 s. c o m pushExternalButton = new PushToApplicationButton(this, PushToApplications.getApplications()); fillMenu(); createToolBar(); getContentPane().setLayout(gbl); splitPane.setDividerSize(2); splitPane.setBorder(null); //getContentPane().setBackground(GUIGlobals.lightGray); con.fill = GridBagConstraints.HORIZONTAL; con.anchor = GridBagConstraints.WEST; con.weightx = 1; con.weighty = 0; con.gridwidth = GridBagConstraints.REMAINDER; //gbl.setConstraints(mb, con); //getContentPane().add(mb); setJMenuBar(mb); con.anchor = GridBagConstraints.NORTH; //con.gridwidth = 1;//GridBagConstraints.REMAINDER;; gbl.setConstraints(tlb, con); getContentPane().add(tlb); Component lim = Box.createGlue(); gbl.setConstraints(lim, con); //getContentPane().add(lim); /* JPanel empt = new JPanel(); empt.setBackground(GUIGlobals.lightGray); gbl.setConstraints(empt, con); getContentPane().add(empt); con.insets = new Insets(1,0,1,1); con.anchor = GridBagConstraints.EAST; con.weightx = 0; gbl.setConstraints(searchManager, con); getContentPane().add(searchManager);*/ con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 1; con.weighty = 0; con.fill = GridBagConstraints.BOTH; con.anchor = GridBagConstraints.WEST; con.insets = new Insets(0, 0, 0, 0); lim = Box.createGlue(); gbl.setConstraints(lim, con); getContentPane().add(lim); //tabbedPane.setVisible(false); //tabbedPane.setForeground(GUIGlobals.lightGray); con.weighty = 1; gbl.setConstraints(splitPane, con); getContentPane().add(splitPane); UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0)); splitPane.setRightComponent(tabbedPane); splitPane.setLeftComponent(sidePaneManager.getPanel()); sidePaneManager.updateView(); JPanel status = new JPanel(); status.setLayout(gbl); con.weighty = 0; con.weightx = 0; con.gridwidth = 1; con.insets = new Insets(0, 2, 0, 0); gbl.setConstraints(statusLabel, con); status.add(statusLabel); con.weightx = 1; con.insets = new Insets(0, 4, 0, 0); con.gridwidth = 1; gbl.setConstraints(statusLine, con); status.add(statusLine); con.weightx = 0; con.gridwidth = GridBagConstraints.REMAINDER; con.insets = new Insets(2, 4, 2, 2); gbl.setConstraints(progressBar, con); status.add(progressBar); con.weightx = 1; con.gridwidth = GridBagConstraints.REMAINDER; statusLabel.setForeground(GUIGlobals.ENTRY_EDITOR_LABEL_COLOR.darker()); con.insets = new Insets(0, 0, 0, 0); gbl.setConstraints(status, con); getContentPane().add(status); // Drag and drop for tabbedPane: TransferHandler xfer = new EntryTableTransferHandler(null, this, null); tabbedPane.setTransferHandler(xfer); tlb.setTransferHandler(xfer); mb.setTransferHandler(xfer); sidePaneManager.getPanel().setTransferHandler(xfer); }
From source file:de.tor.tribes.ui.views.DSWorkbenchReportFrame.java
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this * method is always regenerated by the Form Editor. *//* w w w . jav a 2 s.co m*/ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jCreateStatsFrame = new javax.swing.JFrame(); jPanel2 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jReportSetsForStatsList = new javax.swing.JList(); jButton10 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); jList1 = new javax.swing.JList(); jResultTabbedPane = new javax.swing.JTabbedPane(); jPanel4 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jOverallStatsArea = new javax.swing.JTextPane(); jPanel5 = new javax.swing.JPanel(); jScrollPane5 = new javax.swing.JScrollPane(); jAllyStatsArea = new javax.swing.JTextPane(); jPanel6 = new javax.swing.JPanel(); jScrollPane6 = new javax.swing.JScrollPane(); jTribeStatsArea = new javax.swing.JTextPane(); capabilityInfoPanel2 = new de.tor.tribes.ui.components.CapabilityInfoPanel(); jXReportsPanel = new org.jdesktop.swingx.JXPanel(); jReportsTabbedPane = new javax.swing.JTabbedPane(); jNewPlanPanel = new javax.swing.JPanel(); jLabel10 = new javax.swing.JLabel(); jxSearchPane = new org.jdesktop.swingx.JXPanel(); jXPanel2 = new org.jdesktop.swingx.JXPanel(); jButton15 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); jLabel21 = new javax.swing.JLabel(); jFilterRows = new javax.swing.JCheckBox(); jFilterCaseSensitive = new javax.swing.JCheckBox(); jScrollPane8 = new javax.swing.JScrollPane(); jXColumnList = new org.jdesktop.swingx.JXList(); jLabel22 = new javax.swing.JLabel(); jPanel7 = new javax.swing.JPanel(); jGuessUnknownLosses = new javax.swing.JCheckBox(); jUseSilentKillsBox = new javax.swing.JCheckBox(); jCheckBox3 = new javax.swing.JCheckBox(); jShowPercentsBox = new javax.swing.JCheckBox(); jAlwaysOnTopBox = new javax.swing.JCheckBox(); jReportsPanel = new javax.swing.JPanel(); capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel(); jCreateStatsFrame.setTitle("Kampfstatistiken"); jPanel2.setBackground(new java.awt.Color(239, 235, 223)); jLabel6.setText("Verwendete Berichtsets"); jScrollPane2.setPreferredSize(new java.awt.Dimension(258, 100)); jScrollPane2.setViewportView(jReportSetsForStatsList); jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/select.png"))); // NOI18N jButton10.setText("Auswerten"); jButton10.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { fireDoCreateStatsEvent(evt); } }); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Ergebnisse")); jPanel3.setOpaque(false); jLabel7.setText("Angezeigte Stmme"); jScrollPane3.setMaximumSize(new java.awt.Dimension(140, 130)); jScrollPane3.setMinimumSize(new java.awt.Dimension(140, 130)); jScrollPane3.setPreferredSize(new java.awt.Dimension(140, 130)); jScrollPane3.setViewportView(jList1); jResultTabbedPane.setBackground(new java.awt.Color(239, 235, 223)); jPanel4.setOpaque(false); jPanel4.setLayout(new java.awt.BorderLayout()); jOverallStatsArea.setContentType("text/html"); // NOI18N jOverallStatsArea.setEditable(false); jScrollPane1.setViewportView(jOverallStatsArea); jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER); jResultTabbedPane.addTab("Gesamtbersicht", new javax.swing.ImageIcon(getClass().getResource("/res/ui/chart.png")), jPanel4); // NOI18N jPanel5.setBackground(new java.awt.Color(239, 235, 223)); jPanel5.setLayout(new java.awt.BorderLayout()); jAllyStatsArea.setContentType("text/html"); // NOI18N jAllyStatsArea.setEditable(false); jScrollPane5.setViewportView(jAllyStatsArea); jPanel5.add(jScrollPane5, java.awt.BorderLayout.CENTER); jResultTabbedPane.addTab("Stmme", new javax.swing.ImageIcon(getClass().getResource("/res/ally.png")), jPanel5); // NOI18N jPanel6.setBackground(new java.awt.Color(239, 235, 223)); jPanel6.setLayout(new java.awt.BorderLayout()); jTribeStatsArea.setContentType("text/html"); // NOI18N jTribeStatsArea.setEditable(false); jScrollPane6.setViewportView(jTribeStatsArea); jPanel6.add(jScrollPane6, java.awt.BorderLayout.CENTER); jResultTabbedPane.addTab("Spieler", new javax.swing.ImageIcon(getClass().getResource("/res/face.png")), jPanel6); // NOI18N javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jResultTabbedPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 570, Short.MAX_VALUE) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(jLabel7) .addGap(18, 18, 18).addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE))) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7).addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jResultTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) .addContainerGap())); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup().addComponent(jLabel6) .addGap(18, 18, 18).addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)) .addComponent(jButton10)) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6).addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); capabilityInfoPanel2.setCopyable(false); capabilityInfoPanel2.setDeletable(false); capabilityInfoPanel2.setPastable(false); capabilityInfoPanel2.setSearchable(false); javax.swing.GroupLayout jCreateStatsFrameLayout = new javax.swing.GroupLayout( jCreateStatsFrame.getContentPane()); jCreateStatsFrame.getContentPane().setLayout(jCreateStatsFrameLayout); jCreateStatsFrameLayout.setHorizontalGroup( jCreateStatsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jCreateStatsFrameLayout.createSequentialGroup().addContainerGap() .addGroup(jCreateStatsFrameLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(capabilityInfoPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jCreateStatsFrameLayout.setVerticalGroup(jCreateStatsFrameLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jCreateStatsFrameLayout.createSequentialGroup().addContainerGap() .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(capabilityInfoPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jXReportsPanel.setLayout(new java.awt.BorderLayout()); jXReportsPanel.add(jReportsTabbedPane, java.awt.BorderLayout.CENTER); jNewPlanPanel.setOpaque(false); jNewPlanPanel.setLayout(new java.awt.BorderLayout()); jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/document_new_24x24.png"))); // NOI18N jLabel10.setToolTipText("Leeres Berichtset erstellen"); jLabel10.setEnabled(false); jLabel10.setMaximumSize(new java.awt.Dimension(40, 40)); jLabel10.setMinimumSize(new java.awt.Dimension(40, 40)); jLabel10.setPreferredSize(new java.awt.Dimension(40, 40)); jLabel10.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { fireEnterEvent(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { fireExitEvent(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { fireCreateAttackPlanEvent(evt); } }); jNewPlanPanel.add(jLabel10, java.awt.BorderLayout.CENTER); jxSearchPane.setOpaque(false); jxSearchPane.setLayout(new java.awt.GridBagLayout()); jXPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jXPanel2.setInheritAlpha(false); jButton15.setText("Anwenden"); jButton15.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { jButton15fireHideGlassPaneEvent(evt); } }); jTextField1.addCaretListener(new javax.swing.event.CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent evt) { jTextField1fireHighlightEvent(evt); } }); jLabel21.setText("Suchbegriff"); jFilterRows.setText("Nur gefilterte Zeilen anzeigen"); jFilterRows.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jFilterRowsfireUpdateFilterEvent(evt); } }); jFilterCaseSensitive.setText("Gro-/Kleinschreibung beachten"); jFilterCaseSensitive.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jFilterCaseSensitivefireUpdateFilterEvent(evt); } }); jXColumnList.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jXColumnList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane8.setViewportView(jXColumnList); jLabel22.setText("Spalten"); javax.swing.GroupLayout jXPanel2Layout = new javax.swing.GroupLayout(jXPanel2); jXPanel2.setLayout(jXPanel2Layout); jXPanel2Layout .setHorizontalGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel2Layout.createSequentialGroup() .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jXPanel2Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jXPanel2Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jFilterRows, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jFilterCaseSensitive, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jButton15))) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 355, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jXPanel2Layout.setVerticalGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel21) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jXPanel2Layout .createSequentialGroup().addComponent(jFilterCaseSensitive) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jFilterRows) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton15)) .addComponent(jScrollPane8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel22)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jxSearchPane.add(jXPanel2, new java.awt.GridBagConstraints()); jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Optionen")); jPanel7.setOpaque(false); jGuessUnknownLosses.setSelected(true); jGuessUnknownLosses.setText("Gegnerische Verluste schtzen, falls unbekannt"); jGuessUnknownLosses.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireStatOptionsChangedEvent(evt); } }); jUseSilentKillsBox.setSelected(true); jUseSilentKillsBox.setText("Auswrtige Einheiten bei Adelung als Verlust werten"); jUseSilentKillsBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireStatOptionsChangedEvent(evt); } }); jCheckBox3.setSelected(true); jCheckBox3.setText("Verluste pro Angreifer/Verteidiger anzeigen"); jCheckBox3.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireStatOptionsChangedEvent(evt); } }); jShowPercentsBox.setText("Prozentuale Anteile anzeigen"); jShowPercentsBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireStatOptionsChangedEvent(evt); } }); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jGuessUnknownLosses).addComponent(jUseSilentKillsBox) .addComponent(jCheckBox3).addComponent(jShowPercentsBox)))); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap().addComponent(jGuessUnknownLosses) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jUseSilentKillsBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jCheckBox3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jShowPercentsBox).addContainerGap(23, Short.MAX_VALUE))); setTitle("Berichtsdatenbank"); getContentPane().setLayout(new java.awt.GridBagLayout()); jAlwaysOnTopBox.setText("Immer im Vordergrund"); jAlwaysOnTopBox.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { fireAlwaysOnTopEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jAlwaysOnTopBox, gridBagConstraints); jReportsPanel.setBackground(new java.awt.Color(239, 235, 223)); jReportsPanel.setPreferredSize(new java.awt.Dimension(500, 400)); jReportsPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipadx = 500; gridBagConstraints.ipady = 400; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; getContentPane().add(jReportsPanel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(capabilityInfoPanel1, gridBagConstraints); pack(); }
From source file:org.esa.beam.visat.toolviews.stat.StatisticsPanel.java
private void updateLeftPanel() { PagePanel pagePanel = new StatisticsSpreadsheetPagePanel(parentDialog, helpID, statisticsCriteriaPanel, statsSpreadsheet, this); pagePanel.initComponents();// w ww . jav a2 s . com spreadsheetPanel.removeAll(); // JPanel statsSpeadPanel = statsSpreadsheetPanel(); // spreadsheetPanel.add(statsSpeadPanel); spreadsheetPanel.add(pagePanel); // spreadsheetPanel.setBackground(Color.WHITE); spreadsheetScrollPane.setVisible(statisticsCriteriaPanel.showStatsSpreadSheet()); spreadsheetScrollPane.setMinimumSize(new Dimension(100, 100)); leftPanel.removeAll(); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0; gbc.gridx = 0; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; // histogramPanel.setVisible(showHistogramPlots); if (statisticsCriteriaPanel.showPercentPlots() || statisticsCriteriaPanel.showHistogramPlots() || statisticsCriteriaPanel.showStatsList()) { if ((numStxRegions + 1) > spreadsheetMinRowsBeforeWeight) { gbc.weighty = 1.0 - spreadsheetHeightWeight; leftPanel.add(contentScrollPane, gbc); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = spreadsheetHeightWeight; } else { leftPanel.add(contentScrollPane, gbc); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weighty = 0; int buffer = 50; int minHeight = spreadsheetPanel.getPreferredSize().height + buffer; spreadsheetScrollPane.setMinimumSize(new Dimension(100, minHeight)); } gbc.gridy += 1; gbc.insets.top = 10; } else { gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 1.0; } if (statisticsCriteriaPanel.showStatsSpreadSheet()) { leftPanel.add(spreadsheetScrollPane, gbc); } // gbc.gridy += 1; // leftPanel.add(pagePanel, gbc); leftPanel.revalidate(); leftPanel.repaint(); contentPanel.revalidate(); contentPanel.repaint(); backgroundPanel.revalidate(); backgroundPanel.repaint(); }
From source file:display.ANNFileFilter.java
License:asdf
Yanng() { JPanel toolBars;/* www. j a va 2s. c o m*/ JMenuBar menuBar; JToolBar utilBar, fileBar; JButton toJava, runner, trainer, modify, getTraininger, inputer, newwer, saver, saveAser, loader, helper; JMenu file; final JMenu util; JMenu help; ImageIcon IJava, IRun, ITrain, IModify, INew, ISave, ILoad, IGetTrainingSet, IGetInput, ISaveAs; //initialize main window mainWindow = new JFrame("YANNG - Yet Another Neural Network (simulator) Generator"); mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainWindow.setLayout(new BorderLayout()); mainWindow.setSize(675, 525); mainWindow.setIconImage(new ImageIcon(ClassLoader.getSystemResource("display/icons/logo.png")).getImage()); loadingImage = new ImageIcon(ClassLoader.getSystemResource("display/icons/loading.gif")); path = new Vector<String>(); net = new Vector<NeuralNetwork>(); oneNet = new Vector<JPanel>(); tabPanel = new Vector<JPanel>(); readOut = new Vector<JTextArea>(); readOutLocale = new Vector<JScrollPane>(); loadingBar = new Vector<JLabel>(); title = new Vector<JLabel>(); close = new Vector<JButton>(); netName = new Vector<StringBuffer>(); netKind = new Vector<StringBuffer>(); resultsPane = new JTabbedPane(); mainWindow.add(resultsPane); toolBars = new JPanel(); toolBars.setLayout(new FlowLayout(FlowLayout.LEFT)); //create utilities toolbar with 3 buttons utilBar = new JToolBar("Utilities"); IRun = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/running.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); ITrain = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/training.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); IModify = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/modifyNet.png")) .getImage().getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); IGetTrainingSet = new ImageIcon( new ImageIcon(ClassLoader.getSystemResource("display/icons/trainingSet.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); IGetInput = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/input.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); //set the icons/tooltips for the utilitiy bar runner = new JButton(IRun); runner.setToolTipText( "<html>Run the Current Neural Network<br>Once Through with the Current Input</html>"); trainer = new JButton(ITrain); trainer.setToolTipText( "<html>Train the Network with the Current<br>Configuration and Training Set</html>"); modify = new JButton(IModify); modify.setToolTipText("<html>Modify the Network<br>for Fun and Profit</html>"); getTraininger = new JButton(IGetTrainingSet); getTraininger.setToolTipText("Get Training Set from File"); inputer = new JButton(IGetInput); inputer.setToolTipText("Get Input Set from File"); utilBar.add(inputer); utilBar.add(runner); utilBar.add(getTraininger); utilBar.add(trainer); utilBar.add(modify); //create file toolbar fileBar = new JToolBar("file"); ISaveAs = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/saveAs.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); INew = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/new.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); ISave = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/save.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); ILoad = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/load.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); IJava = new ImageIcon(new ImageIcon(ClassLoader.getSystemResource("display/icons/toJava.png")).getImage() .getScaledInstance(20, 20, java.awt.Image.SCALE_SMOOTH)); newwer = new JButton(INew); newwer.setToolTipText("Create New Neural Network"); saver = new JButton(ISave); saver.setToolTipText("Save Current Network Configuration"); saveAser = new JButton(ISaveAs); saveAser.setToolTipText("Save Network As"); loader = new JButton(ILoad); loader.setToolTipText("Load Network Configuration from File"); toJava = new JButton(IJava); toJava.setToolTipText("Export Network to Java Project"); fileBar.add(newwer); fileBar.add(loader); fileBar.add(saver); fileBar.add(saveAser); fileBar.add(toJava); toolBars.add(fileBar); toolBars.add(utilBar); mainWindow.add(toolBars, BorderLayout.NORTH); //create a menubar with three menus on it menuBar = new JMenuBar(); file = new JMenu("File"); util = new JMenu("Utilities"); help = new JMenu("Help"); //add menu items for file menu load = new JMenuItem("Load Network Configuration"); newNet = new JMenuItem("New Network"); saveAs = new JMenuItem("Save Network As"); save = new JMenuItem("Save Current Configuration"); exportNet = new JMenuItem("Export Network to Java Project"); exportOutput = new JMenuItem("Export Output to Text File"); file.add(load); file.add(newNet); file.addSeparator(); file.add(saveAs); file.add(save); file.addSeparator(); file.add(exportNet); file.add(exportOutput); menuBar.add(file); //add menu items for utilities menu changeConfig = new JMenuItem("Modify Network Settings"); getInput = new JMenuItem("Get Input From File"); getTraining = new JMenuItem("Get Training Set From File"); run = new JMenuItem("Run"); train = new JMenuItem("Train"); getColorMap = new JMenuItem("View Color Map"); getColorMap.setVisible(false); util.add(changeConfig); util.addSeparator(); util.add(getInput); util.add(getTraining); util.addSeparator(); util.add(run); util.add(train); menuBar.add(util); //add menu items for help menu quickStart = new JMenuItem("Quick Start Guide"); searchHelp = new JMenuItem("Programming with Yanng"); about = new JMenuItem("License"); links = new JMenuItem("<html>Links to Resources<br>about Neural Networks</html>"); help.add(quickStart); help.addSeparator(); help.add(searchHelp); help.addSeparator(); help.add(about); help.addSeparator(); help.add(links); menuBar.add(help); mainWindow.setJMenuBar(menuBar); //opens the quickstart guide quickStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { File myFile = new File(URLDecoder .decode(ClassLoader.getSystemResource("ann/quick-start.pdf").getFile(), "UTF-8")); Desktop.getDesktop().open(myFile); } catch (IOException ex) { try { Runtime.getRuntime().exec("xdg-open ./yanng/src/ann/quick-start.pdf"); } catch (Exception e) { JOptionPane.showMessageDialog(mainWindow, "Your desktop is not supported by java,\ngo to yanng/src/ann/quick-start.pdf to view the technical manual.", "Desktop not Supported", JOptionPane.ERROR_MESSAGE); } } } }); links.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { File myFile = new File( URLDecoder.decode(ClassLoader.getSystemResource("ann/links.pdf").getFile(), "UTF-8")); Desktop.getDesktop().open(myFile); } catch (IOException ex) { try { Runtime.getRuntime().exec("xdg-open ./yanng/src/ann/links.pdf"); } catch (Exception e) { JOptionPane.showMessageDialog(mainWindow, "Your desktop is not supported by java,\ngo to yanng/src/ann/links.pdf to view the technical manual.", "Desktop not Supported", JOptionPane.ERROR_MESSAGE); } } } }); //Displays license information about.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JTextArea x = new JTextArea("Copyright [2015] [Sam Findler and Michael Scott]\n" + "\n" + "Licensed under the Apache License, Version 2.0 (the \"License\");\n" + "you may not use this file except in compliance with the License.\n" + "You may obtain a copy of the License at\n" + "\n" + "http://www.apache.org/licenses/LICENSE-2.0\n" + "\n" + "Unless required by applicable law or agreed to in writing, software\n" + "distributed under the License is distributed on an \"AS IS\" BASIS,\n" + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + "See the License for the specific language governing permissions and\n" + "limitations under the License."); JDialog aboutDialog = new JDialog(mainWindow, "License", true); aboutDialog.setSize(500, 250); aboutDialog.setLayout(new FlowLayout()); aboutDialog.add(x); x.setEditable(false); aboutDialog.setVisible(true); } }); //opens the more technical user guide searchHelp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { File myFile = new File(URLDecoder .decode(ClassLoader.getSystemResource("ann/technical-manual.pdf").getFile(), "UTF-8")); Desktop.getDesktop().open(myFile); } catch (IOException ex) { try { Runtime.getRuntime().exec("xdg-open ./yanng/src/ann/technical-manual.pdf"); } catch (Exception e) { JOptionPane.showMessageDialog(mainWindow, "Your desktop is not supported by java,\ngo to yanng/src/ann/technical-manual.pdf to view the technical manual.", "Desktop not Supported", JOptionPane.ERROR_MESSAGE); } } } }); //class trains the neural network in the background while the loading bar displays, then prints out the output/connections listings/average error to the readOut pane class Trainer extends SwingWorker<NeuralNetwork, Object> { protected NeuralNetwork doInBackground() { net.get(resultsPane.getSelectedIndex()).trainNet(); setProgress(1); return net.get(resultsPane.getSelectedIndex()); } public void done() { if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Feed Forward Network")) { if (Double.isNaN(net.get(resultsPane.getSelectedIndex()).getAverageError())) JOptionPane.showMessageDialog(mainWindow, "Training Set Formatted Incorrectly", "Formatting Error", JOptionPane.ERROR_MESSAGE); else { printConnections(); readOut.get(resultsPane.getSelectedIndex()).append( "Results of Training " + netName.get(resultsPane.getSelectedIndex()) + ":\n\n"); printOutput(); readOut.get(resultsPane.getSelectedIndex()).append("Average Error = " + net.get(resultsPane.getSelectedIndex()).getAverageError() + "\n\n"); loadingBar.get(resultsPane.getSelectedIndex()).setVisible(false); JOptionPane.showMessageDialog(mainWindow, "<html>If the Input is not displaying as expected, chances are the input was inproperly formatted.<br>See help for more details<html>"); } } else if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Self-Organizing Map")) { readOut.get(resultsPane.getSelectedIndex()).append("\nUpdated Untrained Map:\n"); printInitMap(); loadingBar.get(resultsPane.getSelectedIndex()).setVisible(false); JOptionPane.showMessageDialog(mainWindow, "<html>If the Input is not displaying as expected, chances are the input was inproperly formatted.<br>See help for more details<html>"); } } } //starts the training class when train is pressed in the utilities menu train.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0) { if (net.get(resultsPane.getSelectedIndex()).getTrainingSet() != null) { loadingBar.get(resultsPane.getSelectedIndex()).setText( "<html><font color = rgb(160,0,0)>Training</font> <font color = rgb(0,0,248)>net...</font></html>"); loadingBar.get(resultsPane.getSelectedIndex()).setVisible(true); (thisTrainer = new Trainer()).execute(); } else JOptionPane.showMessageDialog(mainWindow, "No Input Set Specified", "Empty Signifier Error", JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog(mainWindow, "Can't Train Nonexistent Neural Network", "Existential Error", JOptionPane.ERROR_MESSAGE); } }); //associates the toolbar button with the jump rope guy with the training button on the utilities menu trainer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : train.getActionListeners()) { a.actionPerformed(ae); } } }); //runs through one set of inputs and prints the results to the readOut pane run.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Feed Forward Network")) { if (net.get(resultsPane.getSelectedIndex()).getInputSet() != null) { net.get(resultsPane.getSelectedIndex()).runNet(); if (Double.isNaN(net.get(resultsPane.getSelectedIndex()).getAverageError())) JOptionPane.showMessageDialog(mainWindow, "Training Set Formatted Incorrectly", "Formatting Error", JOptionPane.ERROR_MESSAGE); else { readOut.get(resultsPane.getSelectedIndex()).append("Results of Running through Network " + netName.get(resultsPane.getSelectedIndex()) + ":\n\n"); printOutput(); System.out.println("Results:"); for (int i = 0; i < net.get(resultsPane.getSelectedIndex()) .getOutputSet().length; i++) { System.out.println("\n Output of Input Vector " + i + ":"); for (int j = 0; j < net.get(resultsPane.getSelectedIndex()) .getOutputSet()[i].length; j++) { System.out.println(" Output Node " + j + " = " + net.get(resultsPane.getSelectedIndex()).getOutputSet()[i][j]); } } JOptionPane.showMessageDialog(mainWindow, "<html>If the Input is not displaying as expected, chances are the input was inproperly formatted.<br>See help for more details<html>"); } } else JOptionPane.showMessageDialog(mainWindow, "No Input Set Specified", "Empty Signifier Error", JOptionPane.ERROR_MESSAGE); } else if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Self-Organizing Map")) { if (net.get(resultsPane.getSelectedIndex()).getInputValues() != null) { loadingBar.get(resultsPane.getSelectedIndex()).setText( "<html><font color = rgb(160,0,0)>Training</font> <font color = rgb(0,0,248)>net...</font></html>"); loadingBar.get(resultsPane.getSelectedIndex()).setVisible(true); (thisTrainer = new Trainer()).execute(); } else JOptionPane.showMessageDialog(mainWindow, "No Input Set Specified", "Empty Signifier Error", JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog(mainWindow, "Can't Run Nonexistent Neural Network", "Existential Error", JOptionPane.ERROR_MESSAGE); } }); runner.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : run.getActionListeners()) { a.actionPerformed(ae); } } }); //the following code is for the getTraining button under utilities getTrainingSet = new JFileChooser(); getTrainingSet.setFileFilter(new TrainingFileFilter()); getTraining.addActionListener(new ActionListener() { //this method/class gets a training set (tsv/csv file) and parse it through the neural network. Kind of test that the file is formatted correctly, but if the data is wrong, there isn't much it can do. public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Feed Forward Network")) { int result; result = getTrainingSet.showOpenDialog(mainWindow); if (result == JFileChooser.APPROVE_OPTION) if (getTrainingSet.getSelectedFile().getName().endsWith(".csv") || getTrainingSet.getSelectedFile().getName().endsWith(".tsv") || getTrainingSet.getSelectedFile().getName().endsWith(".txt")) if (net.get(resultsPane.getSelectedIndex()) .parseTrainingSet(getTrainingSet.getSelectedFile())) JOptionPane.showMessageDialog(mainWindow, "<html>Method gives no Garuntee that this File is Formatted Correctly<br>(see help for more details)</html>", "Formatting Warning", JOptionPane.WARNING_MESSAGE); else JOptionPane.showMessageDialog(mainWindow, "File Mismatch with Network Configuration", "Correspondence Error", JOptionPane.ERROR_MESSAGE); else { JOptionPane.showMessageDialog(mainWindow, "Wrong File Type", "Category Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(mainWindow, "No File Selected", "Absence Warning", JOptionPane.WARNING_MESSAGE); } } else if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Self-Organizing Map")) { int result; result = getTrainingSet.showOpenDialog(mainWindow); if (result == JFileChooser.APPROVE_OPTION) if (getTrainingSet.getSelectedFile().getName().endsWith(".csv") || getTrainingSet.getSelectedFile().getName().endsWith(".tsv") || getTrainingSet.getSelectedFile().getName().endsWith(".txt")) if (net.get(resultsPane.getSelectedIndex()) .parseTrainingSet(getTrainingSet.getSelectedFile())) { JOptionPane.showMessageDialog(mainWindow, "<html>Method gives no Garuntee that this File is Formatted Correctly<br>(see help for more details)</html>", "Formatting Warning", JOptionPane.WARNING_MESSAGE); readOut.get(resultsPane.getSelectedIndex()).append("\nUpdated Untrained Map:\n"); printInitMap(); } else JOptionPane.showMessageDialog(mainWindow, "File Mismatch with Network Configuration", "Correspondence Error", JOptionPane.ERROR_MESSAGE); else { JOptionPane.showMessageDialog(mainWindow, "Wrong File Type", "Category Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(mainWindow, "No File Selected", "Absence Warning", JOptionPane.WARNING_MESSAGE); } } else { JOptionPane.showMessageDialog(mainWindow, "Can't Train Nonexistent Neural Network", "Existential Error", JOptionPane.ERROR_MESSAGE); } } }); getTraininger.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : getTraining.getActionListeners()) { a.actionPerformed(ae); } } }); //this ends the getTraining section of the code getInput.addActionListener(new ActionListener() { //this method/class gets an input set (tsv/csv file) and parses it through the neural network. Somewhat tests that the file is formatted correctly, but cannot give a garuntee. public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0) { int result; result = getTrainingSet.showOpenDialog(mainWindow); if (result == JFileChooser.APPROVE_OPTION) if (getTrainingSet.getSelectedFile().getName().endsWith(".csv") || getTrainingSet.getSelectedFile().getName().endsWith(".tsv") || getTrainingSet.getSelectedFile().getName().endsWith(".txt")) if (net.get(resultsPane.getSelectedIndex()) .parseInputSet(getTrainingSet.getSelectedFile())) { JOptionPane.showMessageDialog(mainWindow, "<html>Method gives no Garuntee that this File is Formatted Correctly<br>(see help for more details)</html>", "Formatting Warning", JOptionPane.WARNING_MESSAGE); if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Self-Organizing Map")) printInitMap(); } else JOptionPane.showMessageDialog(mainWindow, "File Mismatch with Network Configuration", "Correspondence Error", JOptionPane.ERROR_MESSAGE); else JOptionPane.showMessageDialog(mainWindow, "Wrong File Type", "Category Error", JOptionPane.ERROR_MESSAGE); else JOptionPane.showMessageDialog(mainWindow, "No File Selected", "Absence Warning", JOptionPane.WARNING_MESSAGE); } else { JOptionPane.showMessageDialog(mainWindow, "Can't train nonexistent network", "Existential Error", JOptionPane.ERROR_MESSAGE); } } }); //opens and displays a color map of a SOM getColorMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0) { if (netKind.get(resultsPane.getSelectedIndex()).toString().equals("Self-Organizing Map")) { MapNode[][] map; map = net.get(resultsPane.getSelectedIndex()).getMapArray(); int lValue = net.get(resultsPane.getSelectedIndex()).getLatticeValue(); int inputDimensions = net.get(resultsPane.getSelectedIndex()).getInputDimensions(); int[][] colorValues = new int[(lValue * lValue)][3]; double dMax = net.get(resultsPane.getSelectedIndex()).getDataMax(); double dMin = net.get(resultsPane.getSelectedIndex()).getDataMin(); int count = 0; for (int i = 0; i < lValue; i++) { for (int j = 0; j < lValue; j++) { for (int k = 0; k < 3; k++) { Vector tempVec = map[i][j].getWeights(); if (inputDimensions % 3 == 0) { colorValues[count][k] = Integer.parseInt(String.valueOf((Math.round(255 * (Double.parseDouble(String.valueOf(tempVec.elementAt(k)))))))); } if (inputDimensions % 3 == 1) { if (k == 0) colorValues[count][k] = 0; if (k == 1) { colorValues[count][k] = Integer .parseInt(String.valueOf((Math.round(255 * (Double .parseDouble(String.valueOf(tempVec.elementAt(0)))))))); } if (k == 2) colorValues[count][k] = 0; } if (inputDimensions % 3 == 2) { if (k == 2) { colorValues[count][k] = 0; } else colorValues[count][k] = Integer .parseInt(String.valueOf((Math.round(255 * (Double .parseDouble(String.valueOf(tempVec.elementAt(k)))))))); } } count++; } } JFrame frame = new JFrame(); frame.setTitle("Color Map"); frame.setPreferredSize(new Dimension(525, 500)); frame.add(new DrawPanel(colorValues, lValue)); frame.pack(); frame.setVisible(true); } else { JOptionPane.showMessageDialog(mainWindow, "This Feauture is only available for Self-Organizing Maps", "Not a Som Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(mainWindow, "Network does not exist", "Existential Error", JOptionPane.ERROR_MESSAGE); } } }); inputer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : getInput.getActionListeners()) a.actionPerformed(ae); } }); getNet = new JFileChooser(); getNet.setFileFilter(new ANNFileFilter()); //saves the net, or opens save as dialog if net is not saved yet save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0) { if (!path.get(resultsPane.getSelectedIndex()).equals("")) { net.get(resultsPane.getSelectedIndex()) .save(new File(path.get(resultsPane.getSelectedIndex()))); } else { for (ActionListener a : saveAs.getActionListeners()) { a.actionPerformed(ae); } } } else { JOptionPane.showMessageDialog(mainWindow, "Can't save NonExistent Neural Network", "Existential Error", JOptionPane.ERROR_MESSAGE); } } }); saver.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : save.getActionListeners()) { a.actionPerformed(ae); } } }); //opens dialog for saving the net saveAs.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0) { int result, override; String tempName; result = getNet.showSaveDialog(mainWindow); if (result == JFileChooser.APPROVE_OPTION) if ((new File(tempName = getNet.getSelectedFile().getName())).exists() || (new File(tempName + ".ffn")).exists() || (new File(tempName + ".som")).exists() || (new File(tempName + ".hfn")).exists()) { override = JOptionPane.showConfirmDialog(mainWindow, tempName + " already exists, do you want to override?", "File Exists", JOptionPane.YES_NO_OPTION); if (override == JOptionPane.YES_OPTION) { if (net.get(resultsPane.getSelectedIndex()).save(getNet.getSelectedFile())) { if (tempName.endsWith(".ffn") || tempName.endsWith(".som")) { netName.set(resultsPane.getSelectedIndex(), new StringBuffer(tempName)); title.get(resultsPane.getSelectedIndex()).setText(tempName + " "); } else if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Feed Forward Network")) { netName.set(resultsPane.getSelectedIndex(), new StringBuffer(tempName + ".ffn")); title.get(resultsPane.getSelectedIndex()).setText(tempName + ".ffn "); } else if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Self-Organizing Map")) { netName.set(resultsPane.getSelectedIndex(), new StringBuffer(tempName + ".som")); title.get(resultsPane.getSelectedIndex()).setText(tempName + ".som "); } path.set(resultsPane.getSelectedIndex(), getNet.getSelectedFile().getPath()); } else JOptionPane.showMessageDialog(mainWindow, "Could not save file", "File Error", JOptionPane.ERROR_MESSAGE); } } else { if (net.get(resultsPane.getSelectedIndex()).save(getNet.getSelectedFile())) { if (tempName.endsWith(".ffn") || tempName.endsWith(".som") || tempName.endsWith(".hfn")) { netName.set(resultsPane.getSelectedIndex(), new StringBuffer(tempName)); title.get(resultsPane.getSelectedIndex()).setText(tempName + " "); } else if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Feed Forward Network")) { netName.set(resultsPane.getSelectedIndex(), new StringBuffer(tempName + ".ffn")); title.get(resultsPane.getSelectedIndex()).setText(tempName + ".ffn "); } else if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Self-Organizing Map")) { netName.set(resultsPane.getSelectedIndex(), new StringBuffer(tempName + ".som")); title.get(resultsPane.getSelectedIndex()).setText(tempName + ".som "); path.set(resultsPane.getSelectedIndex(), getNet.getSelectedFile().getPath()); } } else JOptionPane.showMessageDialog(mainWindow, "Could not save file", "File Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(mainWindow, "Nothing to Save", "Existetial Error", JOptionPane.ERROR_MESSAGE); } } }); saveAser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : saveAs.getActionListeners()) { a.actionPerformed(ae); } } }); //loads a net load.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { int result; boolean test = true; String tempName; result = getNet.showOpenDialog(mainWindow); if (result == JFileChooser.APPROVE_OPTION) { tempName = getNet.getSelectedFile().getName(); for (StringBuffer names : netName) { if (names.toString().equals(tempName)) test = false; } if (test != false) { //creates and sets the network configuration if (tempName.endsWith(".ffn")) { net.add(new FullyConnectedFeedForwardNet()); } if (tempName.endsWith(".som")) { net.add(new SelfOrganizingMap()); } if (net.get(openNets).load(getNet.getSelectedFile())) try { //adds a close button to the top corner of each tab title.add(new JLabel(tempName + " ")); close.add(new JButton("X")); close.get(openNets).setActionCommand(tempName); close.get(openNets) .setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); close.get(openNets).setMargin(new Insets(0, 0, 0, 0)); tabPanel.add(new JPanel(new GridBagLayout())); tabPanel.get(openNets).setOpaque(false); GridBagConstraints grid = new GridBagConstraints(); grid.fill = GridBagConstraints.HORIZONTAL; grid.gridx = 0; grid.gridy = 0; grid.weightx = 1; tabPanel.get(openNets).add(title.get(openNets), grid); grid.gridx = 1; grid.gridy = 0; grid.weightx = 0; tabPanel.get(openNets).add(close.get(openNets), grid); //adds a loading bar loadingBar.add(new JLabel("", loadingImage, SwingConstants.CENTER)); loadingBar.get(openNets).setHorizontalTextPosition(SwingConstants.LEFT); loadingBar.get(openNets).setVisible(false); path.add(getNet.getSelectedFile().getPath()); netKind.add(new StringBuffer(netType.getSelectedItem().toString())); netName.add(new StringBuffer(tempName)); oneNet.add(new JPanel()); oneNet.get(openNets).setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; //creates the readOut space and formats it so that the scroll pane/text changes size with the window, reserves space for the loading bar readOut.add(new JTextArea("")); readOutLocale.add(new JScrollPane(readOut.get(openNets))); readOut.get(openNets).setEditable(false); constraints.gridx = 0; constraints.gridy = 0; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.gridwidth = 2; constraints.ipady = 90; oneNet.get(openNets).add(readOutLocale.get(openNets), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 1; constraints.ipady = 0; constraints.gridwidth = 2; constraints.anchor = GridBagConstraints.PAGE_END; //add everythign to the tabbed pane oneNet.get(openNets).add(loadingBar.get(openNets), constraints); resultsPane.addTab(netName.get(openNets).toString(), oneNet.get(openNets)); resultsPane.setTabComponentAt(openNets, tabPanel.get(openNets)); //display the starting configuration of the network readOut.get(openNets).append("Network: " + netName.get(openNets) + "\n\n"); resultsPane.setSelectedIndex(openNets++); if (tempName.endsWith(".ffn")) printConnections(); if (tempName.endsWith(".som")) { readOut.get(resultsPane.getSelectedIndex()).append("\nUpdated Map:\n"); printInitMap(); } //unfortunately difficult way that I made to add the close button functionality to close a tab //it works, but there has to be a better way to do this close.get(resultsPane.getSelectedIndex()).addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { int result; result = 0; for (StringBuffer names : netName) { if (ae.getActionCommand().equals(names.toString())) { result = JOptionPane.showConfirmDialog(createFFN, "<html>Exiting Without Saving can Cause you to Lose your Progress<br>Are you sure you want to Continue?</html>", "Close Network", JOptionPane.OK_CANCEL_OPTION); resultsPane.setSelectedIndex(netName.indexOf(names)); } } if (result == JOptionPane.OK_OPTION) { net.remove(resultsPane.getSelectedIndex()); oneNet.remove(resultsPane.getSelectedIndex()); readOutLocale.remove(resultsPane.getSelectedIndex()); readOut.remove(resultsPane.getSelectedIndex()); loadingBar.remove(resultsPane.getSelectedIndex()); tabPanel.remove(resultsPane.getSelectedIndex()); title.remove(resultsPane.getSelectedIndex()); close.remove(resultsPane.getSelectedIndex()); netName.remove(resultsPane.getSelectedIndex()); resultsPane.remove(resultsPane.getSelectedIndex()); openNets--; } } }); } catch (Error e) { JOptionPane.showMessageDialog(mainWindow, "File Formatted Incorrectly", "Formatting Error", JOptionPane.ERROR_MESSAGE); } else { //if file was unable to load, remove the newly created neural network and display an error message net.remove(openNets); JOptionPane.showMessageDialog(mainWindow, "File Formatted Incorrectly", "Formatting Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(mainWindow, "File Already Open", "Duality Error", JOptionPane.ERROR_MESSAGE); } } } }); //associates the load toolbar button with load from the file menu loader.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : load.getActionListeners()) a.actionPerformed(ae); } }); textFileChooser = new JFileChooser(); textFileChooser.setFileFilter(new TextFileFilter()); //exports all text from readout to a text file exportOutput.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0) { int result; result = textFileChooser.showSaveDialog(mainWindow); if (result == JFileChooser.APPROVE_OPTION) { if (textFileChooser.getSelectedFile().exists() || (new File(textFileChooser.getSelectedFile().getPath() + ".txt")).exists()) { result = JOptionPane.showConfirmDialog(mainWindow, "The File you have selected already Exists, do you want to Overwrite it?", "File Exits", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { try { if (textFileChooser.getSelectedFile().getPath().endsWith(".txt")) FileUtils.writeStringToFile(textFileChooser.getSelectedFile(), readOut.get(resultsPane.getSelectedIndex()).getText()); else FileUtils.writeStringToFile( new File(textFileChooser.getSelectedFile().getPath() + ".txt"), readOut.get(resultsPane.getSelectedIndex()).getText()); JOptionPane.showMessageDialog(mainWindow, "Succesfully wrote readout to file"); } catch (Exception e) { JOptionPane.showMessageDialog(mainWindow, "Could not write to file", "Error", JOptionPane.ERROR_MESSAGE); } } } else { try { if (textFileChooser.getSelectedFile().getPath().endsWith(".txt")) FileUtils.writeStringToFile(textFileChooser.getSelectedFile(), readOut.get(resultsPane.getSelectedIndex()).getText()); else FileUtils.writeStringToFile( new File(textFileChooser.getSelectedFile().getPath() + ".txt"), readOut.get(resultsPane.getSelectedIndex()).getText()); JOptionPane.showMessageDialog(mainWindow, "Succesfully wrote readout to file"); } catch (Exception e) { JOptionPane.showMessageDialog(mainWindow, "Could not write to file", "Error", JOptionPane.ERROR_MESSAGE); } } } } else { JOptionPane.showMessageDialog(mainWindow, "Nothing to Export", "Existential Error", JOptionPane.ERROR_MESSAGE); } } }); projectFileChooser = new JFileChooser(); projectFileChooser.setFileFilter(new ProjectFileFilter()); //exports a neural network to a java/android project exportNet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { int result, override, override2; String tempName; String templateFile; String directory; String path; if (resultsPane.getTabCount() != 0) { result = projectFileChooser.showSaveDialog(mainWindow); if (result == JFileChooser.APPROVE_OPTION) { path = projectFileChooser.getSelectedFile().getPath(); directory = projectFileChooser.getSelectedFile().getPath().substring(0, projectFileChooser.getSelectedFile().getPath().lastIndexOf(File.separator)); tempName = projectFileChooser.getSelectedFile().getName(); if (projectFileChooser.getSelectedFile().exists() || (new File(directory, tempName + ".java")).exists()) { override = JOptionPane.showConfirmDialog(mainWindow, "Java Class File" + tempName + " already exists, do you want to overwrite it?", "File Exists", JOptionPane.YES_NO_OPTION); if (override == JOptionPane.YES_OPTION) { try { if (!(new File(directory, "ann")).exists()) FileUtils.copyDirectoryToDirectory( FileUtils.toFile(ClassLoader.getSystemResource("ann/")), new File(directory)); if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Feed Forward Network")) { templateFile = FileUtils.readFileToString(FileUtils .toFile(ClassLoader.getSystemResource("ann/FFNTemplate.txt"))); templateFile = templateFile.replaceAll("yourpackagename", (new File(directory)).getName()); templateFile = templateFile.replaceAll("YourProjectName", projectFileChooser.getSelectedFile().getName()); if (netName.get(resultsPane.getSelectedIndex()).toString().endsWith(".ffn")) templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName .get(resultsPane.getSelectedIndex()).toString()); else templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName.get(resultsPane.getSelectedIndex()).toString() + ".ffn"); if (path.indexOf('.') > 0) { FileUtils.writeStringToFile( new File(path.substring(0, path.lastIndexOf('.')) + ".java"), templateFile); } else FileUtils.writeStringToFile(new File(path + ".java"), templateFile); if ((new File(directory, (tempName = netName.get(resultsPane.getSelectedIndex()) .toString()))).exists() || (new File(directory, tempName + ".ffn")).exists()) { override2 = JOptionPane.showConfirmDialog(mainWindow, "Neural Network " + tempName + " already exists, do you want to overwrite it?", "File Exists", JOptionPane.YES_NO_OPTION); if (override2 == JOptionPane.YES_OPTION) if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } else { if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } } else if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Self-Organizing Map")) { templateFile = FileUtils.readFileToString(FileUtils .toFile(ClassLoader.getSystemResource("ann/SOMTemplate.txt"))); templateFile = templateFile.replaceAll("yourpackagename", (new File(directory)).getName()); templateFile = templateFile.replaceAll("YourProjectName", projectFileChooser.getSelectedFile().getName()); if (netName.get(resultsPane.getSelectedIndex()).toString().endsWith(".som")) templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName .get(resultsPane.getSelectedIndex()).toString()); else templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName.get(resultsPane.getSelectedIndex()).toString() + ".som"); if (path.indexOf('.') > 0) { FileUtils.writeStringToFile( new File(path.substring(0, path.lastIndexOf('.')) + ".java"), templateFile); } else FileUtils.writeStringToFile(new File(path + ".java"), templateFile); if ((new File(directory, (tempName = netName.get(resultsPane.getSelectedIndex()) .toString()))).exists() || (new File(directory, tempName + ".som")).exists()) { override2 = JOptionPane.showConfirmDialog(mainWindow, "Neural Network " + tempName + " already exists, do you want to overwrite it?", "File Exists", JOptionPane.YES_NO_OPTION); if (override2 == JOptionPane.YES_OPTION) if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } else { if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } } } catch (IOException io) { System.out.println(io); } } } else { try { if (!(new File(directory, "ann")).exists()) FileUtils.copyDirectoryToDirectory( FileUtils.toFile(ClassLoader.getSystemResource("ann/")), new File(directory)); if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Feed Forward Network")) { templateFile = FileUtils.readFileToString( FileUtils.toFile(ClassLoader.getSystemResource("ann/FFNTemplate.txt"))); templateFile = templateFile.replaceAll("yourpackagename", (new File(directory)).getName()); templateFile = templateFile.replaceAll("YourProjectName", projectFileChooser.getSelectedFile().getName()); if (netName.get(resultsPane.getSelectedIndex()).toString().endsWith(".ffn")) templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName.get(resultsPane.getSelectedIndex()).toString()); else templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName.get(resultsPane.getSelectedIndex()).toString() + ".ffn"); if (path.indexOf('.') > 0) { FileUtils.writeStringToFile( new File(path.substring(0, path.lastIndexOf('.')) + ".java"), templateFile); } else FileUtils.writeStringToFile(new File(path + ".java"), templateFile); if ((new File(directory + File.separator + (tempName = netName.get(resultsPane.getSelectedIndex()).toString()))) .exists() || (new File(directory + File.separator + tempName + ".ffn")) .exists()) { override2 = JOptionPane.showConfirmDialog(mainWindow, "Neural Network " + tempName + " already exists, do you want to overwrite it?", "File Exists", JOptionPane.YES_NO_OPTION); if (override2 == JOptionPane.YES_OPTION) if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } else { if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } } else if (netKind.get(resultsPane.getSelectedIndex()).toString() .equals("Self-Organizing Map")) { templateFile = FileUtils.readFileToString( FileUtils.toFile(ClassLoader.getSystemResource("ann/SOMTemplate.txt"))); templateFile = templateFile.replaceAll("yourpackagename", (new File(directory)).getName()); templateFile = templateFile.replaceAll("YourProjectName", projectFileChooser.getSelectedFile().getName()); if (netName.get(resultsPane.getSelectedIndex()).toString().endsWith(".som")) templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName.get(resultsPane.getSelectedIndex()).toString()); else templateFile = templateFile.replaceAll("networkName", (new File(directory)).getName() + File.separator + netName.get(resultsPane.getSelectedIndex()).toString() + ".som"); if (path.indexOf('.') > 0) { FileUtils.writeStringToFile( new File(path.substring(0, path.lastIndexOf('.')) + ".java"), templateFile); } else FileUtils.writeStringToFile(new File(path + ".java"), templateFile); if ((new File(directory, (tempName = netName.get(resultsPane.getSelectedIndex()).toString()))) .exists() || (new File(directory, tempName + ".som")).exists()) { override2 = JOptionPane.showConfirmDialog(mainWindow, "Neural Network " + tempName + " already exists, do you want to overwrite it?", "File Exists", JOptionPane.YES_NO_OPTION); if (override2 == JOptionPane.YES_OPTION) if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } else { if (net.get(resultsPane.getSelectedIndex()) .save(new File(directory + File.separator + tempName))) { JOptionPane.showMessageDialog(mainWindow, "Network Exported to " + (new File(directory)).getName()); } else { JOptionPane.showMessageDialog(mainWindow, "Couldn't save neural network to file, the rest of the project is exported", "Write Error", JOptionPane.ERROR_MESSAGE); } } } } catch (IOException io) { System.out.println(io); } } } } else { JOptionPane.showMessageDialog(mainWindow, "Can't Export NonExistent Neural Network", "Existential Error", JOptionPane.ERROR_MESSAGE); } } }); toJava.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : exportNet.getActionListeners()) a.actionPerformed(ae); } }); //settings menu changeConfig.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Feed Forward Network")) { modifyFFNDialog = new JDialog(mainWindow, "Network Settings", true); modifyFFNDialog.setSize(500, 500); modifyFFNDialog.setLayout(new GridBagLayout()); GridBagConstraints asdf = new GridBagConstraints(); asdf.gridwidth = 5; asdf.gridheight = 1; asdf.gridx = 0; asdf.gridy = 0; asdf.fill = GridBagConstraints.HORIZONTAL; modifyFFNDialog.add(new JSeparator(), asdf); asdf.gridwidth = 5; asdf.gridheight = 15; asdf.weightx = 1.0; asdf.weighty = 1.0; asdf.gridx = 0; asdf.gridy = 1; asdf.fill = GridBagConstraints.BOTH; settings = new JTextArea(); settings.setEditable(false); settings.setBorder(BorderFactory.createEtchedBorder()); modifyFFNDialog.add(settings, asdf); asdf.fill = GridBagConstraints.HORIZONTAL; asdf.gridwidth = 5; asdf.gridheight = 1; asdf.gridx = 0; asdf.gridy = 16; modifyFFNDialog.add(new JSeparator(), asdf); asdf.gridwidth = 2; asdf.gridx = 7; asdf.gridy = 0; modifyFFNDialog.add(new JSeparator(), asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 1; learningRateL = new JLabel("Set Learning Rate:"); modifyFFNDialog.add(learningRateL, asdf); asdf.gridx = 7; asdf.gridy = 2; asdf.fill = GridBagConstraints.HORIZONTAL; learningRateTF = new JFormattedTextField(new NumberFormatter(NumberFormat.getNumberInstance())); learningRateTF.setText(""); modifyFFNDialog.add(learningRateTF, asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 3; momentumL = new JLabel("Set Momentum:"); modifyFFNDialog.add(momentumL, asdf); asdf.gridx = 7; asdf.gridy = 4; asdf.fill = GridBagConstraints.HORIZONTAL; momentumTF = new JFormattedTextField(new NumberFormatter(NumberFormat.getNumberInstance())); momentumTF.setText(""); modifyFFNDialog.add(momentumTF, asdf); asdf.gridx = 7; asdf.gridy = 5; modifyFFNDialog.add(new JSeparator(), asdf); asdf.fill = GridBagConstraints.NONE; /*asdf.gridwidth = 2; asdf.gridheight = 1; asdf.gridx = 7; asdf.gridy = 6; setNoise = new JLabel("Use Noise: "); modifyFFNDialog.add(setNoise, asdf); asdf.gridx = 7; asdf.gridy = 7; asdf.gridwidth = 1; noiseOn = new JRadioButton("yes"); noiseOff = new JRadioButton("no"); noiseGroup = new ButtonGroup(); noiseGroup.add(noiseOn); noiseGroup.add(noiseOff); modifyFFNDialog.add(noiseOn,asdf); asdf.gridx = 8; asdf.gridy = 7; modifyFFNDialog.add(noiseOff,asdf); asdf.gridx = 7; asdf.gridy = 8; asdf.gridwidth = 2; setNoiseRange = new JButton("Set Noise Range"); modifyFFNDialog.add(setNoiseRange,asdf); asdf.gridx = 7; asdf.gridy = 9; setNoiseTiming = new JButton("Set Noise Timing"); modifyFFNDialog.add(setNoiseTiming,asdf);*/ asdf.gridx = 7; asdf.gridy = 10; asdf.fill = GridBagConstraints.HORIZONTAL; modifyFFNDialog.add(new JSeparator(), asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 11; setTrainingStyle = new JLabel("Set Training Style:"); modifyFFNDialog.add(setTrainingStyle, asdf); asdf.gridx = 7; asdf.gridy = 12; asdf.gridwidth = 1; batchOn = new JRadioButton("batch"); onlineOn = new JRadioButton("online"); batchGroup = new ButtonGroup(); batchGroup.add(batchOn); batchGroup.add(onlineOn); modifyFFNDialog.add(batchOn, asdf); asdf.gridx = 8; modifyFFNDialog.add(onlineOn, asdf); asdf.gridx = 7; asdf.gridy = 13; asdf.gridwidth = 2; asdf.fill = GridBagConstraints.HORIZONTAL; modifyFFNDialog.add(new JSeparator(), asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 14; modifyBiases = new JButton("Modify Biases"); modifyFFNDialog.add(modifyBiases, asdf); asdf.gridx = 7; asdf.gridy = 15; trainingCompletionButton = new JButton("Modify End Condition"); modifyFFNDialog.add(trainingCompletionButton, asdf); asdf.fill = GridBagConstraints.HORIZONTAL; asdf.gridy = 16; modifyFFNDialog.add(new JSeparator(), asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridwidth = 1; asdf.gridx = 3; asdf.gridy = 17; asdf.anchor = GridBagConstraints.PAGE_END; modifyFFN = new JButton("OK"); modifyFFNDialog.add(modifyFFN, asdf); asdf.gridx = 7; cancelModifyFFN = new JButton("Cancel"); modifyFFNDialog.add(cancelModifyFFN, asdf); settings.setText(""); settings.append( "\n\n\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append("\n\nMomentum: " + net.get(resultsPane.getSelectedIndex()).getMomentum()); settings.append("\n\nTraining Style: "); if (net.get(resultsPane.getSelectedIndex()).getBatchvOnline()) { settings.append("batch"); batchOn.setSelected(true); } else { settings.append("online"); onlineOn.setSelected(true); } settings.append("\n\nTraining End Condition: "); if (net.get(resultsPane.getSelectedIndex()).getUseIteration()) { settings.append("Iterative"); settings.append( "\n\nIterations: " + net.get(resultsPane.getSelectedIndex()).getIterations()); } else { settings.append("Ideal Error"); settings.append( "\n\nIdeal Error: " + net.get(resultsPane.getSelectedIndex()).getIdealError()); } //expiremental feature, needs work on the back end to be properly implemented modifyBiases.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JButton addBiases, removeBiases; biasesDialog = new JDialog(modifyFFNDialog, "Set Biases"); biasesDialog.setSize(200, 46); biasesDialog.setLayout(new GridLayout(2, 1)); addBiases = new JButton("Add Bias"); removeBiases = new JButton("Remove Bias"); biasesDialog.add(addBiases); biasesDialog.add(removeBiases); addBiases.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JLabel howManyBiasLayersLabel, whatBiasNodeLabel, whatBiasValueLabel; final JFormattedTextField howManyBiasLayers, whatBiasNode, whatBiasValue; JButton addBiasOK, addBiasCancel; biasesDialog.setVisible(false); addBiasDialog = new JDialog(modifyFFNDialog, "Add Bias"); addBiasDialog.setSize(756, 90); addBiasDialog.setLayout(new GridLayout(4, 2)); howManyBiasLayersLabel = new JLabel("What Layer will get the Bias?"); howManyBiasLayers = new JFormattedTextField( new NumberFormatter(NumberFormat.getIntegerInstance())); whatBiasNodeLabel = new JLabel("Which Node will get the Bias?"); whatBiasNode = new JFormattedTextField( new NumberFormatter(NumberFormat.getIntegerInstance())); whatBiasValueLabel = new JLabel("What Value will the Bias have?"); whatBiasValue = new JFormattedTextField( new NumberFormatter(NumberFormat.getInstance())); addBiasOK = new JButton("OK"); addBiasCancel = new JButton("Cancel"); addBiasDialog.add(howManyBiasLayersLabel); addBiasDialog.add(howManyBiasLayers); addBiasDialog.add(whatBiasNodeLabel); addBiasDialog.add(whatBiasNode); addBiasDialog.add(whatBiasValueLabel); addBiasDialog.add(whatBiasValue); addBiasDialog.add(addBiasOK); addBiasDialog.add(addBiasCancel); addBiasOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!howManyBiasLayers.getText().equals("") && !whatBiasNode.getText().equals("") && !whatBiasValue.getText().equals("")) { addBiasDialog.setVisible(false); if (net.get(resultsPane.getSelectedIndex()).addBias( Integer.parseInt(howManyBiasLayers.getText()) - 1, Integer.parseInt(whatBiasNode.getText()) - 1, Double.parseDouble(whatBiasValue.getText()))) { } else { JOptionPane.showMessageDialog(modifyFFNDialog, "Existential Error", "Invalid Node for Bias", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(modifyFFNDialog, "Form Error", "Form not completed", JOptionPane.ERROR_MESSAGE); } } }); addBiasCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { addBiasDialog.setVisible(false); } }); addBiasDialog.setVisible(true); } }); removeBiases.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JLabel howManyBiasLayersLabel, whatBiasNodeLabel; final JFormattedTextField howManyBiasLayers, whatBiasNode; JButton addBiasOK, addBiasCancel; biasesDialog.setVisible(false); removeBiasDialog = new JDialog(modifyFFNDialog, "Remove Bias"); removeBiasDialog.setSize(756, 90); removeBiasDialog.setLayout(new GridLayout(3, 2)); howManyBiasLayersLabel = new JLabel("What Layer will lose the Bias?"); howManyBiasLayers = new JFormattedTextField( new NumberFormatter(NumberFormat.getIntegerInstance())); whatBiasNodeLabel = new JLabel("Which Node will get the Bias?"); whatBiasNode = new JFormattedTextField( new NumberFormatter(NumberFormat.getIntegerInstance())); addBiasOK = new JButton("OK"); addBiasCancel = new JButton("Cancel"); removeBiasDialog.add(howManyBiasLayersLabel); removeBiasDialog.add(howManyBiasLayers); removeBiasDialog.add(whatBiasNodeLabel); removeBiasDialog.add(whatBiasNode); removeBiasDialog.add(addBiasOK); removeBiasDialog.add(addBiasCancel); addBiasOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!howManyBiasLayers.getText().equals("") && !whatBiasNode.getText().equals("")) { addBiasDialog.setVisible(false); if (net.get(resultsPane.getSelectedIndex()).removeBias( Integer.parseInt(howManyBiasLayers.getText()) - 1, Integer.parseInt(whatBiasNode.getText()) - 1)) { } else { JOptionPane.showMessageDialog(modifyFFNDialog, "Existential Error", "Invalid Node for Bias", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(modifyFFNDialog, "Form Error", "Form not completed", JOptionPane.ERROR_MESSAGE); } } }); addBiasCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { addBiasDialog.setVisible(false); } }); removeBiasDialog.setVisible(true); } }); biasesDialog.setVisible(true); } }); trainingCompletionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { final JDialog iterationsDialog; JLabel numberOfIterationsLabel; final JFormattedTextField numberOfIterations; JButton iterationsOK, iterationsCancel; iterationsDialog = new JDialog(modifyFFNDialog, "Set Iterations"); iterationsDialog.setSize(765, 75); iterationsDialog.setLayout(new GridLayout(2, 2)); numberOfIterationsLabel = new JLabel("How Many Iterations do you want to Train?"); numberOfIterations = new JFormattedTextField( new NumberFormatter(NumberFormat.getIntegerInstance())); iterationsOK = new JButton("OK"); iterationsCancel = new JButton("Cancel"); iterationsDialog.add(numberOfIterationsLabel); iterationsDialog.add(numberOfIterations); iterationsDialog.add(iterationsOK); iterationsDialog.add(iterationsCancel); iterationsOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!numberOfIterations.getText().equals("")) { iterationsDialog.setVisible(false); if (net.get(resultsPane.getSelectedIndex()) .setIterations(Integer.parseInt(numberOfIterations.getText()))) { settings.setText(""); settings.append("\n\n\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append("\n\nMomentum: " + net.get(resultsPane.getSelectedIndex()).getMomentum()); settings.append("\n\nTraining Style: "); if (net.get(resultsPane.getSelectedIndex()).getBatchvOnline()) { settings.append("batch"); batchOn.setSelected(true); } else { settings.append("online"); onlineOn.setSelected(true); } settings.append("\n\nTraining End Condition: "); if (net.get(resultsPane.getSelectedIndex()).getUseIteration()) { settings.append("Iterative"); settings.append("\n\nIterations: " + net.get(resultsPane.getSelectedIndex()).getIterations()); } else { settings.append("Ideal Error"); settings.append("\n\nIdeal Error: " + net.get(resultsPane.getSelectedIndex()).getIdealError()); } modifyFFNDialog.setVisible(true); } else { JOptionPane.showMessageDialog(modifyFFNDialog, "Invalid Number of Iterations", "Math Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog(iterationsDialog, "Field not filled out", "Form Error", JOptionPane.ERROR_MESSAGE); } } }); iterationsCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { iterationsDialog.setVisible(false); } }); iterationsDialog.setVisible(true); } }); modifyFFN.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!learningRateTF.getText().equals("")) { net.get(resultsPane.getSelectedIndex()) .setLearningRate(Double.parseDouble(learningRateTF.getText())); learningRateTF.setText(""); } if (!momentumTF.getText().equals("")) { net.get(resultsPane.getSelectedIndex()) .setMomentum(Double.parseDouble(momentumTF.getText())); momentumTF.setText(""); } if (batchOn.isSelected()) { net.get(resultsPane.getSelectedIndex()).setBatchvOnline(true); } else { net.get(resultsPane.getSelectedIndex()).setBatchvOnline(false); } modifyFFNDialog.setVisible(false); } }); learningRateTF.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (learningRateTF.getText() != "") { net.get(resultsPane.getSelectedIndex()) .setLearningRate(Double.parseDouble(learningRateTF.getText())); } settings.setText(""); settings.append("\n\n\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append( "\n\nMomentum: " + net.get(resultsPane.getSelectedIndex()).getMomentum()); settings.append("\n\nTraining Style: "); if (net.get(resultsPane.getSelectedIndex()).getBatchvOnline()) { settings.append("batch"); batchOn.setSelected(true); } else { settings.append("online"); onlineOn.setSelected(true); } settings.append("\n\nTraining End Condition: "); if (net.get(resultsPane.getSelectedIndex()).getUseIteration()) { settings.append("Iterative"); settings.append("\n\nIterations: " + net.get(resultsPane.getSelectedIndex()).getIterations()); } else { settings.append("Ideal Error"); settings.append("\n\nIdeal Error: " + net.get(resultsPane.getSelectedIndex()).getIdealError()); } modifyFFNDialog.setVisible(true); } }); momentumTF.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (momentumTF.getText() != "") { net.get(resultsPane.getSelectedIndex()) .setMomentum(Double.parseDouble(momentumTF.getText())); } settings.setText(""); settings.append("\n\n\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append( "\n\nMomentum: " + net.get(resultsPane.getSelectedIndex()).getMomentum()); settings.append("\n\nTraining Style: "); if (net.get(resultsPane.getSelectedIndex()).getBatchvOnline()) { settings.append("batch"); batchOn.setSelected(true); } else { settings.append("online"); onlineOn.setSelected(true); } settings.append("\n\nTraining End Condition: "); if (net.get(resultsPane.getSelectedIndex()).getUseIteration()) { settings.append("Iterative"); settings.append("\n\nIterations: " + net.get(resultsPane.getSelectedIndex()).getIterations()); } else { settings.append("Ideal Error"); settings.append("\n\nIdeal Error: " + net.get(resultsPane.getSelectedIndex()).getIdealError()); } modifyFFNDialog.setVisible(true); } }); cancelModifyFFN.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { modifyFFNDialog.setVisible(false); } }); modifyFFNDialog.setVisible(true); } if (resultsPane.getTabCount() != 0 && netKind.get(resultsPane.getSelectedIndex()).toString().equals("Self-Organizing Map")) { modifySOMDialog = new JDialog(mainWindow, "Network Settings", true); modifySOMDialog.setSize(500, 400); modifySOMDialog.setLayout(new GridBagLayout()); GridBagConstraints asdf = new GridBagConstraints(); asdf.gridwidth = 5; asdf.gridheight = 1; asdf.gridx = 0; asdf.gridy = 0; asdf.fill = GridBagConstraints.HORIZONTAL; modifySOMDialog.add(new JSeparator(), asdf); asdf.gridwidth = 5; asdf.gridheight = 15; asdf.weightx = 1.0; asdf.weighty = 1.0; asdf.gridx = 0; asdf.gridy = 1; asdf.fill = GridBagConstraints.BOTH; settings = new JTextArea(); settings.setEditable(false); settings.setBorder(BorderFactory.createEtchedBorder()); modifySOMDialog.add(settings, asdf); asdf.fill = GridBagConstraints.HORIZONTAL; asdf.gridwidth = 5; asdf.gridheight = 1; asdf.gridx = 0; asdf.gridy = 16; modifySOMDialog.add(new JSeparator(), asdf); asdf.gridwidth = 2; asdf.gridx = 7; asdf.gridy = 0; modifySOMDialog.add(new JSeparator(), asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 1; mIterationL = new JLabel("Set Number of Iterations:"); modifySOMDialog.add(mIterationL, asdf); asdf.gridx = 7; asdf.gridy = 2; asdf.fill = GridBagConstraints.HORIZONTAL; mIterationTF = new JFormattedTextField(new NumberFormatter(NumberFormat.getIntegerInstance())); mIterationTF.setText(""); modifySOMDialog.add(mIterationTF, asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 3; mLRL = new JLabel("Set Learning Rate (0-1):"); modifySOMDialog.add(mLRL, asdf); asdf.gridx = 7; asdf.gridy = 4; asdf.fill = GridBagConstraints.HORIZONTAL; mLRTF = new JFormattedTextField(new NumberFormatter(NumberFormat.getNumberInstance())); mLRTF.setText(""); modifySOMDialog.add(mLRTF, asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 5; mMaxL = new JLabel("Set Data Maximum:"); modifySOMDialog.add(mMaxL, asdf); asdf.gridx = 7; asdf.gridy = 6; asdf.fill = GridBagConstraints.HORIZONTAL; mMaxTF = new JFormattedTextField(new NumberFormatter(NumberFormat.getNumberInstance())); mMaxTF.setText(""); modifySOMDialog.add(mMaxTF, asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridx = 7; asdf.gridy = 7; mMinL = new JLabel("Set Data Minimum:"); modifySOMDialog.add(mMinL, asdf); asdf.gridx = 7; asdf.gridy = 8; asdf.fill = GridBagConstraints.HORIZONTAL; mMinTF = new JFormattedTextField(new NumberFormatter(NumberFormat.getNumberInstance())); mMinTF.setText(""); modifySOMDialog.add(mMinTF, asdf); asdf.fill = GridBagConstraints.HORIZONTAL; asdf.gridy = 16; modifySOMDialog.add(new JSeparator(), asdf); asdf.fill = GridBagConstraints.NONE; asdf.gridwidth = 1; asdf.gridx = 3; asdf.gridy = 17; asdf.anchor = GridBagConstraints.PAGE_END; modifySOM = new JButton("OK"); modifySOMDialog.add(modifySOM, asdf); asdf.gridx = 7; cancelModifySOM = new JButton("Cancel"); modifySOMDialog.add(cancelModifySOM, asdf); settings.setText(""); settings.append("\n\nNumber of Iterations: " + net.get(resultsPane.getSelectedIndex()).getNumIterations()); settings.append( "\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append("\n\nData Maximum: " + net.get(resultsPane.getSelectedIndex()).getDataMax()); settings.append("\n\nData Minimum: " + net.get(resultsPane.getSelectedIndex()).getDataMin()); mIterationTF.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (mIterationTF.getText() != "") { net.get(resultsPane.getSelectedIndex()) .setNumIterations(Integer.parseInt(mIterationTF.getText())); settings.setText(""); settings.append("\n\nNumber of Iterations: " + net.get(resultsPane.getSelectedIndex()).getNumIterations()); settings.append("\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append("\n\nData Maximum: " + net.get(resultsPane.getSelectedIndex()).getDataMax()); settings.append("\n\nData Minimum: " + net.get(resultsPane.getSelectedIndex()).getDataMin()); } } }); mLRTF.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if ((mLRTF.getText() != "") && ((Double.parseDouble(mLRTF.getText())) <= 1.0)) { net.get(resultsPane.getSelectedIndex()) .setLearningRate(Double.parseDouble(mLRTF.getText())); settings.setText(""); settings.append("\n\nNumber of Iterations: " + net.get(resultsPane.getSelectedIndex()).getNumIterations()); settings.append("\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append("\n\nData Maximum: " + net.get(resultsPane.getSelectedIndex()).getDataMax()); settings.append("\n\nData Minimum: " + net.get(resultsPane.getSelectedIndex()).getDataMin()); } else { JOptionPane.showMessageDialog(mLRTF, "Pick a number from 0 - 1", "Incorrect Value", JOptionPane.ERROR_MESSAGE); mLRTF.setText(""); } } }); mMaxTF.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if ((mMaxTF.getText() != "") && (((Double.parseDouble(mMaxTF.getText())) > net .get(resultsPane.getSelectedIndex()).getDataMin()))) { net.get(resultsPane.getSelectedIndex()) .setDataMax(Double.parseDouble(mMaxTF.getText())); settings.setText(""); settings.append("\n\nNumber of Iterations: " + net.get(resultsPane.getSelectedIndex()).getNumIterations()); settings.append("\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append("\n\nData Maximum: " + net.get(resultsPane.getSelectedIndex()).getDataMax()); settings.append("\n\nData Minimum: " + net.get(resultsPane.getSelectedIndex()).getDataMin()); } else { JOptionPane.showMessageDialog(mMaxTF, "Max value must be greater than Min value", "Incorrect Value", JOptionPane.ERROR_MESSAGE); mMaxTF.setText(""); } } }); mMinTF.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if ((mMinTF.getText() != "") && ((Double.parseDouble(mMinTF.getText())) < net .get(resultsPane.getSelectedIndex()).getDataMax())) { net.get(resultsPane.getSelectedIndex()) .setDataMin(Double.parseDouble(mMinTF.getText())); settings.setText(""); settings.append("\n\nNumber of Iterations: " + net.get(resultsPane.getSelectedIndex()).getNumIterations()); settings.append("\n\nLearning Rate: " + net.get(resultsPane.getSelectedIndex()).getLearningRate()); settings.append("\n\nData Maximum: " + net.get(resultsPane.getSelectedIndex()).getDataMax()); settings.append("\n\nData Minimum: " + net.get(resultsPane.getSelectedIndex()).getDataMin()); } else { JOptionPane.showMessageDialog(mMinTF, "Min value must be less than Max value", "Incorrect Value", JOptionPane.ERROR_MESSAGE); mMinTF.setText(""); } } }); modifySOM.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { boolean error = false; if (!("".equals(mIterationTF.getText()))) { net.get(resultsPane.getSelectedIndex()) .setNumIterations(Integer.parseInt(mIterationTF.getText())); } if (!("".equals(mLRTF.getText()))) { if ((Double.parseDouble(mLRTF.getText())) > 1.0) { error = true; mLRTF.setText(""); } else net.get(resultsPane.getSelectedIndex()) .setLearningRate(Double.parseDouble(mLRTF.getText())); } if (!("".equals(mMaxTF.getText()))) { if (((Double.parseDouble(mMaxTF.getText())) < net .get(resultsPane.getSelectedIndex()).getDataMin())) { error = true; mMaxTF.setText(""); } else net.get(resultsPane.getSelectedIndex()) .setDataMax(Double.parseDouble(mMaxTF.getText())); } if (!("".equals(mMinTF.getText()))) { if ((Double.parseDouble(mMinTF.getText())) > net.get(resultsPane.getSelectedIndex()) .getDataMax()) { error = true; mMinTF.setText(""); } else net.get(resultsPane.getSelectedIndex()) .setDataMin(Double.parseDouble(mMinTF.getText())); } if (error == true) { JOptionPane.showMessageDialog(modifySOMDialog, "One or more fields have incorrect values", "Incorrect Value", JOptionPane.ERROR_MESSAGE); } else { modifySOMDialog.setVisible(false); readOut.get(resultsPane.getSelectedIndex()).append("\nUpdated Map:\n"); printInitMap(); } } }); cancelModifySOM.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { modifySOMDialog.setVisible(false); } }); modifySOMDialog.setVisible(true); } } }); modify.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : changeConfig.getActionListeners()) { a.actionPerformed(ae); } } }); //The following code is for the newNet button under file: //create a dialog to be activated when "New Network" is pressed in the file menu newDialog = new JDialog(mainWindow, "New Network", true); newDialog.setSize(375, 100); newDialog.setLayout(new GridLayout(3, 2)); //going to change the layout to GridBagLayout for better customization name = new JLabel("Network Name:"); newName = new JTextField(10); type = new JLabel("Type of Network:"); netTypes = new String[] { "Feed Forward Network", "Self-Organizing Map" }; netType = new JComboBox<String>(netTypes); netType.setSelectedItem("Feed Forward Network"); createNewNet = new JButton("create"); cancelNew = new JButton("cancel"); newDialog.add(name); newDialog.add(newName); newDialog.add(type); newDialog.add(netType); newDialog.add(createNewNet); newDialog.add(cancelNew); //utilities for a second dialog(Feed Forward Network) in the process of creating a new network number = new JLabel("Enter the number of layers you want for your network:"); howManyLayers = new JFormattedTextField(new NumberFormatter(NumberFormat.getIntegerInstance())); createFFNArchitecture = new JButton("OK"); cancelFFN = new JButton("Cancel"); howManyNodes = new JFormattedTextField(new NumberFormatter(NumberFormat.getIntegerInstance())); createFFN = new JButton("OK"); cancelNodes = new JButton("Cancel"); //Written by Michael Scott somLattice = new JLabel(" Lattice number for your Map:"); somLatticeField = new JFormattedTextField(new NumberFormatter(NumberFormat.getIntegerInstance())); somLatticeField.setFocusLostBehavior(1); somMax = new JLabel(" Maximum value of your input (if known):"); somMaxField = new JFormattedTextField(new NumberFormatter(NumberFormat.getInstance())); somMaxField.setFocusLostBehavior(1); somMin = new JLabel(" Minimum value of your input (if known):"); somMinField = new JFormattedTextField(new NumberFormatter(NumberFormat.getInstance())); somMinField.setFocusLostBehavior(1); somDim = new JLabel(" Node Dimensions:"); somDimField = new JFormattedTextField(new NumberFormatter(NumberFormat.getIntegerInstance())); somDimField.setFocusLostBehavior(1); createSOM = new JButton("OK"); cancelSOM = new JButton("Cancel"); //displays the newDialog window when newNet is pressed newNet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { newDialog.setVisible(true); } }); newwer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { newDialog.setVisible(true); } }); //makes hitting enter in the text box do the same thing as clicking "create" newName.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : createNewNet.getActionListeners()) { a.actionPerformed(ae); } } }); //when create net is pressed, this reads the selections from the newNet dialog and creates the approriate next dialog createNewNet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { int test; test = 0; for (StringBuffer names : netName) { if (names.toString().equals(newName.getText())) test = 1; } if (test == 0) if (!newName.getText().equals("")) { if (netType.getSelectedIndex() == 0) { //if the net selected is Feed Forward, create and display the prompt for a feed forward network newDialog.setVisible(false); fFNDialog = new JDialog(mainWindow, newName.getText(), true); fFNDialog.setSize(919, 65); fFNDialog.setLayout(new GridLayout(2, 2)); fFNDialog.add(number); fFNDialog.add(howManyLayers); fFNDialog.add(createFFNArchitecture); fFNDialog.add(cancelFFN); fFNDialog.setVisible(true); } //Written by Michael Scott if (netType.getSelectedIndex() == 1) { newDialog.setVisible(false); sOMDialog = new JDialog(mainWindow, newName.getText(), true); sOMDialog.setSize(500, 180); sOMDialog.setLayout(new GridLayout(5, 2)); sOMDialog.add(somLattice); sOMDialog.add(somLatticeField); sOMDialog.add(somDim); sOMDialog.add(somDimField); sOMDialog.add(somMax); sOMDialog.add(somMaxField); sOMDialog.add(somMin); sOMDialog.add(somMinField); sOMDialog.add(createSOM); sOMDialog.add(cancelSOM); sOMDialog.setVisible(true); } } else JOptionPane.showMessageDialog(createNewNet, "Network must have a Name", "Namelessness Error", JOptionPane.ERROR_MESSAGE); else { JOptionPane.showMessageDialog(createNewNet, "Network " + newName.getText() + " already exists", "Existential Naming Error", JOptionPane.ERROR_MESSAGE); newName.setText(""); } } }); //beginning of section about creating Feed Forward Networks //cancel clears the name field and hides the newDialog dialog cancelNew.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { newDialog.setVisible(false); newName.setText(""); } }); //makes hitting enter the same as clicking "ok" howManyLayers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : createFFNArchitecture.getActionListeners()) { a.actionPerformed(ae); } } }); //create a prompt for the first layer to determine how many nodes will go into the first layer createFFNArchitecture.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!howManyLayers.getText().equals("") && (layers = Integer.parseInt(howManyLayers.getText())) > 1) { nodeConfiguration = new int[layers]; //create an array to hold the node configuration that will be passed to the Net constructor layer = 1; //create a variable to hold the current layer the prompt series is on numberofNodes = new JLabel("How many nodes do you want in layer " + layer + "?"); fFNDialog.setVisible(false); howManyNodesDialog = new JDialog(mainWindow, newName.getText(), true); howManyNodesDialog.setSize(919, 65); howManyNodesDialog.setLayout(new GridLayout(2, 2)); howManyNodesDialog.add(numberofNodes); howManyNodesDialog.add(howManyNodes); howManyNodesDialog.add(createFFN); howManyNodesDialog.add(cancelNodes); howManyNodesDialog.setVisible(true); } else { //if the string is not valid, pop up an error message JOptionPane.showMessageDialog(fFNDialog, "<html>Number Out of Bounds<br>Please Enter a Number Greater than 1</html>", "Out of Bounds", JOptionPane.ERROR_MESSAGE); } } }); //runs each time ok is pressed, until all the layers have a vaule for the number of nodes in the layer createFFN.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (!howManyNodes.getText().equals("") && (nodeConfiguration[layer - 1] = Integer.parseInt(howManyNodes.getText())) > 0) { if (layer == layers) { try { //adds a close button to the top corner of each tab title.add(new JLabel(newName.getText() + " ")); close.add(new JButton("X")); close.get(openNets).setActionCommand(newName.getText()); close.get(openNets).setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); close.get(openNets).setMargin(new Insets(0, 0, 0, 0)); tabPanel.add(new JPanel(new GridBagLayout())); tabPanel.get(openNets).setOpaque(false); GridBagConstraints grid = new GridBagConstraints(); grid.fill = GridBagConstraints.HORIZONTAL; grid.gridx = 0; grid.gridy = 0; grid.weightx = 1; tabPanel.get(openNets).add(title.get(openNets), grid); grid.gridx = 1; grid.gridy = 0; grid.weightx = 0; tabPanel.get(openNets).add(close.get(openNets), grid); //adds a loading bar loadingBar.add(new JLabel("", loadingImage, SwingConstants.CENTER)); loadingBar.get(openNets).setHorizontalTextPosition(SwingConstants.LEFT); loadingBar.get(openNets).setVisible(false); //creates and sets the network configuration net.add(new FullyConnectedFeedForwardNet(nodeConfiguration)); netKind.add(new StringBuffer(netType.getSelectedItem().toString())); netName.add(new StringBuffer(newName.getText())); oneNet.add(new JPanel()); oneNet.get(openNets).setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; //creates the readOut space and formats it so that the scroll pane/text changes size with the window, reserves space for the loading bar readOut.add(new JTextArea("")); readOutLocale.add(new JScrollPane(readOut.get(openNets))); readOut.get(openNets).setEditable(false); constraints.gridx = 0; constraints.gridy = 0; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.gridwidth = 2; constraints.ipady = 90; oneNet.get(openNets).add(readOutLocale.get(openNets), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 1; constraints.ipady = 0; constraints.gridwidth = 2; constraints.anchor = GridBagConstraints.PAGE_END; //add everythign to the tabbed pane oneNet.get(openNets).add(loadingBar.get(openNets), constraints); resultsPane.addTab(netName.get(openNets).toString(), oneNet.get(openNets)); resultsPane.setTabComponentAt(openNets, tabPanel.get(openNets)); path.add(""); //display the starting configuration of the network readOut.get(openNets).append("Network: " + netName.get(openNets) + "\n\n"); resultsPane.setSelectedIndex(openNets++); printConnections(); //erases all the text in the setup fields and closes the window howManyNodes.setValue(null); howManyLayers.setText(""); newName.setText(""); howManyNodesDialog.setVisible(false); //unfortunately difficult way that I made to add the close button functionality to close a tab //it works, but there has to be a better way to do this close.get(resultsPane.getSelectedIndex()).addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { int result; result = 0; for (StringBuffer names : netName) { if (ae.getActionCommand().equals(names.toString())) { result = JOptionPane.showConfirmDialog(createFFN, "<html>Exiting Without Saving can Cause you to Lose your Progress<br>Are you sure you want to Continue?</html>", "Close Network", JOptionPane.OK_CANCEL_OPTION); resultsPane.setSelectedIndex(netName.indexOf(names)); } } if (result == JOptionPane.OK_OPTION) { net.remove(resultsPane.getSelectedIndex()); oneNet.remove(resultsPane.getSelectedIndex()); readOutLocale.remove(resultsPane.getSelectedIndex()); readOut.remove(resultsPane.getSelectedIndex()); loadingBar.remove(resultsPane.getSelectedIndex()); tabPanel.remove(resultsPane.getSelectedIndex()); title.remove(resultsPane.getSelectedIndex()); close.remove(resultsPane.getSelectedIndex()); netName.remove(resultsPane.getSelectedIndex()); resultsPane.remove(resultsPane.getSelectedIndex()); openNets--; } } }); } catch (OutOfMemoryError e) { JOptionPane.showMessageDialog(mainWindow, "<html>Net too Large for Memory.<br>Try Closing some of the Nets.</html>", "Memory Error", JOptionPane.ERROR_MESSAGE); } } else { layer++; howManyNodes.setText(""); numberofNodes.setText("How many nodes do you want in layer " + layer + "?"); } } else { JOptionPane.showMessageDialog(createFFN, "<html>Number Out of Bounds<br>Please Enter a Number Greater than 0", "Out of Bounds", JOptionPane.ERROR_MESSAGE); } } }); //makes hitting enter in text box the same as clicking ok howManyNodes.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ActionListener a : createFFN.getActionListeners()) { a.actionPerformed(ae); } } }); //cancels the node prompt cancelNodes.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { newName.setText(""); howManyLayers.setText(""); howManyNodes.setText(""); howManyNodesDialog.setVisible(false); } }); //cancel clears both name fields so far filled in the series of dialogs and hides the dialog cancelFFN.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { newName.setText(""); howManyLayers.setText(""); fFNDialog.setVisible(false); } }); //end of section about creating FFNs //end of section about newNet //Method to create a SOM createSOM.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (somLatticeField.getText().equals("") || somDimField.getText().equals("")) { JOptionPane.showMessageDialog(createSOM, "<html>Empty Field<br>Please Fill All Fields", "Empty Field", JOptionPane.ERROR_MESSAGE); } else { if (somMaxField.getText().equals("")) somMaxField.setText("100"); if (somMinField.getText().equals("")) somMinField.setText("0"); if (Double.parseDouble(somMaxField.getText().replace(",", "")) < Double .parseDouble(somMinField.getText().replace(",", ""))) { JOptionPane.showMessageDialog(createSOM, "MIN GREATER THAN MAX!!!!", "Stupidity Error", JOptionPane.ERROR_MESSAGE); } try { //adds a close button to the top corner of each tab title.add(new JLabel(newName.getText() + " ")); close.add(new JButton("X")); close.get(openNets).setActionCommand(newName.getText()); close.get(openNets).setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); close.get(openNets).setMargin(new Insets(0, 0, 0, 0)); tabPanel.add(new JPanel(new GridBagLayout())); tabPanel.get(openNets).setOpaque(false); GridBagConstraints grid = new GridBagConstraints(); grid.fill = GridBagConstraints.HORIZONTAL; grid.gridx = 0; grid.gridy = 0; grid.weightx = 1; tabPanel.get(openNets).add(title.get(openNets), grid); grid.gridx = 1; grid.gridy = 0; grid.weightx = 0; tabPanel.get(openNets).add(close.get(openNets), grid); //adds a loading bar loadingBar.add(new JLabel("", loadingImage, SwingConstants.CENTER)); loadingBar.get(openNets).setHorizontalTextPosition(SwingConstants.LEFT); loadingBar.get(openNets).setVisible(false); //creates and sets the network configuration net.add(new SelfOrganizingMap()); netKind.add(new StringBuffer(netType.getSelectedItem().toString())); netName.add(new StringBuffer(newName.getText())); oneNet.add(new JPanel()); oneNet.get(openNets).setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; //creates the readOut space and formats it so that the scroll pane/text changes size with the window, reserves space for the loading bar readOut.add(new JTextArea("")); readOutLocale.add(new JScrollPane(readOut.get(openNets))); readOut.get(openNets).setEditable(false); constraints.gridx = 0; constraints.gridy = 0; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.gridwidth = 2; constraints.ipady = 90; oneNet.get(openNets).add(readOutLocale.get(openNets), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 1; constraints.ipady = 0; constraints.gridwidth = 2; constraints.anchor = GridBagConstraints.PAGE_END; //add everythign to the tabbed pane oneNet.get(openNets).add(loadingBar.get(openNets), constraints); resultsPane.addTab(netName.get(openNets).toString(), oneNet.get(openNets)); resultsPane.setTabComponentAt(openNets, tabPanel.get(openNets)); path.add(""); //display the starting configuration of the network readOut.get(openNets).append("Network: " + netName.get(openNets) + "\n\n"); resultsPane.setSelectedIndex(openNets++); try { net.get(resultsPane.getSelectedIndex()) .setLatticeValue(Integer.parseInt(somLatticeField.getText().replace(",", ""))); net.get(resultsPane.getSelectedIndex()) .setDataMax(Double.parseDouble(somMaxField.getText().replace(",", ""))); net.get(resultsPane.getSelectedIndex()) .setDataMin(Double.parseDouble(somMinField.getText().replace(",", ""))); net.get(resultsPane.getSelectedIndex()) .setInputDimensions(Integer.parseInt(somDimField.getText().replace(",", ""))); net.get(resultsPane.getSelectedIndex()).runNet(); readOut.get(resultsPane.getSelectedIndex()).append("Initial Untrained Map:\n"); printInitMap(); if (!getColorMap.isVisible()) { util.addSeparator(); util.add(getColorMap); getColorMap.setVisible(true); } //erases all the text in the setup fields and closes the window newName.setText(""); somLatticeField.setText(""); somDimField.setText(""); somMaxField.setText(""); somMinField.setText(""); sOMDialog.setVisible(false); //unfortunately difficult way that I made to add the close button functionality to close a tab //it works, but there has to be a better way to do this close.get(resultsPane.getSelectedIndex()).addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { int result; result = 0; for (StringBuffer names : netName) { if (ae.getActionCommand().equals(names.toString())) { result = JOptionPane.showConfirmDialog(createSOM, "<html>Exiting Without Saving can Cause you to Lose your Progress<br>Are you sure you want to Continue?</html>", "Close Network", JOptionPane.OK_CANCEL_OPTION); resultsPane.setSelectedIndex(netName.indexOf(names)); } } if (result == JOptionPane.OK_OPTION) { net.remove(resultsPane.getSelectedIndex()); oneNet.remove(resultsPane.getSelectedIndex()); readOutLocale.remove(resultsPane.getSelectedIndex()); readOut.remove(resultsPane.getSelectedIndex()); loadingBar.remove(resultsPane.getSelectedIndex()); tabPanel.remove(resultsPane.getSelectedIndex()); title.remove(resultsPane.getSelectedIndex()); close.remove(resultsPane.getSelectedIndex()); netName.remove(resultsPane.getSelectedIndex()); resultsPane.remove(resultsPane.getSelectedIndex()); openNets--; } } }); } catch (Exception e) { net.remove(resultsPane.getSelectedIndex()); oneNet.remove(resultsPane.getSelectedIndex()); readOutLocale.remove(resultsPane.getSelectedIndex()); readOut.remove(resultsPane.getSelectedIndex()); loadingBar.remove(resultsPane.getSelectedIndex()); tabPanel.remove(resultsPane.getSelectedIndex()); title.remove(resultsPane.getSelectedIndex()); close.remove(resultsPane.getSelectedIndex()); netName.remove(resultsPane.getSelectedIndex()); resultsPane.remove(resultsPane.getSelectedIndex()); openNets--; JOptionPane.showMessageDialog(sOMDialog, "Numbers too large to parse", "Parse error", JOptionPane.ERROR_MESSAGE); } } catch (OutOfMemoryError e) { JOptionPane.showMessageDialog(mainWindow, "<html>Net too Large for Memory.<br>Try Closing some of the Nets.</html>", "Memory Error", JOptionPane.ERROR_MESSAGE); } } } }); cancelSOM.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { newName.setText(""); somLatticeField.setText(""); somMaxField.setText(""); somMinField.setText(""); sOMDialog.setVisible(false); } }); //end of SOM creation mainWindow.setVisible(true); }