📄 clusterheadconfpanel.java
字号:
private void clusterHeadDissIntervalTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_clusterHeadDissIntervalTextFieldFocusLost
javax.swing.JTextField textField = (javax.swing.JTextField) evt.getSource();
String content = textField.getText();
if (content.length() != 0) {
try {
double aux = Double.parseDouble(content);
MainFrame.getTcl().setClusterHeadDissInterval(aux);
} catch (NumberFormatException nfe) {
textField.requestFocus();
}
}
}//GEN-LAST:event_clusterHeadDissIntervalTextFieldFocusLost
private void clusterHeadTransmissionRangeTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_clusterHeadTransmissionRangeTextFieldFocusLost
javax.swing.JTextField textField = (javax.swing.JTextField) evt.getSource();
String content = textField.getText();
if (content.length() != 0) {
try {
double aux = Double.parseDouble(content);
MainFrame.getTcl().setClusterHeadTransmissionRange(aux);
} catch (NumberFormatException nfe) {
textField.requestFocus();
}
}
}//GEN-LAST:event_clusterHeadTransmissionRangeTextFieldFocusLost
private void clusterHeadEnergyTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_clusterHeadEnergyTextFieldFocusLost
javax.swing.JTextField textField = (javax.swing.JTextField) evt.getSource();
String content = textField.getText();
if (content.length() != 0) {
try {
double aux = Double.parseDouble(content);
MainFrame.getTcl().setClusterHeadEnergy(aux);
} catch (NumberFormatException nfe) {
textField.requestFocus();
}
}
}//GEN-LAST:event_clusterHeadEnergyTextFieldFocusLost
private void clusterHeadNumberTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_clusterHeadNumberTextFieldFocusLost
javax.swing.JTextField textField = (javax.swing.JTextField) evt.getSource();
String content = textField.getText();
if (content.length() != 0) {
try {
int aux = Integer.parseInt(content);
MainFrame.getTcl().setClusterHeadNumber(aux);
} catch (NumberFormatException nfe) {
textField.requestFocus();
}
}
}//GEN-LAST:event_clusterHeadNumberTextFieldFocusLost
private void clusterHeadNumberTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadNumberTextFieldActionPerformed
int aux = 0;
String s = clusterHeadNumberTextField.getText();
if (s.length() != 0) {
try {
aux = Integer.parseInt(s);
MainFrame.getTcl().setClusterHeadNumber(aux);
} catch (NumberFormatException nfe) {
getToolkit().beep();
clusterHeadNumberTextField.requestFocus();
}
}
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadNumberTextFieldActionPerformed
private void clusterHeadLocationComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadLocationComboBoxActionPerformed
MainFrame.getTcl().setClusterHeadLocation((String)clusterHeadLocationComboBox.getSelectedItem());
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadLocationComboBoxActionPerformed
private void clusterHeadEnergyTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadEnergyTextFieldActionPerformed
double aux = 0;
String s = clusterHeadEnergyTextField.getText();
if (s.length() != 0) {
try {
aux = Double.parseDouble(s);
MainFrame.getTcl().setClusterHeadEnergy(aux);
} catch (NumberFormatException nfe) {
getToolkit().beep();
clusterHeadEnergyTextField.requestFocus();
}
}
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadEnergyTextFieldActionPerformed
private void clusterHeadApplicationComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadApplicationComboBoxActionPerformed
MainFrame.getTcl().setClusterHeadApplication((String)clusterHeadApplicationComboBox.getSelectedItem());
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadApplicationComboBoxActionPerformed
private void clusterHeadProcessingComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadProcessingComboBoxActionPerformed
MainFrame.getTcl().setClusterHeadProcessingType((String)clusterHeadProcessingComboBox.getSelectedItem());
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadProcessingComboBoxActionPerformed
private void clusterHeadTransmissionRangeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadTransmissionRangeTextFieldActionPerformed
double aux = 0;
String s = clusterHeadTransmissionRangeTextField.getText();
if (s.length() != 0) {
try {
aux = Double.parseDouble(s);
MainFrame.getTcl().setClusterHeadTransmissionRange(aux);
} catch (NumberFormatException nfe) {
getToolkit().beep();
clusterHeadTransmissionRangeTextField.requestFocus();
}
}
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadTransmissionRangeTextFieldActionPerformed
private void clusterHeadDissTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadDissTypeComboBoxActionPerformed
MainFrame.getTcl().setClusterHeadDissType((String)clusterHeadDissTypeComboBox.getSelectedItem());
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadDissTypeComboBoxActionPerformed
private void clusterHeadDissIntervalTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterHeadDissIntervalTextFieldActionPerformed
double aux = 0;
String s = clusterHeadDissIntervalTextField.getText();
if (s.length() != 0) {
try {
aux = Double.parseDouble(s);
MainFrame.getTcl().setClusterHeadDissInterval(aux);
} catch (NumberFormatException nfe) {
getToolkit().beep();
clusterHeadDissIntervalTextField.requestFocus();
}
}
MainFrame.setXMLSaved(false);
}//GEN-LAST:event_clusterHeadDissIntervalTextFieldActionPerformed
private void setClusterHeadLocationComboBox(String s) {
clusterHeadLocationComboBox.addItem(s);
clusterHeadLocationComboBox.setSelectedItem(s);
}
private void setClusterHeadNumberTextField(String s) {
clusterHeadNumberTextField.setText(s);
}
private void setClusterHeadEnergyTextField(String s) {
clusterHeadEnergyTextField.setText(s);
}
private void setClusterHeadApplicationComboBox(String s) {
clusterHeadApplicationComboBox.addItem(s);
clusterHeadApplicationComboBox.setSelectedItem(s);
}
private void setClusterHeadProcessingComboBox(String s) {
clusterHeadProcessingComboBox.addItem(s);
clusterHeadProcessingComboBox.setSelectedItem(s);
}
private void setClusterHeadTransmissionRangeTextField(String s) {
clusterHeadTransmissionRangeTextField.setText(s);
}
private void setClusterHeadDissTypeComboBox(String s) {
clusterHeadDissTypeComboBox.addItem(s);
clusterHeadDissTypeComboBox.setSelectedItem(s);
}
private void setClusterHeadDissIntervalTextField(String s) {
clusterHeadDissIntervalTextField.setText(s);
}
public void updateFields(TclFields tcl){
setClusterHeadLocationComboBox(tcl.getClusterHeadLocation());
setClusterHeadNumberTextField(String.valueOf(tcl.getClusterHeadNumber()));
setClusterHeadEnergyTextField(String.valueOf(tcl.getClusterHeadEnergy()));
setClusterHeadApplicationComboBox(tcl.getClusterHeadApplication());
setClusterHeadProcessingComboBox(tcl.getClusterHeadProcessingType());
setClusterHeadTransmissionRangeTextField(String.valueOf(tcl.getClusterHeadTransmissionRange()));
setClusterHeadDissTypeComboBox(tcl.getClusterHeadDissType());
setClusterHeadDissIntervalTextField(String.valueOf(tcl.getClusterHeadDissInterval()));
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox clusterHeadApplicationComboBox;
private javax.swing.JLabel clusterHeadApplicationLabel;
private javax.swing.JLabel clusterHeadApplicationLabel1;
private javax.swing.JLabel clusterHeadDissIntervalLabel;
private javax.swing.JTextField clusterHeadDissIntervalTextField;
private javax.swing.JComboBox clusterHeadDissTypeComboBox;
private javax.swing.JLabel clusterHeadDissTypeLabel;
private javax.swing.JLabel clusterHeadEnergyLabel;
private javax.swing.JTextField clusterHeadEnergyTextField;
private javax.swing.JComboBox clusterHeadLocationComboBox;
private javax.swing.JLabel clusterHeadLocationLabel;
private javax.swing.JLabel clusterHeadNumberLabel;
private javax.swing.JTextField clusterHeadNumberTextField;
private javax.swing.JComboBox clusterHeadProcessingComboBox;
private javax.swing.JLabel clusterHeadPtLabel;
private javax.swing.JTextField clusterHeadTransmissionRangeTextField;
private javax.swing.JLabel joulesLabel;
private javax.swing.JLabel secondsLabel;
private javax.swing.JLabel secondsLabel1;
// End of variables declaration//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -