import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import javax.swing.event.*;
import javax.swing.ListSelectionModel;
class Listfile extends JFrame {
private String name_v;
private int age;
private JButton btn;
private JTextArea reply;
private JPanel pane;
private JScrollPane scrollbar;
public static void main(String[] args){
String name = "lee-roy";
String password = "anointed23";
String body = "hi my name is: ";
String body2 = "and this is my account im glad you could join in";
Listfile account1 = new Listfile();
account1.setListfile("Jamal", 19);
account1.getListfile();
Listfile app = new Listfile();
}
public Listfile(){
super("App chat log Gui");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setSize(550, 600);
pane = new JPanel();
reply = new JTextArea(10, 35);
scrollbar = new JScrollPane(reply);
btn = new JButton("Send");
reply.setLineWrap(true);
reply.setWrapStyleWord(true);
scrollbar.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
add(pane);
pane.add(scrollbar);
pane.add(btn);
AreaHandler handle = new AreaHandler();
btn.addActionListener(handle);
}
class AreaHandler implements ActionListener{
public void actionPerformed(ActionEvent event){
if(event.getSource()==btn){
reply.append("Button has been clicked");
}
}
}
public void setListfile(String name, int age_r){
name_v = name;
age = age_r;
}
public void getListfile(){
JOptionPane.showMessageDialog(null, "Hi my name is " + name_v + " the discussion for to day is too sencetive so no viewers of under the age of " + age);
}
}
これは参考にしていただきありがとうございますが、これによって_columnarテキストがこの領域にどのように設定されますか?つまり、これは質問に対する答えではありません... – kleopatra