Welcome to Java Swing Components

It is with great sadness that Custom Swing Components is closing down and will no longer exist. Speaking personally, I know that a great deal of love has been put into making these components, so rather simply closing the site, I will be keeping the site up and allowing the components to be downloaded for free. However these components will be provided "as is" and will no longer be supported. Essentially you may use them however you want, but at your own risk.

If anyone is interested in the source code, I would be happy to make it available should anyone enquire.

It has been a great deal of fun and I hope those using the components enjoy the bling they can bring to an application.

Taming Swing Threads Part 3: The Swing Worker

The problem.

We problem we encountered at the end of part 2 is that although it is really easy to offload long run tasks to a background thread, it is rather difficult displaying the results in a thread safe manner.

 

Java™ 5 has recently provided us with a class called the SwingWorker, which solves this problem and at the same time shields us from the complexity of passing information between threads. The SwingWorker is the perfect solution to our problem. The SwingWorker offers a great deal of functionality; however for this blog entry I will only be showing you how to use it to solve the problem discussed above. If you want further information on the SwingWorker, you can check out its API on the sun site: http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html.

 

Taming Swing Threads Part 2: Common Event Queue Pitfalls

Key points from part 1.

Hopefully after reading part 1 you should be feeling pretty comfortable about what the EDT is and how it processes, but just as a reminder, here are the key points from part 1.

  • Only the EDT may safely manipulate swing components (it is the uber master swing thread).
  • If any other threads are manipulating swing components, they are doing so in an unsafe manner (and bad things will happen).
  • The EDT processes events using a simple sequential queue called the Event Queue.

 

The idea behind part 2 is to explain some of the tricky situations and pitfalls that swing developers often get caught in, as well as hopefully answering some of the questions you have regarding the Event Queue.

Taming Swing Threads Part 1: The Event Dispatch Thread

Why do I need to know what the Event Dispatch Thread (EDT).

As far as a topic goes for my first blog, discussing the Event Dispatch Thread is probably not the most exciting topic for some, but it is definitely one of the most important as far as swing is concerned.

 

If you have ever wondered (or shouted while pulling your hair out in frustration)

  • Why does my application go gray or become unresponsive while I’m processing?
  • Why is my swing application slow?
  • Or why do I seem to get random paint errors from swing?

The answer is the EDT and the painful truth is that you are probably not using it optimally.

 

However don’t get intimidated by the name, the Event Dispatch Thread (EDT) sounds a bit complex, but understanding it is in fact really easy. Once you have this piece of knowledge tucked safely under your belt, you will truly be able to make swing fly, and built the killer applications you have always wanted.

What's in the cart

View your shopping cart.

The LATEST chatter

  • Halted all development on the twitter client. The application in its incomplete state is available at: http://tinyurl.com/6ktd8xw 6 years 35 weeks ago
  • Java Swing Components is currently undergoing a rebranding exercise to Custom Swing Components. The url however will remain the same. 7 years 6 weeks ago
  • Java Swing Components is proud to announce the release of our rater component. http://www.javaswingcomponents.com/product/rater 7 years 7 weeks ago
  • Java Swing Components is proud to announce the release of our first bundle including a fun demo. http://www.javaswingcomponents.com/products 7 years 11 weeks ago
  • New post: New Component Teaser http://tinyurl.com/35hxfnn 7 years 12 weeks ago

User login

Syndicate

Syndicate content