• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Hacks

 
Marcelo Ortega
Ranch Hand
Posts: 528
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone heard of the Swing Hacks book?

I don't understand what they mean by hacks. Do they mean tricks?
Will this book be worth it? Or would Desktop Java Live be better?

Best Regards,
Marzo.
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it means 'tricks' in a way - but also a bit more than that. The Free Online Dictionary of Computing has several definitions for 'hack', the most relevant one here being:

1. Originally, a quick job that produces what is needed, but not well.

In this sense it could mean changing the Swing source code to get it to do new things, or just using the Swing API in a way that creates code that is hard to understand, maintain, or use.
[ August 26, 2005: Message edited by: Stuart Gray ]
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the book and I'm impressed with it. It has 100 recipes that expose lesser known things you can do with Swing. In working through them, I have discovered many parts of the API that are very useful in other things I am working on. Lots of code examples. Lots of links to useful tools.
 
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 haven't read Swing Hacks but I have read a lot of reviews on it and the majority of those are bad. This review kind of sums it up I think.
 
Scott Delap
author
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disclaimer ... I'm the author of Desktop Java Live

The two books are very different in what they are trying to cover. I'd call Swing Hacks a Java Cookbook type book for Swing. The format of the book is a large collection of "hacks". Desktop Java Live on the other hand walks through a number of open source API's while providing examples for core Swing development related topics like threading, layout, data binding, etc. Feel free to check out sample chapter on threading.

http://www.sourcebeat.com/TitleAction.do?id=10

Scott Delap
ClientJava.com
Desktop Java Live
 
Steve Sinai
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm about halfway through Swing Hacks. So far I haven't come across anything so compelling that I've decided to put them into my Swing application, but it's always nice to pick up a few ideas while reading about how others use Swing. There are hardly any books that talk about Swing beyond a beginner-level, so being able to read anything about Swing at an intermediate or higher level is a rare opportunity. (On his blog, the author says the book is geared toward intermediate-level Swing programmers.)
 
todd runstein
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't purchased a Java book in over a year - except Swing Hacks. I love this book!

If you're just learning Swing, this isn't the book for you, however once you're comfortable building GUI's, Swing Hacks can help you think up new and interested ideas to make your application just a bit more compelling. If you're bored with Swing, this book will help get the creative juices flowing again. I'm very happy with it!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by todd runstein:
I haven't purchased a Java book in over a year - except Swing Hacks. I love this book!

If you're just learning Swing, this isn't the book for you, however once you're comfortable building GUI's, Swing Hacks can help you think up new and interested ideas to make your application just a bit more compelling. If you're bored with Swing, this book will help get the creative juices flowing again. I'm very happy with it!


You could probably get all the same new and interesting ideas for free if you just browse Romain Guy's Weblog.
 
Ed Ewing
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, the review on blogspot is pretty harsh.

I found "Swing Hacks" useful as a source of interesting ideas that prompted me to think about some things I wouldn't otherwise have thought of. Most of the ideas presented are things that I wouldn't even want to try to do. Some are good ideas, but incomplete. Nonetheless, the book is easy and fun to read and it gave me some inspiration.

There is one idea I very happily used. Hack #95 shows how to send the System.out and System.err streams to a custom panel. This is amazingly useful for me. We deliver an application with Java WebStart. Sometimes, useful information is printed to System.out. But naive users of WebStart won't know how to turn on the WebStart console. I easily adapted code from the book to send System.out to a "Console" panel inside our application. It is much easier to tell our users how to turn on that "Console" than to tell them how to turn on the WebStart Console.

I extended the code in the book to send both System.out
and System.err to the same "Console" panel inside our application, and also to send copies out along the normal System.out and .err streams.

