アットウィキロゴ

がめ1128xp

import javax.swing.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Dimension;

public class game1209 extends JFrame{

  private String[][] tabledata = {
    {"日本", "3勝", "0敗", "1分"},
    {"クロアチア", "3勝", "1敗", "0分"},
    {"ブラジル", "1勝", "2敗", "1分"},
    {"オーストラリア", "2勝", "2敗", "0分"}};

  private String[] columnNames = {"COUNTRY", "WIN", "LOST", "EVEN"};

  public static void main(String[] args){
    game1209 test = new game1209("SwingTest");

    test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    test.setVisible(true);
  }

  game1209(String title){
    setTitle(title);
    setBounds( 10, 10, 300, 200);

    JTable table = new JTable(tabledata, columnNames);

    JScrollPane sp = new JScrollPane(table);
    sp.setPreferredSize(new Dimension(250, 70));

    JPanel p = new JPanel();
    p.add(sp);

    getContentPane().add(p, BorderLayout.CENTER);
  }
}
最終更新:2011年03月18日 15:32