X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fgui%2FGuiGridLayout.java;h=7b226b5f9af0afc48d1f18384f27d2b859bcd6f8;hp=cb3572b7b2dcdcfe14ead8c516af5b58d827a722;hb=140e9d165f85c3d4f0435a311e091209313faa2a;hpb=c0387c124840c9407e040600fda88f3c3e8f6aa6 diff --git a/tim/prune/gui/GuiGridLayout.java b/tim/prune/gui/GuiGridLayout.java index cb3572b..7b226b5 100644 --- a/tim/prune/gui/GuiGridLayout.java +++ b/tim/prune/gui/GuiGridLayout.java @@ -16,6 +16,7 @@ public class GuiGridLayout private GridBagLayout _layout = null; private GridBagConstraints _constraints = null; private JPanel _panel = null; + private boolean _allLeft = false; private int _x = 0; private int _y = 0; @@ -24,8 +25,19 @@ public class GuiGridLayout * @param inPanel panel using layout */ public GuiGridLayout(JPanel inPanel) + { + this(inPanel, false); + } + + /** + * Constructor + * @param inPanel panel using layout + * @param inAllLeft true to align all elements to left + */ + public GuiGridLayout(JPanel inPanel, boolean inAllLeft) { _panel = inPanel; + _allLeft = inAllLeft; _layout = new GridBagLayout(); _constraints = new GridBagConstraints(); _constraints.weightx = 1.0; @@ -47,7 +59,7 @@ public class GuiGridLayout _constraints.gridy = _y; _constraints.weightx = (_x==0?0.5:1.0); // set anchor - _constraints.anchor = (_x == 0?GridBagConstraints.LINE_END:GridBagConstraints.LINE_START); + _constraints.anchor = ((_x == 0 && !_allLeft)?GridBagConstraints.LINE_END:GridBagConstraints.LINE_START); _layout.setConstraints(inComponent, _constraints); // add to panel _panel.add(inComponent);