アットウィキロゴ

がめ1217

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.text.BadLocationException;

class game1216 extends JFrame{

JTextArea txarea;
String str;
int a;

  public static void main(String args[]){
    game1216 frame = new game1216("タイトル");
    frame.setVisible(true);
  }

  game1216(String title){
    setTitle(title);
    setBounds(0, 0, 700, 700);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel p = new JPanel();    

    txarea = new JTextArea();
    txarea.setLineWrap(true);
    txarea.setEditable(false);
    JScrollPane scrollpane2 = new JScrollPane(txarea);
    scrollpane2.setPreferredSize(new Dimension(500, 500));

a=700;

str=Integer.toString(a);

str=str+"XXX";

str=str+"\n";

str=str+"ccc";


    JButton button1 = new JButton("全て取得");
    button1.addActionListener(
      new ActionListener(){
        public void actionPerformed(ActionEvent event){
          txarea.setText(str);
        }
      }
    );

    

    p.add(scrollpane2);
    p.add(button1);

    Container contentPane = getContentPane();
    contentPane.add(p, BorderLayout.CENTER);
  }
}
最終更新:2011年03月21日 08:49