So this is my first attempt at a GUI in swing, and so far things seem to have been going somewhat smoothly. MULTIPLE_INTERVAL_SELECTION); objects Layout Orientation(JList.
However I am un-able to update a JList named objects L. Image Icon; import javax.swing.*; import javax.swing.event.*; import
so just replace repaint() with validate()Ah, the good think of having the javadoc pop up when you mouseover a method.
Eclipse rocks Originally posted by orestis: From the javadocs of
For example, the collections classes from the original JDK (Vector and Hashtable) are always thread-safe. Because there's a great deal of overhead necessary to build thread-safe artifacts, they tend to be much slower than nonthread-safe alternatives.
This is true of the collections classes (which is why we now have Array List and Hashmap, the nonthread-safe alternatives) and Swing.
/* * The program does not seem to be refreshing the screen correctly. You can give the GUI a suggested time delay, but the GUI might ignore it.
* * A strange bug in this code is that when the button is pressed * the requested square is not displayed until after the window has * been manually resized. You can try playing with that, or you can try calling update() and paint() in that order instead of repaint(). Container.add: Note: If a component has been added to a container that has been displayed, validate must be called on that container to display the new component.
If multiple components are being added, you can improve efficiency by calling validate only once, after all the components have been added.For the first version of this example, no thread safety is built into the code (see Listing 1).As you can see, the thread updates the contents of the list box continuously. When it runs, you get the result shown in Figure 1.I imagine this is because I have already added it to a panel? So, now Im am very lost, and any help would be appreciated.