Terai Atsuhiro 2021-07-03 (土) 03:42:14

http://terai.xrea.jp/swing/expandpanel/screenshot.png

public void initComps(Vector panelList, ExpansionEvent e){
  setVisible(false);
  centerBox.removeAll();
  northBox.removeAll();
  southBox.removeAll();
  ExpansionPanel es = (ExpansionPanel) e.getSource();
  boolean southFlag = false;
  for(Iterator it=panelList.iterator();it.hasNext();){
    ExpansionPanel exp = (ExpansionPanel) it.next();
    if(exp==es && exp.isSelected()) {
      centerBox.add(exp);
      southFlag = true;
    }else if(southFlag) {
      exp.setSelected(false);
      southBox.add(exp);
    }else{
      exp.setSelected(false);
      northBox.add(exp);
    }
  }
  setVisible(true);
}