Hi :remove item in Jtable
hi
i use JTable which extends The Abstract table model , in that i didn't find method for remove item from the table , is there any way to remov the item from table.
why i extends the Abstract table model my table should be uneditable, if i use the default table model it is not possible the table become uneditable
help me plz
reg
vino
hi camickr
here is my code i overrirde the isCellEditable method with return value false , but table is still editable, plz tell me what is a error in my code
thanks in advance , its very urgent to me
reg
vino
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
public class SimpleTableSample {
static Object rows[][] = { { "one", "ichi - \u4E00" },
{ "two", "ni - \u4E8C" }, { "three", "san - \u4E09" },
{ "four", "shi - \u56DB" }, { "five", "go - \u4E94" },
{ "six", "roku - \u516D" }, { "seven", "shichi - \u4E03" },
{ "eight", "hachi - \u516B" }, { "nine", "kyu - \u4E5D" },
{ "ten", "ju - \u5341" } };
static Object headers[] = { "English", "Japanese" };
public static void main(String args[]) {
String title = (args.length == 0 ? "JTable Sample" : args[0]);
JFrame frame = new JFrame(title);
DefaultTableModel model = new DefaultTableModel(rows,headers);
JTable table = new JTable(model);
table.remove(0);
JScrollPane scrollPane = new JScrollPane(table);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.setSize(300, 150);
frame.setVisible(true);
public int getColumnCount()
return headers.length;
public int getRowCount()
return rows.length;
public String getColumnName(int c)
return headers[c];
public Object getValueAt(int rowIndex, int colIndex)
return rows[rowIndex][colIndex];
public boolean isCellEditable(int rowIndex, int colIndex)
return false;
}
Similar Messages
-
Add and remove columns from JTable
Help me please!
A try to remove column from JTable. It's removed, but when I try to add column in table, then I get all old (removed early) columns + new column....
I completely confused with it.....
Here is my code for remove column:
class DelC implements ActionListener
public void actionPerformed (ActionEvent e )
int [] HowManyColDelete = table.getSelectedColumns();
if (HowManyColDelete.length !=0)
TableColumnModel tableCModel = table.getColumnModel();
for (int i = HowManyColDelete.length-1; i>-1; i--)
table.getColumnModel().removeColumn (tableCModel.getColumn (HowManyColDelete [ i ]));
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
}It's little ex for me, I just try understand clearly how it's work (table models i mean). Here is code. All action with tables take place through menu items.
My brain is boiled, I've try a lot of variants of code, but did't get right result :((
It's code represent problem, which I've describe above. If you'll try remove column and then add it again, it will be ma-a-a-any colunms...
I understand, that my code just hide columns, not delete from table model....
But now I have not any decision of my problem...
Thanks a lot for any help. :)
import javax.swing.*;
import java.awt.*;
import javax.swing.table.*;
import java.awt.event.*;
import javax.swing.table.DefaultTableModel;
class JTableF extends JFrame
Object [] [] data = new Object [0] [2];
JTable table;
DefaultTableModel model;
String [] columnNames = {"1", "2"};
TableColumnModel cm;
JTableF()
super("Table features");
setDefaultLookAndFeelDecorated( true );
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
JMenuBar MBar = new JMenuBar();
JMenu [] menus = {new JMenu("A"), new JMenu("B")};
JMenuItem [] menu1 = {new JMenuItem("Add row"), new JMenuItem("Delete row", 'D'), new JMenuItem("Add column"), new JMenuItem("Delete column")};
menu1 [ 0 ].addActionListener(new AddL());
menu1 [ 1 ].addActionListener(new DelL());
menu1 [ 2 ].addActionListener(new AddC());
menu1 [ 3 ].addActionListener(new DelC());
for (int i=0; i<menu1.length; i++)
menus [ 0 ].add( menu1 [ i ]);
for (int i=0; i<menus.length; i++)
MBar.add(menus );
JPanel panel = new JPanel ();
model = new DefaultTableModel( data, columnNames );
table = new JTable (model);
cm = table.getColumnModel();
panel.add (new JScrollPane(table));
JButton b = new JButton ("Add row button");
b.addActionListener(new AddL());
panel.add (b);
setJMenuBar (MBar);
getContentPane().add(panel);
pack();
setLocationRelativeTo (null);
setVisible (true);
class DelC implements ActionListener
public void actionPerformed (ActionEvent e )
int [] HowManyColDelete = table.getSelectedColumns();
if (HowManyColDelete.length !=0)
TableColumnModel tableCModel = table.getColumnModel();
for (int i = HowManyColDelete.length-1; i>-1; i--)
int vizibleCol = table.convertColumnIndexToView(HowManyColDelete [ i ]);
tableCModel.removeColumn (tableCModel.getColumn (vizibleCol));
//cm = tableCModel;
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
class AddC implements ActionListener
public void actionPerformed (ActionEvent e)
//table.setColumnModel(cm);
Object NewColumnName = new String();
NewColumnName = JOptionPane.showInputDialog ("Input new column name", "Here");
int i = model.getRowCount();
int j = model.getColumnCount();
Object [] newData = new Object [ i ];
model.addColumn ( NewColumnName, newData);
class AddL implements ActionListener
public void actionPerformed (ActionEvent e)
int i = model.getColumnCount();
Object [] Row = new Object [ i ];
model.addRow ( Row );
class DelL implements ActionListener
public void actionPerformed (ActionEvent e)
int [] HowManyRowsDelete = table.getSelectedRows();
if (HowManyRowsDelete.length !=0)
for (int k = HowManyRowsDelete.length-1; k>-1; k--)
model.removeRow (HowManyRowsDelete[k]);
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Row is not selected!");
public static void main (String [] args)
javax.swing.SwingUtilities.invokeLater(new Runnable()
public void run()
JTableF inst = new JTableF(); -
White patch after removing row from JTable
I am working with JTable and removing item from table on clicking on button but after removing row there is white Patch on that row. I don�t want to show this white patch.
I did repaint table but that is also not working.
Any thoughts !!!!!!!javax.swing.SwingUtilities.invokeLater(new Runnable(){
public void run(){
museTable.setBackground(Color.black);//your color here
}); -
How can we remove items from the VF04 list?
We have a long list of items in VF04 that, for various reasons (some process related, some due to errors), are not to be billed. We have looked at applying filters to the list but there is nothing really suitable to hide these individual documents e.g. we could filter out some dates where none of the items on that date are to be billed but other dates have a mix of items we want to bill and others we don't.
I have done a search of this forum but didn't find a previous topic with a quick and simple method to remove items from the list .
Is there a method, other than billing them or sorting each issue individually, to permanently remove individual documents from the VF04 list?
Thanks in advance for any help.
DavidHi,
David,
Download a list of Pending delivers doc form VF04.
Paste the list in T.Code : VL09 (Delivery reversal) and reverse the delivery.
Then go to T.Code: VL06G Select the list of deliveries that has been reversed, select/delete all un- wanted deliveries.
This way you can remove all unwanted pending deliveries forn Billing due list (VF04).
Thanks & Regards,
R.Janakiraman -
How can i update/Remove Items from AR Invoice using SDK?
Hi All,
I have 1 problem with update or remove item from sales order. here is the source code of mine.
If inv.GetByKey(DocumentNumber) = True Then
inv.CardCode = cardcode
Dim ercode As Integer
Dim ind As Integer = 1
For Each drow As DataGridViewRow In gv.Rows
If gv.Rows.Count = ind Then Exit For
ercode = drow.Cells("No").Value
inv.Lines.SetCurrentLine(ercode)
'inv.Lines.ItemCode = drow.Cells("itemcode").Value
'inv.Lines.ItemDescription = drow.Cells("itemname").Value
inv.Lines.Quantity = drow.Cells("qty").Value
inv.Lines.Price = drow.Cells("price").Value
ind = ind + 1
Next
errorcode = inv.Update
If errorcode <> 0 Then
PublicVariable.oCompany.GetLastError(errorcode, errorsms)
Else
errorcode = 0
End If
Else
errorsms = "Not found Invoice Document Number"
End If
After update, it error "[INV1.Quantity][line:1],'Field cannot be updated (ODBC -1029)'"
Does anybody know about this?
Thanks
TONYHi $riniva$ Rachumallu,
This is my mistake that not test manually in application.
Thanks
TONY -
Remove Item from Item list through DTW
Hi Experts,
Please do the needful for the below issues.
1.System is not allow partial delivery but I already activate allow partial delivery at sales order logistic tab.
2.System is allow to print the document at client place automatically at the time of the creation of the sales quotation but not at server.
3.How to remove Item code from the DB with the help of the DTW.hi,
If there is no transactions associated with item,
Open item in item master data,From menu bar,Select Data ---> Remove.
for other cases refer Note 1163367 - How can obsolete items be managed in SAP Business One?
[https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1163367]
Jeyakanthan -
My Mac Book Air tells me that the start up disc is nearly full land that I do not have the capacity to load Maverick. How can I remove items that I may not need from this disc?
Move them to an external hard drive, formatted as HFS Extended (Journaled).
-
How do I remove items from the cloud without losing them permanently?
My icloud storage is almost full. How do I remove items from the cloud and not lose them?
What items?
Purchased music, movies, TV shows, apps, and books do not use up your iCloud storage.
See the link below for how to reduce the amount of storage you're using:
http://support.apple.com/kb/HT4847 -
How do you remove items from the assets panel that are duplicated?
How do you remove items from the assets panel that are duplicated?
If you add an item to a slideshow, you'll usually see 2 entries for that image in the assets panel - one represents the thumbnail, and the other represents the larger 'hero' image.
It sounds like you may have added the same image to your slideshow twice. You can select one of the hero images or thumbnail images in your slideshow and use the delete key to remove it. Then the extra 2 entries in the assets panel should disappear. -
How do you remove items from the start up disc
How do you remove items from the start up disc?
Freeing Up Space on The Hard Drive
You can remove data from your Home folder except for the /Home/Library/ folder.
Visit The XLab FAQs and read the FAQ on freeing up space on your hard drive.
Also see Freeing space on your Mac OS X startup disk. -
How do I remove items from the dock?
How do I remove items from the dock ?
Single click and then drag it to the desktop. It will dissapear in a puff of smoke. You also may benefit by bookmarking and using:
Find Out How Video tutorials -
Can't remove items from the selectMenu
I am using selectMenu as:
<a4j:region selfRendered="true" id="text">
<h:selectOneListbox id="symbol" value="#{user.name}">
<f:selectItems value="#{user.temp_list}" />
</h:selectOneListbox>
<a4j:commandButton action="#{user.getData}" reRender="symbol" value="Get"/>
</a4j:region>temp_list has following three values when page loads:
temp_list.add(new SelectItem("Sunday"));
temp_list.add(new SelectItem("Monday"));
temp_list.add(new SelectItem("Tuesday"));Now in user.getData i want to remove items one by one based on the selection made by the user. The code is:
temp_list.remove(0);
this.setTemp_list(temp_list);But the problem is that if user selects Sunday for example, it remove it from the list but next time when user select Monday it removes monday but BRING BACK SUNDAY AGAIN IN THE LIST. Why is it so?BalusC wrote:
I don´t understand you.Actually i was asking about the code which i mentioned in my last post.
Okay then what could be the solution? What my thinking is that calling list.remove actually removes the item from the list permenantly, isn't it? If so then why does it showing me again in the selectMenu? -
Can I remove items from the Services menu?
I think the subject line says it all: can I remove items from the Services menu? I have a number of items in the Services menu that I never use and I would like to make the menu shorter to make it easier to access the items that I do use.
There are a couple of things you could try. There's an application called Service Scrubber that is supposed to do this. But the web page says it's for 10.4, though it says it might work on 10.3
Alternatively, you can edit the Info.plist or Info-macos.plist file in each application bundle to remove its service from the Services menu. This post at Mac OS X Hints has a pretty detailed description of how to do it. I tried this on my iMac running 10.3.9 and it worked just fine.
Don't know about the Service Scrubber app, but if you edit the plist files, you'll need to log out and log back in before the changes take effect.
Also, if you decide to edit the files by hand, I'd suggest just renaming NSServices by adding an "x" to the front or something, rather than deleting the item completely. That makes the changes easier to reverse.
charlie -
How can i remove items from list that have been deleted when i click on them it keeps showing empty
how can i remove items from the list that have been deleted when i click on them it keeps showing folder empty
Actually, Reader SHOULD keep showing documents that no longer exist, I disagree. It's no big deal, and people will quickly realise why they can't open the file. They open more files, the old ones move off.
The REASON why it should not check is that checking whether a file exists can take a long time when things aren't good. For instance if a file server goes down, or a memory card is unplugged. That in turn would mean delays opening the File menu, and I've seen some software that can sit there for several minutes. That would really give people something of which to complain... -
How can I remove items from the open a recent file menue.
How can I remove items from the "Open a Recent File" menue. Many other applications allow the clearing of that file . Is this possible in Adobe Reader 10.1.2 ? If so how?
See this previous topic: http://forums.adobe.com/message/3759596
It is for Acrobat, but the registry entries are similar for Reader.
Maybe you are looking for
-
How to make my PowerMac G4 run faster
My PowerMac. G4 is running very slowly. I am running OSX 10.4.11 with Safari. Are there solutions for this?
-
Class not found javax.swing.JLabel
Hello, I'm using JDK 1.3.0 and now I tried the first time to include Swing components into my Applet. When I compile the coding there are no errors and even when I use a standard coding example I always get the "class not found error message" for the
-
how do i launch one Java program from another? both .class files and the JRE directory are in the same directory
-
Iphone running 2.1 does not check for new email in the background
hi my iphone does not get new email unless i open the mail app. it worked perfectly previous to now. this has been the case for a few weeks. i have asked several friends, who tell me that they have the same issue after upgrading. any solution? i use
-
Point to dynamical internal table
hi friends, i have a dynamic internal table A holding some data based on an ddic-structure. now i have a second table B - self defined - that should in one column hold kind of a pointer ( or better the row data ) to a row of table A. how to achieve t