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

FrontPage>Swing Tips>ST/TabbedPane

ST/TabbedPane

Terai Atsuhiro 2024-01-27 (土) 14:37:42

JTabbedPane

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

private void showTabPop(MouseEvent e){
  JPopupMenu pop = new JPopupMenu();
  AbstractAction action = new NewTabAction(MENUITEM_NEWTAB, null);
  pop.add(action);
  pop.addSeparator();
  action = new ClosePageAction(MENUITEM_CLOSEPAGE, null);
  boolean flg = false;
  for(int i=0;i<tab.getTabCount();i++){
    if(tab.getBoundsAt(i).contains(e.getPoint())){
      flg = true;
      break;
    }
  }
  action.setEnabled(flg);
  pop.add(action);
  pop.addSeparator();
  action = new CloseAllAction(MENUITEM_CLOSEALL, null);
  pop.add(action);
  action = new CloseAllButActiveAction(MENUITEM_CLOSEALLBUTACTIVE, null);
  pop.add(action);
  pop.show(tab, e.getX(), e.getY());
}