KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > helloworld > model > HwTableModel


1 /*******************************************************************************
2  * Copyright (c) 2004, Dirk von der Weiden.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * Dirk von der Weiden - initial API and implementation
10  *
11  * Created on 26.02.2005
12  *
13  * date: 26.02.2005
14  * project: WiSer-HelloWorld
15  *
16  * *******************************************************************************/

17
18 package helloworld.model;
19
20 import javax.swing.table.*;
21
22 /**
23  * @author Dirk
24  *
25  * date: 26.02.2005
26  *
27  * <p>
28  * Purpose: Simple table model
29  * </p>
30  */

31 public class HwTableModel extends DefaultTableModel
32 {
33
34     /**
35      *
36      */

37     public HwTableModel()
38     {
39         super();
40     
41     Object JavaDoc l_row0[] = {"header 1", "header 2", "header 3", "header 4"};
42     Object JavaDoc l_row1[] = {"val 1", "val 2", "val 3", "val 4"};
43     
44     this.addColumn(l_row0[0]);
45     this.addColumn(l_row0[1]);
46     this.addColumn(l_row0[2]);
47     this.addColumn(l_row0[3]);
48     this.insertRow(0, l_row1);
49     this.insertRow(1, l_row1);
50     this.insertRow(2, l_row1);
51     this.insertRow(3, l_row1);
52     }
53 }
54
Popular Tags