set model default values from L&F 99/13699/3
Antoine ELIAS [Mon, 10 Feb 2014 15:00:42 +0000 (16:00 +0100)]
Change-Id: Ie82c8103068f01a4c0fb83b86e930c126689f942

52 files changed:
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/Uicontrol.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/checkbox/CheckBox.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/edit/Edit.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/frame/Frame.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/layer/Layer.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/listbox/ListBox.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/popupmenu/PopupMenu.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/pushbutton/PushButton.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/radiobutton/RadioButton.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/slider/Slider.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/tab/Tab.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/table/Table.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/uiimage/UiImage.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/uitext/UiText.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/xmlloader/GOBuilder.java
scilab/modules/gui/src/c/checkColorRange.c
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingViewWidget.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/checkbox/SwingScilabCheckBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/checkboxmenuitem/SwingScilabCheckBoxMenuItem.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/contextmenu/SwingScilabContextMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabEditBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabScrollableFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/label/SwingScilabLabel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/menu/SwingScilabMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/menuitem/SwingScilabMenuItem.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/popupmenu/SwingScilabPopupMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/pushbutton/SwingScilabPushButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiobutton/SwingScilabRadioButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabScroll.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabSlider.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/textbox/SwingScilabTextBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tree/SwingScilabTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uidisplaytree/SwingScilabUiDisplayTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uiimage/SwingScilabUiImage.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uitable/SwingScilabUiTable.java
scilab/modules/gui/src/java/org/scilab/modules/gui/checkbox/ScilabCheckBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/contextmenu/ScilabContextMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/editbox/ScilabEditBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/label/ScilabLabel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/listbox/ScilabListBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/menu/ScilabMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/popupmenu/ScilabPopupMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/pushbutton/ScilabPushButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/radiobutton/ScilabRadioButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/slider/ScilabSlider.java
scilab/modules/gui/src/java/org/scilab/modules/gui/textbox/ScilabTextBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/tree/ScilabTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/uidisplaytree/ScilabUiDisplayTree.java
scilab/modules/gui/src/java/org/scilab/modules/gui/uitable/ScilabUiTable.java
scilab/modules/gui/src/java/org/scilab/modules/gui/widget/Widget.java

index 6b111ce..29bac97 100644 (file)
@@ -61,6 +61,8 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TAB__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TEXT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TITLE_POSITION__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TITLE_SCROLL__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TOOLTIPSTRING_SIZE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TOOLTIPSTRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_UNITS__;
@@ -71,9 +73,11 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TITLE_SCROLL__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SCROLLABLE__;
 
+import java.awt.Font;
 import java.util.Arrays;
 import java.util.StringTokenizer;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
 import org.scilab.modules.graphic_objects.graphicObject.Visitor;
 import org.scilab.modules.graphic_objects.utils.LayoutType;
@@ -256,13 +260,13 @@ public class Uicontrol extends GraphicObject {
         }
     }
 
-    protected static final String NONE_RELIEF   = "";
-    protected static final String FLAT_RELIEF   = "flat";
-    protected static final String RAISED_RELIEF = "raised";
-    protected static final String SUNKEN_RELIEF = "sunken";
-    protected static final String GROOVE_RELIEF = "groove";
-    protected static final String RIDGE_RELIEF  = "ridge";
-    protected static final String SOLID_RELIEF  = "solid";
+    protected static final String RELIEF_NONE   = "";
+    protected static final String RELIEF_FLAT   = "flat";
+    protected static final String RELIEF_RAISED = "raised";
+    protected static final String RELIEF_SUNKEN = "sunken";
+    protected static final String RELIEF_GROOVE = "groove";
+    protected static final String RELIEF_RIDGE  = "ridge";
+    protected static final String RELIEF_SOLID  = "solid";
 
     protected static final double DEFAULT_RED_BACKGROUND = 0.8;
     protected static final double DEFAULT_GREEN_BACKGROUND = 0.8;
