home *** CD-ROM | disk | FTP | other *** search
Java Source | 1999-11-28 | 3.5 KB | 107 lines |
- /*
- * @(#)MyTable.java 1.0 99/11/27
- *
- * Copyright (c) 1999, David Griffiths. All Rights Reserved.
- *
- * This software is the proprietary information of David Griffiths.
- * This source code may not be published or redistributed without the
- * express permission of the author.
- *
- * THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
- * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES
- * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
- * THIS SOFTWARE OR ITS DERIVATIVES.
- *
- */
-
- import java.awt.*;
- import java.applet.*;
- import com.sun.java.swing.*;
-
- /**
- * A Swing table example
- */
- public class MyTable extends JPanel {
- public MyTable() {
-
- JTable tabMain = new JTable(cells, headings);
-
- Font fntTable = new Font("HELVETICA", Font.PLAIN, 12);
- tabMain.setFont(fntTable);
- tabMain.getTableHeader().setFont(fntTable);
-
- // Switch off auto-resize, because it's mad...
- tabMain.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
-
- add(
- JTable.createScrollPaneForTable(tabMain),
- BorderLayout.CENTER
- );
- }
-
- // Some example data follows
-
- String[] headings = {
- "Author",
- "Title",
- "Publisher",
- "ISBN",
- "Description"
- };
-
- Object[][] cells = {
- {"Peter Anders",
- "Envisioning Cyberspace: Designing 3d Electronic Spaces",
- "McGraw-Hill Companies, The", "0070016321",
- "Free of the constraints of physical form and limited..."},
- {"Tom Armstrong",
- "Activex Developer`s SourceBook: With CD-ROM",
- "McGraw-Hill Companies, The", "0070062137",
- "Focusing on design and development of Web-based and..."},
- {"Richard L. Petersen",
- "UNIX Clearly Explained",
- "Academic Press, Incorporated", "0125521308",
- "Unix Clearly Explained is a complete tutorial introduction..."},
- {"Robby Swipe",
- "A smile, a song and a balloon: 30 years of comedy",
- "Biscos Discount Publishers", "0177682456",
- "I'll never forget what the late great Bernie Clifton said to me..."},
- {"Peter Anders",
- "Envisioning Cyberspace: Designing 3d Electronic Spaces",
- "McGraw-Hill Companies, The", "0070016321",
- "Free of the constraints of physical form and limited..."},
- {"Tom Armstrong",
- "Activex Developer`s SourceBook: With CD-ROM",
- "McGraw-Hill Companies, The", "0070062137",
- "Focusing on design and development of Web-based and..."},
- {"Richard L. Petersen",
- "UNIX Clearly Explained",
- "Academic Press, Incorporated", "0125521308",
- "Unix Clearly Explained is a complete tutorial introduction..."},
- {"Robby Swipe",
- "A smile, a song and a balloon: 30 years of comedy",
- "Biscos Discount Publishers", "0177682456",
- "I'll never forget what the late great Bernie Clifton said to me..."},
- {"Peter Anders",
- "Envisioning Cyberspace: Designing 3d Electronic Spaces",
- "McGraw-Hill Companies, The", "0070016321",
- "Free of the constraints of physical form and limited..."},
- {"Tom Armstrong",
- "Activex Developer`s SourceBook: With CD-ROM",
- "McGraw-Hill Companies, The", "0070062137",
- "Focusing on design and development of Web-based and..."},
- {"Richard L. Petersen",
- "UNIX Clearly Explained",
- "Academic Press, Incorporated", "0125521308",
- "Unix Clearly Explained is a complete tutorial introduction..."},
- {"Robby Swipe",
- "A smile, a song and a balloon: 30 years of comedy",
- "Biscos Discount Publishers", "0177682456",
- "I'll never forget what the late great Bernie Clifton said to me..."}
- };
- }
-
-
-