-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91b0e97
commit 5c5acba
Showing
373 changed files
with
30,896 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ bin.includes = META-INF/,\ | |
previews/,\ | ||
plugin.xml,\ | ||
plugin.properties,\ | ||
about.html | ||
about.html,\ | ||
source/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2012 IBM Corporation 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: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.snippets; | ||
|
||
/* | ||
* example snippet: Hello World | ||
* | ||
* For a list of all SWT example snippets see | ||
* http://www.eclipse.org/swt/snippets/ | ||
*/ | ||
import org.eclipse.swt.widgets.*; | ||
|
||
public class Snippet1 { | ||
|
||
public static void main (String [] args) { | ||
Display display = new Display (); | ||
Shell shell = new Shell(display); | ||
shell.setText("Snippet 1"); | ||
shell.open (); | ||
while (!shell.isDisposed ()) { | ||
if (!display.readAndDispatch ()) display.sleep (); | ||
} | ||
display.dispose (); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2016 IBM Corporation 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: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.snippets; | ||
|
||
/* | ||
* Draw using transformations, paths and alpha blending | ||
* | ||
* For a list of all SWT example snippets see | ||
* http://www.eclipse.org/swt/snippets/ | ||
* | ||
* @since 3.1 | ||
*/ | ||
import org.eclipse.swt.*; | ||
import org.eclipse.swt.graphics.*; | ||
import org.eclipse.swt.widgets.*; | ||
|
||
public class Snippet10 { | ||
public static void main(String[] args) { | ||
final Display display = new Display(); | ||
final Shell shell = new Shell(display); | ||
shell.setText("Advanced Graphics"); | ||
FontData fd = shell.getFont().getFontData()[0]; | ||
final Font font = new Font(display, fd.getName(), 60, SWT.BOLD | SWT.ITALIC); | ||
final Image image = new Image(display, 640, 480); | ||
final Rectangle rect = image.getBounds(); | ||
GC gc = new GC(image); | ||
gc.setBackground(display.getSystemColor(SWT.COLOR_RED)); | ||
gc.fillOval(rect.x, rect.y, rect.width, rect.height); | ||
gc.dispose(); | ||
shell.addListener(SWT.Paint, event -> { | ||
GC gc1 = event.gc; | ||
Transform tr = new Transform(display); | ||
tr.translate(50, 120); | ||
tr.rotate(-30); | ||
gc1.drawImage(image, 0, 0, rect.width, rect.height, 0, 0, rect.width / 2, rect.height / 2); | ||
gc1.setAlpha(100); | ||
gc1.setTransform(tr); | ||
Path path = new Path(display); | ||
path.addString("SWT", 0, 0, font); | ||
gc1.setBackground(display.getSystemColor(SWT.COLOR_GREEN)); | ||
gc1.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); | ||
gc1.fillPath(path); | ||
gc1.drawPath(path); | ||
tr.dispose(); | ||
path.dispose(); | ||
}); | ||
shell.setSize(shell.computeSize(rect.width / 2, rect.height / 2)); | ||
shell.open(); | ||
while (!shell.isDisposed()) { | ||
if (!display.readAndDispatch()) | ||
display.sleep(); | ||
} | ||
image.dispose(); | ||
font.dispose(); | ||
display.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2011 IBM Corporation 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: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.snippets; | ||
|
||
/* | ||
* Font example snippet: create a large font for use by a text widget | ||
* | ||
* For a list of all SWT example snippets see | ||
* http://www.eclipse.org/swt/snippets/ | ||
*/ | ||
import org.eclipse.swt.*; | ||
import org.eclipse.swt.graphics.*; | ||
import org.eclipse.swt.widgets.*; | ||
|
||
public class Snippet100 { | ||
|
||
public static void main(String[] args) { | ||
Display display = new Display(); | ||
Shell shell = new Shell(display); | ||
shell.setText("Snippet 100"); | ||
shell.setBounds(10, 10, 200, 200); | ||
Text text = new Text(shell, SWT.MULTI); | ||
Rectangle clientArea = shell.getClientArea(); | ||
text.setBounds(clientArea.x + 10, clientArea.y + 10, 150, 150); | ||
Font initialFont = text.getFont(); | ||
FontData[] fontData = initialFont.getFontData(); | ||
for (FontData element : fontData) { | ||
element.setHeight(24); | ||
} | ||
Font newFont = new Font(display, fontData); | ||
text.setFont(newFont); | ||
shell.open(); | ||
while (!shell.isDisposed()) { | ||
if (!display.readAndDispatch()) | ||
display.sleep(); | ||
} | ||
newFont.dispose(); | ||
display.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2011 IBM Corporation 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: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.snippets; | ||
|
||
/* | ||
* Table example snippet: insert a table item (at an index) | ||
* | ||
* For a list of all SWT example snippets see | ||
* http://www.eclipse.org/swt/snippets/ | ||
*/ | ||
import org.eclipse.swt.*; | ||
import org.eclipse.swt.graphics.*; | ||
import org.eclipse.swt.widgets.*; | ||
|
||
public class Snippet101 { | ||
|
||
public static void main (String [] args) { | ||
Display display = new Display (); | ||
Shell shell = new Shell (display); | ||
shell.setText("Snippet 101"); | ||
Table table = new Table (shell, SWT.BORDER | SWT.MULTI); | ||
Rectangle clientArea = shell.getClientArea (); | ||
table.setBounds (clientArea.x, clientArea.y, 200, 200); | ||
for (int i=0; i<12; i++) { | ||
TableItem item = new TableItem (table, SWT.NONE); | ||
item.setText ("Item " + i); | ||
} | ||
TableItem item = new TableItem (table, SWT.NONE, 1); | ||
item.setText ("*** New Item " + table.indexOf (item) + " ***"); | ||
shell.pack (); | ||
shell.open (); | ||
while (!shell.isDisposed ()) { | ||
if (!display.readAndDispatch ()) display.sleep (); | ||
} | ||
display.dispose (); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2011 IBM Corporation 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: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.snippets; | ||
|
||
/* | ||
* Tree example snippet: insert a tree item (at an index) | ||
* | ||
* For a list of all SWT example snippets see | ||
* http://www.eclipse.org/swt/snippets/ | ||
*/ | ||
import org.eclipse.swt.*; | ||
import org.eclipse.swt.graphics.*; | ||
import org.eclipse.swt.widgets.*; | ||
|
||
public class Snippet102 { | ||
|
||
public static void main (String [] args) { | ||
Display display = new Display (); | ||
Shell shell = new Shell (display); | ||
shell.setText("Snippet 102"); | ||
Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI); | ||
Rectangle clientArea = shell.getClientArea (); | ||
tree.setBounds (clientArea.x, clientArea.y, 200, 200); | ||
for (int i=0; i<12; i++) { | ||
TreeItem item = new TreeItem (tree, SWT.NONE); | ||
item.setText ("Item " + i); | ||
} | ||
TreeItem item = new TreeItem (tree, SWT.NONE, 1); | ||
TreeItem [] items = tree.getItems (); | ||
int index = 0; | ||
while (index < items.length && items [index] != item) index++; | ||
item.setText ("*** New Item " + index + " ***"); | ||
shell.pack (); | ||
shell.open (); | ||
while (!shell.isDisposed ()) { | ||
if (!display.readAndDispatch ()) display.sleep (); | ||
} | ||
display.dispose (); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2016 IBM Corporation 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: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.snippets; | ||
|
||
/* | ||
* Table example snippet: update table item text | ||
* | ||
* For a list of all SWT example snippets see | ||
* http://www.eclipse.org/swt/snippets/ | ||
*/ | ||
import org.eclipse.swt.*; | ||
import org.eclipse.swt.graphics.*; | ||
import org.eclipse.swt.widgets.*; | ||
|
||
public class Snippet103 { | ||
|
||
static char content = 'a'; | ||
public static void main(String[] args) { | ||
final Display display = new Display(); | ||
Shell shell = new Shell(display); | ||
shell.setText("Snippet 103"); | ||
shell.setBounds(10, 10, 200, 240); | ||
Table table = new Table(shell, SWT.NONE); | ||
Rectangle clientArea = shell.getClientArea (); | ||
table.setBounds (clientArea.x + 10, clientArea.y + 10, 160, 160); | ||
|
||
final TableItem[] items = new TableItem[4]; | ||
for (int i = 0; i < 4; i++) { | ||
new TableColumn(table, SWT.NONE).setWidth(40); | ||
} | ||
for (int i = 0; i < 4; i++) { | ||
items[i] = new TableItem(table, SWT.NONE); | ||
populateItem(items[i]); | ||
} | ||
|
||
Button button = new Button(shell, SWT.PUSH); | ||
button.setText("Change"); | ||
button.pack(); | ||
button.setLocation(10, 180); | ||
button.addListener(SWT.Selection, event -> { | ||
for (int i = 0; i < 4; i++) { | ||
populateItem(items[i]); | ||
} | ||
}); | ||
|
||
shell.open(); | ||
while (!shell.isDisposed()) { | ||
if (!display.readAndDispatch()) display.sleep(); | ||
} | ||
display.dispose(); | ||
} | ||
|
||
static void populateItem(TableItem item) { | ||
String stringContent = String.valueOf(content); | ||
item.setText( | ||
new String[] { | ||
stringContent, | ||
stringContent, | ||
stringContent, | ||
stringContent }); | ||
content++; | ||
if (content > 'z') content = 'a'; | ||
} | ||
|
||
} |
Oops, something went wrong.