@Override public void actionPerformed(ActionEvent ae) { if (ae.getSource() == partsPileUpSubmitButton) { app.sendObjectToServer( new Message("partsPiledUp_" + (String) partsPileUpComboBox.getSelectedItem())); } if (ae.getSource() == noPartsSubmitButton) { app.sendObjectToServer( new Message("noGoodParts_" + (String) noGoodPartsComboBox.getSelectedItem())); } if (ae.getSource() == partsUnstableSubmitButton) { app.sendObjectToServer( new Message("unstableParts_" + (String) partsUnstableComboBox.getSelectedItem())); } if (ae.getSource() == partsRobotSubmitButton) { app.sendObjectToServer( new Message("partsRobotInWay_" + (String) partsRobotComboBox.getSelectedItem())); } }
public NNNoGoodPartsPanel(LaneManager app) { this.app = app; GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] {61, 138, 117, 0}; gridBagLayout.rowHeights = new int[] {16, 0, 27, 29, 0, 0, 0}; gridBagLayout.columnWeights = new double[] {0.0, 1.0, 0.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; setLayout(gridBagLayout); JLabel lblNewLabel = new JLabel("No good parts in nest #"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.anchor = GridBagConstraints.EAST; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 0; add(lblNewLabel, gbc_lblNewLabel); noGoodPartsComboBox = new JComboBox(); noGoodPartsComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_comboBox = new GridBagConstraints(); gbc_comboBox.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox.insets = new Insets(0, 0, 5, 5); gbc_comboBox.gridx = 1; gbc_comboBox.gridy = 0; add(noGoodPartsComboBox, gbc_comboBox); noPartsSubmitButton = new JButton("Submit"); GridBagConstraints gbc_btnNewButton = new GridBagConstraints(); gbc_btnNewButton.insets = new Insets(0, 0, 5, 0); gbc_btnNewButton.gridx = 2; gbc_btnNewButton.gridy = 0; add(noPartsSubmitButton, gbc_btnNewButton); JLabel lblNewLabel_1 = new JLabel("Parts unstable in nest #"); GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints(); gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_1.gridx = 0; gbc_lblNewLabel_1.gridy = 1; add(lblNewLabel_1, gbc_lblNewLabel_1); partsUnstableComboBox = new JComboBox(); partsUnstableComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_comboBox_1 = new GridBagConstraints(); gbc_comboBox_1.insets = new Insets(0, 0, 5, 5); gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_1.gridx = 1; gbc_comboBox_1.gridy = 1; add(partsUnstableComboBox, gbc_comboBox_1); partsUnstableSubmitButton = new JButton("Submit"); GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints(); gbc_btnNewButton_1.insets = new Insets(0, 0, 5, 0); gbc_btnNewButton_1.gridx = 2; gbc_btnNewButton_1.gridy = 1; add(partsUnstableSubmitButton, gbc_btnNewButton_1); JLabel lblNewLabel_2 = new JLabel("Robot in way of nest #"); GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints(); gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_2.gridx = 0; gbc_lblNewLabel_2.gridy = 2; add(lblNewLabel_2, gbc_lblNewLabel_2); partsRobotComboBox = new JComboBox(); partsRobotComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_parts_comboBox = new GridBagConstraints(); gbc_parts_comboBox.insets = new Insets(0, 0, 5, 5); gbc_parts_comboBox.fill = GridBagConstraints.HORIZONTAL; gbc_parts_comboBox.gridx = 1; gbc_parts_comboBox.gridy = 2; add(partsRobotComboBox, gbc_parts_comboBox); partsRobotSubmitButton = new JButton("Submit"); GridBagConstraints gbc_button = new GridBagConstraints(); gbc_button.insets = new Insets(0, 0, 5, 0); gbc_button.gridx = 2; gbc_button.gridy = 2; add(partsRobotSubmitButton, gbc_button); JLabel lblNewLabel_3 = new JLabel("Parts Pile Up in Nest #"); GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints(); gbc_lblNewLabel_3.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_3.gridx = 0; gbc_lblNewLabel_3.gridy = 3; add(lblNewLabel_3, gbc_lblNewLabel_3); partsPileUpComboBox = new JComboBox(); partsPileUpComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_pileUp_comboBox = new GridBagConstraints(); gbc_pileUp_comboBox.insets = new Insets(0, 0, 5, 5); gbc_pileUp_comboBox.fill = GridBagConstraints.HORIZONTAL; gbc_pileUp_comboBox.gridx = 1; gbc_pileUp_comboBox.gridy = 3; add(partsPileUpComboBox, gbc_pileUp_comboBox); partsPileUpSubmitButton = new JButton("Submit"); GridBagConstraints gbc_pileUp = new GridBagConstraints(); gbc_pileUp.insets = new Insets(0, 0, 5, 0); gbc_pileUp.gridx = 2; gbc_pileUp.gridy = 3; add(partsPileUpSubmitButton, gbc_pileUp); noPartsSubmitButton.addActionListener(this); partsUnstableSubmitButton.addActionListener(this); partsRobotSubmitButton.addActionListener(this); partsPileUpSubmitButton.addActionListener(this); }