• Post Reply Bookmark Topic Watch Topic
  • New Topic

Feel Like I Am Starting Over

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I've got a personal project coming up with a few friends and a very small part of the project is a Swing front end. I've been wrapped up in web development for so long, I feel like I am starting all over with Swing. So I downloaded Java6 because I know there are some great enhancements to the desktop API. Ever since 1.5 came out Sun has been touting how part of their plan is to provide up to date demos and tutorials on the Swing trail. Going through it this evening, they haven't. It's the same old crap that has been there for years with a few minor adjustments. But here is the real kicker.



This is the way sun says to kick start a Swing app. All fine and dandy. Makes sense to me. I realize why they are doing this. But here is the kicker. I decide to glance at the JFC demos that came with JDK6. Interesting that none of the main methods in the source kick off the applications this way.

Sun has promised demos and tutorials that abide by what they consider best Swing development practices. They have yet to deliver. This is frustrating. I don't want this thread to be focused on my code above. I know how components work. I know how to throw together a Swing application. And I know how to create a real mess of it along the way.

What I want to know is how everyone else is dealing with the still grossly incompetent code examples that are available for Swing and what they are using to do things the right way. And while we are on the topic of the right way, if Sun can't even provide demos of code done right, who is deciding what is right and what is not? Who is setting the standard for Swing development? I'd really like to know.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this won't help with the 1.6 bit, but in Oct '06 'Ask the Experts' I asked
about the best way to start an app.

This is the reply from Scott Violet.

(added code tags to preserve formatting - will it work?)


I rarely use sun's code examples - I prefer to search the forums I
participate in, and in particular for several of the regulars' code
snippets, which I find better explained and easier to understand.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I rarely use sun's code examples - I prefer to search the forums I
participate in, and in particular for several of the regulars' code
snippets, which I find better explained and easier to understand.


True. But that's kind of my point. It's unfortunate that Sun's Swing gurus seem to only participate on Sun's forums, which I detest. Luckily we have a few on JavaRanch that seem to know what's going on. Craig and yourself included.

I just got done looking at the Desktop class and the TrayIcon support. What a couple of worthless additions. Oddly enough, no docs on the Swing Trail for those either. :roll:
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another point while I feel like ranting. Why aren't there more built in Factories for instantiating Swing widgets?

JButton button = ButtonFactory.createButton(...);

I'm really sick of all the boilerplate code and I hate designers that generate code for me. There is a middle ground there that I think could be filled with Factories. But alas, there aren't any in the core API. Any 3rd party libraries for such things that anyone knows of? Guess I could write one.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think JButton comes with an, um, factory method: new JButton()

If you need a special JButton, subclass it. Right?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!