添加两个标签一个文本框,一个文本区和一个按钮是java中的构件吗,还是html中,
我这个问题不会太难,
你说清楚一点

解决方案 »

  1.   

    import java.awt.*;
    import java.applet.*;
    public class BJ extends Applet {
    Label l1=new Label("liming"),
          l2=new Label("zhanglin");
    TextField t=new TextField(10);
    TextArea ta=new TextArea(2,2);
    Button b=new Button("liming");
    Panel p=new Panel();

    public void init() {
    p.setLayout(new BorderLayout());
    p.add(l2,BorderLayout.NORTH);
    p.add(l1,BorderLayout.SOUTH);
    setLayout(new BorderLayout());
    add(p,BorderLayout.NORTH);
    add(ta,BorderLayout.CENTER);
    add(t,BorderLayout.SOUTH);
    add(b,BorderLayout.EAST);
    //add();
    } public void paint(Graphics g) {
    // g.drawString("Welcome to Java!!", 50, 60 );
    }
    }
      

  2.   

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;public class Frame1 extends JFrame {
      private JPanel contentPane;
      private JLabel jLabel1 = new JLabel();
      private JButton jb=new JButton("click");
      private JPanel jp=new JPanel(new FlowLayout());
      private JScrollPane jscr=new JScrollPane();
      private JTextArea jta=new JTextArea();
      public Frame1() {
        super("myFrame");
        this.setSize(400,300);
        this.setResizable(false);
        this.setLocation(this.getToolkit().getScreenSize().width/2-this.getWidth()/2,this.getToolkit().getScreenSize().height/2-this.getHeight()/2);
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        contentPane = (JPanel) this.getContentPane();
        contentPane.setLayout(new BorderLayout());
        contentPane.add("South",jp);
        contentPane.add("Center",jscr);
        jscr.getViewport().add(jta);
        jta.setText("start\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nend");
        jp.add(jb);
        jb.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            click(e);
          }
        });
        this.setSize(new Dimension(400, 300));
        this.setTitle("Frame Title");
        for(int i=1;i<=9;i++) {
      for(int j=1;j<=i;j++) {
        if(j!=1)
          System.out.print(",");
        System.out.print(j+"*"+i+"="+i*j);
      }
      System.out.println("");
        }
        this.setVisible(true);
      }  public void click(ActionEvent e) {
        this.jta.requestFocus();
        this.jta.setSelectionStart(this.jta.getText().length());
        this.jta.setSelectionEnd(this.jta.getText().length());
      }  public static void main(String args[]) {
        new Frame1();
      }
    }