2013年11月17日星期日

Why call this text area JTextArea show no effect

import javax.swing. *;

public class Menu extends JFrame {
private JTextArea k = new JTextArea (100,100); / / Create a text area object and initializes 100 , field length is 100
public Menu () {
this.setLayout (null);
this.add (k);
this.setBounds (50, 50, 400, 400);
this.setVisible (true);
}
public static void main (String [] args) {
new Menu ();
}
}


displayed without text area , seeking god puzzle . I confused at school in JAVA
------ Solution - -------------------------------------------
use null layout , needs its own
k.setBounds(x,y,w,h);

没有评论:

发表评论