/** Adds a tab for creating new tabs. */ private void addCreateTab() { final BaseXButton add = tabButton("e_new"); add.setRolloverIcon(BaseXLayout.icon("e_new2")); add.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { addTab(); refreshControls(true); } }); tabs.add(new BaseXBack(), add, 0); tabs.setEnabledAt(0, false); }
/** * Adds a new editor tab. * * @return editor reference */ EditorArea addTab() { final EditorArea edit = new EditorArea(this, newTabFile()); edit.setFont(GUIConstants.mfont); final BaseXBack tab = new BaseXBack(new BorderLayout(10, 0)).mode(Fill.NONE); tab.add(edit.label, BorderLayout.CENTER); final BaseXButton close = tabButton("e_close"); close.setRolloverIcon(BaseXLayout.icon("e_close2")); close.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { close(edit); } }); tab.add(close, BorderLayout.EAST); tabs.add(edit, tab, tabs.getComponentCount() - 2); return edit; }