# HG changeset patch # User Frank Benoit # Date 1201049959 -3600 # Node ID d4b244e1e1aeaff04abaafee098c4532509c5daf # Parent 424cc4e141246bacf9abeb2f6be67dc5a132ad31 CustomControlExample compiles diff -r 424cc4e14124 -r d4b244e1e1ae dsss.conf --- a/dsss.conf Wed Jan 23 01:08:24 2008 +0100 +++ b/dsss.conf Wed Jan 23 01:59:19 2008 +0100 @@ -99,4 +99,34 @@ buildflags+=-L-lcairo buildflags+=-g -gc buildflags+=-Jdwtexamples/controlexample +buildflags+=-version=CONTROL_EXAMPLE_MAIN +[dwtexamples/controlexample/CustomControlExample.d] +buildflags+=-L-lgtk-x11-2.0 +buildflags+=-L-lgdk-x11-2.0 +buildflags+=-L-latk-1.0 +buildflags+=-L-lgdk_pixbuf-2.0 +buildflags+=-L-lgthread-2.0 +buildflags+=-L-lm +buildflags+=-L-lpangocairo-1.0 +buildflags+=-L-lfontconfig +buildflags+=-L-lXtst +buildflags+=-L-lXext +buildflags+=-L-lXrender +buildflags+=-L-lXinerama +buildflags+=-L-lXi +buildflags+=-L-lXrandr +buildflags+=-L-lXcursor +buildflags+=-L-lXcomposite +buildflags+=-L-lXdamage +buildflags+=-L-lX11 +buildflags+=-L-lXfixes +buildflags+=-L-lpango-1.0 +buildflags+=-L-lgobject-2.0 +buildflags+=-L-lgmodule-2.0 +buildflags+=-L-ldl +buildflags+=-L-lglib-2.0 +buildflags+=-L-lcairo +buildflags+=-g -gc +buildflags+=-Jdwtexamples/controlexample +buildflags+=-version=CUSTOM_CONTROL_EXAMPLE_MAIN diff -r 424cc4e14124 -r d4b244e1e1ae dwtexamples/controlexample/CComboTab.d --- a/dwtexamples/controlexample/CComboTab.d Wed Jan 23 01:08:24 2008 +0100 +++ b/dwtexamples/controlexample/CComboTab.d Wed Jan 23 01:59:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -34,21 +34,25 @@ /* Style widgets added to the "Style" group */ Button flatButton, readOnlyButton; - static char[] [] ListData = {ControlExample.getResourceString("ListData1_0"), - ControlExample.getResourceString("ListData1_1"), - ControlExample.getResourceString("ListData1_2"), - ControlExample.getResourceString("ListData1_3"), - ControlExample.getResourceString("ListData1_4"), - ControlExample.getResourceString("ListData1_5"), - ControlExample.getResourceString("ListData1_6"), - ControlExample.getResourceString("ListData1_7"), - ControlExample.getResourceString("ListData1_8")}; + static char[] [] ListData; /** * Creates the Tab within a given instance of ControlExample. */ this(ControlExample instance) { super(instance); + if( ListData is null ){ + ListData = [ + ControlExample.getResourceString("ListData1_0"), + ControlExample.getResourceString("ListData1_1"), + ControlExample.getResourceString("ListData1_2"), + ControlExample.getResourceString("ListData1_3"), + ControlExample.getResourceString("ListData1_4"), + ControlExample.getResourceString("ListData1_5"), + ControlExample.getResourceString("ListData1_6"), + ControlExample.getResourceString("ListData1_7"), + ControlExample.getResourceString("ListData1_8")]; + } } /** diff -r 424cc4e14124 -r d4b244e1e1ae dwtexamples/controlexample/CLabelTab.d --- a/dwtexamples/controlexample/CLabelTab.d Wed Jan 23 01:08:24 2008 +0100 +++ b/dwtexamples/controlexample/CLabelTab.d Wed Jan 23 01:59:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -22,6 +22,12 @@ import dwt.widgets.Group; import dwt.widgets.Widget; + +import dwtexamples.controlexample.AlignableTab; +import dwtexamples.controlexample.ControlExample; + +import tango.text.convert.Format; + class CLabelTab : AlignableTab { /* Example widgets and groups that contain them */ CLabel label1, label2, label3; @@ -33,7 +39,7 @@ /** * Creates the Tab within a given instance of ControlExample. */ - CLabelTab(ControlExample instance) { + this(ControlExample instance) { super(instance); } @@ -73,7 +79,7 @@ label2 = new CLabel (textLabelGroup, style); label2.setImage (instance.images[ControlExample.ciTarget]); label3 = new CLabel (textLabelGroup, style); - label3.setText(ControlExample.getResourceString("Example_string") + "\n" + ControlExample.getResourceString("One_Two_Three")); + label3.setText(Format( "{}\n{}", ControlExample.getResourceString("Example_string"), ControlExample.getResourceString("One_Two_Three"))); } /** @@ -95,21 +101,21 @@ * Gets the "Example" widget children. */ Widget [] getExampleWidgets () { - return new Widget [] {label1, label2, label3}; + return [ cast(Widget) label1, label2, label3]; } /** * Returns a list of set/get API method names (without the set/get prefix) * that can be used to set/get values in the example control(s). */ - String[] getMethodNames() { - return new String[] {"Text", "ToolTipText"}; + char[][] getMethodNames() { + return ["Text", "ToolTipText"]; } /** * Gets the text for the tab folder item. */ - String getTabText () { + char[] getTabText () { return "CLabel"; } diff -r 424cc4e14124 -r d4b244e1e1ae dwtexamples/controlexample/CTabFolderTab.d --- a/dwtexamples/controlexample/CTabFolderTab.d Wed Jan 23 01:08:24 2008 +0100 +++ b/dwtexamples/controlexample/CTabFolderTab.d Wed Jan 23 01:59:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -39,6 +39,11 @@ import dwt.widgets.Text; import dwt.widgets.Widget; +import dwtexamples.controlexample.Tab; +import dwtexamples.controlexample.ControlExample; + +import tango.text.convert.Format; + class CTabFolderTab : Tab { int lastSelectedTab = 0; @@ -49,14 +54,12 @@ /* Style widgets added to the "Style" group */ Button topButton, bottomButton, flatButton, closeButton; - static String [] CTabItems1 = {ControlExample.getResourceString("CTabItem1_0"), - ControlExample.getResourceString("CTabItem1_1"), - ControlExample.getResourceString("CTabItem1_2")}; + static char[] [] CTabItems1; /* Controls and resources added to the "Fonts" group */ - static final int SELECTION_FOREGROUND_COLOR = 3; - static final int SELECTION_BACKGROUND_COLOR = 4; - static final int ITEM_FONT = 5; + static const int SELECTION_FOREGROUND_COLOR = 3; + static const int SELECTION_BACKGROUND_COLOR = 4; + static const int ITEM_FONT = 5; Color selectionForegroundColor, selectionBackgroundColor; Font itemFont; @@ -68,6 +71,12 @@ */ this(ControlExample instance) { super(instance); + if( CTabItems1 is null ){ + CTabItems1 = [ + ControlExample.getResourceString("CTabItem1_0"), + ControlExample.getResourceString("CTabItem1_1"), + ControlExample.getResourceString("CTabItem1_2")]; + } } /** @@ -83,7 +92,7 @@ item = new TableItem(colorAndFontTable, DWT.None); item.setText(ControlExample.getResourceString ("Item_Font")); - shell.addDisposeListener(new DisposeListener() { + shell.addDisposeListener(new class() DisposeListener { public void widgetDisposed(DisposeEvent event) { if (selectionBackgroundColor !is null) selectionBackgroundColor.dispose(); if (selectionForegroundColor !is null) selectionForegroundColor.dispose(); @@ -149,7 +158,7 @@ simpleTabButton = new Button (otherGroup, DWT.CHECK); simpleTabButton.setText (ControlExample.getResourceString("Set_Simple_Tabs")); simpleTabButton.setSelection(true); - simpleTabButton.addSelectionListener (new SelectionAdapter () { + simpleTabButton.addSelectionListener (new class() SelectionAdapter { public void widgetSelected (SelectionEvent event) { setSimpleTabs(); } @@ -158,7 +167,7 @@ singleTabButton = new Button (otherGroup, DWT.CHECK); singleTabButton.setText (ControlExample.getResourceString("Set_Single_Tabs")); singleTabButton.setSelection(false); - singleTabButton.addSelectionListener (new SelectionAdapter () { + singleTabButton.addSelectionListener (new class() SelectionAdapter { public void widgetSelected (SelectionEvent event) { setSingleTabs(); } @@ -167,7 +176,7 @@ showMinButton = new Button (otherGroup, DWT.CHECK); showMinButton.setText (ControlExample.getResourceString("Set_Min_Visible")); showMinButton.setSelection(false); - showMinButton.addSelectionListener (new SelectionAdapter () { + showMinButton.addSelectionListener (new class() SelectionAdapter { public void widgetSelected (SelectionEvent event) { setMinimizeVisible(); } @@ -176,7 +185,7 @@ showMaxButton = new Button (otherGroup, DWT.CHECK); showMaxButton.setText (ControlExample.getResourceString("Set_Max_Visible")); showMaxButton.setSelection(false); - showMaxButton.addSelectionListener (new SelectionAdapter () { + showMaxButton.addSelectionListener (new class() SelectionAdapter { public void widgetSelected (SelectionEvent event) { setMaximizeVisible(); } @@ -184,7 +193,7 @@ imageButton = new Button (otherGroup, DWT.CHECK); imageButton.setText (ControlExample.getResourceString("Set_Image")); - imageButton.addSelectionListener (new SelectionAdapter () { + imageButton.addSelectionListener (new class() SelectionAdapter { public void widgetSelected (SelectionEvent event) { setImages(); } @@ -193,7 +202,7 @@ unselectedImageButton = new Button (otherGroup, DWT.CHECK); unselectedImageButton.setText (ControlExample.getResourceString("Set_Unselected_Image_Visible")); unselectedImageButton.setSelection(true); - unselectedImageButton.addSelectionListener (new SelectionAdapter () { + unselectedImageButton.addSelectionListener (new class() SelectionAdapter { public void widgetSelected (SelectionEvent event) { setUnselectedImageVisible(); } @@ -201,7 +210,7 @@ unselectedCloseButton = new Button (otherGroup, DWT.CHECK); unselectedCloseButton.setText (ControlExample.getResourceString("Set_Unselected_Close_Visible")); unselectedCloseButton.setSelection(true); - unselectedCloseButton.addSelectionListener (new SelectionAdapter () { + unselectedCloseButton.addSelectionListener (new class() SelectionAdapter { public void widgetSelected (SelectionEvent event) { setUnselectedCloseVisible(); } @@ -240,10 +249,10 @@ CTabItem item = new CTabItem(tabFolder1, DWT.NONE); item.setText(CTabItems1[i]); Text text = new Text(tabFolder1, DWT.READ_ONLY); - text.setText(ControlExample.getResourceString("CTabItem_content") + ": " + i); + text.setText(Format( "{}: {}", ControlExample.getResourceString("CTabItem_content"), i)); item.setControl(text); } - tabFolder1.addListener(DWT.Selection, new Listener() { + tabFolder1.addListener(DWT.Selection, new class() Listener { public void handleEvent(Event event) { lastSelectedTab = tabFolder1.getSelectionIndex(); } @@ -276,8 +285,8 @@ * * @return an array containing custom event names */ - String [] getCustomEventNames () { - return new String [] {"CTabFolderEvent"}; + char[] [] getCustomEventNames () { + return ["CTabFolderEvent"]; } /** @@ -293,24 +302,26 @@ * Gets the "Example" widget children. */ Widget [] getExampleWidgets () { - return new Widget [] {tabFolder1}; + return [ cast(Widget) tabFolder1]; } /** * Gets the text for the tab folder item. */ - String getTabText () { + char[] getTabText () { return "CTabFolder"; } /** * Hooks the custom listener specified by eventName. */ - void hookCustomListener (final String eventName) { + void hookCustomListener (char[] eventName) { if (eventName is "CTabFolderEvent") { - tabFolder1.addCTabFolder2Listener (new CTabFolder2Adapter () { + tabFolder1.addCTabFolder2Listener (new class(eventName) CTabFolder2Adapter { + char[] name; + this( char[] name ){ this.name = name; } public void close (CTabFolderEvent event) { - log (eventName, event); + log (name, event); } }); } diff -r 424cc4e14124 -r d4b244e1e1ae dwtexamples/controlexample/ControlExample.d --- a/dwtexamples/controlexample/ControlExample.d Wed Jan 23 01:08:24 2008 +0100 +++ b/dwtexamples/controlexample/ControlExample.d Wed Jan 23 01:59:19 2008 +0100 @@ -12,15 +12,6 @@ *******************************************************************************/ module dwtexamples.controlexample.ControlExample; -pragma( msg, "The ControlExample: still work left" ); -pragma( msg, "todo: search for //PORTING_LEFT" ); -pragma( msg, "todo: Implement Get/Set API reflection" ); -pragma( msg, "todo: DateTimeTab not implemented" ); -pragma( msg, "todo: ExpandBarTab looks strange" ); -pragma( msg, "todo: ProgressBarTab crash on vertical" ); -pragma( msg, "todo: SliderTab horizontal arrow buttons are too high" ); -pragma( msg, "please report problems" ); - import dwt.DWT; import dwt.graphics.Image; import dwt.graphics.ImageData; @@ -80,8 +71,18 @@ import jive.stacktrace; } -void main(){ - ControlExample.main( null ); +version( CONTROL_EXAMPLE_MAIN ){ + void main(){ + Stdout.formatln( "The ControlExample: still work left" ); + Stdout.formatln( "todo: search for //PORTING_LEFT" ); + Stdout.formatln( "todo: Implement Get/Set API reflection" ); + Stdout.formatln( "todo: DateTimeTab not implemented" ); + Stdout.formatln( "todo: ExpandBarTab looks strange" ); + Stdout.formatln( "todo: ProgressBarTab crash on vertical" ); + Stdout.formatln( "todo: SliderTab horizontal arrow buttons are too high" ); + Stdout.formatln( "please report problems" ); + ControlExample.main( null ); + } } public class ControlExample { diff -r 424cc4e14124 -r d4b244e1e1ae dwtexamples/controlexample/CustomControlExample.d --- a/dwtexamples/controlexample/CustomControlExample.d Wed Jan 23 01:08:24 2008 +0100 +++ b/dwtexamples/controlexample/CustomControlExample.d Wed Jan 23 01:59:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -18,6 +18,23 @@ import dwt.widgets.Display; import dwt.widgets.Shell; +import dwtexamples.controlexample.ControlExample; +import dwtexamples.controlexample.CComboTab; +import dwtexamples.controlexample.CLabelTab; +import dwtexamples.controlexample.CTabFolderTab; +import dwtexamples.controlexample.SashFormTab; +import dwtexamples.controlexample.StyledTextTab; + +import dwtexamples.controlexample.Tab; +import tango.io.Stdout; + +version( CUSTOM_CONTROL_EXAMPLE_MAIN ){ + void main(){ + Stdout.formatln( "The CustomControlExample: still work left" ); + Stdout.formatln( "please report problems" ); + CustomControlExample.main( null ); + } +} public class CustomControlExample : ControlExample { @@ -35,23 +52,28 @@ * Answers the set of example Tabs */ Tab[] createTabs() { - return new Tab [] { + return [ cast(Tab) new CComboTab (this), new CLabelTab (this), new CTabFolderTab (this), new SashFormTab (this), - new StyledTextTab (this), - }; + new StyledTextTab (this) + ]; } /** * Invokes as a standalone program. */ - public static void main(String[] args) { + public static void main(char[][] args) { + Stdout.formatln( "{}", __LINE__ ); Display display = new Display(); + Stdout.formatln( "{}", __LINE__ ); Shell shell = new Shell(display); + Stdout.formatln( "{}", __LINE__ ); shell.setLayout(new FillLayout()); + Stdout.formatln( "{}", __LINE__ ); CustomControlExample instance = new CustomControlExample(shell); + Stdout.formatln( "{}", __LINE__ ); shell.setText(getResourceString("custom.window.title")); setShellSize(instance, shell); shell.open(); diff -r 424cc4e14124 -r d4b244e1e1ae dwtexamples/controlexample/SashFormTab.d --- a/dwtexamples/controlexample/SashFormTab.d Wed Jan 23 01:08:24 2008 +0100 +++ b/dwtexamples/controlexample/SashFormTab.d Wed Jan 23 01:59:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -24,6 +24,10 @@ import dwt.widgets.Text; import dwt.widgets.Widget; +import dwtexamples.controlexample.Tab; +import dwtexamples.controlexample.ControlExample; + + class SashFormTab : Tab { /* Example widgets and groups that contain them */ Group sashFormGroup; @@ -34,23 +38,8 @@ /* Style widgets added to the "Style" group */ Button horizontalButton, verticalButton, smoothButton; - static String [] ListData0 = {ControlExample.getResourceString("ListData0_0"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData0_1"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData0_2"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData0_3"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData0_4"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData0_5"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData0_6"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData0_7")}; //$NON-NLS-1$ - - static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData1_1"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData1_2"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData1_3"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData1_4"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData1_5"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData1_6"), //$NON-NLS-1$ - ControlExample.getResourceString("ListData1_7")}; //$NON-NLS-1$ + static char[] [] ListData0; + static char[] [] ListData1; /** @@ -58,6 +47,29 @@ */ this(ControlExample instance) { super(instance); + if( ListData0 is null ){ + ListData0 = [ + ControlExample.getResourceString("ListData0_0"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData0_1"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData0_2"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData0_3"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData0_4"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData0_5"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData0_6"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData0_7")]; //$NON-NLS-1$ + + } + if( ListData1 is null ){ + ListData1 = [ + ControlExample.getResourceString("ListData1_0"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData1_1"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData1_2"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData1_3"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData1_4"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData1_5"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData1_6"), //$NON-NLS-1$ + ControlExample.getResourceString("ListData1_7")]; //$NON-NLS-1$ + } } void createExampleGroup () { super.createExampleGroup (); @@ -84,7 +96,7 @@ list2.setItems (ListData1); text = new Text (form, DWT.MULTI | DWT.BORDER); text.setText (ControlExample.getResourceString("Multi_line")); //$NON-NLS-1$ - form.setWeights(new int[] {1, 1, 1}); + form.setWeights([1, 1, 1]); } /** * Creates the "Style" group. @@ -108,13 +120,13 @@ * Gets the "Example" widget children. */ Widget [] getExampleWidgets () { - return new Widget [] {form}; + return [ cast(Widget) form]; } /** * Gets the text for the tab folder item. */ - String getTabText () { + char[] getTabText () { return "SashForm"; //$NON-NLS-1$ } diff -r 424cc4e14124 -r d4b244e1e1ae dwtexamples/controlexample/StyledTextTab.d --- a/dwtexamples/controlexample/StyledTextTab.d Wed Jan 23 01:08:24 2008 +0100 +++ b/dwtexamples/controlexample/StyledTextTab.d Wed Jan 23 01:59:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -13,8 +13,7 @@ module dwtexamples.controlexample.StyledTextTab; -import java.io.IOException; -import java.io.InputStream; +import dwt.dwthelper.ByteArrayInputStream; import dwt.DWT; @@ -41,6 +40,11 @@ import dwt.widgets.TabFolder; import dwt.widgets.Widget; +import dwtexamples.controlexample.ScrollableTab; +import dwtexamples.controlexample.ControlExample; +import tango.core.Exception; +import tango.io.Stdout; + class StyledTextTab : ScrollableTab { /* Example widgets and groups that contain them */ StyledText styledText; @@ -54,7 +58,7 @@ Image boldImage, italicImage, redImage, yellowImage, underlineImage, strikeoutImage; /* Variables for saving state. */ - String text; + char[] text; StyleRange[] styleRanges; /** @@ -67,9 +71,9 @@ /** * Creates a bitmap image. */ - Image createBitmapImage (Display display, String name) { - InputStream sourceStream = ControlExample.class.getResourceAsStream (name + ".bmp"); - InputStream maskStream = ControlExample.class.getResourceAsStream (name + "_mask.bmp"); + Image createBitmapImage (Display display, void[] sourceData, void[] maskData ) { + InputStream sourceStream = new ByteArrayInputStream ( cast(byte[])sourceData ); + InputStream maskStream = new ByteArrayInputStream ( cast(byte[])maskData ); ImageData source = new ImageData (sourceStream); ImageData mask = new ImageData (maskStream); Image result = new Image (display, source, mask); @@ -77,7 +81,7 @@ sourceStream.close (); maskStream.close (); } catch (IOException e) { - e.printStackTrace (); + Stderr.formatln( "Stacktrace: {}", e ); } return result; } @@ -164,12 +168,12 @@ styledTextStyleGroup.setLayoutData (data); /* Get images */ - boldImage = createBitmapImage (display, "bold"); - italicImage = createBitmapImage (display, "italic"); - redImage = createBitmapImage (display, "red"); - yellowImage = createBitmapImage (display, "yellow"); - underlineImage = createBitmapImage (display, "underline"); - strikeoutImage = createBitmapImage (display, "strikeout"); + boldImage = createBitmapImage (display, import("bold.bmp"), import("bold_mask.bmp")); + italicImage = createBitmapImage (display, import("italic.bmp"), import("italic_mask.bmp")); + redImage = createBitmapImage (display, import("red.bmp"), import("red_mask.bmp")); + yellowImage = createBitmapImage (display, import("yellow.bmp"), import("yellow_mask.bmp")); + underlineImage = createBitmapImage (display, import("underline.bmp"), import("underline_mask.bmp")); + strikeoutImage = createBitmapImage (display, import("strikeout.bmp"), import("strikeout_mask.bmp")); /* Create controls to modify the StyledText */ Label label = new Label (styledTextStyleGroup, DWT.NONE); @@ -205,7 +209,7 @@ label.setLayoutData(new GridData(DWT.END, DWT.CENTER, true, false)); yellowButton = new Button (styledTextStyleGroup, DWT.PUSH); yellowButton.setImage (yellowImage); - SelectionListener styleListener = new SelectionAdapter () { + SelectionListener styleListener = new class() SelectionAdapter { public void widgetSelected (SelectionEvent e) { Point sel = styledText.getSelectionRange(); if ((sel is null) || (sel.y is 0)) return; @@ -213,7 +217,7 @@ for (int i = sel.x; i