diff options
author | Silenio Quarti | 2002-05-15 18:36:32 +0000 |
---|---|---|
committer | Silenio Quarti | 2002-05-15 18:36:32 +0000 |
commit | 445337d8bb4d71f80e4d409a69aad8e01974504c (patch) | |
tree | 0a1e685c5186b1efed8674f38736b2c60ca17fc4 /examples | |
parent | 19fe62c08a14deb8e2bf089dd6c3d564f767039d (diff) | |
download | eclipse.platform.swt-445337d8bb4d71f80e4d409a69aad8e01974504c.tar.gz eclipse.platform.swt-445337d8bb4d71f80e4d409a69aad8e01974504c.tar.xz eclipse.platform.swt-445337d8bb4d71f80e4d409a69aad8e01974504c.zip |
*** empty log message ***
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java index 92532bfcc4..045f07c6b5 100755 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java @@ -80,6 +80,15 @@ Menu createEditMenu() { */
void bold(boolean bold) {
isBold = bold;
+ Point sel = text.getSelectionRange();
+ if ((sel != null) && (sel.y != 0)) {
+ StyleRange style;
+ int fontStyle = SWT.NORMAL;
+ if (isBold) fontStyle = SWT.BOLD;
+ style = new StyleRange(sel.x, sel.y, null, null, fontStyle);
+ text.setStyleRange(style);
+ }
+ text.setSelectionRange(sel.x + sel.y, 0);
}
/*
* Clear all style data for the selected text.
|