import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.net.*; import java.io.*; import java.util.*; import java.util.Properties; import java.text.*; public class WOR_sh_FormFrame extends JInternalFrame { static int openFrameCount = 0; static final int offset = 20; JTextField DesPSField; String if_wor, irTxt = ""; String dsgns, desStg; String WOR_DIR = "./wor"; String[] des_prop_val; public WOR_sh_FormFrame ( String if_wor ){ super("", true, true, true, true); openFrameCount++; setTitle("PRODUCT DESIGN WORK ORDER REQUEST " + openFrameCount); JPanel topPanel = new JPanel(); topPanel.setBorder(new EmptyBorder(1,1,1,1)); topPanel.setLayout(new BorderLayout()); // Designers final String des_propsfile = "ROG_des.properties"; String ROG_desSTG = "ROG_des."; Properties des_props = new Properties (); try { InputStream in = new FileInputStream(des_propsfile); des_props.load(in); in.close(); } catch (IOException e) {} String[] des_prop_val = new String[des_props.size()]; for (int n = 0; n < des_props.size(); n++) { des_prop_val[n] = des_props.getProperty(ROG_desSTG + n); System.out.println( n + ": " + des_prop_val[n] ); } desStg = des_prop_val[0]; // Designers JPanel DesPanel = new JPanel(); GridBagLayout gbc2 = new GridBagLayout(); DesPanel.setLayout(gbc2); JPanel DesPSPanel = new JPanel(); JLabel DesPSLabel = new JLabel ("Designer: "); DesPSField = new JTextField("TBD",19); DesPSPanel.add(DesPSLabel); DesPSPanel.add(DesPSField); JPanel DesCBPanel = new JPanel(); final JComboBox dsgnsComboBox = new JComboBox(des_prop_val); dsgnsComboBox.setSelectedItem(desStg); DesCBPanel.add(dsgnsComboBox); dsgnsComboBox.addItemListener( new ItemListener() { public void itemStateChanged( ItemEvent e ) { if( e.getStateChange() == ItemEvent.SELECTED ){ DesPSField.setText("" + ((JComboBox)e.getSource()).getSelectedItem()); } } } ); DesPanel.add(DesPSPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 1, 1, 1), 1, 0)); DesPanel.add(DesCBPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(1, 1, 1, 1), 1, 0)); topPanel.add(DesPanel, BorderLayout.NORTH); setContentPane(topPanel); pack(); setLocation( offset * openFrameCount, offset * openFrameCount); } public void ExitSelected() { this.setVisible(false); } public String getDes() { dsgns = DesPSField.getText(); return dsgns; } }