473,788 Members | 2,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Errors when deleting a row in a JTable.

Hi everybody,

The following code (putted in a inherited object from AbstractTableMo del
object) make some errors :

public void deleteRow(int rowToDelete){
try{
Object dataObject = datas.get(rowTo Delete);
String idName = idField.getColu mnName();
Method method = dataObjectClass .getMethod("get " +
StringServices. capitalize(idNa me), null);
Object o = method.invoke(d ataObject, null);
deletedRows.add (o);
datas.remove(ro wToDelete);
fireTableRowsDe leted(rowToDele te, rowToDelete);
}
catch(Exception e){
e.printStackTra ce();
}
}

I don't understand why.

And here is the Stack trace exception

java.lang.NullP ointerException
at javax.swing.JTa ble.prepareRend erer(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell (Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell s(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paint(Unk nown Source)
at javax.swing.pla f.ComponentUI.u pdate(Unknown Source)
at javax.swing.JCo mponent.paintCo mponent(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JVi ewport.paint(Un known Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JLa yeredPane.paint (Unknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paintWi thOffscreenBuff er(Unknown Source)
at javax.swing.JCo mponent.paintDo ubleBuffered(Un known Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at java.awt.Graphi csCallback$Pain tCallback.run(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nOneComponent(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nComponents(Unk nown Source)
at java.awt.Contai ner.paint(Unkno wn Source)
at sun.awt.Repaint Area.paint(Unkn own Source)
at sun.awt.windows .WComponentPeer .handleEvent(Un known Source)
at java.awt.Compon ent.dispatchEve ntImpl(Unknown Source)
at java.awt.Contai ner.dispatchEve ntImpl(Unknown Source)
at java.awt.Window .dispatchEventI mpl(Unknown Source)
at java.awt.Compon ent.dispatchEve nt(Unknown Source)
at java.awt.EventQ ueue.dispatchEv ent(Unknown Source)
at java.awt.EventD ispatchThread.p umpOneEventForH ierarchy(Unknow n Source)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(Unknown Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.r un(Unknown Source)

Thanks all

Bernard

Jul 17 '05 #1
5 5512
The same error occurs when I've no data in the table model Object for add
row operation

public void addRow(){
try{
Object o = dataObjectClass .newInstance();
datas.add(o);
insertedRows.ad d(datas.get(dat as.size() - 1));
fireTableRowsIn serted(datas.si ze() - 1, datas.size() - 1);
}
catch(Exception e){
e.printStackTra ce();
}
}

java.lang.NullP ointerException
at javax.swing.JTa ble.prepareRend erer(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell (Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell s(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paint(Unk nown Source)
at javax.swing.pla f.ComponentUI.u pdate(Unknown Source)
at javax.swing.JCo mponent.paintCo mponent(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JVi ewport.paint(Un known Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JLa yeredPane.paint (Unknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paintWi thOffscreenBuff er(Unknown Source)
at javax.swing.JCo mponent.paintDo ubleBuffered(Un known Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at java.awt.Graphi csCallback$Pain tCallback.run(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nOneComponent(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nComponents(Unk nown Source)
at java.awt.Contai ner.paint(Unkno wn Source)
at sun.awt.Repaint Area.paint(Unkn own Source)
at sun.awt.windows .WComponentPeer .handleEvent(Un known Source)
at java.awt.Compon ent.dispatchEve ntImpl(Unknown Source)
at java.awt.Contai ner.dispatchEve ntImpl(Unknown Source)
at java.awt.Window .dispatchEventI mpl(Unknown Source)
at java.awt.Compon ent.dispatchEve nt(Unknown Source)
at java.awt.EventQ ueue.dispatchEv ent(Unknown Source)
at java.awt.EventD ispatchThread.p umpOneEventForH ierarchy(Unknow n Source)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(Unknown Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.r un(Unknown Source)
"Bernard Koninckx" <ko************ *@excite.com> a écrit dans le message de
news: 40************* **********@news .skynet.be...
Hi everybody,

The following code (putted in a inherited object from AbstractTableMo del
object) make some errors :

public void deleteRow(int rowToDelete){
try{
Object dataObject = datas.get(rowTo Delete);
String idName = idField.getColu mnName();
Method method = dataObjectClass .getMethod("get " +
StringServices. capitalize(idNa me), null);
Object o = method.invoke(d ataObject, null);
deletedRows.add (o);
datas.remove(ro wToDelete);
fireTableRowsDe leted(rowToDele te, rowToDelete);
}
catch(Exception e){
e.printStackTra ce();
}
}

I don't understand why.

And here is the Stack trace exception

java.lang.NullP ointerException
at javax.swing.JTa ble.prepareRend erer(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell (Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell s(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paint(Unk nown Source)
at javax.swing.pla f.ComponentUI.u pdate(Unknown Source)
at javax.swing.JCo mponent.paintCo mponent(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JVi ewport.paint(Un known Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JLa yeredPane.paint (Unknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paintWi thOffscreenBuff er(Unknown Source)
at javax.swing.JCo mponent.paintDo ubleBuffered(Un known Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at java.awt.Graphi csCallback$Pain tCallback.run(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nOneComponent(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nComponents(Unk nown Source)
at java.awt.Contai ner.paint(Unkno wn Source)
at sun.awt.Repaint Area.paint(Unkn own Source)
at sun.awt.windows .WComponentPeer .handleEvent(Un known Source)
at java.awt.Compon ent.dispatchEve ntImpl(Unknown Source)
at java.awt.Contai ner.dispatchEve ntImpl(Unknown Source)
at java.awt.Window .dispatchEventI mpl(Unknown Source)
at java.awt.Compon ent.dispatchEve nt(Unknown Source)
at java.awt.EventQ ueue.dispatchEv ent(Unknown Source)
at java.awt.EventD ispatchThread.p umpOneEventForH ierarchy(Unknow n Source)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(Unknown Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.r un(Unknown Source)

Thanks all

Bernard

Jul 17 '05 #2
Here is the complete code :

/*
* TableModelObjec t.java
*
* Created on 22 avril 2004, 11:39
*/

package com.framework.c ontrols.table;

import java.io.InputSt ream;
import java.lang.refle ct.Field;
import java.lang.refle ct.Method;
import java.net.URL;
import java.util.Array List;
import java.util.Vecto r;

import javax.swing.tab le.AbstractTabl eModel;
import javax.xml.parse rs.DocumentBuil der;
import javax.xml.parse rs.DocumentBuil derFactory;

import org.w3c.dom.Doc ument;
import org.w3c.dom.Ele ment;
import org.w3c.dom.Nod eList;
import org.xml.sax.Ent ityResolver;
import org.xml.sax.Inp utSource;

import com.framework.m isc.fields.Colu mn;
import com.framework.m isc.stringservi ces.StringServi ces;
import com.framework.m isc.fields.IdFi eld;

/**
*
* @author Bernard Koninckx
*/
public class TableModelObjec t extends AbstractTableMo del {
private Class dataObjectClass ;
private Vector datas;
private ArrayList columns;
private IdField idField;
private Vector insertedRows;
private Vector deletedRows;
private Vector updatedRows;

/** Creates a new instance of TableModelObjec t */
public TableModelObjec t(Vector alDatas, Class cData) {
this(alDatas, cData, null);
}

public TableModelObjec t(Vector alDatas, Class cData, URL aURL) {
URL url;
insertedRows = new Vector();
deletedRows = new Vector();
updatedRows = new Vector();
if (alDatas == null) datas = new Vector();
else datas = alDatas;
dataObjectClass = cData;
try{
InputStream in = (aURL == null) ?
cData.getResour ceAsStream(Stri ngServices.conv ertClassName(da taObjectClass) +
".xml") : aURL.openStream ();
setColumnsArray (in);
}
catch(Exception e){
e.printStackTra ce();
}
}

private void setColumnsArray (InputStream aIn){
try{
columns = new ArrayList();

DocumentBuilder Factory factory =
DocumentBuilder Factory.newInst ance();
factory.setIgno ringComments(tr ue);
factory.setCoal escing(true);
factory.setName spaceAware(fals e);
factory.setVali dating(true);

DocumentBuilder parser = factory.newDocu mentBuilder();
parser.setEntit yResolver(new LocalEntityReso lver());
Document document = parser.parse(aI n);

NodeList fields = document.getEle mentsByTagName( "field");

for (int i = 0; i < fields.getLengt h(); i++){
Element el = (Element) fields.item(i);
Column col = new Column();
if
(el.getParentNo de().getNodeNam e().equals("col umn_identifier" )){
idField = new IdField();
idField.setColu mnName(el.getAt tribute("name") );
}
col.setColumnNa me(el.getAttrib ute("name"));
col.setColumnTi tle(el.getAttri bute("column_na me"));
columns.add(col );
}
}
catch(Exception e){
e.printStackTra ce();
}
}

private Field findField(Class classType, String asFieldName) throws
NullPointerExce ption {
if (classType == null) { throw new
java.lang.NullP ointerException ("Cannot find field in ancestor class"); }
try{
return classType.getDe claredField(asF ieldName);
}
catch(Exception e){
return findField(class Type.getSupercl ass(), asFieldName);
}
}

private void invokeMethod(Ob ject oData, Object oValue, String
methodName, Class className[]) throws
java.lang.Illeg alAccessExcepti on,
java.lang.Illeg alArgumentExcep tion,
java.lang.refle ct.InvocationTa rgetException,
java.lang.NoSuc hMethodExceptio n {

Method m;

try{
m = oData.getClass( ).getMethod(met hodName, className);
Object oValues[] = new Object[1];
oValues[0] = oValue;
m.invoke(oData, oValues);
}
catch(Exception e){
Class newClassName[] = new Class[1];

if (className[0].toString().end sWith("Boolean" )) newClassName[0]
= Boolean.TYPE;
if (className[0].toString().end sWith("Byte")) newClassName[0] =
Byte.TYPE;
if (className[0].toString().end sWith("Short")) newClassName[0] =
Short.TYPE;
if (className[0].toString().end sWith("Characte r"))
newClassName[0] = Character.TYPE;
if (className[0].toString().end sWith("Integer" )) newClassName[0]
= Integer.TYPE;
if (className[0].toString().end sWith("Long")) newClassName[0] =
Long.TYPE;
if (className[0].toString().end sWith("Float")) newClassName[0] =
Float.TYPE;
if (className[0].toString().end sWith("Double") ) newClassName[0]
= Double.TYPE;

m = oData.getClass( ).getMethod(met hodName, newClassName);
Object oValues[] = new Object[1];
oValues[0] = oValue;
m.invoke(oData, oValues);
}
}

public Class getColumnClass( int columnIndex) {
if (getRowCount()> 1)
return getValueAt(0,co lumnIndex).getC lass();
return null;
}

public int getColumnCount( ) {
return columns.size();
}

public String getColumnName(i nt row){
Column col = (Column)columns .get(row);
return col.getColumnTi tle();
}

public int getRowCount() {
return datas.size();
}

public Object getValueAt(int row, int col) {
Object dataObject = datas.get(row);
Column colInfo = (Column)columns .get(col);
String columnName =
StringServices. capitalize(colI nfo.getColumnNa me());
try{
Method method = dataObjectClass .getMethod("get " + columnName,
null);
return method.invoke(d ataObject, null);
}
catch(Exception e){
e.printStackTra ce();
return null;
}
}

public void setValueAt(Obje ct aValue, int row, int col){
Object oData = datas.get(row);
Column colInfo = (Column) columns.get(col );
String columnName =
StringServices. capitalize(colI nfo.getColumnNa me());

try {
if (!insertedRows. contains(oData) && !
updatedRows.con tains(oData)){
updatedRows.add (datas.get(row) );
}
invokeMethod(oD ata, aValue ,"set" + columnName, new Class[] {
getColumnClass( col) } );
}
catch(Exception e){
e.printStackTra ce();
}
fireTableRowsUp dated(row, row);
}

public boolean isCellEditable( int rowIndex, int columnIndex){
return true;
}

public void addRow(){
try{
Object o = dataObjectClass .newInstance();
datas.add(o);
insertedRows.ad d(datas.get(dat as.size() - 1));
fireTableRowsIn serted(datas.si ze() - 1, datas.size() - 1);
}
catch(Exception e){
e.printStackTra ce();
}
}

public void deleteRow(int rowToDelete){
try{
Object dataObject = datas.get(rowTo Delete);
String idName = idField.getColu mnName();
Method method = dataObjectClass .getMethod("get " +
StringServices. capitalize(idNa me), null);
Object o = method.invoke(d ataObject, null);
deletedRows.add (o);
datas.remove(ro wToDelete);
this.fireTableR owsDeleted(rowT oDelete, rowToDelete);
}
catch(Exception e){
e.printStackTra ce();
}
}

public Class getDataTypeClas s(){
return dataObjectClass ;
}

private class LocalEntityReso lver implements EntityResolver{
public InputSource resolveEntity(S tring publicId, String systemId){
if (publicId.equal s("-//TableModelObjec t/TableModelObjec t DTD
2.0//EN")){
try {
return new
InputSource(Tab leModelObject.c lass.getResourc eAsStream("Tabl eModelObject.dt d
"));
}
catch (Exception e) {
return null;
}
}
return new InputSource(sys temId);
}
}
}

"Bernard Koninckx" <ko************ *@excite.com> a écrit dans le message de
news: 40************* **********@news .skynet.be...
Hi everybody,

The following code (putted in a inherited object from AbstractTableMo del
object) make some errors :

public void deleteRow(int rowToDelete){
try{
Object dataObject = datas.get(rowTo Delete);
String idName = idField.getColu mnName();
Method method = dataObjectClass .getMethod("get " +
StringServices. capitalize(idNa me), null);
Object o = method.invoke(d ataObject, null);
deletedRows.add (o);
datas.remove(ro wToDelete);
fireTableRowsDe leted(rowToDele te, rowToDelete);
}
catch(Exception e){
e.printStackTra ce();
}
}

I don't understand why.

And here is the Stack trace exception

java.lang.NullP ointerException
at javax.swing.JTa ble.prepareRend erer(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell (Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paintCell s(Unknown Source)
at javax.swing.pla f.basic.BasicTa bleUI.paint(Unk nown Source)
at javax.swing.pla f.ComponentUI.u pdate(Unknown Source)
at javax.swing.JCo mponent.paintCo mponent(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JVi ewport.paint(Un known Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at javax.swing.JLa yeredPane.paint (Unknown Source)
at javax.swing.JCo mponent.paintCh ildren(Unknown Source)
at javax.swing.JCo mponent.paintWi thOffscreenBuff er(Unknown Source)
at javax.swing.JCo mponent.paintDo ubleBuffered(Un known Source)
at javax.swing.JCo mponent.paint(U nknown Source)
at java.awt.Graphi csCallback$Pain tCallback.run(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nOneComponent(U nknown Source)
at sun.awt.SunGrap hicsCallback.ru nComponents(Unk nown Source)
at java.awt.Contai ner.paint(Unkno wn Source)
at sun.awt.Repaint Area.paint(Unkn own Source)
at sun.awt.windows .WComponentPeer .handleEvent(Un known Source)
at java.awt.Compon ent.dispatchEve ntImpl(Unknown Source)
at java.awt.Contai ner.dispatchEve ntImpl(Unknown Source)
at java.awt.Window .dispatchEventI mpl(Unknown Source)
at java.awt.Compon ent.dispatchEve nt(Unknown Source)
at java.awt.EventQ ueue.dispatchEv ent(Unknown Source)
at java.awt.EventD ispatchThread.p umpOneEventForH ierarchy(Unknow n Source)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(Unknown Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.p umpEvents(Unkno wn Source)
at java.awt.EventD ispatchThread.r un(Unknown Source)

Thanks all

Bernard

Jul 17 '05 #3
Hi, Bernard:
public Class getColumnClass( int columnIndex) {
if (getRowCount()> 1)
return getValueAt(0,co lumnIndex).getC lass();
return null;


I think it is verboten to return null in getColumnClass. At least, it
makes good sense that prepareRenderer doesn't like it - that method will
use the class fro looking up a suitable renderer (in an overcomplicated
maybe-column-bound maybe-class-bound scheme, by the way).

Try using Object.class or something like that instead.

Also, why do you mix Vectors and ArrayLists ? As far as I know, Vectors
are obsolete, synchronized (slow) and had better be replaced by Lists.

Let me know if I guessed right :)

Soren
Jul 17 '05 #4
The code below return a good class object but I've already the same stack
trace
error

public Class getColumnClass( int columnIndex) {
Column colInfo = (Column)columns .get(columnInde x);
String colName = colInfo.getColu mnName();
Field fieldInfo = findField(dataO bjectClass, colName);
Class className = fieldInfo.getTy pe();

return fieldInfo.getTy pe();
}

I don't understand what's really the problem.

Bernard

"Soren Kuula" <do************ @bitplanet.net> a écrit dans le message de
news: w4************* *********@news0 00.worldonline. dk...
Hi, Bernard:
public Class getColumnClass( int columnIndex) {
if (getRowCount()> 1)
return getValueAt(0,co lumnIndex).getC lass();
return null;


I think it is verboten to return null in getColumnClass. At least, it
makes good sense that prepareRenderer doesn't like it - that method will
use the class fro looking up a suitable renderer (in an overcomplicated
maybe-column-bound maybe-class-bound scheme, by the way).

Try using Object.class or something like that instead.

Also, why do you mix Vectors and ArrayLists ? As far as I know, Vectors
are obsolete, synchronized (slow) and had better be replaced by Lists.

Let me know if I guessed right :)

Soren

Jul 17 '05 #5
Bernard Koninckx wrote:
The code below return a good class object but I've already the same stack
trace
error

public Class getColumnClass( int columnIndex) {
Column colInfo = (Column)columns .get(columnInde x);
String colName = colInfo.getColu mnName();
Field fieldInfo = findField(dataO bjectClass, colName);
Class className = fieldInfo.getTy pe();

return fieldInfo.getTy pe();
}

I don't understand what's really the problem.


The problem IS your column classes. I can see that you sometimes return
Integer.TYPE, or TYPE of the wrapper class for some other simple type.
It does not work - JTable has no renderer installes for these types (I
am not even sure they are subtypes of Object). That's what you get
nullpointer exc.

Try this:
public Class getColumnClass( int columnIndex) {
Column colInfo = (Column)columns .get(columnInde x);
String colName = colInfo.getColu mnName();
Field fieldInfo = findField(dataO bjectClass, colName);
Class className = fieldInfo.getTy pe();
if (className == Integer.TYPE)
return Object.class;
return fieldInfo.getTy pe();
// if (getRowCount()> =1)
// return getValueAt(0,co lumnIndex).getC lass();
// return null;
}

and it quits crashing.

That said, I think there is something overly complicated about your
table model. I't not worth all of your effort (reflection) to avoid
wrapper types in a TableModel, if that's what you want to do. If you
want to, a better way is still to have the getValueAt return a wrapper
type for underlying primitive types.

Also, avoid file name literals in your code. The code would not run here
until I had found and corrected them. And get rid o' them Vectors :)

Soren
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1927
by: Alan Hoffman | last post by:
Hi, Is it possible to create a JTable where the column is not all one type of Component. For example using a JTable to enter in values for an address where the first column is just JLabels and the second columns first cell is a JTextField for the street and the next cell is a JComboBox that contains all the states. Thanks, Alan
1
5501
by: gwerk | last post by:
Does anyone know how I can use a MouseListener to select a specific row in a JTable? Also, is there a way to have a hidden field or key for each row? Thanks! Gwerk.
1
8976
by: asd | last post by:
I need to make the cells in the 1st column look like the column header. I tried the following code but it didn't change anything: private void rendererTest() { TableColumn column = tblDecisions.getColumnModel().getColumn(0); TableCellRenderer renderer = column.getHeaderRenderer(); column.setCellRenderer(renderer); }
1
6745
by: Andrea Sansottera | last post by:
Hi fellows, I was wondering if in the Java API there's a way to easily map a disconnected RowSet to a JTable... I have looked at the doc but i did not found anything. What I want is simply do the follow: 1. Load: Database -> disconected Rowset -> automapping in a JTable 2. Editing of the data in the table/rowset
3
8088
by: Chucker | last post by:
Hi Folks, I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this worked fine. When moving to .NET 2.0 I get a couple of unresolved externals / linker errors: Error 16 error LNK2028: unresolved token (0A000007) "extern "C" void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)" (?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "public: virtual __thiscall...
0
4887
by: Adam Clauss | last post by:
I have managed C++ library (is bridging between a Win32 .dll and a C# application). All was well when compiled under VS2003, but I am running into a series of linking errors when compiling against VS2005. They all/mostly seem to be within the STL. Any idea what might cause something like this? Linking errors follow. ---
1
7389
by: onsir | last post by:
I have code like this, but still wrong. how to show data from database in JTable. package my.JavaNetBean; import java.sql.*; import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException;
1
5843
by: emekadavid | last post by:
can anyone help me flesh out the problem? I wanted to insert a combo box into one of the columns of a JTable. although the combo box is drawn, the list of the data model fails to render. import java.awt.*; import javax.swing.*; import javax.swing.table.*; public class TableAvecRenderer extends JPanel {
3
4993
by: sibusiso | last post by:
HI there Can anyone help I am using netbeans and I populated a Jtable with some data, I have a search button and TextField allowing a user to search for a specific records, but know I want to know how do I then filter the JTable and display records from the results of a user search option In short a user has to view records of a specific date on the JTable Thanks
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.