Table Demo
Friday, November 9, 2007
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class SimpleTableExample extends JFrame
{
private JPanel topPanel;
private JTable table;
private JScrollPane scrollPane;
public SimpleTableExample()
{
setTitle( "Simple Table Application" );
setSize( 300, 200 );
setBackground( Color.gray );
topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );
// Create columns names
String columnNames[] = { "Column 1", "Column 2", "Column 3" };
// Create some data
String dataValues[][] =
{
{ "12", "234", "67" },
{ "-123", "43", "853" },
{ "93", "89.2", "109" },
{ "279", "9033", "3092" }
};
// Create a new table instance
table = new JTable( dataValues, columnNames );
// Add the table to a scrolling pane
scrollPane = new JScrollPane( table );
topPanel.add( scrollPane, BorderLayout.CENTER );
}
// Main entry point for this example
public static void main( String args[] )
{
// Create an instance of the test application
SimpleTableExample mainFrame = new SimpleTableExample();
mainFrame.setVisible( true );
}
}
6 comments:
hi i need a source code for a voice chatting in java.can u plz help me.you can mail me at hemashiki@gmail.com
hi sir,
i am a student of MCA.
i need a full project in jsp on hotel management that should be run on tomcat server.
plz help me and send project on er_oracle@yahoo.co.in
hi frend..i need source code for smsbaning project in java..can u plz help me..u can send project on
snehalbhngl66@gmail.com
Please put the following code in constructor to get the proper exit of this swing application.
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Thanking you.
AMOL
hi sir
i am a student of mca 4 sem and want a desktop apllication based minor project in java on job consultancy, please send me or help me about another minor project on client server based in java
About Me
- Seventh Sense
hi frnd i need a source code for a banking project in java kindly help me out....you can email me at ur_frnd_18@yahoo.co.in