Results 1 to 3 of 3
Thread: Java Tables
- 03-24-2010, 06:38 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 23
- Rep Power
- 0
- 03-25-2010, 04:32 PM #2
probably because this topic isn't easy. i don't know what your connotation of "easy" is but i got a easy example from here www.javabuch.de - Das Handbuch der Java-Programmierung
save this code as Listing3804.java
save this code as TableData.javaJava Code:/* Listing3804.java */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Listing3804 extends JFrame implements TableData { public Listing3804() { super("JTable 1"); setDefaultCloseOperation(EXIT_ON_CLOSE); // not originally JTable table = new JTable(DATA, COLHEADS); Container cp = getContentPane(); cp.add(new JLabel("Alte c\'t-Ausgaben:"), BorderLayout.NORTH); cp.add(new JScrollPane(table), BorderLayout.CENTER); } public static void main(String[] args) { Listing3804 frame = new Listing3804(); frame.setLocation(100, 100); frame.setSize(300, 200); frame.setVisible(true); } }
Java Code:/* TableData.java */ public interface TableData { public static final String[][] DATA = { {" 1/1987", "195", "Vergleichstest EGA-Karten"}, {" 2/1987", "171", "Schneider PC: Bewährungsprobe"}, {" 3/1987", "235", "Luxus-Textsyteme im Vergleich"}, {" 4/1987", "195", "Turbo BASIC"}, {" 5/1987", "211", "640-K-Grenze durchbrochen"}, {" 6/1987", "211", "Expertensysteme"}, {" 7/1987", "199", "IBM Model 30 im Detail"}, {" 8/1987", "211", "PAK-68: Tuning für 68000er"}, {" 9/1987", "215", "Desktop Publishing"}, {"10/1987", "279", "2,5 MByte im ST"}, {"11/1987", "279", "Transputer-Praxis"}, {"12/1987", "271", "Preiswert mit 24 Nadeln"}, {" 1/1988", "247", "Schnelle 386er"}, {" 2/1988", "231", "Hayes-kompatible Modems"}, {" 3/1988", "295", "TOS/GEM auf 68020"}, {" 4/1988", "263", "Projekt Super-EGA"}, {" 5/1988", "263", "Neuheiten auf der CeBIT 88"}, {" 6/1988", "231", "9600-Baud-Modem am Postnetz"} }; public static final String[] COLHEADS = { "Ausgabe", "Seiten", "Titelthema" }; }
compile and run. the code above is very basically. the first file a jtable is instantiate and the second file defines the DATA and COLHEADS. very simple. feel free to ask.
- 03-25-2010, 05:03 PM #3
Member
- Join Date
- Mar 2010
- Posts
- 23
- Rep Power
- 0
Similar Threads
-
Java Swing Tables ( JTable Models ) to connect to Database using Table Models
By javaprogrammerishere in forum AWT / SwingReplies: 2Last Post: 01-27-2010, 08:28 AM -
Java classes representing DB tables
By aa74 in forum Advanced JavaReplies: 1Last Post: 06-20-2008, 09:06 PM -
Help Printing Tables
By ogidantunde in forum Advanced JavaReplies: 0Last Post: 06-14-2008, 06:34 PM -
caching the tables
By jayashree in forum JDBCReplies: 0Last Post: 01-30-2008, 06:43 AM -
Updating into 2 tables in the DB
By yuchuang in forum New To JavaReplies: 2Last Post: 05-12-2007, 06:54 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks