Modified the default off-axis policy to CONSTRAIN, a new policy type that
causes widgets that are wider than the container in the off-axis to be squeezed to fit but widgets that are smaller to be left alone. It is not a valid on-axis policy. git-svn-id: https://samskivert.googlecode.com/svn/trunk@740 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GroupLayout.java,v 1.4 2002/04/26 02:34:48 mdb Exp $
|
||||
// $Id: GroupLayout.java,v 1.5 2002/05/16 02:02:38 mdb Exp $
|
||||
//
|
||||
// samskivert library - useful routines for java programs
|
||||
// Copyright (C) 2001 Michael Bayne
|
||||
@@ -98,6 +98,13 @@ public abstract class GroupLayout
|
||||
*/
|
||||
public final static int EQUALIZE = 2;
|
||||
|
||||
/**
|
||||
* Only valid for off-axis policy, this leaves widgets alone unless
|
||||
* they are larger in the off-axis direction than their container, in
|
||||
* which case it constrains them to fit on the off-axis.
|
||||
*/
|
||||
public final static int CONSTRAIN = 3;
|
||||
|
||||
public void setPolicy (int policy)
|
||||
{
|
||||
_policy = policy;
|
||||
@@ -391,7 +398,7 @@ public abstract class GroupLayout
|
||||
}
|
||||
|
||||
protected int _policy = NONE;
|
||||
protected int _offpolicy = NONE;
|
||||
protected int _offpolicy = CONSTRAIN;
|
||||
protected int _gap = DEFAULT_GAP;
|
||||
protected int _justification = CENTER;
|
||||
protected int _offjust = CENTER;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: HGroupLayout.java,v 1.8 2001/10/09 19:46:31 mdb Exp $
|
||||
// $Id: HGroupLayout.java,v 1.9 2002/05/16 02:02:38 mdb Exp $
|
||||
//
|
||||
// samskivert library - useful routines for java programs
|
||||
// Copyright (C) 2001 Michael Bayne
|
||||
@@ -179,6 +179,8 @@ public class HGroupLayout extends GroupLayout
|
||||
|
||||
if (_offpolicy == NONE) {
|
||||
newhei = info.dimens[i].height;
|
||||
} else if (_offpolicy == CONSTRAIN) {
|
||||
newhei = Math.min(info.dimens[i].height, b.height);
|
||||
} else {
|
||||
newhei = defhei;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: VGroupLayout.java,v 1.9 2001/10/17 17:01:02 mdb Exp $
|
||||
// $Id: VGroupLayout.java,v 1.10 2002/05/16 02:02:38 mdb Exp $
|
||||
//
|
||||
// samskivert library - useful routines for java programs
|
||||
// Copyright (C) 2001 Michael Bayne
|
||||
@@ -179,6 +179,8 @@ public class VGroupLayout extends GroupLayout
|
||||
|
||||
if (_offpolicy == NONE) {
|
||||
newwid = info.dimens[i].width;
|
||||
} else if (_offpolicy == CONSTRAIN) {
|
||||
newwid = Math.min(info.dimens[i].width, b.width);
|
||||
} else {
|
||||
newwid = defwid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user