I expect that there will be at least one of the hacks in the book that will be useful to you, either directly or as inspiration, and that may be enough. You will need to read other books for details, but those detailed books aren't as much fun.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ed Ewing:
There is one idea I very happily used. Hack #95 shows how to send the System.out and System.err streams to a custom panel. This is amazingly useful for me. We deliver an application with Java WebStart. Sometimes, useful information is printed to System.out. But naive users of WebStart won't know how to turn on the WebStart console. I easily adapted code from the book to send System.out to a "Console" panel inside our application. It is much easier to tell our users how to turn on that "Console" than to tell them how to turn on the WebStart Console.


Ok, I feel like arguing today.

A. Why are your end users needing to see information that is sent to System.out and System.err? Better yet, why is your application writing messages to those streams?

B. This is something you didn't think to do? Capture those streams? You spent $20+ dollars to learn that? To me, that doesn't seem a fair tradeoff. For you that is.
 
William A White
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:


A. Why are your end users needing to see information that is sent to System.out and System.err? Better yet, why is your application writing messages to those streams?

B. This is something you didn't think to do? Capture those streams? You spent $20+ dollars to learn that? To me, that doesn't seem a fair tradeoff. For you that is.



Everybody has to learn somehow... I did a very similar thing when I was starting out in Java development and it got the job done. Today, I would never do it, but neither would I think it a stupid thing to do. If you're on your own with no senior developer to tell you what's possible, the only way to grow as a programmer is to experiment and read what others have done. The disadvantages of this approach may become apparent (it's perfectly adequete in some cases, if inelegant) and spur further development.

I haven't read the book in question, but $20 is not so bad.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William A White:
I haven't read the book in question, but $20 is not so bad.


For one google-able solution? Man, I am in the wrong business. Ok, from now on email me your questions and for $20 I'll answer 1 of them.

Seriously, I wasn't implying that everyone should know this already. I assume a delivered application is typically developed by people that pretty much know what they are doing for the most part (we won't talk about M$ developers). My questions just came across wrong, sorry about that.
 
Ed Ewing
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:


Ok, I feel like arguing today.

A. Why are your end users needing to see information that is sent to System.out and System.err? Better yet, why is your application writing messages to those streams?

B. This is something you didn't think to do? Capture those streams? You spent $20+ dollars to learn that? To me, that doesn't seem a fair tradeoff. For you that is.




A. I would prever that the application were not writing anything to System.out, but that is a situation I inherited. This patch is a dirty hack, and is just applying a band-aid to a bad situation. The information going to System.out is diagnostics and logging message. Users should not need to look at any of it except when something goes seriously wrong, in which case the information there can occasionaly help find the problem.

I'm slowly removing all the messages going to System.out inserted by others. But I have other priorities, and this patch is a blessing in the interim.

B. The point I was trying to make is that with this sort of book, even if many of the ideas it presents are incomplete or even wrong, it can spur you to think of things that you might not have otherwise. You then do need to do some more work to refine those ideas, and that includes going out to other books and javadocs and web resources. But the books that include all the details are usually *boring* so they will sit on your shelf. A book like this is easy enough to browse, so it might be useful to get you started on some idea, and it can remind you of things you'd forgotten.

I have for a long time wanted to fix the mess of writing to System.out. But the real long-term solution requires lots of work. (Work that should be done, but which isn't my bosses priority.)

Once you get the spark of an idea, it is easy to "Google" (for example) for more information. But you need to get the sparks from somewhere.

So although I didn't spend any money to buy the book -- I borrowed it -- $20 might be a good deal for a spark and some entertaining (if incomplete) ideas. If nothing more, it can remind you that programming can be fun sometimes.
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got the book sitting on my desk (didn't pay for it). At first glance seemed kind of useful, and I suppose examples almost always have some use. I did use the table column resizer from there (I'm sure a similiar solution could have been googled), but I did have to change parts of it to make it work in an expected manner. I don't see why it would be targeted for immediate or advanced users though, but since it is, I can definitely understand the bitter attitude of more experienced programmers who paid for it.

-Tad
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!