?? comunicationtest.java~3~
字號(hào):
package comunication;
import javax.swing.JApplet;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JSlider;
import java.awt.Rectangle;
import javax.swing.JProgressBar;
import javax.swing.JLabel;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ComunicationTest extends JApplet {
public ComunicationTest() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception{
getContentPane().setLayout(null);
滑標(biāo).setOrientation(JSlider.VERTICAL);
滑標(biāo).setMajorTickSpacing(10);
滑標(biāo).setPaintLabels(true);
滑標(biāo).setPaintTicks(true);
滑標(biāo).setBounds(new Rectangle(200, 15, 94, 215));
滑標(biāo).addChangeListener(new ComunicationTest_滑標(biāo)_changeAdapter(this));
指示.setOrientation(JProgressBar.VERTICAL);
溫度指示.setText("溫度指示");
溫度指示.setBounds(new Rectangle(149, 251, 49, 15));
溫度滑標(biāo).setText("溫度滑標(biāo)");
溫度滑標(biāo).setBounds(new Rectangle(230, 251, 58, 15));
當(dāng)前溫度.setText("當(dāng)前溫度為:");
當(dāng)前溫度.setBounds(new Rectangle(13, 271, 140, 15));
this.getContentPane().add(指示);
this.getContentPane().add(滑標(biāo));
this.getContentPane().add(溫度滑標(biāo));
this.getContentPane().add(溫度指示);
this.getContentPane().add(當(dāng)前溫度);
指示.setBounds(new Rectangle(156, 15, 28, 215));
}
public static void main(String[] args) {
ComunicationTest comunicationtest = new ComunicationTest();
}
JSlider 滑標(biāo) = new JSlider();
JProgressBar 指示 = new JProgressBar();
JLabel 溫度指示 = new JLabel();
JLabel 溫度滑標(biāo) = new JLabel();
JLabel 當(dāng)前溫度 = new JLabel();
public void 滑標(biāo)_stateChanged(ChangeEvent e) {
int i=滑標(biāo).getValue();
指示.setValue(i);
當(dāng)前溫度.setText("當(dāng)前溫度為:"+i);
}
}
class ComunicationTest_滑標(biāo)_changeAdapter implements ChangeListener {
private ComunicationTest adaptee;
ComunicationTest_滑標(biāo)_changeAdapter(ComunicationTest adaptee) {
this.adaptee = adaptee;
}
public void stateChanged(ChangeEvent e) {
adaptee.滑標(biāo)_stateChanged(e);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -