Is the loop in a separate thread? If not, I suggest you move it into one. If the loop is in the same thread as the gui (buttons and keyboard polling, etc), the paint will not occur until the end of the loop.
Try putting <html> at the beginning of the text, like this:
label.setText("<html><font size=2>your text");
Closing tags don't seem to be necessary unless you're switching to another font within the same label.
Arrays offer advantages in certain circumstances. For instance, if you have a method that must return a group of primatives (ints, longs), there's considerable overhead in wrapping those primatives in objects to include in a collection - even when the jvm is doing it for you as in java 1.5. An...
I'm willing to bet that after you click the button, the focus is still on the button. You're then copying the button object to the clipboard.
You would either need to shift the focus to the JTable - I'm not sure how - or do it in such a way that the table never loses focus in the first place...
An ImageIcon will handle an animated gif alright.
On ImageIcon there's a method called setImageObserver(). The ImageObserver is what triggers the animation. Here's the example in ImageIcon's source:
* icon = new ImageIcon(...)
* button.setIcon(icon);
*...
Yes, you have to make the table variable final IF you want to keep it as a local variable.
If you move the table variable xxx to be a class variable rather than a local one, you should no longer get the message.
I'm not sure what the default layout manager is for JToolBar, but you might try setting it (using JToolBar.setLayout()) to FlowLayout or BoxLayout or something to see if it works better for you. A little trial and error...
Java is a terrible memory hog. If the code snippet you posted is really all you're doing, then just increase the memory for the application and move on to more important things.
If you're really interested, download a copy of Oracles JDeveloper and run your app under it. It has a built in...
On the other hand, doing an iterator on a HashMap kind of defeats the purpose - you might as well use an ArrayList and save the extra overhead.
What if you did a toUpperCase() on the String when you set it as the key in the HashMap, and toUpperCase on the string in the get method?
Well, I implemented something like that once by having the servlet, after completing the first step, load a jsp that displayed the progress so far.
The jsp had an OnLoad javascript method that immediately passed control back to the servlet to perform the next step. They kept bouncing back and...
When programs stop working, the data is sometimes the problem. You're getting a null pointer exception when your reporting package tries to sort an array. This will occur when an array of Objects contains a null entry.
In other words, it may not have anything to do with the client machines...
If you want a database that the end user doesn't have to own, then you should look for ones that offer an "embedded" database driver.
Both Pointbase (www.pointbase.com) and HSQLDB (hsqldb.sourceforge.net/) offer those options. I'm sure there are others.
I understand your problem. Even an InternalFrameListener doesn't get any events when the tab is changed. Basically the UI considers the tabbed pane as one big container, always displayed and active.
What I ended up doing was making all my JInternalFrame objects globally accessable (I made...
I figured out a workaround for the problem. After getting the Date object as above, I check to see if that date is within daylight savings time, and if it isn't, I add an hour to it.
Here's the full handling:
long tm = f.lastModified();
TimeZone tz = TimeZone.getTimeZone("US/Eastern")...
Thanks for the suggestion. I didn't find setRawOffset on the Calendar object, but I did find one on the TimeZone object. That led me to try creating a SimpleTimeZone with no daylight savings time settings, but that had no effect.
Here's what I tried:
long tm = f.lastModified();
TimeZone tz...
I have a file on my local drive (Windows 2000) with a last modified date/time of Jan 30, 2005 12:09:34 AM.
When I create a File object for that file today, call lastModified() and make a Date object from it, the result is Jan 29, 2005 23:09:34 PM - one hour earlier.
It seems to be making some...
I tried this experiment with three databases, using the jdbc drivers provided by each:
DB2 under jdk1.3 (type 2 driver)
Pointbase under jdk1.5 (type 4 driver)
Hsqldb under jdk1.5 (type 4 driver)
All three were able to retrieve the same column from a result set 20 times without...
ResultSet itself is abstract - the actual implementation of it is contained in the jdbc driver you're using. Another driver (for a different database, for instance) might work as you expect.
That's why Sun doesn't guarantee the behaviour - it most likely didn't write the driver.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.