Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 224f0c91ea38cded3c9361fb26491bfa82b063e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*******************************************************************************
 * Copyright (c) 2020 Syntevo and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Syntevo - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.tests.win32.snippets;

import org.eclipse.swt.*;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class Bug565679_WS_BORDER {
	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell(display);
		GridLayout layout = new GridLayout(1, true);
		layout.horizontalSpacing = 10;
		shell.setLayout(layout);

		new Label(shell, 0).setText(
			"Border of these Composite controls is affected by the patch.\n" +
			"They should have thin border as before."
		);

		{
			final Composite compControls = new Composite(shell, 0);
			compControls.setLayout(new GridLayout(2, true));

			new Label(compControls, 0).setText("Canvas");
			new Canvas(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("Composite");
			new Composite(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("StyledText");
			new StyledText(compControls, SWT.BORDER).setText("Some text");

			new Label(compControls, 0).setText("Spinner (with border)");
			new Spinner(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("Spinner (no border)");
			new Spinner(compControls, 0);

			new Label(compControls, 0).setText("Tree (with header)");
			Tree tree = new Tree(compControls, SWT.BORDER);
			tree.setHeaderVisible(true);
			new TreeColumn(tree, 0).setText("Column");
			new TreeItem(tree, 0).setText("Item");
		}

		new Label(shell, 0).setText(
			"Border of these Composite controls is unchanged."
		);

		{
			final Composite compControls = new Composite(shell, 0);
			compControls.setLayout(new GridLayout(2, true));

			new Label(compControls, 0).setText("Combo");
			new Combo(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("CoolBar");
			CoolBar coolbar = new CoolBar(compControls, SWT.BORDER);
			coolbar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

			new Label(compControls, 0).setText("DateTime");
			new DateTime(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("Decorations");
			new Decorations(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("ExpandBar");
			new ExpandBar(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("Table");
			new Table(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("Text");
			new Text(compControls, SWT.BORDER);

			new Label(compControls, 0).setText("ToolBar");
			ToolBar toolbar = new ToolBar(compControls, SWT.BORDER);
			toolbar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

			new Label(compControls, 0).setText("Tree (no header)");
			new Tree(compControls, SWT.BORDER);
		}

		new Label(shell, 0).setText(
			"Border of these Composite controls is unchanged.\n" +
			"But using SWT.BORDER with them is very weird anyway..."
		);

		{
			final Composite compControls = new Composite(shell, 0);
			compControls.setLayout(new GridLayout(2, true));

			new Label(compControls, 0).setText("Group");
			Group group = new Group(compControls, SWT.BORDER);
			group.setText("Group");

			new Label(compControls, 0).setText("TabFolder");
			TabFolder tabFolder = new TabFolder(compControls, SWT.BORDER);
			new TabItem(tabFolder, 0).setText("Item");
			new TabItem(tabFolder, 0).setText("Item");
		}

		shell.setSize(400, 800);
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}
}

Back to the top