Editing a Component using JTable

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
vindsr2211
Posts: 16
Joined: Mon Oct 19, 2009 1:40 am
antibot: No, of course not.

Re: Editing a Component using JTable

Post by vindsr2211 » Mon Oct 19, 2009 6:03 pm

Thank You.
It works.

But what if there are multiple columns like First name, last name, and marks
How do I pass these?

Or is it fine if it works for a string and a double value?(Based on the question)

vindsr2211
Posts: 16
Joined: Mon Oct 19, 2009 1:40 am
antibot: No, of course not.

Re: Editing a Component using JTable

Post by vindsr2211 » Mon Oct 19, 2009 6:22 pm

And to validate the data in the table:
Must we use InputVerifier class? or must we verify manually? or is there any other thing which can help over this?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Editing a Component using JTable

Post by david.gilbert » Mon Oct 19, 2009 7:27 pm

vindsr2211 wrote:And to validate the data in the table:
Must we use InputVerifier class? or must we verify manually? or is there any other thing which can help over this?
I'm not 100% sure about this. You should look at the events that the JTable fires, and also the TableCellEditor, and see which one you could listen to in order to invoke your validation code. This is definitely the tricky part.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

vindsr2211
Posts: 16
Joined: Mon Oct 19, 2009 1:40 am
antibot: No, of course not.

Re: Editing a Component using JTable

Post by vindsr2211 » Mon Oct 19, 2009 7:32 pm

what if there are multiple columns like First name, last name, and marks
How do I pass these?

Or is it fine if it works for a string and a double value?(Based on the question)

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Editing a Component using JTable

Post by david.gilbert » Mon Oct 19, 2009 8:35 pm

Your TableModel should have only two columns, since it is explicitly for editing a PieDataset and completely under your control. The editing component is intended to be reusable, but it has only one purpose and that is to permit editing of a PieDataset.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

vindsr2211
Posts: 16
Joined: Mon Oct 19, 2009 1:40 am
antibot: No, of course not.

Re: Editing a Component using JTable

Post by vindsr2211 » Mon Oct 19, 2009 8:40 pm

Adding a row, deleting a row, editable cell

Do these 3 imply editable components!?
Are these enough?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Editing a Component using JTable

Post by david.gilbert » Mon Oct 19, 2009 9:05 pm

Sure, the dataset for a pie chart is essentially a 2 column table with N rows. The first column contains keys (and each key should be unique) and the second column contains values (these should not be negative, since that's hard to display on a pie chart). Now if you can add rows to this table, delete rows from this table, and modify existing rows, then you have a component that will let you enter just about any pie chart dataset you can imagine...which would be a nice component to have. Especially if it was wired up with some event notifications that could be listened to externally and used to update a separate chart to display those data values. But even just getting the table to a usable state for editing would be good progress.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

vindsr2211
Posts: 16
Joined: Mon Oct 19, 2009 1:40 am
antibot: No, of course not.

Re: Editing a Component using JTable

Post by vindsr2211 » Tue Oct 20, 2009 11:21 pm

Should we save a table and must pre-saved tables be retrievable?
Must all the saved table names be retrievable every time we run the application ?
Must this condition work?
Or is it ok if the basic working is demonstrated?

vindsr2211
Posts: 16
Joined: Mon Oct 19, 2009 1:40 am
antibot: No, of course not.

Re: Editing a Component using JTable

Post by vindsr2211 » Tue Oct 20, 2009 11:46 pm

Also specified in the question is :
For a more challenging project, do the same for a CategoryDataset or an XYDataset.

Is this mandatory?
Are we awarded extra credit for this?

vindsr2211
Posts: 16
Joined: Mon Oct 19, 2009 1:40 am
antibot: No, of course not.

Re: Editing a Component using JTable

Post by vindsr2211 » Thu Oct 22, 2009 5:23 am

Hello

I also have another query..!

Do we have to just implement a class and demonstrate the basic implementation as per the requirements? or must we design a reusable component?

Kindly let us know as soon as possible so that we can have sufficient time to work upon.

Thank You

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Editing a Component using JTable

Post by david.gilbert » Thu Oct 22, 2009 9:16 pm

vindsr2211 wrote:Is this mandatory?
Are we awarded extra credit for this?
It's not mandatory. I'm not exactly sure how credit is being assigned, but I'd certainly rather see the easier task done well than the harder ones done badly.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked