ComboBox的设置和监听

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class ComboBox extends Applet{
    String str[]={"计算机1班","计算机2班","计算机3班","计算机4班"};
    Label l1=new Label("班级选项:");
    Label l2=new Label("选中的班级为:");
    Label l3=new Label("计算机1班");
    JComboBox cb=new JComboBox(str);
    JPanel row1=new JPanel();
    JPanel row2=new JPanel();
    FlowLayout layout = new FlowLayout();
    public void init(){
        row1.setLayout(layout);
        row1.add(l1);
        row1.add(cb);
        this.add(row1);
        row2.setLayout(layout);
        row2.add(l2);
        row2.add(l3);
        this.add(row2);
    }
    public void start(){
        cb.addItemListener(new ItemListener(){

            public void itemStateChanged(ItemEvent arg0) {
                l3.setText(arg0.getItem().toString());
            }

        });
    }

}
时间: 2024-10-19 03:31:39

ComboBox的设置和监听的相关文章

Android之如何设置键盘监听

5.设置键盘监听[以EditText为例] username.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // TODO Auto-generated method stub switch (keyCode) { case KeyEvent.KEYCODE_1: Toast.makeText(MainActivity.thi

docker疑难解答 -- 设置远程服务监听

环境: ubuntu 16.04 tls docker version 17.05.0-ce ========================= 今天想要搭建一个多主机的集成docker环境,但是我最后发现设置docker远程服务监听的时候总是失败: Cannot connect to the Docker daemon at tcp://ip:port. Is the docker daemon running? 上网上搜了一下,都说是要修改/etc/default/docker中的DOCKE

元素全屏的设置与监听

作者网站:http://hawkzz.com 设置全屏和退出全屏 //全屏设置 $('#fullScreen').on('click', function () { fullScreen(); }); //退出全屏 $('#exitFullScreen').on('click', function () { exitFullScreen(); }); //进入全屏 function fullScreen() { var obj = document.getElementById('editMar

Spring boot设置启动监听端口

一.直接看代码: 1 @Controller 2 @EnableAutoConfiguration 3 @ComponentScan 4 public class CallMain extends SpringBootServletInitializer implements EmbeddedServletContainerCustomizer { 5 private final static Logger logger = LoggerFactory.getLogger(CallMain.cl

(转)cocos2d-x 每帧动画的播放设置一个监听函数的做法

1 local cache = cc.AnimationCache:getInstance() 2 cache:addAnimations("animations-2.plist") 3 local animation = cache:getAnimation("dance_1") 4 animation:setDelayPerUnit(0.25) 5 animation:setRestoreOriginalFrame(true) 6 local aniamte =

设置Apache监听多个端口

1.在配置文件httpd.conf中Listen多个端口 Listen localhost:8033    Listen localhost:8083 ....... 2.在配置文件夹下的extra文件夹下httpd-vhosts.conf文件中加入如下内容: <VirtualHost *:8033> DocumentRoot "F:\wamp\www" ServerName localhost <Directory "F:\wamp\www" &

tomcat设置远程监听端口(linux&amp;windows)

1.Linxu系统: apach/bin/startup.sh开始处中增加如下内容: declare -x CATALINA_OPTS="-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8081" 2.Windows系统: apach/bin/startup.bat开始处中增加如下内容:SET CATALINA_OPTS=-se

设置登录注册页面输入密码时,监听密码显示隐藏;

代码里面:在oncreate()方法里面调用:还需要先定义一个全局变量:private boolean isHidden = true; private void setchck_password() { // 设置第一次输入密码未不可见状态 login_password.setTransformationMethod(PasswordTransformationMethod .getInstance()); // 设置CheckBox监听 check_password .setOnChecke

Aircrack-ng设置监听模式异常

Aircrack-ng设置监听模式异常 aircrack-ng 在某些情况下,用户使用Aircrack-ng工具集中的airmon-ng命令,将无线网卡设置为监听模式时,会出现异常.如SIOCSIFFLA65:Name not unique on network等.此时,用户可以尝试使用iwconfig来设置.具体设置方法如下所示: (1)关闭无线网卡.执行如下命令: ifconfig wlan0 down (2)设置监听模式.执行命令如下所示: iwconfig wlan0 mode moni