📄 controlbean.java
字号:
package comm;import java.awt.*;import javax.swing.*;import java.awt.event.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class ControlBean extends JPanel { GridBagLayout gridBagLayout = new GridBagLayout(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); JLabel ToolName = new JLabel(); JLabel CommPortID = new JLabel(); JComboBox jComboBox1 = new JComboBox(); JComboBox jComboBox2 = new JComboBox(); JComboBox jComboBox3 = new JComboBox(); JComboBox jComboBox4 = new JComboBox(); JToggleButton OnOff = new JToggleButton(); JToggleButton begin = new JToggleButton(); JButton jButton1 = new JButton(); public ControlBean() { try { jbInit(); } catch(Exception ex) { ex.printStackTrace(); } } private void jbInit() throws Exception { this.setLayout(gridBagLayout); this.setSize(new Dimension(100,300)); gridBagConstraints.insets = new Insets(30,0,5,0); gridBagConstraints.anchor = gridBagConstraints.CENTER; gridBagConstraints.gridwidth = gridBagConstraints.REMAINDER; gridBagLayout.setConstraints(ToolName,gridBagConstraints); gridBagConstraints.fill = gridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new Insets(5,20,5,15); gridBagLayout.setConstraints(CommPortID,gridBagConstraints); gridBagLayout.setConstraints(jComboBox1,gridBagConstraints); gridBagLayout.setConstraints(jComboBox2,gridBagConstraints); gridBagLayout.setConstraints(jComboBox3,gridBagConstraints); gridBagLayout.setConstraints(jComboBox4,gridBagConstraints); gridBagLayout.setConstraints(OnOff,gridBagConstraints); gridBagConstraints.gridwidth = 1; gridBagConstraints.fill = gridBagConstraints.NONE; gridBagConstraints.insets = new Insets(5,5,5,0); gridBagConstraints.anchor = gridBagConstraints.EAST; gridBagLayout.setConstraints(begin,gridBagConstraints); gridBagConstraints.insets = new Insets(5,0,5,5); gridBagLayout.setConstraints(jButton1,gridBagConstraints); ToolName.setForeground(Color.BLUE); ToolName.setText("Gooseli MCU Controler"); CommPortID.setForeground(Color.PINK); jComboBox1.addItem("9600"); jComboBox1.addItem("19200"); jComboBox1.addItem("57600"); jComboBox1.addItem("115200"); jComboBox2.addItem("8"); jComboBox2.addItem("7"); jComboBox3.addItem("1"); jComboBox3.addItem("1.5"); jComboBox3.addItem("2"); jComboBox4.addItem("None"); jComboBox4.addItem("Odd"); jComboBox4.addItem("Even"); OnOff.setText("OFF"); begin.setText("Stop"); jButton1.setText("Exit"); this.add(ToolName); this.add(CommPortID); this.add(jComboBox1); this.add(jComboBox2); this.add(jComboBox3); this.add(jComboBox4); this.add(OnOff); this.add(begin); this.add(jButton1); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -