Loading

SWT中嵌入Swing的JTextFeild却不能编辑

SWT中嵌入Swing的JTextFeild却不能编辑

学习了:http://www.iteye.com/problems/49487   膜拜一下 org

竟然有这样的坑,需要在中间添加一个JApplet对象;

 

    // 进行测试swing环境加载
    public void initJPanel(CTabFolder tabFolder) {
        CTabItem tbtmNewItem = new CTabItem(tabFolder, SWT.NONE);
        tbtmNewItem.setText("title"); // 
        Composite composite = new Composite(tabFolder, SWT.EMBEDDED);
        tbtmNewItem.setControl(composite);
        Frame frame = SWT_AWT.new_Frame(composite);
        
        JPanel jPanel = new JPanel(new BorderLayout());
        JApplet applet = new JApplet();  
        applet.add(jPanel);  
        frame.add(applet);
        //frame.add(jPanel);
        JTextField textField = new JTextField();
        jPanel.add(textField);
    }

 

posted @ 2018-01-29 14:08  stono  阅读(201)  评论(0编辑  收藏  举报