@@ -273,10 +277,10 @@ public class Uicontrol extends GraphicObject {
     private static final double DEFAULT_WIDTH = 40.0;
     private static final double DEFAULT_HEIGHT = 20.0;
 
-    protected static final double DEFAULTFONTSIZE = 10;
-    protected static final String DEFAULTFONTNAME = "helvetica";
-    protected static final String DEFAULTFONTWEIGHT = "normal";
-    protected static final String DEFAULTFONTANGLE = "normal";
+    protected static final double DEFAULT_FONTSIZE = 10;
+    protected static final String DEFAULT_FONTNAME = "helvetica";
+    protected static final String DEFAULT_FONTWEIGHT = "normal";
+    protected static final String DEFAULT_FONTANGLE = "normal";
     private static final String STRING_SEPARATOR = "|";
 
     private UicontrolStyle style;
@@ -289,18 +293,18 @@ public class Uicontrol extends GraphicObject {
     private String fontWeight = "";
     private Double[] foregroundColor = {0.0, 0.0, 0.0};
     private String horizontalAlignment = "";
+    private String verticalAlignment = "";
     private Integer[] listboxTop;
     private double max = 1.0;
     private double min;
     private Double[] position = {DEFAULT_X, DEFAULT_Y, DEFAULT_WIDTH, DEFAULT_HEIGHT};
-    private String relief = NONE_RELIEF;
+    private String relief = RELIEF_NONE;
     private Double[] sliderStep = {0.01, 0.1};
     private String[] string = {""};
     private int stringColNb = 1; // Used for tables
     private String[] tooltipString = {""};
     private String units = "pixels";
     private Double[] value;
-    private String verticalAlignment = "";
     private LayoutType layout = LayoutType.NONE;
     private Double[] margins = new Double[] {0.0, 0.0, 0.0, 0.0};
     private Integer[] gridbagGrid = new Integer[] { -1, -1, 1, 1};
@@ -405,6 +409,22 @@ public class Uicontrol extends GraphicObject {
     public Uicontrol() {
         super();
         setVisible(false); /* To avoid to see the object rendered before all its properties to be set (See bug #10346) */
+
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULT_FONTNAME);
+            setFontSize(DEFAULT_FONTSIZE);
+            setFontAngle(DEFAULT_FONTANGLE);
+            setFontWeight(DEFAULT_FONTWEIGHT);
+        }
     }
 
     /**
@@ -792,7 +812,6 @@ public class Uicontrol extends GraphicObject {
     /**
      * Set the style
      * @param style the style
-     * @return TODO
      */
     public UpdateStatus setStyle(int style) {
         UicontrolStyle val =  intToStyleEnum(style);
@@ -1424,6 +1443,27 @@ public class Uicontrol extends GraphicObject {
         return scrollable;
     }
 
+    public void setFont(Font font) {
+        if (font == null) {
+            return;
+        }
+
+        setFontName(font.getName());
+        setFontSize(font.getSize());
+
+        if (font.isItalic()) {
+            setFontAngle("italic");
+        } else {
+            setFontAngle("normal");
+        }
+
+        if (font.isBold()) {
+            setFontWeight("bold");
+        } else {
+            setFontWeight("normal");
+        }
+    }
+
     public void accept(Visitor visitor) {
     }
 }
index 9fcb7dd..3dbaa40 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.checkbox;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_CHECKBOX__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -35,20 +38,18 @@ public class CheckBox extends Uicontrol {
         setUiValue(value);
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("CheckBox.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 }
index efb65c0..13b5e1f 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.edit;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_EDIT__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -30,20 +33,18 @@ public class Edit extends Uicontrol {
         setStyle(__GO_UI_EDIT__);
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(SUNKEN_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_SUNKEN);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("TextField.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 }
index 1f5c28f..74b8b9a 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.frame;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -29,23 +32,18 @@ public class Frame extends Uicontrol {
         super();
         setStyle(__GO_UI_FRAME__);
         if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(RELIEF_RIDGE);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("Panel.font"));
+
+            //h-alignment
+            setHorizontalAlignment("left");
 
-            if (Console.getConsole().getUseDeprecatedLF()) {
-                setRelief(RIDGE_RELIEF);
-                setBackgroundColor(new Double[] {
-                                       DEFAULT_RED_BACKGROUND,
-                                       DEFAULT_GREEN_BACKGROUND,
-                                       DEFAULT_BLUE_BACKGROUND
-                                   });
-
-                setHorizontalAlignment("center");
-                setVerticalAlignment("middle");
-
-                setFontName(DEFAULTFONTNAME);
-                setFontSize(DEFAULTFONTSIZE);
-                setFontAngle(DEFAULTFONTANGLE);
-                setFontWeight(DEFAULTFONTWEIGHT);
-            }
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 }
index b106fb2..abe9a62 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.layer;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LAYER__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,5 +30,15 @@ public class Layer extends Uicontrol {
     public Layer() {
         super();
         setStyle(__GO_UI_LAYER__);
+        UIDefaults defaults = UIManager.getDefaults();
+
+        //font
+        setFont(defaults.getFont("Panel.font"));
+
+        //h-alignment
+        setHorizontalAlignment("left");
+
+        //v-alignement
+        setVerticalAlignment("middle");
     }
 }
index 8dbdbd0..f2c073f 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.listbox;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LISTBOX__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -35,20 +38,18 @@ public class ListBox extends Uicontrol {
         setUiValue(value);
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("List.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 
index 251d614..77543e3 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.popupmenu;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_POPUPMENU__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -30,20 +33,18 @@ public class PopupMenu extends Uicontrol {
         setStyle(__GO_UI_POPUPMENU__);
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("PopupMenu.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
 
     }
index 9467515..a9af254 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.pushbutton;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_PUSHBUTTON__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -22,10 +25,6 @@ import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
  */
 public class PushButton extends Uicontrol {
 
-    private static final double BUTTON_RED_BACKGROUND = 0.6;
-    private static final double BUTTON_GREEN_BACKGROUND = 0.6;
-    private static final double BUTTON_BLUE_BACKGROUND = 0.6;
-
     /**
      * Constructor
      */
@@ -35,20 +34,18 @@ public class PushButton extends Uicontrol {
 
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(RAISED_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   BUTTON_RED_BACKGROUND,
-                                   BUTTON_GREEN_BACKGROUND,
-                                   BUTTON_BLUE_BACKGROUND
-                               });
+            setRelief(RELIEF_RAISED);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("Button.font"));
 
+            //h-alignment
             setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 
index 8eeb6e5..8da2986 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.radiobutton;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_RADIOBUTTON__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -35,20 +38,18 @@ public class RadioButton extends Uicontrol {
         setUiValue(value);
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("RadioButton.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 }
index 7e94848..a31e611 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.slider;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDER__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -35,20 +38,18 @@ public class Slider extends Uicontrol {
         setUiValue(value);
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("Slider.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 }
index 7f81200..5b3b5fa 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.tab;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TAB__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -29,20 +32,18 @@ public class Tab extends Uicontrol {
         super();
         setStyle(__GO_UI_TAB__);
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("TabbedPane.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 
index 9a8020b..567cd4c 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.table;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TABLE__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -29,20 +32,18 @@ public class Table extends Uicontrol {
         super();
         setStyle(__GO_UI_TABLE__);
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("Table.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 
index 6b2a644..92ec3d9 100644 (file)
 package org.scilab.modules.graphic_objects.uicontrol.uiimage;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_IMAGE__;
+
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -30,20 +34,18 @@ public class UiImage extends Uicontrol {
         Double[] imageInfos = {1.0, 1.0, 0.0, 0.0, 0.0}; // {XScale, YScale, XShear, YShear, RotationAngle}
         setUiValue(imageInfos);
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(RAISED_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_RAISED);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //font
+            setFont(defaults.getFont("Panel.font"));
+
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 
index 0795aa9..81753a9 100644 (file)
@@ -14,6 +14,9 @@ package org.scilab.modules.graphic_objects.uicontrol.uitext;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TEXT__;
 
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
 import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
@@ -30,20 +33,18 @@ public class UiText extends Uicontrol {
         setStyle(__GO_UI_TEXT__);
 
         if (Console.getConsole().getUseDeprecatedLF()) {
-            setRelief(FLAT_RELIEF);
-            setBackgroundColor(new Double[] {
-                                   DEFAULT_RED_BACKGROUND,
-                                   DEFAULT_GREEN_BACKGROUND,
-                                   DEFAULT_BLUE_BACKGROUND
-                               });
-
-            setHorizontalAlignment("center");
-            setVerticalAlignment("middle");
+            setRelief(RELIEF_FLAT);
+        } else {
+            UIDefaults defaults = UIManager.getDefaults();
+
+            //font
+            setFont(defaults.getFont("Label.font"));
 
-            setFontName(DEFAULTFONTNAME);
-            setFontSize(DEFAULTFONTSIZE);
-            setFontAngle(DEFAULTFONTANGLE);
-            setFontWeight(DEFAULTFONTWEIGHT);
+            //h-alignment
+            setHorizontalAlignment("left");
+
+            //v-alignement
+            setVerticalAlignment("middle");
         }
     }
 }
index f9c7148..0168548 100644 (file)
@@ -356,7 +356,6 @@ public class GOBuilder {
 
                     String columns = attributes.getValue("columns");
                     if (columns != null) {
-                        System.out.println("columns : " + columns);
                         controller.setProperty(uic, __GO_UI_MAX__, Double.parseDouble(columns));
                     }
                     break;
index 5d16d43..cdbdbf1 100644 (file)
@@ -21,6 +21,11 @@ static int checkColorComponent(double c)
 /*--------------------------------------------------------------------------*/
 int checkColorRange(double r, double g, double b)
 {
+    if (r == -1 && g == -1 && b == -1)
+    {
+        return 1;
+    }
+
     return checkColorComponent(r) && checkColorComponent(g) && checkColorComponent(b);
 }
 /*--------------------------------------------------------------------------*/
index d461990..19b6323 100644 (file)
@@ -63,7 +63,9 @@ import java.awt.GridLayout;
 
 import javax.swing.AbstractButton;
 import javax.swing.JComponent;
+import javax.swing.UIManager;
 import javax.swing.border.Border;
+import javax.swing.plaf.ComponentUI;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicObject.CallBack;
@@ -141,6 +143,7 @@ public final class SwingViewWidget {
                 } else {
                     // Do not set BackgroundColor for widgets
                     // rely on Look and Feel
+                    uiControl.resetBackground();
                 }
                 break;
             case __GO_CALLBACK__:
index 2546f72..1714e47 100644 (file)
@@ -18,12 +18,14 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
+import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Enumeration;
 
 import javax.swing.AbstractButton;
 import javax.swing.JCheckBox;
+import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewObject;
@@ -336,4 +338,11 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
     public void update(int property, Object value) {
         SwingViewWidget.update(this, property, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("CheckBox.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 04a8bd6..a15b059 100644 (file)
 
 package org.scilab.modules.gui.bridge.checkboxmenuitem;
 
+import java.awt.Color;
 import java.awt.Container;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
 import javax.swing.JCheckBoxMenuItem;
+import javax.swing.UIManager;
 import javax.swing.JToggleButton.ToggleButtonModel;
 
 import org.scilab.modules.commons.utils.StringBlockingResult;
@@ -418,5 +420,13 @@ public class SwingScilabCheckBoxMenuItem extends JCheckBoxMenuItem implements Sw
         public void forceSelected(boolean status) {
             super.setSelected(status);
         }
+
+    }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("CheckBoxMenuItem.background");
+        if (color != null) {
+            setBackground(color);
+        }
     }
 }
index dab865a..b952a23 100644 (file)
@@ -14,9 +14,11 @@ package org.scilab.modules.gui.bridge.contextmenu;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
 
+import java.awt.Color;
 import java.awt.MouseInfo;
 
 import javax.swing.JPopupMenu;
+import javax.swing.UIManager;
 import javax.swing.event.PopupMenuEvent;
 import javax.swing.event.PopupMenuListener;
 
@@ -369,4 +371,10 @@ public class SwingScilabContextMenu extends JPopupMenu implements SwingViewObjec
         }
     }
 
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("PopupMenu.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index e65e4bf..3a26abf 100644 (file)
@@ -28,6 +28,7 @@ import javax.swing.JScrollPane;
 import javax.swing.JTextPane;
 import javax.swing.KeyStroke;
 import javax.swing.ScrollPaneConstants;
+import javax.swing.UIManager;
 import javax.swing.text.AbstractDocument;
 import javax.swing.text.BoxView;
 import javax.swing.text.ComponentView;
@@ -446,4 +447,11 @@ public class SwingScilabEditBox extends JScrollPane implements SwingViewObject,
             textPane.getInputMap().put(enterKey, "none");
         }
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("TextField.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 04fe452..fcebefc 100644 (file)
@@ -18,6 +18,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 
 import java.awt.BorderLayout;
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.GridBagConstraints;
@@ -26,6 +27,7 @@ import java.awt.GridLayout;
 import java.awt.Insets;
 
 import javax.swing.JPanel;
+import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicModel.GraphicModel;
@@ -751,4 +753,11 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
             }
         }
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Panel.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 07bfe03..a1a511b 100644 (file)
@@ -32,6 +32,7 @@ import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.ScrollPaneLayout;
 import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
 import javax.swing.border.Border;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
@@ -527,4 +528,11 @@ public class SwingScilabScrollableFrame extends JScrollPane implements SwingView
         }
     }
 
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ScrollPane.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
+
 }
index 905ffbe..5dd7838 100644 (file)
@@ -29,6 +29,7 @@ import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.JTextPane;
 import javax.swing.SwingConstants;
+import javax.swing.UIManager;
 import javax.swing.event.HyperlinkEvent;
 import javax.swing.event.HyperlinkListener;
 import javax.swing.text.html.HTMLDocument;
@@ -486,4 +487,10 @@ public class SwingScilabLabel extends JScrollPane implements SwingViewObject, Si
         SwingViewWidget.update(this, property, value);
     }
 
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Label.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index f324e58..d228669 100644 (file)
@@ -28,6 +28,7 @@ import javax.swing.DefaultListModel;
 import javax.swing.JList;
 import javax.swing.JScrollPane;
 import javax.swing.ListSelectionModel;
+import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewObject;
@@ -329,7 +330,7 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
             updateNeeded = true;
         } else {
             for (int k = 0; k < text.length; k++) {
-                if (text[k].compareTo(previousText[k]) != 0) {
+                if (text[k].equals(previousText[k]) == false) {
                     updateNeeded = true;
                     break;
                 }
@@ -344,6 +345,7 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
             model.addElement(text[i]);
         }
         getList().setModel(model);
+        getList().revalidate();
         revalidate();
     }
 
@@ -514,4 +516,11 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
     public void update(int property, Object value) {
         SwingViewWidget.update(this, property, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("List.background");
+        if (color != null) {
+            getList().setBackground(color);
+        }
+    }
 }
index 2697e70..50fc408 100644 (file)
 
 package org.scilab.modules.gui.bridge.menu;
 
+import java.awt.Color;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 
 import javax.swing.JMenu;
+import javax.swing.UIManager;
 
 import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
 import org.scilab.modules.gui.SwingViewMenu;
@@ -464,4 +466,11 @@ public class SwingScilabMenu extends JMenu implements SwingViewObject, SimpleMen
     public void update(int property, Object value) {
         SwingViewMenu.update(this, property, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Menu.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 00877cc..8f41631 100644 (file)
 
 package org.scilab.modules.gui.bridge.menuitem;
 
+import java.awt.Color;
 import java.awt.Container;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
 import javax.swing.JMenuItem;
+import javax.swing.UIManager;
 
 import org.scilab.modules.commons.utils.StringBlockingResult;
 import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
@@ -453,4 +455,11 @@ public class SwingScilabMenuItem extends JMenuItem implements SwingViewObject, S
     public void update(int property, Object value) {
         SwingViewMenu.update(this, property, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("MenuItem.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 2a2e6df..f309ab6 100644 (file)
@@ -16,10 +16,12 @@ package org.scilab.modules.gui.bridge.popupmenu;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
+import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
 import javax.swing.JComboBox;
+import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewWidget;
@@ -392,6 +394,11 @@ public class SwingScilabPopupMenu extends JComboBox implements SwingViewObject,
     public void update(int property, Object value) {
         SwingViewWidget.update(this, property, value);
     }
-}
-
 
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ComboBox.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
+}
index ee14d8b..597711b 100644 (file)
@@ -14,6 +14,7 @@
 
 package org.scilab.modules.gui.bridge.pushbutton;
 
+import java.awt.Color;
 import java.awt.Font;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
@@ -21,6 +22,7 @@ import java.beans.PropertyChangeListener;
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
+import javax.swing.UIManager;
 
 import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
 import org.scilab.modules.graphic_objects.console.Console;
@@ -305,4 +307,19 @@ public class SwingScilabPushButton extends JButton implements SwingViewObject, S
     public void update(int property, Object value) {
         SwingViewWidget.update(this, property, value);
     }
+
+    public void setBackground(Color color) {
+        setContentAreaFilled(false);
+        setOpaque(true);
+        super.setBackground(color);
+    }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Button.background");
+        if (color != null) {
+            setContentAreaFilled(true);
+            setOpaque(false);
+            super.setBackground(color);
+        }
+    }
 }
index 2c3e9ea..d3d8f6d 100644 (file)
@@ -18,12 +18,14 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
+import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Enumeration;
 
 import javax.swing.AbstractButton;
 import javax.swing.JRadioButton;
+import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewObject;
@@ -337,4 +339,11 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
     public void update(int property, Object value) {
         SwingViewWidget.update(this, property, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("RadioButton.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 62a153a..1e999db 100644 (file)
@@ -17,10 +17,12 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
+import java.awt.Color;
 import java.awt.event.AdjustmentEvent;
 import java.awt.event.AdjustmentListener;
 
 import javax.swing.JScrollBar;
+import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewWidget;
@@ -354,4 +356,11 @@ public class SwingScilabScroll extends JScrollBar implements SwingViewObject, Si
         value[0] = userMin + ((getValue() - MINIMUM_VALUE) * (userMax - userMin) / (MAXIMUM_VALUE - MINIMUM_VALUE));
         GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ScrollBar.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 0517641..7acca5e 100644 (file)
@@ -17,12 +17,14 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
+import java.awt.Color;
 import java.awt.event.ActionEvent;
 
 import javax.swing.AbstractAction;
 import javax.swing.JScrollBar;
 import javax.swing.JSlider;
 import javax.swing.KeyStroke;
+import javax.swing.UIManager;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
@@ -423,4 +425,11 @@ public class SwingScilabSlider extends JSlider implements SwingViewObject, Simpl
         value[0] = userMin + ((getValue() - MINIMUM_VALUE) * (userMax - userMin) / (MAXIMUM_VALUE - MINIMUM_VALUE));
         GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Slider.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 65ee927..63784e3 100644 (file)
  */
 package org.scilab.modules.gui.bridge.textbox;
 
+import java.awt.Color;
+
 import javax.swing.JTextArea;
+import javax.swing.UIManager;
 
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
@@ -204,4 +207,10 @@ public class SwingScilabTextBox extends JTextArea implements SimpleTextBox {
         throw new UnsupportedOperationException();
     }
 
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("TextArea.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index f75e8f6..393132b 100644 (file)
@@ -23,6 +23,7 @@ import javax.swing.Icon;
 import javax.swing.JComponent;
 import javax.swing.JScrollPane;
 import javax.swing.JTree;
+import javax.swing.UIManager;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreePath;
@@ -351,12 +352,15 @@ public class SwingScilabTree extends DefaultMutableTreeNode implements SimpleTre
     }
 
     public void setVisible(boolean newVisibleState) {
-        // TODO Auto-generated method stub
-
     }
 
-    @Override
     public void setToolTipText(String tooltipText) {
-        // TODO Auto-generated method stub
+    }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Tree.background");
+        if (color != null) {
+            setBackground(color);
+        }
     }
 }
index 45c408a..b89fef9 100644 (file)
@@ -16,6 +16,7 @@ import java.awt.Font;
 
 import javax.swing.JLabel;
 import javax.swing.JScrollPane;
+import javax.swing.UIManager;
 
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.uidisplaytree.SimpleUiDisplayTree;
@@ -281,4 +282,11 @@ public class SwingScilabUiDisplayTree extends JScrollPane implements SimpleUiDis
         sst = new SwingScilabTree(ScilabDisplayTree.uicontrolScilabDisplayTree(text));
         getViewport().add(sst.getJTree());
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ScrollPane.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 1f8564c..aa04714 100644 (file)
  */
 package org.scilab.modules.gui.bridge.uiimage;
 
+import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.Image;
 import java.awt.image.BufferedImage;
 
 import javax.swing.ImageIcon;
 import javax.swing.JLabel;
+import javax.swing.UIManager;
 
-import org.scilab.forge.scirenderer.shapes.appearance.Color;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
@@ -294,4 +295,11 @@ public class SwingScilabUiImage extends JLabel implements SwingViewObject, Simpl
     public void update(int property, Object value) {
         SwingViewWidget.update(this, property, value);
     }
+
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Label.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index 01adc22..4967410 100644 (file)
@@ -19,6 +19,7 @@ import javax.swing.JList;
 import javax.swing.JTable;
 import javax.swing.JLabel;
 import javax.swing.JScrollPane;
+import javax.swing.UIManager;
 
 import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
@@ -420,4 +421,10 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
         SwingViewWidget.update(this, property, value);
     }
 
+    public void resetBackground() {
+        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ScrollPane.background");
+        if (color != null) {
+            setBackground(color);
+        }
+    }
 }
index d904472..905f4c8 100644 (file)
@@ -259,4 +259,10 @@ public class ScilabCheckBox extends ScilabWidget implements CheckBox {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 5681c40..da10cb3 100644 (file)
@@ -258,4 +258,10 @@ public class ScilabContextMenu extends ScilabWidget implements ContextMenu {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 92e10e8..b5f454c 100644 (file)
@@ -245,4 +245,10 @@ public class ScilabEditBox extends ScilabWidget implements EditBox {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 572c985..ced2374 100644 (file)
@@ -243,4 +243,10 @@ public class ScilabLabel extends ScilabWidget implements Label {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 63f9f56..5a30846 100644 (file)
@@ -318,4 +318,10 @@ public class ScilabListBox extends ScilabWidget implements ListBox {
     public void setToolTipText(String tooltipText) {
         // TODO Auto-generated method stub
     }
+
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
 }
index 5af4af1..a79a249 100644 (file)
@@ -311,4 +311,10 @@ public class ScilabMenu extends ScilabWidget implements Menu {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index d96015d..120f390 100644 (file)
@@ -283,4 +283,10 @@ public class ScilabPopupMenu extends ScilabWidget implements PopupMenu {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 6f5b8f5..2631b71 100644 (file)
@@ -256,4 +256,10 @@ public class ScilabPushButton extends ScilabWidget implements PushButton {
         ScilabBridge.requestFocus(this);
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 6b61eaf..6cbb11a 100644 (file)
@@ -259,4 +259,10 @@ public class ScilabRadioButton extends ScilabWidget implements RadioButton {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 5ae34c5..e146175 100644 (file)
@@ -305,4 +305,10 @@ public class ScilabSlider extends ScilabWidget implements Slider {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 39f877d..817f204 100644 (file)
@@ -246,4 +246,10 @@ public class ScilabTextBox extends ScilabText implements TextBox {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 603d642..5316a65 100644 (file)
@@ -37,8 +37,6 @@ import org.scilab.modules.gui.utils.Size;
  */
 public class ScilabTree implements Tree {
 
-    private static final long serialVersionUID = 1L;
-
     private String label;
     private Icon icon;
     private CommonCallBack callback;
@@ -298,4 +296,10 @@ public class ScilabTree implements Tree {
         // TODO Auto-generated method stub
     }
 
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 5ae4fba..9761bf4 100644 (file)
@@ -250,4 +250,10 @@ public class ScilabUiDisplayTree extends ScilabWidget implements UiDisplayTree {
     public void setToolTipText(String tooltipText) {
         // TODO Auto-generated method stub
     }
+
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
 }
index ca30cd0..b4cd9dd 100644 (file)
@@ -283,4 +283,10 @@ public class ScilabUiTable extends ScilabWidget implements UiTable {
     public void setToolTipText(String tooltipText) {
         // TODO Auto-generated method stub
     }
+
+    @Override
+    public void resetBackground() {
+        // TODO Auto-generated method stub
+
+    }
 }
index 09b6f8c..e2e8867 100644 (file)
@@ -31,7 +31,7 @@ public interface Widget extends Dockable {
      * @param color the Color
      */
     void setBackground(Color color);
-
+    void resetBackground();
     /**
      * Get the Background color of the widget.
      * @return the Color