都知知道Eclipse功能强大,开发出Eclipse软件实数不易,哪位高人知道Eclipse原码?最近在编写一个即时通信软件,就像QQ聊天软件一样,可被一个下拉列表框给难住了,哪位知道下拉列表框怎么写的,请发代码,感激不尽!(谁知道QQ群下拉列表怎么写,点击我的QQ群能下拉出来一堆群)因为无法上图,报歉!

解决方案 »

  1.   

    用JTree呀,树结构啊。可以自定义群组的图片。不过这个还得优化下。Jtree主要是做管理系统的对界面的优化不是很好。可以说难看。不过费些事。
      

  2.   

     Eclipse原码  Eclipse 是开源的  这个到其官方网站可以下载  
      

  3.   

    csdn 每个注册用户都有一个相册,可以上传图片。
      

  4.   

    下拉列表? 你是说combo 吗?  还是jtree?  给个示意图
      

  5.   

    LZ是想用JComboBox还是输入文本形式下拉?JComboBox相对容易,文本下来得要一个插件,网上几乎找不到资料的,我项目中因为也要做一个文本下拉!花了2个多星期才写出了一个插件,是非常的复杂的。
      

  6.   


    谢谢,就是JTree 谁有案例,发个上来
      

  7.   


    谢谢,就是JTree 谁有案例,发个上来
      

  8.   

    http://www.iteye.com/topic/697436这个写得很好
      

  9.   

    如何你开发的是Android项目,可以使用ExpandableListActivity和SimpleExpandableListAdapter
      

  10.   

    我开发的是JAVA C/S 架构的项目,
    请问下拉列表用什么图形编程语言和QQ下拉列表一样
      

  11.   

    自己写的,献丑了,希望对楼主有点帮助
    package qq.com.client.view;import java.awt.Dimension;
    import java.awt.TextField;
    import java.awt.event.*;import javax.swing.*;public class Login2 extends JFrame { public String[] guo = { "中国", "美国", "英国", "日本", "德国", "意大利", "法国" }; private JPanel jp = new JPanel();
    private JPanel jp1 = new JPanel();
    private JPanel jp2 = new JPanel();
    private JPanel jp3 = new JPanel();
    private JPanel jp4 = new JPanel();
    private JPanel jp5 = new JPanel();
    private JPanel jp6 = new JPanel();
    private JPanel jp7 = new JPanel();
    private JPanel jp8 = new JPanel();
    private JPanel jp9 = new JPanel();
    private JPanel jp10 = new JPanel(); JLabel a = new JLabel("选择头像");
    ImageIcon[] imageIcon = new ImageIcon[7];
    JComboBox b = new JComboBox(); JLabel c = new JLabel("昵称");

    JTextField d = new JTextField(5); JLabel e = new JLabel("性别:");
    JCheckBox f = new JCheckBox();
    JLabel g = new JLabel("男");
    JCheckBox h = new JCheckBox();
    JLabel i = new JLabel("女");
    JLabel j = new JLabel("年龄:");
    TextField k = new TextField(); String sb = null;
    String bs=null;
    JLabel l = new JLabel("所在地区:");
    JComboBox m = new JComboBox(guo); JComboBox n = new JComboBox();
    JComboBox o = new JComboBox(); JLabel p = new JLabel("输入密码:");
    JTextField q = new JTextField(15); JLabel r = new JLabel("密码由4-16个字符组成,区分大小写"); JLabel s = new JLabel("确认密码:");
    JTextField t = new JTextField(15); JLabel u = new JLabel("密保问题");
    JTextField v = new JTextField(15); JLabel w = new JLabel("问题答案");
    JTextField ww = new JTextField(15); JLabel x = new JLabel("个性签名");
    JTextField y = new JTextField(); JButton z = new JButton("取消");
    JButton zz = new JButton("提交");


    Box box1 = Box.createHorizontalBox();
    Box box2 = Box.createHorizontalBox();
    Box box3 = Box.createHorizontalBox();
    Box box4 = Box.createHorizontalBox();
    Box box5 = Box.createHorizontalBox();
    Box box6 = Box.createHorizontalBox();
    Box box7 = Box.createHorizontalBox();
    Box box8 = Box.createHorizontalBox();
    Box box9 = Box.createHorizontalBox();
    Box box10 = Box.createHorizontalBox();
    Box verbox = Box.createVerticalBox(); public Login2() {

    y.setPreferredSize(new Dimension(170, 50));


    box1.add(a);
    box1.add(Box.createHorizontalStrut(20));
    box1.add(b);
    box1.add(c);
    box1.add(d); box2.add(e);
    box2.add(f);
    box2.add(g);
    box2.add(h);
    box2.add(i);
    box2.add(j);
    box2.add(k); box3.add(l);
    box3.add(m);
    box3.add(n);
    box3.add(o); box4.add(p);
    box4.add(q); box5.add(r); box6.add(s);
    box6.add(t); box7.add(u);
    box7.add(v); box8.add(w);
    box8.add(ww); box9.add(x);
    box9.add(y); box10.add(z);
    box10.add(Box.createHorizontalStrut(40));
    box10.add(zz); jp1.add(box1);
    jp2.add(box2);
    jp3.add(box3);
    jp4.add(box4);
    jp5.add(box5);
    jp6.add(box6);
    jp7.add(box7);
    jp8.add(box8);
    jp9.add(box9);
    jp10.add(box10); verbox.add(jp1);
    verbox.add(jp2);
    verbox.add(jp3);
    verbox.add(jp4);
    verbox.add(jp5);
    verbox.add(jp6);
    verbox.add(jp7);
    verbox.add(jp8);
    verbox.add(jp9);
    verbox.add(jp10);


    n.addItem("请选择省份");
    o.addItem("请选择城市"); for (int j = 0; j < 7; j++) { m.addItem(guo[j]);
    } for (int i = 1; i < 7; i++) {
    imageIcon[i] = new ImageIcon("./image/" + (i + 1) + ".jpg"); b.addItem(imageIcon[i]); } m.addActionListener(new ActionListener() { @Override
    public void actionPerformed(ActionEvent e) {
    // TODO Auto-generated method stub
    sb = (String) m.getSelectedItem(); if (sb.equals("中国")) {
    String[] Sheng = { "北京", "上海", "山东", "山西", "广东", "辽宁",
    "湖南", "重庆", "四川", "云南", "黑龙江", "吉林", "广西", "内蒙古",
    "陕西", }; n.removeAllItems();
    for (int i = 0; i < Sheng.length; i++) {
    n.addItem(Sheng[i]);
    }

    n.addActionListener(new ActionListener(){ @Override
    public void actionPerformed(ActionEvent e) {
    // TODO Auto-generated method stub
    bs = (String)   n.getSelectedItem();
    if(bs.equals("山东")){
    String[] shi ={"济南","青岛","聊城","东营","潍坊","烟台","淄博","济宁","德州","枣庄","滨州","临沂","威海"};
    o.removeAllItems();
    for(int i=0;i<shi.length;i++){
    o.addItem( shi[i]);
    }
    }
    }

    } );



    } else if (sb.equals("美国")) {
    String[] Zhou = { "请选择选择州", " 阿拉巴马州", "阿拉斯加州", "亚利桑那州",
    "阿肯色州", "科罗拉多州", "康涅狄格州", "特拉华州", "佛罗里达州", "乔治亚州",
    "夏威夷州", "爱达荷州", "伊利诺州", "印地安那州", "爱荷华州", "路易斯安那州",
    "缅因州", "马里兰州", "麻萨诸塞州", "明尼苏达州", "内华达州", "新罕布什尔州", };
    n.removeAllItems();
    for (int i = 0; i < Zhou.length; i++) {
    n.addItem(Zhou[i]);
    }
    }
    }
    }); this.add(verbox);
    this.setTitle("QQ申请");
    this.setVisible(true);
    this.setBounds(200, 200, 500, 500);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } public static void main(String[] args) {
    new Login2();
    }}
      

  12.   

    运行楼上代码报错,如下:
    Exception in thread "main" java.lang.Error: Do not use qq.com.client.view.Login2.add
    ……
    请问这是什么错误??
      

  13.   

    用JTree呀,树结构啊。可以自定义群组的图片。不过这个还得优化下。Jtree主要是做管理系统的对界面的优化不是很好。可以说难看。不过费些事。 
      

  14.   

    很简单。用JTree就可以实现。
      

  15.   

    这是俺昨天为一个朋友回答的一个用JTree列出盘符的例子,希望能帮上楼主package com.xcy.test;import java.io.File;import javax.swing.JFrame;
    import javax.swing.JTree;
    import javax.swing.filechooser.FileSystemView;
    import javax.swing.tree.DefaultMutableTreeNode;public class JTreeTest extends JFrame {
        public JTreeTest() {
            DefaultMutableTreeNode root = new DefaultMutableTreeNode("我的电脑");
            FileSystemView sys = FileSystemView.getFileSystemView();
            File[] files = File.listRoots();
            for (int i = 0; i < files.length; i++) {//测试的时候最好是把这行代码换成  for (int i = 1; i < 2; i++) { i=1在我机子上 是指定D盘
                DefaultMutableTreeNode temp = new DefaultMutableTreeNode(sys.getSystemDisplayName(files[i]));
                root.add(temp);
                bind(temp,files[i].toString());//测试的时候最好是把这行代码换成  bind(temp,"D:\xxx\xxx");指定一个文件夹,否则遍历整个文件系统会非常慢
            }
            JTree jtree = new JTree(root);
            this.add(jtree);
            this.setSize(500, 500);
            this.setVisible(true);
        }
        
        public void bind(DefaultMutableTreeNode node,String path){
            File file = new File(path);
            File[] files = file.listFiles();
            for(int i=0;files!=null && i<files.length;i++){
                File tempFile = files[i];
                if(tempFile.isDirectory()){
                    DefaultMutableTreeNode tempNode = new DefaultMutableTreeNode(tempFile.getName());
                    node.add(tempNode);
                    bind(tempNode,tempFile.getAbsolutePath());
                }else{
                    DefaultMutableTreeNode tempNode = new DefaultMutableTreeNode(tempFile.getName());
                    node.add(tempNode);
                }
            }
        }    public static void main(String[] args) {
            new JTreeTest();
        }
    }