private void stopButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_stopButtonActionPerformed String portName = this.portComboBox.getSelectedItem().toString(); if (DeviceManager.isDeviceOpen(portName)) { DeviceManager.closeDevice(portName); stopButton.setEnabled(false); startButton.setEnabled(true); } } // GEN-LAST:event_stopButtonActionPerformed
public LiveTopComponent() { initComponents(); setName(Bundle.CTL_LiveTopComponent()); setToolTipText(Bundle.HINT_LiveTopComponent()); liveTable.setDefaultRenderer(Object.class, new LiveTableRenderer()); DeviceManager.addListener(this); }
private void setPortList() { String[] deviceList = DeviceManager.getDeviceList(); if (deviceList.length > 0) { this.portComboBox.removeAllItems(); for (String device : deviceList) { this.portComboBox.addItem(device); } } }
private void startButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_startButtonActionPerformed String portName = this.portComboBox.getSelectedItem().toString(); if (portName.equals("None")) { // no device selected, do nothing return; } int speed = this.bitRateComboBox.getSelectedIndex(); DeviceManager.openDevice(portName, speed); startButton.setEnabled(false); stopButton.setEnabled(true); } // GEN-LAST:event_startButtonActionPerformed
private void portComboBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_portComboBoxActionPerformed if (this.portComboBox.getSelectedItem() == null) { return; } String portName = this.portComboBox.getSelectedItem().toString(); if (DeviceManager.isDeviceOpen(portName)) { startButton.setEnabled(false); stopButton.setEnabled(true); } else { startButton.setEnabled(true); stopButton.setEnabled(false); } } // GEN-LAST:event_portComboBoxActionPerformed