How to delete records from jtabel

Ads

 
 
 

Share on Google+Share on Google+

satyendra
How to delete records from jtabel
1 Answer(s)      9 years ago
Posted in : Swing AWT
Ads
View Answers

May 2, 2008 at 6:46 PM


Hi

i am sending code according to your requirement,

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import javax.swing.table.DefaultTableModel;

public class DeleteRows{
public static void main(String[] args) {
new DeleteRows();
}
public DeleteRows(){
DefaultTableModel model;
JFrame frame = new JFrame("Delete rows in the table!");
JPanel panel = new JPanel();
String data[][] = {{"1","10-04-2008","3:42:00"},{"2","11-04-2008","4:00:00"},{"3","12-04-2008","5:54:00"},
{"4","13-04-2008","3:42:00"},{"5","14-04-2008","3:42:00"}};
String col[] = {"S.No","Date","Time"};
model = new DefaultTableModel(data,col);
JTable table = new JTable(model);
JTableHeader header = table.getTableHeader();
header.setBackground(Color.pink);
JScrollPane pane = new JScrollPane(table);
panel.add(pane);
frame.add(panel);
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
System.out.println("Befoure removing, number of rows: "+ model.getRowCount());
//Remove last row
model.removeRow(4);
System.out.println("After removing last row, number of rows: " + model.getRowCount());
frame.setSize(500,200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}


------------------------------

read for more information,

http://www.roseindia.net/java/example/java/swing/

Ads









Related Tutorials/Questions & Answers:
How to delete records from jtabel - Swing AWT
How to delete records from jtabel  hello I am using jtabel.... It is working properly.but now i want to delete rows from tabel at a time one row... number). also tell me ho to genrate serial number for file records.  Hi
Delete a Records in Database
Delete a Records in Database       The Delete Statement is used to delete the records and rows from the table. The generalized Syntax  used for delete query in database
Advertisements
How to delete excel file records using Store Procedure?
How to delete excel file records using Store Procedure?  Hi.. I have created one Excel file through stored procedure.Now I want to delete records or delete excel file. Thanks
how to display records from database
how to display records from database  I want to display records from database in tables, the database is having 2000 records and i want to display 20 records at a time and to use next and previous link buttons to show
How to delete data from MySQL?
How to delete data from MySQL?  Hi, How I can conditionally delete... to conditionally delete the data from MySQL database table. Here is some query examples: delete from email where email_count=400; delete from email where
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
How to insert or delete records in MS access database using jsp - JSP-Servlet
How to insert or delete records in MS access database using jsp  Hi friends please provide me a solution that i insert or delete record from a database using java server pages. I used the microsoft access 2003 database. PlZ
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
how to delete a jar from mobile in j2me application
how to delete a jar from mobile in j2me application  After auto updating a new version of jar from server. I want to delete the old jar from mobile... the code how to do that in my application in j2me for lwuit applications. Thanks
Tutorials   
Java Spring Hibernate Struts Training Change JPanel background color from mouse entered/exit event JTable Pagination Jcombobox JAVA SWING how can i display a pdf file in a jtextarea Crop Image Code in Applet Crop Image Code in Applet Image Manipulation in Swing AWT Applet Ho to get virtual key code. how to show set of images continously using JScrollpane in java how to show set of images continously using JScrollpane in java How to connect on screen keyboard to system. How to connect on screen keyboard to system. query java client server program for playing video file(stored in folder in the same workspace) using swings java client server program for playing video file(stored in folder in the same workspace) using swings java client server program for playing video file(stored in folder in the same workspace) using swings java client server program for playing video file(stored in folder in the same workspace) using swings Download. how to open one Jframe from main method call Urgent requirement display shapes i am getting an error in adding a menu item to a menu. I am trying to develop a Image Sliding application but unfortunately its not working... Can any one help me in this Sliding window protocol how to update the value of jslider how to update the value of jslider how to update the value of jslider how to update the value of jslider how to update the value of jslider Jbutton in JTable cells program code java textfield problem swing retrieve data from database in java swing form using prev n next buttons retrieve data from database in java swing form using prev n next buttons How to close a frame on action event of a button from a different class ? searching the data swings for webnms Jpanel allignment pass data from java frame to file code for traffic control system simulation Bank Management System how to maKE Jcombox editable after saveing value init. i havei) aJTextField and one button. when place the cursor or enter anything in the test field then only button should be enabled.by default the button should be disabled. i havei) a jtable with few cloumns and few rows andii) one button. when place the cursor in any of the table's column cell. i need to enable the button.by default the button should be disabled. PDF Comparator i have JTextfield and JComboBox. there are several values in combobox.when i select a value from combobox how to make textfiled as a combobox. issue on jcombobox

Ads

 
Advertisement null

Ads