Adding JTable into existing Jframe.
i need to add JTable into this code pls help me..
package Com;
import Com.Details;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
@SuppressWarnings("serial")
public class AddPage extends JFrame
{
JDesktopPane pane = new JDesktopPane();
static Details details= new Details();
JTextField searcharea;
String str;
{
setLayout(null);
setTitle("Employee Details Application");
JButton add=new JButton("ADD NEW");
JButton edit=new JButton("EDIT");
JButton delete=new JButton("DELETE");
JButton save=new JButton("SAVE");
JButton cancel=new JButton("CANCEL");
JButton close=new JButton("CLOSE");
JButton print=new JButton("PRINT");
add.setBounds(10,40,100,40);
edit.setBounds(120,40,100,40);
delete.setBounds(240,40,100,40);
save.setBounds(360,40,100,40);
cancel.setBounds(480,40,100,40);
close.setBounds(600,40,100,40);
print.setBounds(720,40,100,40);
add(add);
add(edit);
add(save);
add(delete);
add(cancel);
add(close);
add(print);
String[] search={"--search by--","Employee_ID","Employee Name"};
final JComboBox box=new JComboBox(search);
box.setBounds(10,120,100,25);
add(box);
searcharea=new JTextField();
searcharea.setBounds(130,120,150,25);
add(searcharea);
JButton submit=new JButton("SUB");
submit.setBounds(300,125,80, 20);
add(submit);
details.setBounds(100,60,1300,600);
add(pane);
//Action Listener for button
//for adding new details
add.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
AddPage addpage=new AddPage();
addpage.add(details);
//EmployeeMain empmain=new EmployeeMain();
//empmain.main(null);
}
});
/*for editing previous details
edit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
AddPage addpage=new AddPage();
addpage.add(details);
System.out.println("edit carefully");
}
}); */
//for saving
save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
details.insert();
//EmployeeMain empmain=new EmployeeMain();
//empmain.main(null);
System.out.println("saved successfully");
}
});
//action area for search area.
submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String selecteditem=(String) box.getSelectedItem();
if(selecteditem=="Employee_ID"){
Employee employee=new Employee();
String emp=searcharea.getText();
AddPage addpage=new AddPage();
addpage.add(details);
details.setEmpID(emp);
}
else if(selecteditem=="Employee Name"){
Employee employee=new Employee();
String emp=searcharea.getText();
AddPage addpage=new AddPage();
addpage.add(details);
details.setEmpName(emp);
}
}
});
//end action listener
//table addition
setVisible(true);
setSize(1250,1000);
}
public static void main(String[] args)
{
new AddPage();
//addpage.add(details);
// addpage.add(table);
}
}
Thanks in advance.
View Answers
Related Tutorials/Questions & Answers:
Adding JTable into existing Jframe.Adding JTable into
existing Jframe. i need to add
JTable...("serial")
public class AddPage extends
JFrame
{
JDesktopPane pane = new...(100,60,1300,600);
add(pane);
//Action Listener for button
//for
adding new
Adding JTable into existing Jframe.Adding JTable into
existing Jframe. i need to add
JTable...("serial")
public class AddPage extends
JFrame
{
JDesktopPane pane = new...(100,60,1300,600);
add(pane);
//Action Listener for button
//for
adding new
Advertisements
Adding JTable into existing Jframe.Adding JTable into
existing Jframe. i need to add
JTable...("serial")
public class AddPage extends
JFrame
{
JDesktopPane pane = new...(100,60,1300,600);
add(pane);
//Action Listener for button
//for
adding new
Java: Adding Row in JTable Java:
Adding Row in
JTable how about if we already have the
JTAble created earlier.
And i just found nothing to get its DefaultTableModel, thus, I can't call insertRow() method.
Is there any work around for this?
I found
jtable-adding a row dynamicallyjtable-
adding a row dynamically hi..i am doing a project for pharmacy ..
*pblm:*
when i want to enter the details in
jtable while running the application there are 3 rows and 4 columns which is default bt when we we have
Adding A Primary Key to an Existing Table Adding A Primary Key to an
Existing Table Been trying to add a primary key to a MySQL table using Java for two days with no success. I'm new to Java and JDBC so bear patience with me.
It connects to the database without problem
how update JTable after adding a row into databasehow update
JTable after
adding a row into database J have two... in
JTable, and it's OK, but after
adding a row into database table does't update.
How update
JTable after
adding a row into database?
package djile pak.java
JFrameJFrame write an application with a
JFrame that five labels describing reasons that a customer might not buy your product(for example "Too expensive") every time the user clicks a Jbutton, remove one of the negative reasons
jframejframe Create a
JFrame for the Summervale Resort. Allow the user to view the information about different rooms available, dining options and activities offered. Include at least two options in each menu and display appropriate
JFrame Jframe. How can i do it. Please help me to do it. Or what else can i have
JTableJTable Hi
I have problems in setting values to a cell in
Jtable which is in a
jFrame which implements TableModelListener which has a abstract method
tableChanged(TableModelEvent e) .
I'll be loading values from data base when
JTableJTable Values to be displayed in JTextfield when Clicked on
JTable Cells
JTableJTable i want to delete record from
JTable using a MenuItem DELETE. and values of
JTable are fetched from database....please reply soon
JTable JTable how to select a definite cell which containing a similar text containg to the one which the user entering from a
jtable at runtime in java
JTable);
JFrame f = new
JFrame();
f.getContentPane().add(p...;
data[0][9]=codigopostal;
data[0][10]=pais;
JFrame frame=new
JFrame();
String labels[]={"Nome","Apelido","Nome do meio","Telefone
JTableJTable need to add values to a
JTable having 4 coloumns ,2 of them are comboboxes
JTableJTable Hello, i cannot display data from my table in the database to the cells of my
JTable. please help me
jtablejtable how to get the values from database into
jtable and also add a checkbox into it and then when selected the checkbox it should again insert into database the selected chewckbox.plzz help
jtablejtable hi
Sir
i am working netbeans IDE,I have a
jtable when i insert values in
jtable
then i am unable to print all inserted values,For eg if i insert 1,2,3,4,5,6,7,8 values
then , i am getting output
jtablejtable hey i have build a form and i m also able to add data from database to
jtable along with checkbox.the only problem is that if i select multiple checkboxes the data doesnt get inserted into new database and if only one
Refresh JFrameRefresh JFrame How to refersh a
JFrame and its componets
JTable populate with resultset.JTable populate with resultset. How to diplay data of resultset using
JTable?
JTable is component of java swing toolkit.
JTable class is helpful in displaying data in tabular format. You can also edit data.
JTable Hiding a JFrame javax.swing.*;
import java.awt.event.*;
class PassData extends
JFrame
{
JTextField... java.awt.*;
import java.awt.event.*;
class NextPage extends
JFrame
{
NextPage
Hiding a JFrame javax.swing.*;
import java.awt.event.*;
class PassData extends
JFrame
{
JTextField... java.awt.*;
import java.awt.event.*;
class NextPage extends
JFrame
{
NextPage
REPORT WITH JTABLE JTableDatabase extends
JFrame{
ResultSet rs;
JTableDatabase(){
final...(Exception e){}
JTable table = new
JTable(data, columnNames);
JScrollPane scrollPane
JTable - JDBC
{
JFrame f;
JPanel p;
JLabel l;
JTextField tf;
JButton btn;
JTable tb...JTable
Hello.....
I have
Jtable with four rows and columns and i have also entered some records in MsSql database. i want to increase
Jtable's JTABLE OF JAVAJTABLE OF JAVA i have a
jtable in java,i have used checkbox in
jtable.
now i want to add(submit) only those records that i have checked by checkbox how?
i want small example with coding
Jtable-JavaJtable-Java Hi all,I have a
Jtable And i need to clear the data in the table .I only Need to remove the data in the table.not the rows.Please help me
JTable - Swing AWT*;
public class JTableToConsole extends
JFrame {
public Object GetData(
JTable...JTable Hi Deepak,
i want to display the
Jtable data... how could i show
jtable data on the console.
Thanks,
Prashant
Hi
Swings JTableSwings JTable add values to
JTable with four coloums,two of them are comboboxes
sum in JTablesum in JTable how to calculate sum from
JTable's one field like total
JTABLE IssueJTABLE Issue Hi Eveyone,
I am developing a small application on Swing-AWT. I have used
JTABLE to show data. There is "input field" and "search... on basis of input data provided in input field. For
JTABLE is on some other
jtable queryjtable query I need a syntax...where i could fetch the whole data from the database once i click the cell in
jtable...and that must be displayed in the nearby text field which i have set in the same frame
java jtablejava jtable Hello Sir, I am developing a desktop application in which i have to display database records in
jtable .now I want to read only... that in
jtable.
plz help me with the code
regarding jtable...regarding
jtable... sir,
im working with jtables. i wanted to populate a
jtable from the database and when i click any row it should add a container... a container on the
jtable.
kindly help me sir.
thanks in advance
regards,
rajahari
ABOUT JtableABOUT Jtable My Project is Exsice Management in java swing Desktop Application.
I M Use Netbeans & Mysql .
How can retrive Data in
Jtable from Mysql Database in Net Beans
jframe background color not showingjframe background color not showing
jframe background color is not showing. please suggest.
Just add the background color to JPanel and then add it to
JFrame. For example ..
JFrame myFrame = new
JFrame();
JPanel
adding a dialogueadding a dialogue Blockquote
Hi can you help with the program below,the program is a loop that prints out a code and a quantity when prompt for the user input.what I need is to modify the code to incorporate a dialogue asking
adding loopadding loop Hi I have a program that is not compiling when I add a loop can you help me?The program below is compiling without the loop.
> Blockquote mport java.util.*;
import java.text.*;
import java.util.Scanner