Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.
Replies: 14 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

L2FProd: Conserve Navigation Real Estate with JTaskPaneGroups

At 11:17 PM on May 25, 2005, R.J. Lorimer wrote:

Those of you who are faithful readers will realize that this task sounds strikingly familiar to one I just wrote not two weeks ago: SwingX: Conserve Navigation Real Estate with JXScrollups . There is a reason for that - the JTaskPane and JTaskPaneGroup classes are an alternative implementation of the same control implemented by the JXScrollup . I thought it would be good to show the alternatives here so all of you can consider what works best for you.

JXScrollups and JTaskPaneGroups are very similar, although the current support for JTaskPaneGroups is arguably a little more robust. The design behind each is definitely different. JXScrollup objects are designed to be able to be placed into any parent component, as long as the parent component uses the ScrollupLayout. JTaskPaneGroups, however, are designed to be held in a JTaskPane - which brings with it an entire look-and-feel implementation (actually, set of implementations), which perform background color rendering, layout management, etc. all transparently. In reality you can use task pane groups in any container as well, but the task pane manages all of the complex layout and rendering concerns for you.

Similarly, JXScrollups allow for any child container to be placed in them for their content ( JXScrollup.setContentContainer() ), whereas a JTaskPaneGroup is, itself, the container. Strictly speaking, the JTaskPaneGroup should be able to hold any type of component - I have seen that it doesn't favor well with components more complicated than buttons. The *correct* behavior per the documentation is to use the add(Action) method - although that is a recommendation, not really a design requirement. In my example below I am using buttons, simply for consistency and simplicity.

Finally, it is important to note that L2FProd components are tightly integrated with a very richly defined look and feel system. Look and feel implementations for the various components (such as the JTaskPane and JTaskPaneGroup) are available for most of the common platforms. The SwingX components certainly haven't reached this level of maturity yet - this is probably the strongest advantage of the L2FProd components.

Here is a screenshot using the Windows XP look and feel:

Finally, here is the code from the JXScrollup example , reimplemented with JTaskPaneGroups.

package com.javalobby.tnt.l2fprod;
 
import javax.swing.*;
 
import com.l2fprod.common.swing.JTaskPane;
import com.l2fprod.common.swing.JTaskPaneGroup;
import com.l2fprod.common.swing.plaf.LookAndFeelAddons;
import com.l2fprod.common.swing.plaf.windows.WindowsLookAndFeelAddons;
 
public class JTaskPaneTest {
 
	private static final int NUM_TASK_PANE_GROUPS = 5;	
		
		public static void main(String[] args) {
			try {
				// Simply installing Windows XP look and feel - see LookAndFeelAddons documentation
				// for more information.
				UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
				LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class);
			}
			catch(Exception e) { }
			
			// Create and set up the window.
			JFrame frame = new JFrame("JXScrollUpTest");
			frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
			// Create and set up the task pane.
			JTaskPane rootPanel = new JTaskPane();
			createTaskPaneGroups(rootPanel);
			frame.setContentPane(rootPanel);
			
			// Display the window.
			frame.pack();
			frame.setVisible(true);
			
		}
		
		private static void createTaskPaneGroups(JTaskPane rootPanel) {
			for (int i = 0; i < NUM_TASK_PANE_GROUPS; i++) {
				
				JTaskPaneGroup taskGroup = new JTaskPaneGroup();
				boolean isEven = i % 2 == 0;
				
				// Task Groups support the concept of being 'special', which 
				// means they may be rendered uniquely to stand out from others.
				taskGroup.setSpecial(isEven);
				taskGroup.setExpanded(!isEven);
				taskGroup.setText("Task Group: " + i);
				taskGroup.add(new JButton("Button on TaskPane: " + i + " #1"));
				taskGroup.add(new JButton("Button on TaskPane: " + i + " #2"));
				rootPanel.add(taskGroup);
			}
		}
}

Until next time,

R.J. Lorimer
rj -at- javalobby.org
http://www.coffee-bytes.com

1 . At 11:49 AM on May 26, 2005, Richard Bair DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: L2FProd: Conserve Navigation Real Estate with JTaskPaneGroups

Hey R.J.

Just a quick note, I'm not sure if you are aware but Frederic Lavigne (l2fprod) is working on integrating the two components in the SwingX projects right now.

You can see this thread (http://www.javadesktop.org/forums/thread.jspa?threadID=11278&tstart=0) for more information, or you can try this webstarted app:

https://jdnc-incubator.dev.java.net/documentation/l2fprod/jnlp/l2fprod.jnlp

I'm not sure if that is the latest. For more info, see the forum thread posted above.

Thanks! And BTW, great article's

Richard
2 . At 11:59 AM on May 26, 2005, R.J. Lorimer wrote:
  Click to reply to this thread Reply

Re: L2FProd: Conserve Navigation Real Estate with JTaskPaneGroups

Richard,

This is great news! Thanks for posting here about it. I'm glad to see there is some integration there.

Regards,
Best, R.J. Lorimer
3 . At 3:14 PM on May 26, 2005, Frederic Lavigne wrote:
  Click to reply to this thread Reply

Re: L2FProd: Conserve Navigation Real Estate with JTaskPaneGroups

Hi,

thanks for the press :) I really like the article, it gives a good overview of the component!

