www.5129.net > JAvA下拉框

JAvA下拉框

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

JComboBox有一个getSelectedItem()的方法得到选择的值和一个getSelectedIndex()得到选择值的索引。getSelectedObjects()得到选择的多个值。getItemCount()是得到选择的数量。getItemAt(int i)是得到指定索引的值。 下面是一个具体的例子,首先输...

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; //配...

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

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

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.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 ...

final JComboBox dbtype = new JComboBox(); dbtype.addItem("南京"); dbtype.addItem("苏州"); dbtype.addItem("南通"); dbtype.setSelectedItem("南京");//默认选中南京 dbtype.addItemListener(new ItemListener(){ public void itemStateCha...

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

String[] prpLrepairFeeAuditStatus 这是个数组,直接输出时肯定是一个对象 下拉列表只能选择一项,所以它的值只有一个, String prpLrepairFeeAuditStatus = httpServletRequest .getParameter("prpLrepairFeeAuditStatus");

网站地图

All rights reserved Powered by www.5129.net

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