Java Swing JTable Example and Tutorial
Written by Administrator
Saturday, 20 August 2011 14:29 - Last Updated Thursday, 01...
Java Swing JTable Example and Tutorial
Written by Administrator
Saturday, 20 August 2011 14:29 - Last Updated Thursday, 01...
Upcoming SlideShare
Loading in...5
×

94 java-swing-jtable-example-and-tutorial

844

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
844
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

94 java-swing-jtable-example-and-tutorial

  1. 1. Java Swing JTable Example and Tutorial Written by Administrator Saturday, 20 August 2011 14:29 - Last Updated Thursday, 01 September 2011 19:15   This Java Swing tutorial will demonstrate you how to use JTable companent in java swing and also how you can use multi dimension Object array to populate JTable. As a container of the Table I used Java Frame. - Compile: javac SwingTable.java - Run: java SwingTable   SwingTable.java   //copyrighted by topsourcecode.com import java.awt.Color; import javax.swing.*; public class SwingTable{ public static void main(String[] args) { JFrame frame = new JFrame("Populate Table with Data"); JPanel panel = new JPanel(); //Table Parameters String col[] = {"Name","Country","Telephone"}; Object values[][] = {{"John","USA","087689689"}, {"Sulaiman","Africa","989009980"}, {"Khan","India","098790998"}, {"Alex","Australia","989900098"}, {"Tsong","China","899866444"}}; JTable table = new JTable(values, col); table.setBackground(Color.cyan); //Table Container Paramerters JScrollPane pane = new JScrollPane(table); panel.add(pane); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }   1 / 2
  2. 2. Java Swing JTable Example and Tutorial Written by Administrator Saturday, 20 August 2011 14:29 - Last Updated Thursday, 01 September 2011 19:15 Result {loadposition myad} 2 / 2

×