www.5129.net > jAvA下拉列表框

jAvA下拉列表框

你好,在cp.add(jc);后面,加上以下代码即可 jc.addItemListener(new ItemListener(){ @Override public void itemStateChanged(ItemEvent e) { System.out.println(jc.getSelectedItem().toString()); } });

import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class L extends Applet implements ItemListener, ActionListener { Choice choice; TextField text; TextArea area; Button add, del; public void init() { ...

import java.awt.event.ItemListener; import java.awt.event.ItemEvent; import javax.swing.JFrame; import javax.swing.JComboBox; public class ComBoxDemo extends JFrame { JComboBox computer; //主类别下拉框 JComboBox fittings; //配...

lz 你好 (ps: lz 加点儿分吧 太少了……) 具体代码如下: import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;public class Test extends JFrame {private JLabel name,phone,sex;private JTextField inputName,inp...

//核心代码String[] sg= {"苹果","香蕉","樱桃","山楂"};JComboBox jcb = new JComboBox(sg);完整代码 import java.awt.*;import javax.swing.*;public class MFrame extends JFrame{public MFrame() {String[] sg= {"苹果","香蕉","樱桃","山楂...

Java源程序: import java.awt.event.*; import javax.swing.*; public class FrmGrade implements ActionListener { JFrame frame; JPanel panel; JLabel lblState,lblCity; JComboBox cmbState,cmbCity; String[] provinces = new String[]{"...

假设这JSP叫 index.jsp,自己提交给自己. cn us en 请采纳.

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; public class Demo10 extends JFrame implements ActionListener { String ...

你是要30天的日期嘛。。。 public String genRqOpts() { StringBuilder rtn = new StringBuilder(""); java.util.Date date = new java.util.Date();//获得当前系统时间 SimpleDateFormat simple = new SimpleDateFormat("yyyyMMdd"); String ti...

DateDropFrame extends JFrame 给year和month添加一个ItemListener来实时计算指定年和月中有多少天就可以了. 代码是用Swing写的,不过看你的图,不像是Swing界面. /** * Create the frame. */ public DateDropFrame() { setDefaultCloseOperation(...

网站地图

All rights reserved Powered by www.5129.net

copyright ©right 2010-2021。
www.5129.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com