protected void updateLayout() { if (bar.getOrientation() == SwingConstants.HORIZONTAL) { bar.setLayout(new PercentLayout(PercentLayout.HORIZONTAL, 2)); } else { bar.setLayout(new PercentLayout(PercentLayout.VERTICAL, 2)); } }