2013年12月4日星期三

java can be added to a JPanel JPanel it?

java can be added to a JPanel JPanel it?
------ Solution ------------------------ --------------------
can be heard .
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
heard containers can contain other things.
------ Solution ---------------------------------------- ----
can . I write you an example:
package com.htzy;

import javax.swing.*;

public class Demo1_1 extends JFrame{

//变量
JPanel jp1,jp2;
JTextField jt;
JButton jb;

public static void main(String[] args) {
new Demo1_1();
}

//构造函数
public Demo1_1(){

jp1 = new JPanel();
jp2 = new JPanel();
jt = new JTextField(10);
jb = new JButton("确定");

jp1.add(jt);
jp1.add(jb);
jp2.add(jp1);//把jp1面板加入到jp2中

this.add(jp2);
this.setSize(240,200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}

------ Solution ------------------------------------- -------
possible. Methods inherited from Component to the
------ For reference only -------------------------------- -------


you said something else , including other containers ?
------ For reference only -------------------------------------- -

  
you said something else , including other containers ?  
yes.
------ For reference only -------------------------------------- -
  The reply was deleted administrator at 2013-12-05 08:51:59

------ For reference only ---------------------------------- -----
of course , this is a common tactic useless ah.
------ For reference only -------------------------------------- -

  
you said something else , including other containers ?   understand , thank you !
------ For reference only -------------------------------------- -
Thank you , understand, seems almost, nothing else on the knot posted
------ For reference only ---------------- -----------------------
of course , you may want to add a few of

没有评论:

发表评论