From 3c77f74a8a5d2f9cb697897e2e4bad798bc78a36 Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Wed, 1 Oct 2008 22:30:54 +0000 Subject: [PATCH] Allow components to be added spanning the width of the configurator. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@752 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../game/client/SwingGameConfigurator.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/java/com/threerings/parlor/game/client/SwingGameConfigurator.java b/src/java/com/threerings/parlor/game/client/SwingGameConfigurator.java index 5702010b..68754620 100644 --- a/src/java/com/threerings/parlor/game/client/SwingGameConfigurator.java +++ b/src/java/com/threerings/parlor/game/client/SwingGameConfigurator.java @@ -78,6 +78,29 @@ public abstract class SwingGameConfigurator extends GameConfigurator _panel.add(control, cc); } + /** + * Add a control to the interface. This should be the standard way + * that configurator controls are added, but note also that external + * entities may add their own controls that are related to the game, + * but do not directly alter the game config, so that all the controls + * are added in a uniform manner and are well aligned. This version adds + * a single component spanning the entire width. + */ + public void addWideControl (JComponent control) + { + // Set up the constraints. There's really no point in saving + // these somewhere, as they're cloned anyway with every component + // insertion. + GridBagConstraints cc = new GridBagConstraints(); + cc.gridx = 0; + cc.anchor = GridBagConstraints.NORTHWEST; + cc.insets = _controlInsets; + cc.gridwidth = GridBagConstraints.REMAINDER; + + // add the components + _panel.add(control, cc); + } + /** The panel on which the config options are placed. */ protected JPanel _panel = new JPanel(new GridBagLayout());