Java Swings
I am doing one project on java Swings,
in this i have created one jframe where i defined some JButtons and Jcombobox's,
here i need to insert one JTable with headers(IN CURRENT JFrame only).pls help me urgently.
Thanks in Advance.
View Answers
November 21, 2012 at 3:36 PM
Here is a code that displays button, table and jcombobox.
import javax.swing.*;
import java.awt.*;
public class SimpleJTableExample{
public static void main(String[] args){
new SimpleJTableExample();
}
public SimpleJTableExample(){
JFrame frame = new JFrame("Creating JTable Component Example!");
JPanel panel = new JPanel();
String data[][] = {{"A","Delhi","1111"},{"B","Mumbai","2222"},
{"C","Kolkata","3333"},{"D","Chennai","4444"}};
String col[] = {"Name","Address","Contact No"};
JTable table = new JTable(data,col);
table.getTableHeader().setReorderingAllowed(false) ;
table.getTableHeader().setResizingAllowed(false);
panel.add(table.getTableHeader() , BorderLayout.NORTH);
panel.add(table, BorderLayout.CENTER);
JPanel pan = new JPanel(new GridLayout(2,2));
JLabel l=new JLabel("Select");
JComboBox combo=new JComboBox();
combo.addItem("A");
combo.addItem("B");
combo.addItem("C");
combo.addItem("D");
JButton b=new JButton("Submit");
pan.add(l);
pan.add(combo);
pan.add(b);
frame.add(pan,BorderLayout.NORTH);
frame.add(panel,BorderLayout.SOUTH);
frame.setSize(300,200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Ads
Related Tutorials/Questions & Answers:
Java Swings
Java Swings I am doing one project on
java Swings,
in this i have created one jframe where i defined some JButtons and Jcombobox's,
here i need to insert one JTable with headers(IN CURRENT JFrame only).pls help me urgently
java swings
java swings Hi,
I need a sample code for once click the exit tab the frame window will be closed.
Instead of button close i need tab close option.Please send the sample code immediately.......?Its very urgent........
Thanks
Advertisements
java swings
java swings hi...
I am having multiple swing forms.. when i click on a button another form is going to opening but it is opening as different form... Now i want it to be open dynamically instead separately....
Is there any
java swings
java swings how can we use the shared locks of dbms in
java?
I am working on a mini project which is based on the eamcet councilling .i am struck with a problem where if a student select a college and a branch and sees
java swings
java swings Hi,
I have one class file using three panel methods,the three methods is used for three tabs.then how can i set the background image.Please send the sample code for me.
I already posted two questions,but i didnt get
java swings
java swings Hi,
I need the sample code for how to set the background image using jframe and also set the jtext field and jlable boxes under the bachground image.
Please send the code immediately,its very urgent.Please send me
java code using swings
java code using swings code that should be able to enter data of student details using all
swings into the access database using jdbc connectivity
java swings - JavaMail
java swings Hi sir,i am doing a project on
swings,i don't have any...://www.roseindia.net/
java/example/
java/swing/GrideComponents.shtml
http://www.roseindia.net/
java/example/
java/swing/AbsCoordinate.shtml
http://www.roseindia.net
Java Swings - Java Beginners
Java Swings hi ,
I am doing project using netbeans. I have a combobox . I want to add items in that combobox from a method.For this i found... code:
http://www.roseindia.net/
java/example/
java/swing
java swings - Java Beginners
java swings Hi,
I need the code for how can i set the joptionpane color(background and foreground).
can i set the delay time for joptionpane display.
Please send the code .its urgent.
Thanks,
Valarmathi
swings - Java Beginners
for this in google, but i got very difficult programs. i am beginner in
java swings . i want...);
}
}
For more information, visit the following link:
http://www.roseindia.net/
java/example/
java/swing/
Thanks
java swings - Java Beginners
java swings hi,
I send two questions ,but i didnt reply .please reply me back.
I need the jfiledialog select option is only for directory...
c:/valar/ only.
This code is only for c:/valar/some.txt,pdf...
import
swings - Java Beginners
Exception in thread "main"
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL... it. Hi Friend,
It seems that either you have saved your
java file... your
java file is in tools folder or not.
Thanks
Visit this URL
Java swings - Swing AWT
Java swings i have the following class .In that class i has two panels,panel1and panel2.panel1 contains an image.i want drag it in panel2(gray background).but i dont want to remove the image from panel1.i want
SWINGS
SWINGS WHAT ARE THE DIFFERENCES BETWEEN AWT AND
SWINGS
want a program for date picker by using java swings
want a program for date picker by using
java swings to write a program for the date picker by using
java swings.any one please help me by providing the code to this
java date picker by using the
java swings.previously a program
advanced repalcement for TableModel in java swings
advanced repalcement for TableModel in
java swings Hi,
Is there any advanced replacement for
java TableModel.I want to display the search results ,for that i want better thing than TableModel.ould u please suggest
swings question
swings question how to change the background color with the help of color values by using
swings
swings for webnms
swings for webnms if i am expanding node of jtree then i want to collapse previous expanding node of jtree in
swings how is it possible
Swings & JSP
Swings & JSP Hai all,
Can we use Swing components in a JSP??
Suppose if we enter details in a swing dialog box..and If we want the result in a JSP..is that possible???
Thank you
swings header
swings header have a string1 it contains 3 parts,for example "123456 service hello" and string2 contains text "change request " like this. and the string3 should contain "123456 +(second string)+ hello" "second string can