Unterschiede
Hier werden die Unterschiede zwischen der gewählten und der aktuellen Version gezeigt.
| swt-jface:tree 2007/11/09 08:04 | swt-jface:tree 2020/01/22 20:59 aktuell | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== Tree ====== | + | ====== Tree (SWT) mit Tabelle (TreeTable) ====== |
| + | {{swt-jface:swt-columntree.png|}} | ||
| + | \\ | ||
| + | \\ | ||
| + | <html> | ||
| + | <script type="text/javascript"><!-- | ||
| + | google_ad_client="pub-9681858985507948"; | ||
| + | google_ad_width = 468; | ||
| + | google_ad_height = 60; | ||
| + | google_ad_format = "468x60_as"; | ||
| + | google_ad_type = "text"; | ||
| + | google_ad_channel = ""; | ||
| + | google_color_border = "cccccc"; | ||
| + | google_color_bg = "FFFFFF"; | ||
| + | google_color_link = "1d2d8c"; | ||
| + | google_color_text = "000000"; | ||
| + | google_color_url = "1d2d8c"; | ||
| + | //--> | ||
| + | </script> | ||
| + | <script type="text/javascript" | ||
| + | src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> | ||
| + | </script> | ||
| + | </html> | ||
| + | \\ | ||
| <code java> | <code java> | ||
| - | Tree tree = new Tree(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); | + | package com.sowas.swtdemo; |
| - | tree.setHeaderVisible(true); | + | |
| - | TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); | + | |
| - | tree.setLinesVisible(true); | + | |
| - | column1.setAlignment(SWT.LEFT); | + | |
| - | column1.setText("Land"); | + | |
| - | column1.setWidth(160); | + | |
| - | TreeColumn column2 = new TreeColumn(tree, SWT.CENTER); | + | |
| - | column2.setAlignment(SWT.LEFT); | + | |
| - | column2.setText("Stadt"); | + | |
| - | column2.setWidth(80); | + | |
| - | TreeColumn column3 = new TreeColumn(tree, SWT.RIGHT); | + | |
| - | column3.setAlignment(SWT.LEFT); | + | |
| - | column3.setText("Straße"); | + | |
| - | column3.setWidth(80); | + | |
| - | TreeColumn column4 = new TreeColumn(tree, SWT.RIGHT); | + | |
| - | column4.setAlignment(SWT.LEFT); | + | |
| - | column4.setText("Nr."); | + | |
| - | column4.setWidth(80); | + | |
| - | TreeItem item00 = new TreeItem(tree, SWT.NONE); | + | import org.eclipse.swt.*; |
| - | item00.setText(new String[] { "Deutschland", "", "", ""}); | + | import org.eclipse.swt.widgets.*; |
| - | TreeItem item01 = new TreeItem(item00, SWT.NONE); | + | import org.eclipse.swt.layout.*; |
| - | item01.setText(new String[] { "Berger-Aeby Olivia", "", "12.07.1984", "GZR"}); | + | |
| - | TreeItem item02 = new TreeItem(item00, SWT.NONE); | + | public class ColumnTree{ |
| - | item02.setText(new String[] { "Berger Luca", "", "17.03.1976", "GZR"}); | + | |
| - | TreeItem item10 = new TreeItem(item00, SWT.NONE); | + | public static void main(String[] args) { |
| - | item10.setText(new String[] { "Privatkonto", "80-444-5", "", ""}); | + | Display display = new Display(); |
| - | TreeItem item11 = new TreeItem(item10, SWT.NONE); | + | final Shell shell = new Shell(display); |
| - | item11.setText(new String[] { "Aeby Joel", "", "12.07.1982", "SZR"}); | + | shell.setLayout(new FillLayout()); |
| - | TreeItem item20 = new TreeItem(item00, SWT.NONE); | + | |
| - | item20.setText(new String[] { "Depositokonto", "70-5632-5", "", ""}); | + | Tree tree = new Tree(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); |
| - | TreeItem item21 = new TreeItem(item20, SWT.NONE); | + | tree.setHeaderVisible(true); |
| - | item21.setText(new String[] { "Aeby Joel", "", "12.07.1982", "SZR"}); | + | tree.setLinesVisible(true); |
| - | TreeItem item22 = new TreeItem(item20, SWT.NONE); | + | TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); |
| - | item22.setText(new String[] { "Aeby Karol", "", "24.05.1942", "SZR"}); | + | column1.setAlignment(SWT.LEFT); |
| + | column1.setText("Land/Stadt"); | ||
| + | column1.setWidth(160); | ||
| + | TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT); | ||
| + | column2.setAlignment(SWT.LEFT); | ||
| + | column2.setText("Straße"); | ||
| + | column2.setWidth(100); | ||
| + | TreeColumn column3 = new TreeColumn(tree, SWT.RIGHT); | ||
| + | column3.setAlignment(SWT.LEFT); | ||
| + | column3.setText("Nr."); | ||
| + | column3.setWidth(20); | ||
| + | |||
| + | TreeItem item00 = new TreeItem(tree, SWT.NONE); | ||
| + | item00.setText(new String[] { "Deutschland", "", ""}); | ||
| + | TreeItem item01 = new TreeItem(item00, SWT.NONE); | ||
| + | item01.setText(new String[] { "Bremen", "", ""}); | ||
| + | TreeItem item02 = new TreeItem(item00, SWT.NONE); | ||
| + | item02.setText(new String[] { "Hamburg", "", ""}); | ||
| + | TreeItem item10 = new TreeItem(item00, SWT.NONE); | ||
| + | item10.setText(new String[] { "Baden-Württemberg", "", ""}); | ||
| + | TreeItem item11 = new TreeItem(item10, SWT.NONE); | ||
| + | item11.setText(new String[] { "Heidelberg", "Hauptstraße", "4"}); | ||
| + | TreeItem item20 = new TreeItem(item00, SWT.NONE); | ||
| + | item20.setText(new String[] { "Niedersachsen", "", ""}); | ||
| + | TreeItem item21 = new TreeItem(item20, SWT.NONE); | ||
| + | item21.setText(new String[] { "Hannover", "Herrenhäuserstraße", "44"}); | ||
| + | TreeItem item22 = new TreeItem(item20, SWT.NONE); | ||
| + | item22.setText(new String[] { "Wolfsburg", "Am Finkenhaus", "16"}); | ||
| + | |||
| + | shell.pack(); | ||
| + | shell.open(); | ||
| + | while (!shell.isDisposed()) { | ||
| + | if (!display.readAndDispatch()) { | ||
| + | display.sleep(); | ||
| + | } | ||
| + | } | ||
| + | display.dispose(); | ||
| + | } | ||
| + | } | ||
| </code> | </code> | ||
| + | |||
| + | Siehe auf [[treetableviewer|JFace-Variante]] | ||