import java.awt.event.ActionListener;
import javax.swing.JButton;
+import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
private JLabel answersLabel;
private JTextArea answersArea;
+
+ private JComboBox portSelectBox;
public CommandPanel(Netzdose netzdose) {
this.netzdose = netzdose;
setLayout(new BorderLayout());
- JPanel top = new JPanel();
- top.setLayout(new BorderLayout());
+ JPanel ports = new JPanel();
+ ports.setLayout(new BorderLayout());
+ ports.add(new JLabel("Port: "), BorderLayout.WEST);
+ portSelectBox = new JComboBox();
+ portSelectBox.addItem("Port A");
+ portSelectBox.addItem("Port B");
+ ports.add(portSelectBox, BorderLayout.EAST);
+ add(ports, BorderLayout.NORTH);
+ JPanel commandInputPanel = new JPanel();
+ commandInputPanel.setLayout(new BorderLayout());
commandLabel = new JLabel("Command:");
- top.add(commandLabel, BorderLayout.WEST);
+ commandInputPanel.add(commandLabel, BorderLayout.WEST);
commandField = new JTextField();
commandField.addActionListener(new ActionListener() {
apply();
}
});
- top.add(commandField, BorderLayout.CENTER);
+ commandInputPanel.add(commandField, BorderLayout.CENTER);
+
+ JPanel top = new JPanel();
+ top.setLayout(new BorderLayout());
+ top.add(commandInputPanel, BorderLayout.CENTER);
+ top.add(ports, BorderLayout.EAST);
add(top, BorderLayout.NORTH);
JPanel middle = new JPanel();
"Kann \"" + commandText + "\" nicht in Command wandeln.");
return;
}
- LogMediator.getInstance(this.getClass()).log("Sende " + command);
+ LogMediator.getInstance(this.getClass()).log("Sende an Port: " + portSelectBox.getSelectedIndex() + " command: " + command);
byte[] answerBytes = netzdose.sendCommand(command);
answersArea.append(++commandCounter + ": "
+ new Command(answerBytes).toString() + "\n");