#navi(contents-page-name): No such page: ST

FrontPage

Terai Atsuhiro 2022-07-07 (木) 14:20:26

http://terai.s55.xrea.com/swing/colortab/screenshot.png

tab.addChangeListener(new ChangeListener(){
  public void stateChanged(ChangeEvent e){
    JTabbedPane jtab = (JTabbedPane)e.getSource();
    jtab.setVisible(false);
    int sindex = jtab.getSelectedIndex();
    String str = jtab.getTitleAt(sindex);
    for(int i=0;i<jtab.getTabCount();i++){

        //jtab.setBackgroundAt(i, Color.green);
        jtab.setForegroundAt(i, Color.green);
      }else if(i==sindex){
        Color sc = (sindex%2==0)?Color.red:Color.blue;
        //jtab.setBackgroundAt(i, sc);
        jtab.setForegroundAt(i, sc);
      }else{
        //jtab.setBackgroundAt(i, null);
        jtab.setForegroundAt(i, Color.black);
      }
    }
    jtab.setVisible(true);
  }
});