It is a logical error and just isnt doing what i would like it to. After the user had added a new "event Name" by entering it into a JOption Pane Message Dialog, the program then adds this to the database.after that the program then has to update the Jlist so that the new "event Name" that has been added appears immediately after the user has entered it, on the Jlist.
Please could you help me with any ideas on how i can fix this.If there are any ambiguities about my code or what i am trying to fix, please ask and i will try reinforce what my problem is.Chat Server Project & Tutorial | Wi Fi-remote-control sailboat (building) | Joke Thread Rational thinkers deplore the excesses of democracy; it abuses the individual and elevates the mob. Use XXX in a comment to flag something that is bogus but works.Use FIXME to flag something that is bogus and broken. Calling a program finished before all these points are checked off is lazy.So if the user enters a new event to add and clicks 'ok', the event is added to the database BUT the events list is not updated. Border Layout; import *; public class List extends JFrame implements Action Listener Its late where i am atm and i donno if my brain isnt screwed on properly or its just not working now but i dono what im doing wrong.
THEN i click on another tab in my program and then i click back to the tab where the events list is located in (remember the update Events List() method is called when i clicked back to this tab) and then the method works perfectly there and updates the list. i dont want to be a nag and ask som1 to write out my whole program or method for me so if you could just point out what you think is wrong with the code or some suggestions on how i could fix this.I have a slight suspicion that this is because when the user enters in the event to add (the time when the update method doesnt work) the list is located in the background of the program and does not want to update, it only will update when the focus is away from it (just like when i switch between tabs) I cant understand how nobody else has had this problem with a Jlist, this is happening with all my lists, or maybe I am going about populating my list in the wrong way. However I started my Jlist like this: then I set a loop to remove all the elements. thanks for all the help and effort guys thanks the afcoder, i finaly got the events list working by moving it into another class and declaring the defaultlistmodel in the other class, getting the info and then setting it in the main class.Please can you help me with this error because it is so irritating and i cannot move on until i know what the real solution to this problem is. A senior coder told me to clear the list with a loop remove() and then repopulate it with the query. After the loop was finished removing I ran the repopulation loop to add all the items from in your case the event column. I have checked that the method is actually getting executed by putting simple output text messages to show in the output console and they are coming through at every line in that code.As you can see I even tried to set the model to null before i set the model to the new 'updated' info from the database. I heard from a source that if you get the attention of the GUI away for a moment by putting in a confirmation message to the user and therefore the attention of the program goes to the JOption Pane Message Dialog.supposedly when it comes back to the GUI (i.e the user has clicked 'ok') the list should be updated.