private void adjustAlignment(int align,int curAlign){
  if ((!FIXED_WIDTH) && (align != curAlign)) {
    if (curLine.getComponentCount() == 0) {
      curLine.setLayout(new FlowLayout(curAlign));
    }
  }
}

private void adjustAlignment ( int align , int curAlign ) { if ( ( ! FIXED_WIDTH ) && ( align != curAlign ) ) { if ( curLine . getComponentCount ( ) == 0 ) { curLine . setLayout ( new FlowLayout ( curAlign ) ) ; } } }
the following replaces the layout of the curline container with the correct alignment , in non fixed width alignment is done by flowlayout ' s orientation . in case the line is not empty , a new line will be opened by newlineifnotempty below