About your comment:
> I have seen that it doesn't favor well with components more complicated than buttons.
What kind of problems did you encounter and with which components?

BTW, I just updated the webstart demo (both jdnc-incubator and l2fprod.com) with new look implementations to match the Microsoft XP visual styles Homestead and Silver.

-fred
4 . At 3:17 PM on May 26, 2005, R.J. Lorimer wrote:
  Click to reply to this thread Reply

Re: L2FProd: Conserve Navigation Real Estate with JTaskPaneGroups

Fred,

When I was writing the code for this tip, I tried putting JTextAreas, JScrollPanes with JTables, and all kinds of wierd stuff in them.

Tables weren't rendering properly for one reason or another, and the text areas were having some really unusual (and inconsistent) layout problems.

I can try and reproduce some test cases and screenshots if necessary.

Cheers,
Best, R.J. Lorimer
5 . At 6:03 PM on May 26, 2005, cowwoc wrote:
  Click to reply to this thread Reply

SwingX not publically available?

I don't get it. I followed your links to the SwingX website and while you show nice screenshots from the components you discuss I see absolutely nothing available on the SwingX website. There is no downloadable code, screenshots, tutorials or anything.

What do you go on?

Gili
6 . At 6:56 PM on May 26, 2005, Mark N DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: SwingX not publically available?

CVS. It is publically avalaible. Just no prebuilt binaries.
7 . At 7:12 PM on May 26, 2005, Ian wrote:
  Click to reply to this thread Reply

Re: L2FProd: Conserve Navigation Real Estate with JTaskPaneGroups

> What kind of problems did you encounter and with
> which components?

In the application I've been working on, I've placed everything from jbuttons, jpanels, jtextfields, jtrees panels with textfields and buttons and even other JTaskPaneGroups (don't ask) - all without hiccup. Positive marks from me :)

Cheers,

Ian
8 . At 7:39 PM on May 26, 2005, R.J. Lorimer wrote:
  Click to reply to this thread Reply

Re: SwingX not publically available?

Mark is absolutely right. I think in my first tip on SwingX, I mentioned that it was still alpha (unreleased), and that it was bound to change before the first release - but I haven't kept up that behavior properly - I apologize.

SwingX is still just in CVS only state - thankfully it is trivial to download and build.

Regards,
Best, R.J. Lorimer
9 . At 10:37 AM on May 27, 2005, Alan wrote:
  Click to reply to this thread Reply

Possibile to add aligned components to top bar?

Hi fred,

We are currently using the taskpanegroup to hide/show filters for a Jtable and it looks/works great. we are quite pressed for real estate due to the nature of some of the machines our clients still use - sadly 800*600

Whilst using the widget, it was noted that it would be great to be able to add more than just text to the taskpane bar. ie, instead of just group.setText() it would be cool for us to be able to add a title text and then some more text over to the right to say something like "click here for more options...".

Is this something that could be done?

regards, and great work

Alan
10 . At 11:48 AM on May 27, 2005, Gregory Pierce DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Until SwingX runs on completely on OSX

it is dead to me and I will continue to use all of the L2FProd stuff that we aren't already using from JIDE.
11 . At 12:50 PM on May 27, 2005, Frederic Lavigne wrote:
  Click to reply to this thread Reply

Re: Possibile to add aligned components to top bar?

Not possible with the current component.

SwingX with it JXTitlePane allows to do that by defining areas on the left and on the right where developers can add components.

I'll keep you request in mind!
and BTW, feel free to post or email me screenshots of your app using the JTaskPaneGroup for my collection :)

-fred
12 . At 1:25 PM on May 27, 2005, Alan wrote:
  Click to reply to this thread Reply

Re: Possibile to add aligned components to top bar?

thanks fred, i guessed so, id read the whole api, i was craftily trying to suggest it would be a good thing to implement ;-) indeed, once we have this app rolling screen shots are sure to follow, we have glazed lists, spring rcp, and all sorts. Cool time for java desktop ;-)

regards

Alan
13 . At 1:56 PM on May 27, 2005, Richard Bair DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Until SwingX runs on completely on OSX

Hey Gregory,

By "runs completely on OSX" are you talking about:

* look and feel implementations
* 1.5 support
* other?

Thanks!
Richard
14 . At 3:53 PM on May 27, 2005, Gregory Pierce DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Until SwingX runs on completely on OSX

All of the components being available without rendering artifacts. Got the Java5 release for OSX already so that's not a big deal.

thread.rss_message