请用JAVA语言编写个程序 添加两个标签一个文本框,一个文本区和一个按钮是java中的构件吗,还是html中,我这个问题不会太难,你说清楚一点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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 ); }} 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(); }} StringBuffer类比String类更高效地存储字符串还是更高效的追加字符串 复杂的el ${bActionForm.container.account} 表示什么含义 SplashScreen怎么在Eclipse中用 解释一下两条语句 java的时间函数 iplanet上配置SSL的问题 小弟初来深圳,想找份程序员的工作,各位大哥能介绍下这里的情况不? ==和equals() 请教有关"taglib"的问题? java编写的纸牌游戏!! 今天是1月8日,懷念周總理!! 关于jdbc与sql server2000在jar文件中连接的问题。
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 );
}
}
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();
}
}