你用插件还是直接引用eclipse的包?

解决方案 »

  1.   

    谢谢各位了,我找到答案了:
    在eclipse的swt中ALT+F4的code为:16777229,判断一下即可!还有一个问题,就是如何在整个画面都响应该键盘事件呢?
      

  2.   

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class mytext extends JFrame implements ActionListener{
    private JTextField tf=new JTextField("",20);
    private JTextArea ta=new JTextArea("",5,20);
    private JButton insert=new JButton("insert");
    Container c;
    public mytext(){
    c=getContentPane();
    c.setLayout(new FlowLayout());
    c.add(new JLabel("please enter then press insert"));
    c.add(tf);
    c.add(insert);
    c.add(ta);
    insert.addActionListener(this);
    setSize(300,250);
    setVisible(true);

    }
    public void actionPerformed(ActionEvent e){
    ta.insert(tf.getText()+'\n',0);
    tf.setText("");

    }
    public static void main(String args[])
    {
    mytext app=new mytext();
    app.addWindowListener(new mywindowlistener());
    }
    }class 2:
        import java.awt.*;
    import java.awt.event.*;
    public class mywindowlistener extends WindowAdapter{

    public void windowclosing(WindowEvent e)
    {
    System.exit(1);
    }
    }
      

  3.   

    panzhiwei(panzhiwei008) :例子中的 (WindowEvent e)引入的是:java.awt.event.WindowEvent
    而我要说的是:org.eclipse.swt包中的类,也就是说java.awt.event.WindowEvent
    是不能用的。有没有什么办法啊?
      

  4.   

    用JAVA做图型,找苦吃啊。以后简单了再学。