progJ.pdf progJ-s.pdf progJ-e.pdf 記事一覧 |
![]() JTextArea の追加 |
progJ.pdf の[#56]-[#57]に対応する部分を追加しました.
※ *.class は http://hakurei-isl.org/m-miyata/jar/App56-dist.zip,
http://hakurei-isl.org/m-miyata/jar/App57-dist.zip
//App56.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class App56 extends App52{
JTextArea ta1;
App56( ){
super(); setSize(400, 200); b1.setText("save");
ta1 = new JTextArea(5, 30);
Container f0 = getContentPane();
f0.add(ta1);
}
public void actionPerformed(ActionEvent e){
ta1.append(tf1.getText( ) + "\n");
}
}
//Main.java
public class Main {
public static void main(String[] args) {
new App54();
}
}
-------------------------------------
//App57.java
public class App57 extends App50 {
App57(){super();}
public void run(){
try{
Thread.sleep(1000); tf1.setText("abc");
}catch(Exception e){ }
}
}
//Main.java
public class Main {
public static void main(String[] args) {
Thread th = new Thread(new App57());
th.start();
}
}