summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod <carolyn>2010-04-27 21:36:26 +0000
committerCarolyn MacLeod <carolyn>2010-04-27 21:36:26 +0000
commit72f35904b1b124c0ca0eb097793c58d428f20a35 (patch)
tree1da8f657708a5bfcc19b934d2ff5599c40d8dc00
parentf2377d12858f4e187a475546ec9c138eeb56f9a9 (diff)
downloadeclipse.platform.swt-72f35904b1b124c0ca0eb097793c58d428f20a35.tar.gz
eclipse.platform.swt-72f35904b1b124c0ca0eb097793c58d428f20a35.tar.xz
eclipse.platform.swt-72f35904b1b124c0ca0eb097793c58d428f20a35.zip
*** empty log message ***
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/AccessibleActionExample.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/AccessibleActionExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/AccessibleActionExample.java
index 43f6d37cf4..3aeed7ff10 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/AccessibleActionExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/AccessibleActionExample.java
@@ -24,6 +24,7 @@ import org.eclipse.swt.accessibility.*;
* to provide information pertaining to actions to an AT.
*/
public class AccessibleActionExample {
+ static int MARGIN = 20;
static ResourceBundle resourceBundle = ResourceBundle.getBundle("examples_accessibility"); //$NON-NLS-1$
static String getResourceString(String key) {
try {
@@ -39,11 +40,19 @@ public class AccessibleActionExample {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
- shell.setLayout(new GridLayout());
+ shell.setLayout(new FillLayout());
shell.setText("Accessible Action Example");
- final Canvas customButton = new Canvas(shell, SWT.NONE);
- customButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ final Canvas customButton = new Canvas(shell, SWT.NONE) {
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ GC gc = new GC(this);
+ Point point = gc.stringExtent(buttonText);
+ gc.dispose();
+ point.x += MARGIN;
+ point.y += MARGIN;
+ return point;
+ }
+ };
customButton.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
Rectangle clientArea = customButton.getClientArea();
@@ -131,4 +140,4 @@ public class AccessibleActionExample {
static void customButtonAction(int action) {
System.out.println("action " + action + " occurred");
}
-} \ No newline at end of file
+}