claire perp

Greenhorn
+ Follow
since Nov 03, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by claire perp

It's in the code from the previous post at the beginning:

12 years ago
Yes, it's on the c.RemoveRow(i); line but I don;t understand why.
12 years ago
Well this is it:


And this is the whole program concerning the JButton:




12 years ago
If I keep reading the error log it says this:



Should I interpret it how?
12 years ago
All that the code uses are these:

In the controller class I acces the method from the class with the treemap:


And then in the buttoncelleditor I have this:

And that should work, right?
If I use this code on a random outside button it works without any problems:


Where is the problem?
The error is on this line c.RemoveRow(i);
12 years ago
I've tried using this method instead of the orderlist.remove(row)


but now instead I get nullpointerexception.
I just can t seem to sort this out, clearly I'm doing something wrong or missing something here.
12 years ago
Yes, I ve tried, this is my code.



And now it gives me this error (if i try to delete the fifth row of the table, for example):


It displays an error with this line: ordersready.remove(row);
I can t understand what the problem is. Again, the code works fine with an outside button.
12 years ago
Thank you for the correction but it's still a problem with the button cell renderer. I don't know how to make the code work for the jbutton cell, it just gives me the error.
12 years ago
Yes, you're right, thank you very much. I've modified the code.




This code works fine if I click on a button to delete the selected row but it doesn t work at all if I use it in the renderer for the button type cell.



It gives me this error



How do I make it detele rows on the button cell click?
12 years ago
Ok, so I've made a selection of all the ready orders from the first jtable (that displays all the data, including the orders that are not ready). I displayed the selection in another Jtable, using the same table model, but by applying a filter on it. Now I want to delete a row from the table model by clicking on a button in the jframe containing the jtable with the filter.
This is the code I've used for deleting:



This is the corresponding code from the controller:


For the fireTableRowsDeleted() method I've used i have this code


And this is the filter I used:


this is the error I get


I would be very grateful if you could tell me what I did wrong.
12 years ago
Hi, thank you for your answer.
I have 3 different JFrames (together with the main frame from where you can acces either one of the other 2 frames). The first Jframe is a tabbedpane containig a tab with the order menu list and the other tab I was thinking of using it to put ready orders in there (in a jtable eventually).

The other JFrame contains the JTable with all the orders that were given from the first JFrame and should be accesed by another person by clicking another button from the main jframe.
Indeed, I was thinking of focusing the tab containing the jtable of ready orders.

I have two options I guess: either to reuse the jtable with all the orders by adding them simoultaneously in the second tab from the first JFrame and in the second JFrame and put a state (Processing) on both jtables from both jFrames.
Both users need to validate an order. The first to validate is the person who directly acceses the order jtable. When he validates the order from the second JFrame that should cause a change of state in the both tables. And then the second user can validate too the orders validated by the first user, his validation conducting to their removal from the jtables.

Or I could add only the orders that have been validated from the second JFrame into the second tab from the first JFrame where the second user to validate can view only the ready ones and validate them, at his turn. Because the menu is on another tab I would like to focus the tab so that the person using the first JFrame would know that a order is ready.

Though I don't like the idea of moving orders from one table to another. I'm looking for the most efficient and practical method, considering the fact that there are 2 users accesing the application (and have to validate orders from the jtable with orders succesively).
Should I use multithreading so both users could acces the same window but have different views that will allow them to perform validations at different turns? ( to be allowed only to performe some actions or click some buttons, after the other user clicked another button, have different views of the same window? the multithreading thing is pretty new for me but is it best applicable here than the other methods?)

The other problem would be that I have to save the whole application periodically (serialization to xml or smthg else). I practically save what? The 2 treemaps I used for holding data(one for products and one for orders)?

12 years ago
I have another question, if you don t mind. I ve created an interface where i'm selecting some products from an window with a list of products (every product from the jtable has a checkbox cell) and the suite of selected products ( representing an order)are added to another jtable in another window, the orderlist window. Each order has a button cell that validates the order (that means the order is ready). What I want to do is to fire a message to the first window when I click that validate button to let it know that the order is ready. I was thinking to put an listener to the button that will trigger the appearance of a dialogbox window in the first window saying "order with number... is ready". I was thinking of putting this mesages in some kind of toolbar or menu bar just like a tab so they won't cover the whole window if they are too many (and to open when thay are clicked in the tab).
Do you think this is the best solution, is it implementable (also considering the fact that I'm using a mvc interface)? Or should I use something else?
Is it a more professional or adequate way of doing the triggering alert thing? Thank you.
12 years ago
Yes, I know now that loop didn 't have any point...i've repaired it, thanks.
12 years ago
Now I'm trying to put the data from a treemap in a jTable but I'm having some troubles because it keeps returning just the last product added in the treemap.
I'm having a Product class, a ProductList class that holds the data and I'm trying to add all the data in the JTable.

This is the model for the JTable



The function called elementAt is defined in the Products class:





I get a 2 rows table with "Tea", "sdff", 1,true in both rows.

This is the class that holds the data:


Can you tell me what's wrong? Thank you!
12 years ago
Yes, you're right...it does work with a listmodel, thank you very much.
12 years ago