没有控件和API吧。一般是把子类别(城市)下拉框写在iframe里,在主类别(省份)下拉框onchange的时候更改子类别iframe的查询字符串。

解决方案 »

  1.   

    首先感谢你的帮助,但是我是想问一下用纯粹的java的Swing 控件应该如何实现那?就是一个combox里的值发生改变,可以使与它相链接的另一个list里的内容发生改变。
      

  2.   

    自己写,值CHANGE时调用一个函数就可以了,动态改变下拉条内容
      

  3.   

    用js吧
    <html> 
    <head> 
    <title>List</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <script LANGUAGE="javascript"> 
    <!-- 
    var onecount; 
    onecount=0; 
         
    subcat = new Array(); 
    subcat[0] = new Array("徐汇区","01","001"); 
    subcat[1] = new Array("嘉定区","01","002"); 
    subcat[2] = new Array("黄浦区","01","003"); 
    subcat[3] = new Array("南昌市","02","004"); 
    subcat[4] = new Array("九江市","02","005"); 
    subcat[5] = new Array("上饶市","02","006"); onecount=6; function changelocation(locationid) 
        { 
        document.myform.smalllocation.length = 0;      var locationid=locationid; 
        var i; 
        document.myform.smalllocation.options[0] = new Option('====所有地区====',''); 
        for (i=0;i < onecount; i++) 
            { 
                if (subcat[i][1] == locationid) 
                {  
                document.myform.smalllocation.options[document.myform.smalllocation.length] 
     = new Option(subcat[i][0], subcat[i][2]); 
                }         
            } 
             
        }     //--> 
    </script> 
    </head> 
    <body> 
    <form name="myform" method="post"> 
        <select name="biglocation"  
    onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)"> 
            <option value="01" selected>上海</option> 
            <option value="02">江西</option> 
        </select> 
        <select name="smalllocation">  
            <option selected value="">==所有地区==</option> 
        </select> 
    </form> 
    <script LANGUAGE="javascript">  
    <!--  
        changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value);  
    //-->  
    </script> 
    </body> 
    </html> 
    看这个,能不能有用都给加点分吧,本人现在有问题不能问呀!谢谢
      

  4.   

    在数据库中建二个表.
    一个省表  省表一个主键ID
    一个市表
    将省表中的数据添加到
    下拉列表框1中
    当单击下拉列表框时
    反回一ID
    这时在市表中查询出相关城市.
    显示到列表框2中
      

  5.   

    下面这个是js文件:  function aClass(aData, aValue, aText) {
        if (aClass.arguments.length < 3)
          alert("传入的参数错误!")
        else {
          this.Data  = aData;
          this.Value = aValue;
          this.Text  = aText;
        }
      }  function chgDnCombobox(aSrc, aDes, aClass, aRemain){
        if (chgDnCombobox.arguments.length < 3)
    alert("传入的参数错误!")
        else if (aSrc.type != "select-one")
          alert("传入的参数错误!")
        else if (aClass == null)
          alert("aClass未定义错误!")
        else {
          if (aRemain==null)
            aRemain = 1;
          chgDnComboboxItem(aSrc.options[aSrc.selectedIndex].value, aDes, aClass, aRemain);
        }
      }  function chgDnComboboxItem(aValue, aDes, aClass, aRemain){
        if (chgDnComboboxItem.arguments.length<3)
          alert("参数传入错误!")
        else if (aClass==null)
          alert("错误!aClass没有定义!")
        else{
          if (aRemain==null)
            aRemain = 1;
          deleteAllComboboxItem(aDes, aRemain);
          for (var i=0; i<aClass.length; i++)
            if (aClass[i].Data==aValue)  /* check aClass[i].Data */
              if (aClass[i].Data!="")
                addComboboxItem(aDes, aClass[i].Text, aClass[i].Value);
        }
      }  function deleteAllComboboxItem(aList, aRemain) {
        for (var i=aList.options.length; i > aRemain-1; i--)
          aList.options[i] = null;
      }      function addComboboxItem(aList, aText, aValue) {
        var aOption = new Option(aText, aValue);
        eval("aList.options[aList.options.length]=aOption");
      }//数据区,可以在这里添加数据
    function change_area(aForm) {
    chgDnCombobox(aForm.CountryGroup, aForm.City, f_Set0 , 0);
    }function change_are(aForm) {
    chgDnCombobox(aForm.JGroup, aForm.JCity, f_Set0 , 0);
    }function onchg(aForm) {
    onchg(document.myform);}
    var f_Set0 = new Array(
    new aClass('福建', '福州', '福州'),
    new aClass('福建', '厦门', '厦门'),
    new aClass('福建', '建阳', '建阳'),
    new aClass('福建', '罗源', '罗源'),
    new aClass('福建', '连江', '连江'),
    new aClass('福建', '长乐', '长乐'),
    new aClass('福建', '福清', '福清'),
    new aClass('福建', '平潭', '平潭'),
    new aClass('福建', '永泰', '永泰'),
    new aClass('福建', '闽清', '闽清'),
    new aClass('福建', '闽候', '闽候'),
    new aClass('福建', '同安', '同安'),
    new aClass('福建', '福安', '福安'),
    new aClass('福建', '柘荣', '柘荣'),
    new aClass('福建', '福鼎', '福鼎'),
    new aClass('福建', '霞浦', '霞浦'),
    new aClass('福建', '古田', '古田'),
    new aClass('福建', '屏南', '屏南'),
    new aClass('福建', '周宁', '周宁'),
    new aClass('福建', '寿宁', '寿宁'),
    new aClass('福建', '宁德', '宁德'),
    new aClass('福建', '莆田', '莆田'),
    new aClass('福建', '莆田县', '莆田县'),
    new aClass('福建', '仙游', '仙游'),
    new aClass('福建', '泉州', '泉州'),
    new aClass('福建', '石狮', '石狮'),
    new aClass('福建', '晋江', '晋江'),
    new aClass('福建', '惠安', '惠安'),
    new aClass('福建', '南安', '南安'),
    new aClass('福建', '安溪', '安溪'),
    new aClass('福建', '永春', '永春'),
    new aClass('福建', '德化', '德化'),
    new aClass('福建', '漳州', '漳州'),
    new aClass('福建', '长泰', '长泰'),
    new aClass('福建', '龙海', '龙海'),
    new aClass('福建', '漳浦', '漳浦'),
    new aClass('福建', '东山', '东山'),
    new aClass('福建', '云宵', '云宵'),
    new aClass('福建', '诏安', '诏安'),
    new aClass('福建', '平和', '平和'),
    new aClass('福建', '南靖', '南靖'),
    new aClass('福建', '华安', '华安'),
    new aClass('福建', '龙岩', '龙岩'),
    new aClass('福建', '漳平', '漳平'),
    new aClass('福建', '永定', '永定'),
    new aClass('福建', '上杭', '上杭'),
    new aClass('福建', '武平', '武平'),
    new aClass('福建', '长汀', '长汀'),
    new aClass('福建', '连城', '连城'),
    new aClass('福建', '三明', '三明'),
    new aClass('福建', '沙县', '沙县'),
    new aClass('福建', '尤溪', '尤溪'),
    new aClass('福建', '大田', '大田'),
    new aClass('福建', '永安', '永安'),
    new aClass('福建', '清流', '清流'),
    new aClass('福建', '宁化', '宁化'),
    new aClass('福建', '明溪', '明溪'),
    new aClass('福建', '建宁', '建宁'),
    new aClass('福建', '泰宁', '泰宁'),
    new aClass('福建', '将乐', '将乐'),
    new aClass('福建', '南平', '南平'),
    new aClass('福建', '浦城', '浦城'),
    new aClass('福建', '松溪', '松溪'),
    new aClass('福建', '政和', '政和'),
    new aClass('福建', '建瓯', '建瓯'),
    new aClass('福建', '顺昌', '顺昌'),
    new aClass('福建', '邵武', '邵武'),
    new aClass('福建', '光泽', '光泽'),
    new aClass('福建', '武夷山', '武夷山'),
    new aClass('福建', '建阳', '建阳'),