Share on Google+Share on Google+

thiripura sundari
java
2 Answer(s)      8 years ago
Posted in : Java Server Faces Questions

Ads

View Answers

April 4, 2009 at 1:12 PM


Hi friend,

Use following code to create a Swing table:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class CreateSimpleTable extends JPanel {
public CreateSimpleTable() {
super(new GridLayout(1,0));

String[] columnNames = {"Name", "Address", "Age"};
Object[][] data = {
{"Angelina", "Delhi", new Integer(20)},
{"Martina", "Mumbai ", new Integer(21)},
{"Michelle", "Chennai", new Integer(22)},
{"Simran", "Kolkata", new Integer(23)},
{"Cindrella", "Hyderabad", new Integer(24)}
};
final JTable table = new JTable(data, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane);
}
public static void main(String[] args) {
JFrame frame = new JFrame("Table");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
CreateSimpleTable simpleTable = new CreateSimpleTable();
simpleTable.setOpaque(true);
frame.setContentPane(simpleTable);
frame.setSize(500,130);
frame.setVisible(true);
}
}

Thanks


September 13, 2009 at 9:16 PM


Thanks for your answers.









Related Tutorials/Questions & Answers:
java
java  diff bt core java and java
java
java  what is java
Advertisements
Java
Java   Whether Java is pure object oriented Language
java
java  different between java & core java
java
java  explain technologies are used in java now days and structure java
java
java   why iterator in java if we for loop
JAVA
JAVA  how the name came for java language as "JAVA
java
java  what is java reflection
java
java  is java open source
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
java  write a java program using filenotfoundexception
Java
Java  how to draw class diagrams in java
java
java   difference between class and interface
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java  is java purely object oriented language
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  what are JAVA applications development tools
java
java  how use java method
java
java  send me java interview questions
java
java  write a program in java to acess the email
java
java  Write a java code to print "ABABBABCABABBA
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
Java
Java  how to do java in command prompt
java
java  Does java allows multiline comments
Tutorials   
Java Spring Hibernate Struts Training i have an ques. of advanced java commandlink tag in primefaces needs onclick effect how can i run ASP.Net Server from netbeans IDE? java code for cursor java vertual machine launcher error; cannot access jarfiles JSF Tutorial render in input typetext java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener After authentication and connection establishment, Upload a zipfile by chunks in java JSF CONNECTION WITH MICROSOFT ACCESS Download Current Web Page As PDF java servlet dropdown list in jsf panelGrid header do the following how to make drop down list in JSF & fetch data Item from database help me please doubt regarding JSF Creating Dynamic Tree How to upload zip file from android to server programmatically????? jsf application war file not running in my jboss 6.0 on linux 5.5 Business analysis servlet servlet exception in thread main while running servlet How to get browser time zone? JAVA Socket Programming excel report fro jsp mysql Redirect to same jsp page on successful login jsf f:parm value dynamical settings jsf f:parm value dynamical settings RMI Program in netbeans pagination in jsf pagination jsf pagination How create csv format in jsf ? need JSP Code. Arrays, loops and string handling unique value renderer JSF 1.2 online tutorial JSF code JSP jps Multicast under UDP(client server application) How to rectify "Bad version number in .class file" exception in Eclipse about avl tree and hashing project on avl tree and hashing How to navigate from one jsf to another in eclipse how to focus on the new window opened from JSF ? Editing UI components using managed bean

Ads

 
Advertisement null

Ads