diff --git a/Advanced UI/src/com/samples/toolkit/ui/container/JustifiedEvenlySpacedHorizontalFieldManager.java b/Advanced UI/src/com/samples/toolkit/ui/container/JustifiedEvenlySpacedHorizontalFieldManager.java index f2f7639..35903e0 100644 --- a/Advanced UI/src/com/samples/toolkit/ui/container/JustifiedEvenlySpacedHorizontalFieldManager.java +++ b/Advanced UI/src/com/samples/toolkit/ui/container/JustifiedEvenlySpacedHorizontalFieldManager.java @@ -46,7 +46,13 @@ protected void sublayout( int width, int height ) // There may be a few remaining pixels after dividing up the space // we must split up the space between the first and last buttons - int fieldWidth = width / numFields; + + //if there are no fields the current fieldWidth should be 0 + final int fieldWidth; + if (numFields == 0) + fieldWidth = 0; + else + fieldWidth = width / numFields; int firstFieldExtra = 0; int lastFieldExtra = 0;