Scott Delap

author
+ Follow
since Apr 05, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Scott Delap

Jake,

Any reason why you haven't looked into using Swing? 90% of the controls you need are part of the standard toolkit. The other 10% can often be found available through open source. The look of the various components can be modified to be pretty much anything you want with some amount of work.

Scott Delap
ClientJava.com
Desktop Java Live
19 years ago
I'd like to thank JavaRanch for selecting Desktop Java Live as the book review of the month. Potential readers can feel free to email any questions to me at scott at clientjava.com. The eBook version of the book which includes a year worth of updates can be purchased on SourceBeat.com.
19 years ago
This space is mostly filled the Eclipse RCP platform that is the basis for the Eclipse IDE.
19 years ago
AWT was the original UI toolkit included in Java. It makes use of native peers for UI components. Swing takes a different approach by implementing all of its components with pure Java code. Swing uses a few portions of AWT such as the top level window containers and the AWT mechanisms for collecting input events such as mouse and keyboard clicks. However, it does not make use of the AWT components themselves.

http://www.javaworld.com/javaworld/jw-01-1998/jw-01-jfc.html

SWT uses a native peer approach similar to AWT. There is a JNI accessed layer that is different for each OS supported by SWT that contains peers for native components. So the SWT Table class ultimately delegates the majority of its functionality to the native Windows table component for instance. JFace is a layer built on top of SWT that simplifies common UI programming tasks and promotes a model based structure for using SWT components.

http://www.javaworld.com/javaworld/jw-04-2004/jw-0426-swtjface.html

http://www.martinfowler.com/eaaCatalog/modelViewController.html

Scott Delap
ClientJava.com
Desktop Java Live
19 years ago
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
19 years ago
Klaas,

Actions and dependencies are a core issues that developers run into. There isn't a perfect/easy answer to this. It really depends on your app. You seem to be going down the right road with an action factory. I would extend that concept further by having an action registry with one instance of each action. The various buttons you have should all be able to share once instance of an action in the majority of your cases. Getting back to dependencies ... as you mentioned you can use private inner classes. However, this will cause things to get messy quite quickly. I'll admit the other option of passing in a callback interface can get overwhelming as well. At this point your are getting into a core dependencies issue not just a UI issue. There are a number of ways to help reduce this dependency burden. I would recommend looking at Martin Fowler's dependency injection article for ideas:

http://www.martinfowler.com/articles/injection.html

Dependency injection might be overkill for your project. However, a service locator might help separate out your dependencies better. Another option is to make your application more message based. You can use a JMS implementation like Somnifugi or Werx2 to make a message bus. Then your components can send an event throught the bus which the actions can respond to. The actions can then perform some work and respond on the bus. The components can listen to this message and act accordingly. So you can have the two working together without tight coupling. Finally you should take a look at the following Java.net actions project.

https://gui-commands.dev.java.net/

I hope all this gives you some ideas.

Scott Delap
ClientJava.com
Desktop Java Live
19 years ago
May I suggest my book Desktop Java Live. It covers topics such as threading, data binding, patterns, and validation. Future chapters will include obfuscation/installation and UI testing.

Scott Delap
ClientJava.com
Desktop Java Live
19 years ago
Elam,

Sounds like you have a view/model pattern design. Assuming this is the case the view needs to "observe" the model. So you will have to create some sort of listener interface that model (your data structure) is aware of. Then you'll need to add the view (your JPanels) which implement this interface to the model as listeners. Now your model can notify the view of events without having to be aware of Swing specificially. As far as where to do this registration process, I'd create some sort of external builder class that creates the model, the views, and then wires them together. For more pattern information I'd recommend you checkout some of Martin Fowler's wiki posts.

http://www.martinfowler.com/eaaDev/ModelViewPresenter.html

The next chapter of my book Desktop Java Live (to be released next week hopefully) also has a 50+ page chapter on wiring models and views together.

Scott Delap
ClientJava.com
Desktop Java Live
[ July 27, 2005: Message edited by: Gregg Bolinger ]
19 years ago
Could you please expand on what you want to accomplish?
19 years ago
Glad to help. FlexDock is approaching a .4 release later this month. There is lots of good code currently floating around the codebase.
19 years ago
https://flexdock.dev.java.net perhaps?

[Edited to fix broken link - GDB]
[ July 08, 2005: Message edited by: Gregg Bolinger ]
19 years ago
Depending on your needs you might look at the JDIC project's browser component. Commercially WebRenderer is a pretty good package.

Scott Delap
ClientJava.com
Desktop Java Live
19 years ago
Sure, you can get a printed copy at Amazon.com or LuLu.com. The chapter on patterns, MVC, Presentation Model, etc will be released at the beginning of July. It should be available in the print version a few days after that. Even if you use SWT a significant portion of the book should still be useful. There are ports of FormLayout and JGoodies Data Binding for SWT for instance.
19 years ago
Miguel,

I'm in the process of adding a chapter on GUI design to my book Desktop Java Live.

http://www.clientjava.com/blog/2005/06/13/1118677099804.html

The chapter will be Swing based but will have examples of a number of patterns. In the process of writing this chapter I've done considerable research looking for GUI application architecture resources and didn't find that many resources. In terms of pure patterns Martin Fowler has some information on his wiki about Model View Presenter and Presentation Model.

http://www.martinfowler.com/eaaDev/PresentationModel.html

It looks like Wiley has an upcoming book that may cover more design level concepts.

http://www.amazon.com/exec/obidos/tg/detail/-/0471486965/ref=pd_sbs_b_3/102-2942076-9082517?%5Fencoding=UTF8&v=glance

There are also a number of pdf articles available at the url below that I have found useful.

http://www.jaydeetechnology.co.uk/planetjava/tutorials/swing/
19 years ago
Sounds like you need some sort of shared "controller" or data model behind the panels. You would share this class and then have the panel set a value on it. It would then update any listeners (one which could be your other panel).

Scott Delap
ClientJava.com
Desktop Java Live
19 years ago