The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Make Your Swing App Go Native, Part 3
Subject:  Is that the idea of Swing?
Date:  2006-10-19 02:28:01
From:  miguelm
Response to: Is that the idea of Swing?


The reality is that Swing can't handle everything, because different platforms have different conventions that are outside the scope of Swing. But frankly, there's not a lot to do to tailor your application to conform to a platform's conventions.
I use an abstract class I call Platform, which has subclasses of MacPlatform and WindowsPlatform. I put all my platform-specific code in those two classes and give them a generic interface in the Platform class. That way I can avoid platform-specific code in my application code. In principle, I can adapt this to as many platforms as I want.

 Feed java.net RSS Feeds