Re: [gui-dev] layout patch

Felix Berger <[email protected]> Mon, 28 Feb 2005 18:17:34 +0100
Newsgroups gmane.network.gnutella.limewire.gui.devel
Message-ID <[email protected]>
On Monday 28 February 2005 17:21, Sam Berlin wrote:

>    myContainer.add(myComponent, myConstraint);

I only realized that after sending the patch :-)

> That removes the need to cast the layout back to a GridBagLayout and
> removes the extra line of setConstraints.  GridBagConstraints are also
> cloned when they're added, so there's no need to create a new one prior
> to each component-adding.

I think I did that in one or two places, but most of the time I wanted to make 
sure I have a new instance in order to have the correct default values for 
the unset fields.

> In the future, you may want to use the codepatch at limewire.org
> mailing list for sending patches.  No big difference, but it helps us
> organize the messages a little better.

Sure. I also wanted to propose to move the private bindKey method I introduced 
in ListEditor to GUIUtils and make it static there. I also would like to use 
it for the StandardListEditor's remove action without introducing code 
duplication. The signatures could be:

public static void bindKeyToAction(JComponent c, KeyStroke k, Action a, int 
focusScope)
{
InputMap inputMap = c.getInputMap(focusScope);
        ActionMap actionMap = c.getActionMap();
        if (inputMap != null && actionMap != null) {
         inputMap.put(key, a);
         actionMap.put(a, a);
        }
}

And a convenience wrapper:

public static void bindKeyToAction(JComponent c, KeyStroke k, Action a)
{
 bindKeyToAction(c, k, a, JComponent.WHEN_FOCUSED);
}

I just noticed that I used the wrong constant in the patch I sent. I think 
it's best to use the local binding WHEN_FOCUSED.

Question: Is it possible to use the LimeJTable without inheriting an 
AbstractTableMediator? The padded main_panel that has to be used then makes 
the table unnessecarily small so that it doesn't align with the other 
components in the options panes.

Regards,
Felix

-- 
Try Debian GNU/Linux!
http://www.felix.beldesign.de/
_______________________________________________
gui-dev mailing list
[email protected]
http://www.limewire.org/mailman/listinfo/gui-dev