|
|
|
|
|
|
|
|
package ch.spherICIT.main; |
|
|
package ch.spherICIT.main; |
|
|
|
|
|
|
|
|
|
|
|
import ch.spherICIT.communication.ConnectionState; |
|
|
|
|
|
import ch.spherICIT.communication.ConnectionStateInfo; |
|
|
|
|
|
import ch.spherICIT.communication.IConnectionState; |
|
|
|
|
|
import ch.spherICIT.communication.SerialCommHandler; |
|
|
|
|
|
import ch.spherICIT.components.led.Led; |
|
|
|
|
|
import ch.spherICIT.components.switchbtn.EventSwitchSelected; |
|
|
import ch.spherICIT.components.switchbtn.SwitchButton; |
|
|
import ch.spherICIT.components.switchbtn.SwitchButton; |
|
|
import com.fazecast.jSerialComm.SerialPort; |
|
|
import com.fazecast.jSerialComm.SerialPort; |
|
|
|
|
|
import com.fazecast.jSerialComm.SerialPortEvent; |
|
|
|
|
|
import com.fazecast.jSerialComm.SerialPortMessageListener; |
|
|
|
|
|
import com.google.gson.Gson; |
|
|
|
|
|
|
|
|
import javax.swing.DefaultComboBoxModel; |
|
|
import javax.swing.DefaultComboBoxModel; |
|
|
import javax.swing.ImageIcon; |
|
|
import javax.swing.ImageIcon; |
|
|
|
|
|
|
|
|
import javax.swing.JComboBox; |
|
|
import javax.swing.JComboBox; |
|
|
import javax.swing.JComponent; |
|
|
import javax.swing.JComponent; |
|
|
import javax.swing.JLabel; |
|
|
import javax.swing.JLabel; |
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
import javax.swing.JPanel; |
|
|
import javax.swing.JPanel; |
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
import javax.swing.plaf.FontUIResource; |
|
|
import javax.swing.plaf.FontUIResource; |
|
|
import javax.swing.text.StyleContext; |
|
|
import javax.swing.text.StyleContext; |
|
|
import java.awt.Color; |
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
import java.util.HashSet; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Locale; |
|
|
import java.util.Locale; |
|
|
|
|
|
import java.util.Objects; |
|
|
import java.util.Optional; |
|
|
import java.util.Optional; |
|
|
import java.util.Set; |
|
|
import java.util.Set; |
|
|
|
|
|
import java.util.Timer; |
|
|
|
|
|
import java.util.TimerTask; |
|
|
|
|
|
|
|
|
|
|
|
import static ch.spherICIT.main.LogWindow.SendDirection.IN; |
|
|
|
|
|
import static ch.spherICIT.main.LogWindow.SendDirection.OUT; |
|
|
|
|
|
|
|
|
public class MainPanel { |
|
|
public class MainPanel { |
|
|
|
|
|
|
|
|
|
|
|
public static final long COMM_TIMEOUT = 3000L; |
|
|
|
|
|
|
|
|
private JPanel mainPanel; |
|
|
private JPanel mainPanel; |
|
|
private JLabel serPortLbl; |
|
|
private JLabel serPortLbl; |
|
|
private JComboBox<CommPort> serPortCboBox; |
|
|
private JComboBox<CommPort> serPortCboBox; |
|
|
|
|
|
|
|
|
private SwitchButton relaisPwrBtn; |
|
|
private SwitchButton relaisPwrBtn; |
|
|
private SwitchButton camVelocityModeBtn; |
|
|
private SwitchButton camVelocityModeBtn; |
|
|
private SwitchButton camStepperPwrBtn; |
|
|
private SwitchButton camStepperPwrBtn; |
|
|
private JLabel relaisPwrLed; |
|
|
|
|
|
private JLabel camStepperPwrLed; |
|
|
|
|
|
|
|
|
private Led relaisPwrLed; |
|
|
|
|
|
private Led camStepperPwrLed; |
|
|
private JButton logWindowBtn; |
|
|
private JButton logWindowBtn; |
|
|
private final LogWindow logWindow; |
|
|
private final LogWindow logWindow; |
|
|
|
|
|
|
|
|
private Set<IConnectionState> connectionStateListeners; |
|
|
private Set<IConnectionState> connectionStateListeners; |
|
|
private ActionListener reconnectActionListener; |
|
|
private ActionListener reconnectActionListener; |
|
|
private List<CommPort> commPorts; |
|
|
private List<CommPort> commPorts; |
|
|
|
|
|
private SerialPort selectedSerialPort; |
|
|
|
|
|
private FSSerialPortMessageListener serialPortMessageListener; |
|
|
|
|
|
private Timer timer; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Konstruktor. |
|
|
* Konstruktor. |
|
|
|
|
|
|
|
|
this.reconnectActionListener = new ActionListener() { |
|
|
this.reconnectActionListener = new ActionListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
JOptionPane.showMessageDialog(mainPanel, "Test", "Title", JOptionPane.INFORMATION_MESSAGE); |
|
|
|
|
|
|
|
|
connect(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.serPortOpenBtn.addActionListener(new ActionListener() { |
|
|
this.serPortOpenBtn.addActionListener(new ActionListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
// connectionStateListeners.iterator().next().connectionStateChanged(new ConnectionStateInfo(ConnectionState.CONNECTING, "", "")); |
|
|
|
|
|
getSelectedCommPort().get().getSerialPort().get().openPort(); |
|
|
|
|
|
serPortOpenBtn.setEnabled(false); |
|
|
|
|
|
serPortCloseBtn.setEnabled(true); |
|
|
|
|
|
|
|
|
if (!selectedSerialPort.isOpen()) { |
|
|
|
|
|
System.out.println("connecten clicked"); |
|
|
|
|
|
selectedSerialPort.openPort(); |
|
|
|
|
|
logWindow.addLogEntry(SerialCommHandler.sendInitCommand(selectedSerialPort), OUT); |
|
|
|
|
|
} |
|
|
|
|
|
connect(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.serPortCloseBtn.addActionListener(new ActionListener() { |
|
|
this.serPortCloseBtn.addActionListener(new ActionListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
// connectionStateListeners.iterator().next().connectionStateChanged(new ConnectionStateInfo(ConnectionState.CONNECTED, "COM4", "v1.2.0")); |
|
|
|
|
|
getSelectedCommPort().get().getSerialPort().get().closePort(); |
|
|
|
|
|
serPortOpenBtn.setEnabled(true); |
|
|
|
|
|
serPortCloseBtn.setEnabled(false); |
|
|
|
|
|
|
|
|
if (selectedSerialPort != null && selectedSerialPort.isOpen()) { |
|
|
|
|
|
selectedSerialPort.closePort(); |
|
|
|
|
|
serPortOpenBtn.setEnabled(true); |
|
|
|
|
|
serPortCloseBtn.setEnabled(false); |
|
|
|
|
|
|
|
|
|
|
|
relaisPwrBtn.setEnabled(false); |
|
|
|
|
|
relaisPwrBtn.setSelected(false); |
|
|
|
|
|
relaisPwrLed.switchOff(); |
|
|
|
|
|
camStepperPwrBtn.setEnabled(false); |
|
|
|
|
|
camStepperPwrBtn.setSelected(false); |
|
|
|
|
|
camStepperPwrLed.switchOff(); |
|
|
|
|
|
camVelocityModeBtn.setEnabled(false); |
|
|
|
|
|
camVelocityModeBtn.setSelected(false); |
|
|
|
|
|
|
|
|
|
|
|
for (IConnectionState listener : connectionStateListeners) { |
|
|
|
|
|
listener.connectionStateChanged(new ConnectionStateInfo(ConnectionState.READY, null, null)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.setZeroAzBtn.addActionListener(new ActionListener() { |
|
|
this.setZeroAzBtn.addActionListener(new ActionListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
connectionStateListeners.iterator().next().connectionStateChanged(new ConnectionStateInfo(ConnectionState.TIMEOUT, "", "")); |
|
|
|
|
|
|
|
|
logWindow.addLogEntry(SerialCommHandler.sendCamZeroCommand(selectedSerialPort), OUT); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.logWindowBtn.addActionListener(new ActionListener() { |
|
|
this.logWindowBtn.addActionListener(new ActionListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
logWindow.setVisible(true); |
|
|
logWindow.setVisible(true); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initCommPorts() { |
|
|
|
|
|
this.commPorts = new ArrayList<>(); |
|
|
|
|
|
this.commPorts.add(new CommPort(null)); |
|
|
|
|
|
for (SerialPort serialPort : SerialPort.getCommPorts()) { |
|
|
|
|
|
this.commPorts.add(new CommPort(serialPort)); |
|
|
|
|
|
} |
|
|
|
|
|
this.serPortCboBox.setModel(new DefaultComboBoxModel(this.commPorts.toArray())); |
|
|
|
|
|
serPortCboBox.addItemListener(new ItemListener() { |
|
|
|
|
|
|
|
|
this.relaisPwrBtn.addEventSelected(new EventSwitchSelected() { |
|
|
@Override |
|
|
@Override |
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
|
Optional<CommPort> selCommPortOptional = getSelectedCommPort(); |
|
|
|
|
|
if (selCommPortOptional.isPresent() && selCommPortOptional.get().getSerialPort().isPresent()) { |
|
|
|
|
|
selCommPortOptional.get().getSerialPort().get().openPort(); |
|
|
|
|
|
serPortOpenBtn.setEnabled(false); |
|
|
|
|
|
serPortCloseBtn.setEnabled(true); |
|
|
|
|
|
} else { |
|
|
|
|
|
for (IConnectionState listener : connectionStateListeners) { |
|
|
|
|
|
listener.connectionStateChanged(new ConnectionStateInfo(ConnectionState.READY, null, null)); |
|
|
|
|
|
serPortOpenBtn.setEnabled(false); |
|
|
|
|
|
serPortCloseBtn.setEnabled(false); |
|
|
|
|
|
|
|
|
public void onSelected(boolean selected) { |
|
|
|
|
|
logWindow.addLogEntry(SerialCommHandler.sendRelaisPwrCommand(selectedSerialPort, selected ? Message.CMD_VAL_ON : Message.CMD_VAL_OFF), OUT); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.camStepperPwrBtn.addEventSelected(new EventSwitchSelected() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onSelected(boolean selected) { |
|
|
|
|
|
logWindow.addLogEntry(SerialCommHandler.sendCamPwrCommand(selectedSerialPort, selected ? Message.CMD_VAL_ON : Message.CMD_VAL_OFF), OUT); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
this.serPortCboBox.setSelectedIndex(-1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.camVelocityModeBtn.addEventSelected(new EventSwitchSelected() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onSelected(boolean selected) { |
|
|
|
|
|
logWindow.addLogEntry(SerialCommHandler.sendCamVelocityCommand(selectedSerialPort, selected ? Message.CMD_VELOCITY_FAST : Message.CMD_VELOCITY_SLOW), OUT); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void registerConnectionStateListener(IConnectionState connectionStateListener) { |
|
|
public void registerConnectionStateListener(IConnectionState connectionStateListener) { |
|
|
|
|
|
|
|
|
return this.serPortCboBox.getSelectedIndex() != -1 ? Optional.of(this.serPortCboBox.getItemAt(this.serPortCboBox.getSelectedIndex())) : Optional.empty(); |
|
|
return this.serPortCboBox.getSelectedIndex() != -1 ? Optional.of(this.serPortCboBox.getItemAt(this.serPortCboBox.getSelectedIndex())) : Optional.empty(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void connect() { |
|
|
|
|
|
if (this.selectedSerialPort != null) { |
|
|
|
|
|
if (this.selectedSerialPort.openPort()) { |
|
|
|
|
|
this.timer = new Timer(); |
|
|
|
|
|
this.timer.schedule(new TimerTask() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
|
|
for (IConnectionState listener : connectionStateListeners) { |
|
|
|
|
|
listener.connectionStateChanged(new ConnectionStateInfo(ConnectionState.TIMEOUT, null, null)); |
|
|
|
|
|
} |
|
|
|
|
|
serPortOpenBtn.setEnabled(true); |
|
|
|
|
|
serPortCloseBtn.setEnabled(false); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, COMM_TIMEOUT); |
|
|
|
|
|
|
|
|
|
|
|
for (IConnectionState listener : this.connectionStateListeners) { |
|
|
|
|
|
listener.connectionStateChanged(new ConnectionStateInfo(ConnectionState.CONNECTING, selectedSerialPort.getSystemPortName(), null)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
|
|
logWindow.addLogEntry(SerialCommHandler.sendVersionCommand(selectedSerialPort), |
|
|
|
|
|
OUT); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.serPortOpenBtn.setEnabled(false); |
|
|
|
|
|
this.serPortCloseBtn.setEnabled(true); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initCommPorts() { |
|
|
|
|
|
this.commPorts = new ArrayList<>(); |
|
|
|
|
|
this.commPorts.add(new CommPort(null)); |
|
|
|
|
|
this.serialPortMessageListener = new FSSerialPortMessageListener(); |
|
|
|
|
|
|
|
|
|
|
|
for (SerialPort serialPort : SerialPort.getCommPorts()) { |
|
|
|
|
|
this.commPorts.add(new CommPort(serialPort)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.serPortCboBox.setModel(new DefaultComboBoxModel(this.commPorts.toArray())); |
|
|
|
|
|
this.serPortCboBox.addItemListener(new ItemListener() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
|
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
|
|
|
|
Optional<CommPort> selCommPortOptional = getSelectedCommPort(); |
|
|
|
|
|
if (selCommPortOptional.isPresent() && selCommPortOptional.get().getSerialPort().isPresent()) { |
|
|
|
|
|
selectedSerialPort = selCommPortOptional.get().getSerialPort().get(); |
|
|
|
|
|
selectedSerialPort.setComPortParameters(9600, 8, SerialPort.ONE_STOP_BIT, SerialPort.NO_PARITY); |
|
|
|
|
|
selectedSerialPort.addDataListener(serialPortMessageListener); |
|
|
|
|
|
selectedSerialPort.openPort(); |
|
|
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
|
|
logWindow.addLogEntry(SerialCommHandler.sendInitCommand(selectedSerialPort), OUT); |
|
|
|
|
|
}); |
|
|
|
|
|
serPortOpenBtn.setEnabled(true); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (selectedSerialPort != null) { |
|
|
|
|
|
selectedSerialPort.removeDataListener(); |
|
|
|
|
|
selectedSerialPort = null; |
|
|
|
|
|
} |
|
|
|
|
|
for (IConnectionState listener : connectionStateListeners) { |
|
|
|
|
|
listener.connectionStateChanged(new ConnectionStateInfo(ConnectionState.READY, null, null)); |
|
|
|
|
|
serPortOpenBtn.setEnabled(false); |
|
|
|
|
|
serPortCloseBtn.setEnabled(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
this.serPortCboBox.setSelectedIndex(-1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void createUIComponents() { |
|
|
private void createUIComponents() { |
|
|
this.serPortCboBox = new JComboBox<>(); |
|
|
this.serPortCboBox = new JComboBox<>(); |
|
|
|
|
|
this.relaisPwrLed = new Led(); |
|
|
|
|
|
this.camStepperPwrLed = new Led(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Convenince Comm Port class for combobox usage. |
|
|
|
|
|
*/ |
|
|
private class CommPort { |
|
|
private class CommPort { |
|
|
|
|
|
|
|
|
private SerialPort serialPort; |
|
|
private SerialPort serialPort; |
|
|
|
|
|
|
|
|
public String toString() { |
|
|
public String toString() { |
|
|
return this.serialPort != null ? this.serialPort.getSystemPortName() : ""; |
|
|
return this.serialPort != null ? this.serialPort.getSystemPortName() : ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean equals(Object o) { |
|
|
|
|
|
if (o == null || getClass() != o.getClass()) return false; |
|
|
|
|
|
CommPort commPort = (CommPort) o; |
|
|
|
|
|
return Objects.equals(this.serialPort, commPort.serialPort); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public int hashCode() { |
|
|
|
|
|
return Objects.hashCode(this.serialPort); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Fixed length serial communication read listener. Fires when the character '}' is received. |
|
|
|
|
|
*/ |
|
|
|
|
|
private class FSSerialPortMessageListener implements SerialPortMessageListener { |
|
|
|
|
|
|
|
|
|
|
|
private Gson gson = new Gson(); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public byte[] getMessageDelimiter() { |
|
|
|
|
|
return new byte[]{(byte) 0x7D}; // ='}' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean delimiterIndicatesEndOfMessage() { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public int getListeningEvents() { |
|
|
|
|
|
return SerialPort.LISTENING_EVENT_DATA_RECEIVED | SerialPort.LISTENING_EVENT_DATA_WRITTEN; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void serialEvent(SerialPortEvent serialPortEvent) { |
|
|
|
|
|
System.out.println(serialPortEvent.getEventType()); |
|
|
|
|
|
if (serialPortEvent.getEventType() == SerialPort.LISTENING_EVENT_DATA_RECEIVED) { |
|
|
|
|
|
byte[] receivedData = serialPortEvent.getReceivedData(); |
|
|
|
|
|
String input = new String(receivedData); |
|
|
|
|
|
Message deserializedMsg = gson.fromJson(input, Message.class); |
|
|
|
|
|
System.out.println("serialEvent: " + input); |
|
|
|
|
|
logWindow.addLogEntry(input, IN); |
|
|
|
|
|
if (deserializedMsg.getSender().equals(Message.CMD_SENDER_AN) && deserializedMsg.getCmd().equals(Message.CMD_VER)) { |
|
|
|
|
|
// connected |
|
|
|
|
|
timer.cancel(); |
|
|
|
|
|
SwingUtilities.invokeLater(() -> { |
|
|
|
|
|
for (IConnectionState listener : connectionStateListeners) { |
|
|
|
|
|
listener.connectionStateChanged(new ConnectionStateInfo(ConnectionState.CONNECTED, selectedSerialPort.getSystemPortName(), deserializedMsg.getVal())); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
relaisPwrBtn.setEnabled(true); |
|
|
|
|
|
camStepperPwrBtn.setEnabled(true); |
|
|
|
|
|
camVelocityModeBtn.setEnabled(true); |
|
|
|
|
|
} else if (deserializedMsg.getSender().equals(Message.CMD_SENDER_AN) && deserializedMsg.getCmd().equals(Message.CMD_STATUS_RELAY)) { |
|
|
|
|
|
//Power relais status |
|
|
|
|
|
String val = deserializedMsg.getVal(); |
|
|
|
|
|
relaisPwrLed.doSwitch(val); |
|
|
|
|
|
} else if (deserializedMsg.getSender().equals(Message.CMD_SENDER_AN) && deserializedMsg.getCmd().equals(Message.CMD_STATUS_CAM)) { |
|
|
|
|
|
//Cam relais status |
|
|
|
|
|
String val = deserializedMsg.getVal(); |
|
|
|
|
|
camStepperPwrLed.doSwitch(val); |
|
|
|
|
|
} |
|
|
|
|
|
} else if (serialPortEvent.getEventType() == SerialPort.LISTENING_EVENT_DATA_WRITTEN) { |
|
|
|
|
|
System.out.println("serialEvent: LISTENING_EVENT_DATA_WRITTEN"); |
|
|
|
|
|
logWindow.addLogEntry("serialEvent: LISTENING_EVENT_DATA_WRITTEN", IN); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
if (serPortOpenBtnFont != null) serPortOpenBtn.setFont(serPortOpenBtnFont); |
|
|
if (serPortOpenBtnFont != null) serPortOpenBtn.setFont(serPortOpenBtnFont); |
|
|
serPortOpenBtn.setHideActionText(false); |
|
|
serPortOpenBtn.setHideActionText(false); |
|
|
serPortOpenBtn.setHorizontalTextPosition(0); |
|
|
serPortOpenBtn.setHorizontalTextPosition(0); |
|
|
serPortOpenBtn.setLabel("Öffnen"); |
|
|
|
|
|
|
|
|
serPortOpenBtn.setLabel("Connecten"); |
|
|
serPortOpenBtn.setMinimumSize(new Dimension(130, 32)); |
|
|
serPortOpenBtn.setMinimumSize(new Dimension(130, 32)); |
|
|
serPortOpenBtn.setPreferredSize(new Dimension(130, 32)); |
|
|
serPortOpenBtn.setPreferredSize(new Dimension(130, 32)); |
|
|
serPortOpenBtn.setSelected(false); |
|
|
serPortOpenBtn.setSelected(false); |
|
|
serPortOpenBtn.setText("Öffnen"); |
|
|
|
|
|
|
|
|
serPortOpenBtn.setText("Connecten"); |
|
|
serPortOpenBtn.setVerticalAlignment(3); |
|
|
serPortOpenBtn.setVerticalAlignment(3); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc.gridx = 3; |
|
|
gbc.gridx = 3; |
|
|
|
|
|
|
|
|
panel1.add(label5, gbc); |
|
|
panel1.add(label5, gbc); |
|
|
relaisPwrBtn = new SwitchButton(); |
|
|
relaisPwrBtn = new SwitchButton(); |
|
|
relaisPwrBtn.setBackground(new Color(-16738404)); |
|
|
relaisPwrBtn.setBackground(new Color(-16738404)); |
|
|
|
|
|
relaisPwrBtn.setEnabled(false); |
|
|
relaisPwrBtn.setPreferredSize(new Dimension(80, 40)); |
|
|
relaisPwrBtn.setPreferredSize(new Dimension(80, 40)); |
|
|
|
|
|
relaisPwrBtn.setSelected(false); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc.gridx = 1; |
|
|
gbc.gridx = 1; |
|
|
gbc.gridy = 0; |
|
|
gbc.gridy = 0; |
|
|
|
|
|
|
|
|
gbc.fill = GridBagConstraints.VERTICAL; |
|
|
gbc.fill = GridBagConstraints.VERTICAL; |
|
|
gbc.ipady = 80; |
|
|
gbc.ipady = 80; |
|
|
mainPanel.add(spacer3, gbc); |
|
|
mainPanel.add(spacer3, gbc); |
|
|
relaisPwrLed = new JLabel(); |
|
|
|
|
|
relaisPwrLed.setHorizontalAlignment(0); |
|
|
relaisPwrLed.setHorizontalAlignment(0); |
|
|
relaisPwrLed.setIcon(new ImageIcon(getClass().getResource("/blue_led_off.png"))); |
|
|
relaisPwrLed.setIcon(new ImageIcon(getClass().getResource("/blue_led_off.png"))); |
|
|
relaisPwrLed.setText(""); |
|
|
relaisPwrLed.setText(""); |
|
|
|
|
|
|
|
|
panel2.add(label8, gbc); |
|
|
panel2.add(label8, gbc); |
|
|
camVelocityModeBtn = new SwitchButton(); |
|
|
camVelocityModeBtn = new SwitchButton(); |
|
|
camVelocityModeBtn.setBackground(new Color(-16738404)); |
|
|
camVelocityModeBtn.setBackground(new Color(-16738404)); |
|
|
|
|
|
camVelocityModeBtn.setEnabled(false); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc.gridx = 1; |
|
|
gbc.gridx = 1; |
|
|
gbc.gridy = 1; |
|
|
gbc.gridy = 1; |
|
|
|
|
|
|
|
|
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
|
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
|
gbc.insets = new Insets(0, 10, 5, 10); |
|
|
gbc.insets = new Insets(0, 10, 5, 10); |
|
|
panel4.add(label13, gbc); |
|
|
panel4.add(label13, gbc); |
|
|
camStepperPwrLed = new JLabel(); |
|
|
|
|
|
camStepperPwrLed.setHorizontalAlignment(0); |
|
|
camStepperPwrLed.setHorizontalAlignment(0); |
|
|
camStepperPwrLed.setIcon(new ImageIcon(getClass().getResource("/blue_led_off.png"))); |
|
|
camStepperPwrLed.setIcon(new ImageIcon(getClass().getResource("/blue_led_off.png"))); |
|
|
camStepperPwrLed.setText(""); |
|
|
camStepperPwrLed.setText(""); |
|
|
|
|
|
|
|
|
panel4.add(camStepperPwrLed, gbc); |
|
|
panel4.add(camStepperPwrLed, gbc); |
|
|
camStepperPwrBtn = new SwitchButton(); |
|
|
camStepperPwrBtn = new SwitchButton(); |
|
|
camStepperPwrBtn.setBackground(new Color(-16738404)); |
|
|
camStepperPwrBtn.setBackground(new Color(-16738404)); |
|
|
|
|
|
camStepperPwrBtn.setEnabled(false); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc = new GridBagConstraints(); |
|
|
gbc.gridx = 1; |
|
|
gbc.gridx = 1; |
|
|
gbc.gridy = 1; |
|
|
gbc.gridy = 1; |