• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JButton slow response time

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am experiencing about a 2 second delay when i click on the jbuttons in my swing application. The Gui application is an image program, with each button containing and ImageIcon. The Panel that all the buttons are on implements DropTargetListener(as I just drag images to the panel and the buttons are dynamically created)

I was wondering what suggestions there might be for me to speed up the responsiveness. It is only with button on this panel that I am experiencing this problem. I have another panel with jbuttons with images pulled from the web that are very "snappy." Thanks in advance for any suggestions.

-Juan
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your problem could be due your tying up the EDT, the Event Dispatch Thread, and if so, you'll have to take care to keep the EDT free of busy work.

What I want to know is what actions occur when the button is pressed? Do these actions take a bit of time or strain the processor? If so, do you need to call these actions within a background worker thread?
 
J Vazquez
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as of right now, my JButtons just print out "Button was clicked"
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your best bet here is to post your code. Most here will not want to see your whole program, but rather to have you condense your question/problem into a single small class that is compilable by any and all of us, and demonstrates your problem. In other words, a [Short, Self Contained, Correct (Compilable), Example or SSCCE|http://homepage1.nifty.com/algafield/sscce.html] .

Remember, the code should be compilable and runnable for many of us to be able to understand it fully.

Also, when posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, you will need to paste already formatted code into the forum, highlight this code, and then press the "code" button at the top of the forum Message editor prior to posting the message. You may want to click on the Preview tab to make sure that your code is formatted correctly. Another way is to place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:



good luck
[ August 26, 2008: Message edited by: pete stein ]
 
J Vazquez
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, let me work on it. As of right now the program as a whole is huge. Thank you for your help
-Juan
 
J Vazquez
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is my code... I have a resizeImage() method that I tried in place of the getScaledInstance method that generates a java heap error, which I have posted in different thread(i think I am some how leaking memory). I have verified that I have the same delay problems when I drag images to the panel. The images are approx 2MB each (3072x2048). Thank you for your help.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic