void setLayout() {
   String direction = getObjectAdapter().getDirection();
   if (direction != null && direction.equals(AttributeNames.HORIZONTAL))
     buttonsPanel.setLayout(new GridLayout(1, 0));
   else if (direction != null && direction.equals(AttributeNames.VERTICAL))
     buttonsPanel.setLayout(new GridLayout(0, 1));
   else {
     int numCols = getObjectAdapter().getUnboundButtonsRowSize();
     buttonsPanel.setLayout(new GridLayout(0, numCols));
   }
 }