📄 commtestevent.java
字号:
package com.sunfruit.comm.event.menu.test;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import com.sunfruit.comm.util.GetResource;
import com.sunfruit.comm.model.SetupModel;
import com.sunfruit.comm.swing.menu.test.CommTestJPanel;
import com.sunfruit.comm.dictate.CommDictate;
import javax.swing.ComboBoxModel;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class CommTestEvent implements ActionListener {
private CommTestJPanel commTestJPanel=null;
public CommTestEvent(CommTestJPanel commTestJPanel) {
this.commTestJPanel=commTestJPanel;
}
/**
* Invoked when an action occurs.
*
* @param e ActionEvent
* @todo Implement this java.awt.event.ActionListener method
*/
public void actionPerformed(ActionEvent e) {
JButton jbutton=(JButton)(e.getSource());
String sname=jbutton.getName();
if(sname.equals("jButton1"))
{
SetupModel setupModel=GetResource.getCenterNumber();
setupModel.setComname(commTestJPanel.getComName());
commTestJPanel.getCommMenuJDialog().setVisible(false);
commTestJPanel.getCommMenuJDialog().dispose();
}
else if(sname.equals("jButton2"))
{
commTestJPanel.getJComboBox1().removeAllItems();
String[] comname=CommDictate.getComName();
for(int i=0;i<comname.length;i++)
{
commTestJPanel.getJComboBox1().addItem(comname[i]);
//commTestJPanel.getJComboBox1().updateUI();
}
}
else if(sname.equals("jButton3"))
{
String comname=commTestJPanel.getJComboBox1().getSelectedItem().toString();
boolean bool=CommDictate.isUseCom(comname);
if(bool)
{
commTestJPanel.setTestText(comname+"串口测试正常");
}
else
{
commTestJPanel.setTestText(comname+"串口无法连接");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -