Re: DefaultTableModel() is a crap / How to hide a Table column?
From: John (no_at_email)
Date: 03/07/05
- Next message: Dirk Starke: "Re: Trouble calculating point"
- Previous message: John McGrath: "Re: swing console"
- Maybe in reply to: David: "Re: DefaultTableModel() is a crap / How to hide a Table column?"
- Next in thread: Owen Jacobson: "Re: DefaultTableModel() is a crap / How to hide a Table column?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 07 Mar 2005 10:55:17 +0000
Mark Sizzler wrote:
> It all started with my search for a possibility to store data values in a JTable without displaying it.
> I read somewhere in the Sun docs that columns without a header are not displayed.
> Ok, I thought, according to a good coding style they are not displayed but they are stored.
> But what a crap, the data is even worse deleted. See the simplified scenario below:
>
> String rowData[][] = {
> { "firstrowfirstcol", "firstrowsecondcol" },
> { "secondrowfirstcol", "secondrowsecondcol" }
> };
>
> String columnNames[] = {
> "col1head"
> };
>
> DefaultTabelModel mytm = new DefaultTableModel(rowData, columnNames);
>
> After performing the last command not only mytm does not contain the values of the second column
> but also the values of the second column are removed from the rowData!!!
> What a poor system architecture. It costs me a half day to find it out because I could not believe it.
>
> Do I really have to setup a storage outside of DefaultTableModel to be able to store
> additional data ?
>
> Mark
>
JTable is a UI component. Trying to use it's DefaultTableModel to store
data as you are is ridiculous.
You should create a class based on a suitable data structure that also
implements TableModel.
You said "What a poor system architecture." I suggest that you learn how
to program before attempting to understand or criticise system architecture.
John
- Next message: Dirk Starke: "Re: Trouble calculating point"
- Previous message: John McGrath: "Re: swing console"
- Maybe in reply to: David: "Re: DefaultTableModel() is a crap / How to hide a Table column?"
- Next in thread: Owen Jacobson: "Re: DefaultTableModel() is a crap / How to hide a Table column?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|