addTab method in the GUI application which allows to secifiy he tab typeSwingTabTypeManager, you need to call the TabbedApplication.getTabTypeManager() method (the manager is null by default, it will be created with the dirst call of this method).SwingTabTypeManager has one usefu method wich can be used to register an icon:SwingTabTypeManager tabTypeManager = getTabTypeManager(); // here the type manager is created URL url = // an Icon url tabTypeManager.registerIcon(url, "image"); // the icon is registered to the "image" key
typetype, adding additionazlly a tooltiptype, adding additionazlly a tooltip and specifying if the tab is closeablepublic class ImportDocumentAction extends AbstractMDIAction { public ImportDocumentAction(GUIApplication appli, String name) { super(appli, name); this.setDescription("Open Document", "Open Document"); } public void run() throws Exception { TabbedApplication gui = (TabbedApplication) app; JFileChooser chooser = new JFileChooser("Open Document"); chooser.setDialogTitle("Save Document"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); if (chooser.showOpenDialog(gui.getApplicationWindow()) == JFileChooser.APPROVE_OPTION) { URL url = chooser.getSelectedFile().toURL(); File file = chooser.getSelectedFile(); JEditorPane pane = new JEditorPane(); JScrollPane scroll = new JScrollPane(pane); pane.setPage(url); SwingFileProperties prop = new SwingFileProperties(file.getName(), scroll, pane.getDocument()); prop.setType("text"); gui.addTab(pane, prop); } } }
Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences