Thomas Darimont
Erfahrenes Mitglied
Hallo!
...und so sieht das ganze in SWT aus:
Gruß Tom
...und so sieht das ganze in SWT aus:
Code:
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabFolderAdapter;
import org.eclipse.swt.custom.CTabFolderEvent;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
/**
* @author Administrator
* http://www.tutorials.de
*/
public class Main extends ApplicationWindow {
public Main() {
super(null);
setBlockOnOpen(true);
}
public Control createContents(Composite parent) {
Shell shell = parent.getShell();
shell.setText("Main");
CTabFolder folder = new CTabFolder(shell, SWT.NONE);
for (int i = 0; i < 5; i++) {
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText("Item" + i);
Label label = new Label(folder, SWT.BORDER);
label.setText("Label: " + i);
item.setControl(label);
}
folder.addCTabFolderListener(new CTabFolderAdapter() {
public void itemClosed(CTabFolderEvent evt){
System.out.println("Closing: " + ((CTabItem)evt.item).getText());
}
});
shell.pack();
return folder;
}
public static void main(String[] args) {
Main main = new Main();
main.open();
Display.getCurrent().dispose();
}
}
Gruß Tom