changeset 142:7dca96709d29

Fix: remove trigger of Display creation in static ctors
author Frank Benoit <benoit@tionex.de>
date Thu, 07 Aug 2008 17:23:25 +0200
parents c311768f1afa
children 42c3056512ba
files draw2d/UmlExample.d
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/draw2d/UmlExample.d	Thu Aug 07 17:22:14 2008 +0200
+++ b/draw2d/UmlExample.d	Thu Aug 07 17:23:25 2008 +0200
@@ -59,9 +59,12 @@
 }
 
 public class UMLClassFigure : Figure {
-    public static Color classColor;
-    static this(){
-        classColor = new Color(null,255,255,206);
+    private static Color classColor_;
+    public static Color classColor(){
+        if( classColor_ is null ){
+            classColor_ = new Color(null,255,255,206);
+        }
+        return classColor_;
     }
 
     private CompartmentFigure attributeFigure;
@@ -103,7 +106,7 @@
  * A test class to display a UMLFigure
  */
 public static void main(){
-    Display d = Display.getCurrent();
+    Display d = new Display();
     final Shell shell = new Shell(d);
     shell.setSize(400, 400);
     shell.setText("UMLClassFigure Test");