Bug 563560: Stop using Color constructors which take a device
Change-Id: I3037f38fa716a7d8486ee7998f90e8fe0a493367
Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
index c4e3a71..72e5c00 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
@@ -653,7 +653,7 @@
int r = Integer.parseInt(rgbString.substring(0, comma1));
int g = Integer.parseInt(rgbString.substring(comma1 + 1, comma2));
int b = Integer.parseInt(rgbString.substring(comma2 + 1, rgbString.length()));
- return new Color(display, r, g, b);
+ return new Color(r, g, b);
} catch (NumberFormatException ex) {}
return null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java
index 64a8840..a75942d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java
@@ -351,7 +351,7 @@
int red = from.red + 3*(to.red - from.red)/4;
int green = from.green + 3*(to.green - from.green)/4;
int blue = from.blue + 3*(to.blue - from.blue)/4;
- Color color = new Color(getDisplay(), red, green, blue);
+ Color color = new Color(red, green, blue);
gc.setForeground(color);
gc.drawPolyline(line2);
gc.drawPolyline(line3);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
index 5ca3ddb..03c5b5b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
@@ -478,7 +478,7 @@
int red = from.red + 2*(to.red - from.red)/3;
int green = from.green + 2*(to.green - from.green)/3;
int blue = from.blue + 2*(to.blue - from.blue)/3;
- selectedOuterColor = new Color(parent.getDisplay(), red, green, blue);
+ selectedOuterColor = new Color(red, green, blue);
}
if (innerRGB != null) {
RGB from = lineRGB;
@@ -486,7 +486,7 @@
int red = from.red + 2*(to.red - from.red)/3;
int green = from.green + 2*(to.green - from.green)/3;
int blue = from.blue + 2*(to.blue - from.blue)/3;
- selectedInnerColor = new Color(parent.getDisplay(), red, green, blue);
+ selectedInnerColor = new Color(red, green, blue);
}
/* compute the tabArea color */
outerRGB = parent.getParent().getBackground().getRGB();
@@ -496,7 +496,7 @@
int red = from.red + 2*(to.red - from.red)/3;
int green = from.green + 2*(to.green - from.green)/3;
int blue = from.blue + 2*(to.blue - from.blue)/3;
- tabAreaColor = new Color(parent.getDisplay(), red, green, blue);
+ tabAreaColor = new Color(red, green, blue);
}
}
@@ -528,7 +528,7 @@
int red = (to.red * propTo + from.red * propFrom) / denom;
int green = (to.green * propTo + from.green * propFrom) / denom;
int blue = (to.blue * propTo + from.blue * propFrom) / denom;
- selectionHighlightGradientColorsCache[i] = new Color(parent.getDisplay(), red, green, blue);
+ selectionHighlightGradientColorsCache[i] = new Color(red, green, blue);
}
}
@@ -609,7 +609,7 @@
// this color has to be identical to the colors used in the PNG files of
// the view drop down menu located in
// org.eclipse.e4.ui.workbench.renderers.swt/icons/full/elcl16/view_menu.png
- minMaxBorderColor = new Color (gc.getDevice(), 105, 105, 105);
+ minMaxBorderColor = new Color (105, 105, 105);
}
switch (part) {
case PART_BACKGROUND:
@@ -1695,7 +1695,7 @@
Color getFillColor() {
if (fillColor == null) {
- fillColor = new Color(parent.getDisplay(), CLOSE_FILL);
+ fillColor = new Color(CLOSE_FILL);
}
return fillColor;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
index 284b0ef..d248524 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
@@ -309,7 +309,7 @@
if (printOptions.printLineBackground) {
Color printerColor = (Color)resources.get(color);
if (printerColor == null) {
- printerColor = new Color (printer, color.getRGB());
+ printerColor = new Color (color.getRGB());
resources.put(color, printerColor);
}
printerRenderer.setLineBackground(i, 1, printerColor);
@@ -339,7 +339,7 @@
Color printerColor = (Color)resources.get(color);
if (printOptions.printTextForeground) {
if (printerColor == null) {
- printerColor = new Color (printer, color.getRGB());
+ printerColor = new Color (color.getRGB());
resources.put(color, printerColor);
}
style.foreground = printerColor;
@@ -352,7 +352,7 @@
Color printerColor = (Color)resources.get(color);
if (printOptions.printTextBackground) {
if (printerColor == null) {
- printerColor = new Color (printer, color.getRGB());
+ printerColor = new Color (color.getRGB());
resources.put(color, printerColor);
}
style.background = printerColor;
@@ -8500,7 +8500,7 @@
if (background.equals(disabledBg)) {
return;
} else {
- color = new Color (getDisplay(), disabledBg.getRGBA());
+ color = new Color (disabledBg.getRGBA());
backgroundDisabled = true;
}
}
@@ -8990,7 +8990,7 @@
if (foreground.equals(disabledFg)) {
return;
} else {
- color = new Color (getDisplay(), disabledFg.getRGBA());
+ color = new Color (disabledFg.getRGBA());
foregroundDisabled = true;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 3717bc9..b474f02 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -618,23 +618,23 @@
}
/* Create the standard colors */
- COLOR_TRANSPARENT = new Color (this, 0xFF,0xFF,0xFF,0);
- COLOR_BLACK = new Color (this, 0,0,0);
- COLOR_DARK_RED = new Color (this, 0x80,0,0);
- COLOR_DARK_GREEN = new Color (this, 0,0x80,0);
- COLOR_DARK_YELLOW = new Color (this, 0x80,0x80,0);
- COLOR_DARK_BLUE = new Color (this, 0,0,0x80);
- COLOR_DARK_MAGENTA = new Color (this, 0x80,0,0x80);
- COLOR_DARK_CYAN = new Color (this, 0,0x80,0x80);
- COLOR_GRAY = new Color (this, 0xC0,0xC0,0xC0);
- COLOR_DARK_GRAY = new Color (this, 0x80,0x80,0x80);
- COLOR_RED = new Color (this, 0xFF,0,0);
- COLOR_GREEN = new Color (this, 0,0xFF,0);
- COLOR_YELLOW = new Color (this, 0xFF,0xFF,0);
- COLOR_BLUE = new Color (this, 0,0,0xFF);
- COLOR_MAGENTA = new Color (this, 0xFF,0,0xFF);
- COLOR_CYAN = new Color (this, 0,0xFF,0xFF);
- COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);
+ COLOR_TRANSPARENT = new Color (0xFF, 0xFF,0xFF,0);
+ COLOR_BLACK = new Color (0, 0,0);
+ COLOR_DARK_RED = new Color (0x80, 0,0);
+ COLOR_DARK_GREEN = new Color (0, 0x80,0);
+ COLOR_DARK_YELLOW = new Color (0x80, 0x80,0);
+ COLOR_DARK_BLUE = new Color (0, 0,0x80);
+ COLOR_DARK_MAGENTA = new Color (0x80, 0,0x80);
+ COLOR_DARK_CYAN = new Color (0, 0x80,0x80);
+ COLOR_GRAY = new Color (0xC0, 0xC0,0xC0);
+ COLOR_DARK_GRAY = new Color (0x80, 0x80,0x80);
+ COLOR_RED = new Color (0xFF, 0,0);
+ COLOR_GREEN = new Color (0, 0xFF,0);
+ COLOR_YELLOW = new Color (0xFF, 0xFF,0);
+ COLOR_BLUE = new Color (0, 0,0xFF);
+ COLOR_MAGENTA = new Color (0xFF, 0,0xFF);
+ COLOR_CYAN = new Color (0, 0xFF,0xFF);
+ COLOR_WHITE = new Color (0xFF, 0xFF,0xFF);
emptyTab = OS.pango_tab_array_new(1, false);
if (emptyTab == 0) SWT.error(SWT.ERROR_NO_HANDLES);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
index 1f08667..85da7a6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
@@ -153,7 +153,7 @@
gtk_widget_set_has_surface_or_window (handle, true);
GTK.gtk_widget_set_can_focus (handle, true);
layout = new TextLayout (display);
- disabledColor = new Color (display, LINK_DISABLED_FOREGROUND);
+ disabledColor = new Color (LINK_DISABLED_FOREGROUND);
offsets = new Point [0];
ids = new String [0];
mnemonics = new int [0];
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java
index a8e36ba..4a29115 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CTabFolderTab.java
@@ -146,7 +146,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = selectionForegroundColor;
- selectionForegroundColor = new Color (display, rgb);
+ selectionForegroundColor = new Color (rgb);
setSelectionForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -158,7 +158,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = selectionBackgroundColor;
- selectionBackgroundColor = new Color (display, rgb);
+ selectionBackgroundColor = new Color (rgb);
setSelectionBackground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -183,7 +183,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = itemForegroundColor;
- itemForegroundColor = new Color (display, rgb);
+ itemForegroundColor = new Color (rgb);
setItemForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -195,7 +195,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = itemBackgroundColor;
- itemBackgroundColor = new Color (display, rgb);
+ itemBackgroundColor = new Color (rgb);
setItemBackground ();
if (oldColor != null) oldColor.dispose ();
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LinkTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LinkTab.java
index 97af001..65e70a1 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LinkTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LinkTab.java
@@ -106,7 +106,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = linkForegroundColor;
- linkForegroundColor = new Color (display, rgb);
+ linkForegroundColor = new Color (rgb);
setLinkForeground ();
if (oldColor != null) oldColor.dispose ();
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
index 702c092..e7bc6a6 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
@@ -461,7 +461,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = foregroundColor; // save old foreground color to dispose when done
- foregroundColor = new Color (display, rgb);
+ foregroundColor = new Color (rgb);
setExampleWidgetForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -476,7 +476,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = backgroundColor; // save old background color to dispose when done
- backgroundColor = new Color (display, rgb);
+ backgroundColor = new Color (rgb);
setExampleWidgetBackground ();
if (oldColor != null) oldColor.dispose ();
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
index 061c0bf..1a85041 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
@@ -145,7 +145,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = itemForegroundColor;
- itemForegroundColor = new Color (display, rgb);
+ itemForegroundColor = new Color (rgb);
setItemForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -157,7 +157,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = itemBackgroundColor;
- itemBackgroundColor = new Color (display, rgb);
+ itemBackgroundColor = new Color (rgb);
setItemBackground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -182,7 +182,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = cellForegroundColor;
- cellForegroundColor = new Color (display, rgb);
+ cellForegroundColor = new Color (rgb);
setCellForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -194,7 +194,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = cellBackgroundColor;
- cellBackgroundColor = new Color (display, rgb);
+ cellBackgroundColor = new Color (rgb);
setCellBackground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -219,7 +219,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = headerForegroundColor;
- headerForegroundColor = new Color (display, rgb);
+ headerForegroundColor = new Color (rgb);
setHeaderForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -231,7 +231,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = headerBackgroundColor;
- headerBackgroundColor = new Color (display, rgb);
+ headerBackgroundColor = new Color (rgb);
setHeaderBackground ();
if (oldColor != null) oldColor.dispose ();
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
index f804656..95c3c06 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
@@ -147,7 +147,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = itemForegroundColor;
- itemForegroundColor = new Color (display, rgb);
+ itemForegroundColor = new Color (rgb);
setItemForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -159,7 +159,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = itemBackgroundColor;
- itemBackgroundColor = new Color (display, rgb);
+ itemBackgroundColor = new Color (rgb);
setItemBackground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -184,7 +184,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = cellForegroundColor;
- cellForegroundColor = new Color (display, rgb);
+ cellForegroundColor = new Color (rgb);
setCellForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -196,7 +196,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = cellBackgroundColor;
- cellBackgroundColor = new Color (display, rgb);
+ cellBackgroundColor = new Color (rgb);
setCellBackground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -221,7 +221,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = headerForegroundColor;
- headerForegroundColor = new Color (display, rgb);
+ headerForegroundColor = new Color (rgb);
setHeaderForeground ();
if (oldColor != null) oldColor.dispose ();
}
@@ -233,7 +233,7 @@
RGB rgb = colorDialog.open();
if (rgb == null) return;
oldColor = headerBackgroundColor;
- headerBackgroundColor = new Color (display, rgb);
+ headerBackgroundColor = new Color (rgb);
setHeaderBackground ();
if (oldColor != null) oldColor.dispose ();
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java
index 9dc8921..2dcfe05 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/ColorMenu.java
@@ -314,7 +314,7 @@
RGB rgb = dialog.open();
if (rgb == null) return;
if (customColor != null) customColor.dispose();
- customColor = new Color(display, rgb);
+ customColor = new Color(rgb);
if (customPatternMI != null) customPatternMI.setImage(null);
if (customGradientMI != null) customGradientMI.setImage(null);
if (customImage != null) customImage.dispose();
@@ -354,8 +354,8 @@
dialog.setSecondRGB(background.getBgColor2().getRGB());
}
if (dialog.open() != SWT.OK) return;
- Color colorA = new Color(display, dialog.getFirstRGB());
- Color colorB = new Color(display, dialog.getSecondRGB());
+ Color colorA = new Color(dialog.getFirstRGB());
+ Color colorB = new Color(dialog.getSecondRGB());
if (colorA == null || colorB == null) return;
if (customColorMI != null) customColorMI.setImage(null);
if (customPatternMI != null) customPatternMI.setImage(null);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java
index 3eeeb3b..494c930 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GradientDialog.java
@@ -145,8 +145,8 @@
canvas.addListener (SWT.Paint, e -> {
Image preview = null;
Point size = canvas.getSize();
- Color color1 = new Color(display, rgb1);
- Color color2 = new Color(display, rgb2);
+ Color color1 = new Color(rgb1);
+ Color color2 = new Color(rgb2);
preview = GraphicsExample.createImage(display, color1, color2, size.x, size.y);
if (preview != null) {
e.gc.drawImage (preview, 0, 0);
@@ -174,7 +174,7 @@
// color controls: first color
colorButton1 = new Button(colorButtonComp, SWT.PUSH);
colorButton1.setText(GraphicsExample.getResourceString("GradientDlgButton1"));
- Color color1 = new Color(display, rgb1);
+ Color color1 = new Color(rgb1);
Image img1 = GraphicsExample.createImage(display, color1);
color1.dispose();
colorButton1.setImage(img1);
@@ -196,7 +196,7 @@
// color controls: second color
colorButton2 = new Button(colorButtonComp, SWT.PUSH);
colorButton2.setText(GraphicsExample.getResourceString("GradientDlgButton2"));
- Color color2 = new Color(display, rgb2);
+ Color color2 = new Color(rgb2);
Image img2 = GraphicsExample.createImage(display, color2);
color2.dispose();
colorButton2.setImage(img2);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java
index d30158c..b4bf6c3 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java
@@ -40,7 +40,7 @@
}
public Shell open (Display display) {
- final Color red = new Color(display, 0xFF, 0, 0);
+ final Color red = new Color(0xFF, 0, 0);
final Shell shell = new Shell (display);
shell.addPaintListener(event -> {
GC gc = event.gc;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
index 4e3b0fb..782233c 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
@@ -230,11 +230,11 @@
});
// Create colors and fonts.
- whiteColor = new Color(display, 255, 255, 255);
- blackColor = new Color(display, 0, 0, 0);
- redColor = new Color(display, 255, 0, 0);
- greenColor = new Color(display, 0, 255, 0);
- blueColor = new Color(display, 0, 0, 255);
+ whiteColor = new Color(255, 255, 255);
+ blackColor = new Color(0, 0, 0);
+ redColor = new Color(255, 0, 0);
+ greenColor = new Color(0, 255, 0);
+ blueColor = new Color(0, 0, 255);
fixedWidthFont = new Font(display, "courier", 10, 0);
crossCursor = display.getSystemCursor(SWT.CURSOR_CROSS);
@@ -1486,7 +1486,7 @@
if (showBackground && backgroundPixel != -1) {
// Fill with the background color.
RGB backgroundRGB = imageData.palette.getRGB(backgroundPixel);
- bgColor = new Color(null, backgroundRGB);
+ bgColor = new Color(backgroundRGB);
}
try {
offScreenImageGC.setBackground(bgColor != null ? bgColor : canvasBackground);
@@ -1854,7 +1854,7 @@
int y = (i+1) * 10 + py;
gc.drawString(String.valueOf(i), 10, y, true);
gc.drawString(toHexByteString(rgbs[i].red) + toHexByteString(rgbs[i].green) + toHexByteString(rgbs[i].blue), xTab1, y, true);
- Color color = new Color(display, rgbs[i]);
+ Color color = new Color(rgbs[i]);
gc.setBackground(color);
gc.fillRectangle(xTab2, y+2, 10, 10);
color.dispose();
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
index dbaab82..98970b0 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,7 +28,6 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
class JavaLineStyler implements LineStyleListener {
JavaScanner scanner = new JavaScanner();
@@ -73,12 +72,11 @@
}
void initializeColors() {
- Display display = Display.getDefault();
colors= new Color[] {
- new Color(display, new RGB(0, 0, 0)), // black
- new Color(display, new RGB(255, 0, 0)), // red
- new Color(display, new RGB(0, 255, 0)), // green
- new Color(display, new RGB(0, 0, 255)) // blue
+ new Color(new RGB(0, 0, 0)), // black
+ new Color(new RGB(255, 0, 0)), // red
+ new Color(new RGB(0, 255, 0)), // green
+ new Color(new RGB(0, 0, 255)) // blue
};
tokenColors= new int[MAXIMUM_TOKEN];
tokenColors[WORD]= 0;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintExample.java
index 26d8369..2810d0f 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/paint/PaintExample.java
@@ -411,8 +411,8 @@
private void init() {
Display display = mainComposite.getDisplay();
- paintColorWhite = new Color(display, 255, 255, 255);
- paintColorBlack = new Color(display, 0, 0, 0);
+ paintColorWhite = new Color(255, 255, 255);
+ paintColorBlack = new Color(0, 0, 0);
paintDefaultFont = display.getSystemFont();
@@ -420,8 +420,8 @@
paintColors[0] = paintColorBlack;
paintColors[1] = paintColorWhite;
for (int i = 2; i < paintColors.length; i++) {
- paintColors[i] = new Color(display,
- ((i*7)%255),((i*23)%255), ((i*51)%255));
+ paintColors[i] = new Color(((i*7)%255),
+ ((i*23)%255),((i*51)%255));
}
toolSettings = new ToolSettings();
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 ee52e36..0b0a067 100644
--- 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
@@ -558,7 +558,7 @@
if (newRgb != null) {
if (!newRgb.equals(rgb)) {
disposeResource(underlineColor);
- underlineColor = new Color(display, newRgb);
+ underlineColor = new Color(newRgb);
}
if (underlineSingleItem.getSelection()) setStyle(UNDERLINE_SINGLE);
else if (underlineDoubleItem.getSelection()) setStyle(UNDERLINE_DOUBLE);
@@ -596,7 +596,7 @@
if (newRgb == null) return;
if (!newRgb.equals(rgb)) {
disposeResource(strikeoutColor);
- strikeoutColor = new Color(display, newRgb);
+ strikeoutColor = new Color(newRgb);
}
}
setStyle(STRIKEOUT);
@@ -638,7 +638,7 @@
if (newRgb != null) {
if (!newRgb.equals(rgb)) {
disposeResource(borderColor);
- borderColor = new Color(display, newRgb);
+ borderColor = new Color(newRgb);
}
if (borderDashItem.getSelection()) setStyle(BORDER_DASH);
else if (borderDotItem.getSelection()) setStyle(BORDER_DOT);
@@ -674,7 +674,7 @@
if (newRgb == null) return;
if (!newRgb.equals(rgb)) {
disposeResource(textForeground);
- textForeground = new Color(display, newRgb);
+ textForeground = new Color(newRgb);
}
}
setStyle(FOREGROUND);
@@ -692,7 +692,7 @@
if (newRgb == null) return;
if (!newRgb.equals(rgb)) {
disposeResource(textBackground);
- textBackground = new Color(display, newRgb);
+ textBackground = new Color(newRgb);
}
}
setStyle(BACKGROUND);
@@ -944,13 +944,13 @@
int red = Integer.parseInt(tokenizer.nextToken());
int green = Integer.parseInt(tokenizer.nextToken());
int blue = Integer.parseInt(tokenizer.nextToken());
- range.foreground = new Color(display, red, green, blue);
+ range.foreground = new Color(red, green, blue);
}
if (tokenizer.hasMoreTokens()) {
int red = Integer.parseInt(tokenizer.nextToken());
int green = Integer.parseInt(tokenizer.nextToken());
int blue = Integer.parseInt(tokenizer.nextToken());
- range.background = new Color(display, red, green, blue);
+ range.background = new Color(red, green, blue);
}
if (count >= styles.length) {
StyleRange[] newStyles = new StyleRange[styles.length + 256];
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java
index add8f37..589430e 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java
@@ -153,7 +153,7 @@
RGB rgb = colorDialog.open();
if (rgb != null) {
if (foregroundColor != null) foregroundColor.dispose();
- foregroundColor = new Color(display, rgb);
+ foregroundColor = new Color(rgb);
text.setForeground(foregroundColor);
}
}
@@ -164,7 +164,7 @@
RGB rgb = colorDialog.open();
if (rgb != null) {
if (backgroundColor != null) backgroundColor.dispose();
- backgroundColor = new Color(display, rgb);
+ backgroundColor = new Color(rgb);
text.setBackground(backgroundColor);
}
}
@@ -216,8 +216,8 @@
/* Create printer GC, and create and set the printer font & foreground color. */
gc = new GC(printer);
Font printerFont = new Font(printer, printerFontData);
- Color printerForegroundColor = new Color(printer, printerForeground);
- Color printerBackgroundColor = new Color(printer, printerBackground);
+ Color printerForegroundColor = new Color(printerForeground);
+ Color printerBackgroundColor = new Color(printerBackground);
gc.setFont(printerFont);
gc.setForeground(printerForegroundColor);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java
index eb8d4e9..a7c3edc 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java
@@ -89,7 +89,7 @@
/* Fill with the background color before drawing. */
Color bgColor = null;
if (useGIFBackground && loader.backgroundPixel != -1) {
- bgColor = new Color(display, imageData.palette.getRGB(loader.backgroundPixel));
+ bgColor = new Color(imageData.palette.getRGB(loader.backgroundPixel));
}
offScreenImageGC.setBackground(bgColor != null ? bgColor : shellBackground);
offScreenImageGC.fillRectangle(imageData.x, imageData.y, imageData.width, imageData.height);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java
index 9a1eeb7..f6ed546 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java
@@ -49,7 +49,7 @@
System.out.println("default link color " + link.getLinkForeground());
ColorDialog colorDialog = new ColorDialog(shell);
RGB color = colorDialog.open();
- link.setLinkForeground(new Color(display, color));
+ link.setLinkForeground(new Color(color));
System.out.println("user selected link color " + link.getLinkForeground());
}));
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194.java
index e84e2c2..d5612f3 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet194.java
@@ -43,10 +43,10 @@
redRGB, // 1
greenRGB, // 2
blueRGB); // 3
- white = new Color(display, whiteRGB);
- red = new Color(display, redRGB);
- green = new Color(display, greenRGB);
- blue = new Color(display, blueRGB);
+ white = new Color(whiteRGB);
+ red = new Color(redRGB);
+ green = new Color(greenRGB);
+ blue = new Color(blueRGB);
font = new Font(display, "Comic Sans MS", 24, SWT.BOLD);
ImageData[] data = new ImageData[4];
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet280.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet280.java
index 8860bac..488be41 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet280.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet280.java
@@ -34,15 +34,15 @@
shell.addListener (SWT.Paint, e -> {
GC gc = e.gc;
Rectangle rect = shell.getClientArea ();
- Color color1 = new Color (display, 234, 246, 253);
- Color color2 = new Color (display, 217, 240, 252);
+ Color color1 = new Color (234, 246, 253);
+ Color color2 = new Color (217, 240, 252);
gc.setForeground(color1);
gc.setBackground(color2);
gc.fillGradientRectangle (rect.x, rect.y, rect.width, rect.height / 2, true);
color1.dispose ();
color2.dispose ();
- Color color3 = new Color (display, 190, 230, 253);
- Color color4 = new Color (display, 167, 217, 245);
+ Color color3 = new Color (190, 230, 253);
+ Color color4 = new Color (167, 217, 245);
gc.setForeground(color3);
gc.setBackground(color4);
gc.fillGradientRectangle (rect.x, rect.y + (rect.height / 2), rect.width, rect.height / 2 + 1, true);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet281.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet281.java
index ebbfb8f..2c003c2 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet281.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet281.java
@@ -34,10 +34,10 @@
shell.addListener (SWT.Paint, e -> {
GC gc = e.gc;
Rectangle rect = shell.getClientArea ();
- Color color1 = new Color (display, 234, 246, 253);
- Color color2 = new Color (display, 217, 240, 252);
- Color color3 = new Color (display, 190, 230, 253);
- Color color4 = new Color (display, 167, 217, 245);
+ Color color1 = new Color (234, 246, 253);
+ Color color2 = new Color (217, 240, 252);
+ Color color3 = new Color (190, 230, 253);
+ Color color4 = new Color (167, 217, 245);
Pattern p1 = new Pattern (display, 0, 0, 0, rect.height / 2, color1, color2);
gc.setBackgroundPattern (p1);
gc.fillRectangle (rect.x, rect.y, rect.width, rect.height / 2);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.java
index 09e191e..20ba6d9 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.java
@@ -111,7 +111,7 @@
/* Fill with the background color before drawing. */
Color bgColor = null;
if (useGIFBackground && loader[i].backgroundPixel != -1) {
- bgColor = new Color(display, imageData.palette.getRGB(loader[i].backgroundPixel));
+ bgColor = new Color(imageData.palette.getRGB(loader[i].backgroundPixel));
}
gc.setBackground(bgColor != null ? bgColor : shellBackground);
gc.fillRectangle(imageData.x, imageData.y, imageData.width, imageData.height);
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet316.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet316.java
index b1024e8..a291cf4 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet316.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet316.java
@@ -41,7 +41,7 @@
italic.font = font;
text.setStyleRanges(new int[] {0, text.getCharCount()}, new StyleRange[] {italic});
text.setMargins(30, 30, 30, 30);
- Color color = new Color (display, 138, 226, 255);
+ Color color = new Color (138, 226, 255);
text.setMarginColor(color);
shell.setSize(500, 300);
shell.open ();
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet357.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet357.java
index ed1d790..a6fd086 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet357.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet357.java
@@ -50,11 +50,11 @@
StyleRange style = new StyleRange(textStyle);
/* Create new graphics resources because the old ones are only valid during the event. */
if (textStyle.font != null) style.font = new Font(display, textStyle.font.getFontData());
- if (textStyle.foreground != null) style.foreground = new Color(display, textStyle.foreground.getRGB());
- if (textStyle.background != null) style.background = new Color(display, textStyle.background.getRGB());
- if (textStyle.underlineColor != null) style.underlineColor = new Color(display, textStyle.underlineColor.getRGB());
- if (textStyle.strikeoutColor != null) style.strikeoutColor = new Color(display, textStyle.strikeoutColor.getRGB());
- if (textStyle.borderColor != null) style.borderColor = new Color(display, textStyle.borderColor.getRGB());
+ if (textStyle.foreground != null) style.foreground = new Color(textStyle.foreground.getRGB());
+ if (textStyle.background != null) style.background = new Color(textStyle.background.getRGB());
+ if (textStyle.underlineColor != null) style.underlineColor = new Color(textStyle.underlineColor.getRGB());
+ if (textStyle.strikeoutColor != null) style.strikeoutColor = new Color(textStyle.strikeoutColor.getRGB());
+ if (textStyle.borderColor != null) style.borderColor = new Color(textStyle.borderColor.getRGB());
/* Set the StyleRange into the StyledText. */
style.start = e.start;
style.length = e.end - e.start;
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java
index dfda156..fda3bc3 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java
@@ -165,7 +165,7 @@
link.setBackground(null);
scale.setBackground(null);
RGB rgb = display.getSystemColor(SWT.COLOR_CYAN).getRGB();
- radio.setBackground(new Color(display, new RGBA(rgb.red, rgb.blue, rgb.green, 255)));
+ radio.setBackground(new Color(new RGBA(rgb.red, rgb.blue, rgb.green, 255)));
check.setBackgroundImage(getBackgroundImage(display));
group.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
sash.setBackground(display.getSystemColor(SWT.COLOR_DARK_CYAN));
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java
index 8d244b5..ae3783c 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug138265_SystemMemoryUsage.java
@@ -81,7 +81,7 @@
}
});
-color = new Color(display, new RGB(31,150,192));
+color = new Color(new RGB(31,150,192));
}
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java
index 86a300b..be0bd71 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug175964_LTRClippingGC.java
@@ -35,7 +35,7 @@
static Color lightGray;
public static void main(String [] args) {
Display display = new Display();
- lightGray = new Color(null, 192, 192, 192);
+ lightGray = new Color(192, 192, 192);
final Image image = display.getSystemImage(SWT.ICON_INFORMATION);
Shell shell = new Shell(display);
shell.setText("Clipping rectangle for an RTL widget.tree");//"Images on the right side of the TreeItem");
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java
index 7eff00e..032b15c 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug307441_DnDOverlappingControls.java
@@ -62,13 +62,13 @@
Rectangle clientArea = dropComp.getClientArea();
final Label label2 = new Label (dropComp, SWT.BORDER);
- label2.setBackground(new Color(null,255,255,0));
+ label2.setBackground(new Color(255,255,0));
label2.setText("DropLabel1");
label2.setSize(100,100);
label2.setBounds(clientArea.x, clientArea.y, clientArea.width, (clientArea.height*2)/3);
final Label label3 = new Label (dropComp, SWT.BORDER);
- label3.setBackground(new Color(null, 255, 0,0));
+ label3.setBackground(new Color(255, 0, 0));
label3.setText("DropLabel2");
label3.setSize(100,100);
label3.setBounds(clientArea.x+10, clientArea.y+clientArea.height/3, clientArea.width-10, clientArea.height/2);
@@ -171,7 +171,7 @@
event.detail = DND.DROP_NONE;
return;
}
- control.setBackground(new Color(null,0,0,255));
+ control.setBackground(new Color(0,0,255));
}
@Override
public void dragLeave(DropTargetEvent arg0) {
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java
index 586ff4e..5d3628f 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug393723_checkForegroundBug.java
@@ -30,7 +30,7 @@
System.out.println("shell fore=" + shell.getForeground());
System.out.println("back=" + comp.getBackground());
System.out.println("fore=" + comp.getForeground());
- shell.setForeground(new Color(display, 240, 240, 240));
+ shell.setForeground(new Color(240, 240, 240));
comp.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
System.out.println("after");
System.out.println("shell back=" + shell.getBackground());
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java
index 1646afa..2c081f5 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug477950_SystemColors.java
@@ -59,64 +59,64 @@
actualRGBA.setWidth(150);
Color [] colArray;
Map<String, Color []> map = new HashMap<>();
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW), new Color (display, 0,0,0)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW), new Color (0, 0,0)};
map.put("COLOR_WIDGET_DARK_SHADOW", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), new Color (display, 164,164,161)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), new Color (164, 164,161)};
map.put("COLOR_WIDGET_NORMAL_SHADOW", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW), new Color (display, 232,232,231)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW), new Color (232, 232,231)};
map.put("COLOR_WIDGET_LIGHT_SHADOW", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW), new Color (display, 255,255,255)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW), new Color (255, 255,255)};
map.put("COLOR_WIDGET_HIGHLIGHT_SHADOW", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND), new Color (display, 46,52,54)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND), new Color (46, 52,54)};
map.put("COLOR_WIDGET_FOREGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND), new Color (display, 232,232,231)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND), new Color (232, 232,231)};
map.put("COLOR_WIDGET_BACKGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BORDER), new Color (display, 0,0,0)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_WIDGET_BORDER), new Color (0, 0,0)};
map.put("COLOR_WIDGET_BORDER", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_FOREGROUND), new Color (display, 0,0,0)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_FOREGROUND), new Color (0, 0,0)};
map.put("COLOR_LIST_FOREGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_BACKGROUND), new Color (display, 255,255,255)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_BACKGROUND), new Color (255, 255,255)};
map.put("COLOR_LIST_BACKGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION), new Color (display, 74,144,217)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION), new Color (74, 144,217)};
map.put("COLOR_LIST_SELECTION", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), new Color (display, 255,255,255)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), new Color (255, 255,255)};
map.put("COLOR_LIST_SELECTION_TEXT", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_FOREGROUND), new Color (display, 255,255,255)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_FOREGROUND), new Color (255, 255,255)};
map.put("COLOR_INFO_FOREGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_BACKGROUND), new Color (display, 0,0,0)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_INFO_BACKGROUND), new Color (0, 0,0)};
map.put("COLOR_INFO_BACKGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_FOREGROUND), new Color (display, 255,255,255)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_FOREGROUND), new Color (255, 255,255)};
map.put("COLOR_TITLE_FOREGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), new Color (display, 74,144,217)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), new Color (74, 144,217)};
map.put("COLOR_TITLE_BACKGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT), new Color (display, 133,188,246)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT), new Color (133, 188,246)};
map.put("COLOR_TITLE_BACKGROUND_GRADIENT", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND), new Color (display, 139,142,143)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND), new Color (139, 142,143)};
map.put("COLOR_TITLE_INACTIVE_FOREGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND), new Color (display, 241,241,241)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND), new Color (241, 241,241)};
map.put("COLOR_TITLE_INACTIVE_BACKGROUND", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT), new Color (display, 255,255,255)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT), new Color (255, 255,255)};
map.put("COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT", colArray);
- colArray = new Color [] {display.getSystemColor(SWT.COLOR_LINK_FOREGROUND), new Color (display, 42,118,198)};
+ colArray = new Color [] {display.getSystemColor(SWT.COLOR_LINK_FOREGROUND), new Color (42, 118,198)};
map.put("COLOR_LINK_FOREGROUND", colArray);
for (Entry<String, Color[]> entry : map.entrySet()) {
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java
index 96e2e06..84c50e0 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug530969_ControlPrint.java
@@ -50,7 +50,7 @@
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display, SWT.NO_TRIM);
- Color gray = new Color (display, 222, 223, 224);
+ Color gray = new Color (222, 223, 224);
Composite composite = new Composite(shell, SWT.NONE);
RowLayout layout = new RowLayout();
layout.marginTop = 0;
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java
index e7f167b..eb6a672 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug558222_BlackIcon.java
@@ -44,7 +44,7 @@
*/
Color border = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
Color background = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- Color backgroundHot = new Color(display, new RGB(252, 160, 160));
+ Color backgroundHot = new Color(new RGB(252, 160, 160));
Color transparent = display.getSystemColor(SWT.COLOR_MAGENTA);
PaletteData palette = new PaletteData(new RGB[] { transparent.getRGB(), border.getRGB(), background.getRGB(), backgroundHot.getRGB() });
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java
index b3af29d..a804d46 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug85131_ToolTipSetNull.java
@@ -48,9 +48,9 @@
int hm = r.height/8;
int rw = w2-wm, rh = r.height-2*hm;
- e.gc.setBackground( new Color(null,200,0,0) );
+ e.gc.setBackground( new Color(200,0,0) );
e.gc.fillRectangle( 0,hm,w2,rh);
- e.gc.setBackground( new Color(null,0,0,200) );
+ e.gc.setBackground( new Color(0,0,200) );
e.gc.fillRectangle( w2,hm+hm,rw+wm,rh-hm);
}
});
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
index c905190..826ba77 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,7 +28,6 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
@@ -161,8 +160,7 @@
@Test
public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
boolean exceptionThrown = false;
- Device d = null;
- Color colors[] = {new Color(d, 0, 0, 0), new Color(d, 255, 255, 255), new Color(d, 0, 45, 255)};
+ Color colors[] = {new Color(0, 0, 0), new Color(255, 255, 255), new Color(0, 45, 255)};
try {
for(int i=0; i<3; i++) {
ccombo.setBackground(colors[i]);
@@ -253,10 +251,9 @@
@Test
public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
boolean exceptionThrown = false;
- Device d = null;
- Color c1 = new Color(d, 0, 0, 0);
- Color c2 = new Color(d, 255, 255, 255);
- Color c3 = new Color(d, 23, 45, 151);
+ Color c1 = new Color(0, 0, 0);
+ Color c2 = new Color(255, 255, 255);
+ Color c3 = new Color(23, 45, 151);
try {
ccombo.setForeground(c1);
ccombo.setForeground(c2);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java
index 897f81a..66e49ff 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -27,7 +27,6 @@
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -46,10 +45,9 @@
return colors.get(rgb);
}
protected void initializeColors() {
- Display display = Display.getDefault();
- colors.put(RED, new Color (display, RED));
- colors.put(GREEN, new Color (display, GREEN));
- colors.put(BLUE, new Color (display, BLUE));
+ colors.put(RED, new Color (RED));
+ colors.put(GREEN, new Color (GREEN));
+ colors.put(BLUE, new Color (BLUE));
}
@Before
@@ -121,7 +119,7 @@
@Test
public void test_hashCode() {
Set<StyleRange> set = new HashSet<>();
- Color testColor = new Color(Display.getDefault(), 0, 0, 0);
+ Color testColor = new Color(0, 0, 0);
//regression test for bug 30924
set.add(new StyleRange());
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
index 0c4f185..1f765a5 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -163,13 +163,12 @@
}
// this method must not be public so that the auto-gen tool keeps it
protected void initializeColors() {
- Display display = Display.getDefault();
- colors.put(RED, new Color (display, RED));
- colors.put(BLUE, new Color (display, BLUE));
- colors.put(GREEN, new Color (display, GREEN));
- colors.put(YELLOW, new Color (display, YELLOW));
- colors.put(CYAN, new Color (display, CYAN));
- colors.put(PURPLE, new Color (display, PURPLE));
+ colors.put(RED, new Color (RED));
+ colors.put(BLUE, new Color (BLUE));
+ colors.put(GREEN, new Color (GREEN));
+ colors.put(YELLOW, new Color (YELLOW));
+ colors.put(CYAN, new Color (CYAN));
+ colors.put(PURPLE, new Color (PURPLE));
}
@Override
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java
index f73b11b..b171187 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java
@@ -213,9 +213,9 @@
@Test
public void test_drawImageLorg_eclipse_swt_graphics_ImageII() {
- Color c1 = new Color(display, 255, 0, 0);
- Color c2 = new Color(display, 0, 0, 0);
- Color c3 = new Color(display, 255, 255, 0);
+ Color c1 = new Color(255, 0, 0);
+ Color c2 = new Color(0, 0, 0);
+ Color c3 = new Color(255, 255, 0);
PaletteData paletteData = new PaletteData(c1.getRGB(), c2.getRGB(), c3.getRGB());
ImageData data = new ImageData(30,30, 8, paletteData);
@@ -257,9 +257,9 @@
@Test
public void test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII() {
- Color c1 = new Color(display, 255, 0, 0);
- Color c2 = new Color(display, 0, 0, 0);
- Color c3 = new Color(display, 255, 255, 0);
+ Color c1 = new Color(255, 0, 0);
+ Color c2 = new Color(0, 0, 0);
+ Color c3 = new Color(255, 255, 0);
PaletteData paletteData = new PaletteData(c1.getRGB(), c2.getRGB(), c3.getRGB());
ImageData data = new ImageData(30,30, 8, paletteData);
@@ -507,7 +507,7 @@
@Test
public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(shell.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
gc.setBackground(color);
assertEquals(color, gc.getBackground());
try {
@@ -571,7 +571,7 @@
@Test
public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(shell.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
gc.setForeground(color);
assertEquals(color, gc.getForeground());
try {
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
index 8a78044..ee066d9 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
@@ -934,7 +934,7 @@
}
image = new Image(display, 10, 10);
- Color color = new Color(display, 255, 255, 255);
+ Color color = new Color(255, 255, 255);
color.dispose();
try {
image.setBackground(color);
@@ -947,7 +947,7 @@
image = new Image(display, 10, 10);
image.dispose();
- color = new Color(display, 255, 255, 255);
+ color = new Color(255, 255, 255);
try {
image.setBackground(color);
fail("No exception thrown for disposed image");
@@ -1015,7 +1015,7 @@
void getImageData2(int depth, PaletteData palette) {
int width = 10;
int height = 10;
- Color color = new Color(display, 0, 0xff, 0);
+ Color color = new Color(0, 0xff, 0);
RGB colorRGB = color.getRGB();
ImageData imageData = new ImageData(width, height, depth, palette);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java
index 2edca62..8b187f2 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java
@@ -179,7 +179,7 @@
@Test
public void test_setBackgroundCheckButton() {
Button checkButton = new Button(shell, SWT.CHECK);
- Color color = new Color(checkButton.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
checkButton.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.CHECK Button",
color, checkButton.getBackground());
@@ -187,7 +187,7 @@
assertTrue("getBackground unchanged after setBackground(null) for SWT.CHECK Button",
!checkButton.getBackground().equals(color));
color.dispose();
- color = new Color(checkButton.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
checkButton.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.CHECK Button",
color, checkButton.getBackground());
@@ -195,7 +195,7 @@
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.CHECK Button",
!checkButton.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(checkButton.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
checkButton.setBackground(color);
checkButton.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.CHECK Button",
@@ -211,10 +211,10 @@
@Test
public void test_setBackgroundAlphaCheckButton() {
Button checkButton = new Button(shell, SWT.CHECK);
- Color color = new Color (checkButton.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
checkButton.setBackground(color);
assertEquals(color, checkButton.getBackground());
- Color fg = new Color(checkButton.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
checkButton.setForeground(fg);
assertEquals(color, checkButton.getBackground());
color.dispose();
@@ -225,7 +225,7 @@
@Test
public void test_setBackgroundRadioButton() {
Button radioButton = new Button(shell, SWT.RADIO);
- Color color = new Color(radioButton.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
radioButton.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.RADIO Button",
color, radioButton.getBackground());
@@ -233,7 +233,7 @@
assertTrue("getBackground unchanged after setBackground(null) for SWT.RADIO Button",
!radioButton.getBackground().equals(color));
color.dispose();
- color = new Color(radioButton.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
radioButton.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.RADIO Button",
color, radioButton.getBackground());
@@ -241,7 +241,7 @@
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.RADIO Button",
!radioButton.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(radioButton.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
radioButton.setBackground(color);
radioButton.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.RADIO Button",
@@ -257,10 +257,10 @@
@Test
public void test_setBackgroundAlphaRadioButton() {
Button radioButton = new Button(shell, SWT.RADIO);
- Color color = new Color (radioButton.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
radioButton.setBackground(color);
assertEquals(color, radioButton.getBackground());
- Color fg = new Color(radioButton.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
radioButton.setForeground(fg);
assertEquals(color, radioButton.getBackground());
color.dispose();
@@ -278,13 +278,13 @@
@Test
public void test_setForegroundCheckButton() {
Button checkButton = new Button(shell, SWT.CHECK);
- Color color = new Color(checkButton.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
checkButton.setForeground(color);
assertEquals(color, checkButton.getForeground());
checkButton.setForeground(null);
assertFalse(checkButton.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(checkButton.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
checkButton.setForeground(color);
checkButton.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.CHECK Button",
@@ -302,10 +302,10 @@
Button checkButton = new Button(shell, SWT.CHECK);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (checkButton.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
checkButton.setForeground(color);
assertEquals(color, checkButton.getForeground());
- Color bg = new Color(checkButton.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
checkButton.setBackground(bg);
assertEquals(color, checkButton.getForeground());
color.dispose();
@@ -316,13 +316,13 @@
@Test
public void test_setForegroundRadioButton() {
Button radioButton = new Button(shell, SWT.RADIO);
- Color color = new Color(radioButton.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
radioButton.setForeground(color);
assertEquals(color, radioButton.getForeground());
radioButton.setForeground(null);
assertFalse(radioButton.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(radioButton.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
radioButton.setForeground(color);
radioButton.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.RADIO Button",
@@ -340,10 +340,10 @@
Button radioButton = new Button(shell, SWT.RADIO);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (radioButton.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
radioButton.setForeground(color);
assertEquals(color, radioButton.getForeground());
- Color bg = new Color(radioButton.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
radioButton.setBackground(bg);
assertEquals(color, radioButton.getForeground());
color.dispose();
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
index 35e3866..1b11771 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
@@ -759,7 +759,7 @@
@Test
public void test_setBackgroundDropDownCombo() {
Combo dropDown = new Combo(shell, SWT.DROP_DOWN);
- Color color = new Color(dropDown.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
dropDown.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.DROP_DOWN Combo",
color, dropDown.getBackground());
@@ -767,7 +767,7 @@
assertTrue("getBackground unchanged after setBackground(null) for SWT.DROP_DOWN Combo",
!dropDown.getBackground().equals(color));
color.dispose();
- color = new Color(dropDown.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
dropDown.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.DROP_DOWN Combo",
color, dropDown.getBackground());
@@ -775,7 +775,7 @@
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.DROP_DOWN Combo",
!dropDown.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(dropDown.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
dropDown.setBackground(color);
dropDown.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.DROP_DOWN Combo",
@@ -791,10 +791,10 @@
@Test
public void test_setBackgroundAlphaDropDownCombo() {
Combo dropDown = new Combo(shell, SWT.DROP_DOWN);
- Color color = new Color (dropDown.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
dropDown.setBackground(color);
assertEquals(color, dropDown.getBackground());
- Color fg = new Color(dropDown.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
dropDown.setForeground(fg);
assertEquals(color, dropDown.getBackground());
color.dispose();
@@ -805,7 +805,7 @@
@Test
public void test_setBackgroundSimpleCombo() {
Combo simple = new Combo(shell, SWT.SIMPLE);
- Color color = new Color(simple.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
simple.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.SIMPLE Combo",
color, simple.getBackground());
@@ -813,7 +813,7 @@
assertTrue("getBackground unchanged after setBackground(null) for SWT.SIMPLE Combo",
!simple.getBackground().equals(color));
color.dispose();
- color = new Color(simple.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
simple.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.SIMPLE Combo",
color, simple.getBackground());
@@ -821,7 +821,7 @@
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.SIMPLE Combo",
!simple.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(simple.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
simple.setBackground(color);
simple.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.SIMPLE Combo",
@@ -837,10 +837,10 @@
@Test
public void test_setBackgroundAlphaSimpleCombo() {
Combo simple = new Combo(shell, SWT.SIMPLE);
- Color color = new Color (simple.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
simple.setBackground(color);
assertEquals(color, simple.getBackground());
- Color fg = new Color(simple.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
simple.setForeground(fg);
assertEquals(color, simple.getBackground());
color.dispose();
@@ -851,13 +851,13 @@
@Test
public void test_setForegroundDropDownCombo() {
Combo dropDown = new Combo(shell, SWT.DROP_DOWN);
- Color color = new Color(dropDown.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
dropDown.setForeground(color);
assertEquals(color, dropDown.getForeground());
dropDown.setForeground(null);
assertFalse(dropDown.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(dropDown.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
dropDown.setForeground(color);
dropDown.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.DROP_DOWN Combo",
@@ -875,10 +875,10 @@
Combo dropDown = new Combo(shell, SWT.DROP_DOWN);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (dropDown.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
dropDown.setForeground(color);
assertEquals(color, dropDown.getForeground());
- Color bg = new Color(dropDown.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
dropDown.setBackground(bg);
assertEquals(color, dropDown.getForeground());
color.dispose();
@@ -889,13 +889,13 @@
@Test
public void test_setForegroundSimpleCombo() {
Combo simple = new Combo(shell, SWT.SIMPLE);
- Color color = new Color(simple.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
simple.setForeground(color);
assertEquals(color, simple.getForeground());
simple.setForeground(null);
assertFalse(simple.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(simple.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
simple.setForeground(color);
simple.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.SIMPLE Combo",
@@ -913,10 +913,10 @@
Combo simple = new Combo(shell, SWT.SIMPLE);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (simple.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
simple.setForeground(color);
assertEquals(color, simple.getForeground());
- Color bg = new Color(simple.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
simple.setBackground(bg);
assertEquals(color, simple.getForeground());
color.dispose();
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
index 6346ca1..d08ad5a 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
@@ -606,19 +606,19 @@
}
@Test
public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(control.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
control.setBackground(color);
assertEquals("getBackground not equal color after setBackground(color) for " + control, color, control.getBackground());
control.setBackground(null);
assertTrue("getBackground unchanged after setBackground(null) for " + control, !control.getBackground().equals(color));
color.dispose();
- color = new Color(control.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
control.setBackground(color);
assertEquals("getBackground not equal color after setBackground(color) with 0 alpha for " + control + " " + control.getBackground(), color, control.getBackground());
control.setBackground(null);
assertTrue("getBackground unchanged after setBackground(null) alpha for " + control + " " + control.getBackground() + " " + control, !control.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(control.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
control.setBackground(color);
control.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for " + control,
@@ -630,10 +630,10 @@
}
@Test
public void test_setBackgroundAlphaLorg_eclipse_swt_graphics_Color() {
- Color color = new Color (control.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
control.setBackground(color);
assertEquals(color, control.getBackground());
- Color fg = new Color(control.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
control.setForeground(fg);
assertEquals(color, control.getBackground());
color.dispose();
@@ -641,7 +641,7 @@
}
@Test
public void test_setBackgroundDisposedColorLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(control.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
color.dispose();
try {
control.setBackground(color);
@@ -747,13 +747,13 @@
}
@Test
public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(control.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
control.setForeground(color);
assertEquals(color, control.getForeground());
control.setForeground(null);
assertFalse(control.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(control.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
control.setForeground(color);
control.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for " + control,
@@ -767,10 +767,10 @@
public void test_setForegroundAlphaLorg_eclipse_swt_graphics_Color() {
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (control.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
control.setForeground(color);
assertEquals(color, control.getForeground());
- Color bg = new Color(control.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
control.setBackground(bg);
assertEquals(color, control.getForeground());
color.dispose();
@@ -779,7 +779,7 @@
@Test
public void test_setForegroundDisposedColorLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(control.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
color.dispose();
try {
control.setForeground(color);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java
index a01e94f..a5b3005 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DateTime.java
@@ -152,7 +152,7 @@
@Test
public void test_setBackgroundCalendarDateTime() {
DateTime calendar = new DateTime(shell, SWT.CALENDAR);
- Color color = new Color(calendar.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
calendar.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.CALENDAR DateTime",
color, calendar.getBackground());
@@ -160,7 +160,7 @@
assertTrue("getBackground unchanged after setBackground(null) for SWT.CALENDAR DateTime",
!calendar.getBackground().equals(color));
color.dispose();
- color = new Color(calendar.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
calendar.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.CALENDAR DateTime",
color, calendar.getBackground());
@@ -168,7 +168,7 @@
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.CALENDAR DateTime",
!calendar.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(calendar.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
calendar.setBackground(color);
calendar.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.CALENDAR DateTime",
@@ -184,10 +184,10 @@
@Test
public void test_setBackgroundAlphaCalendarDateTime() {
DateTime calendar = new DateTime(shell, SWT.CALENDAR);
- Color color = new Color (calendar.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
calendar.setBackground(color);
assertEquals(color, calendar.getBackground());
- Color fg = new Color(calendar.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
calendar.setForeground(fg);
assertEquals(color, calendar.getBackground());
color.dispose();
@@ -198,7 +198,7 @@
@Test
public void test_setBackgroundTimeDateTime() {
DateTime time = new DateTime(shell, SWT.TIME);
- Color color = new Color(time.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
time.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.TIME DateTime",
color, time.getBackground());
@@ -206,7 +206,7 @@
assertTrue("getBackground unchanged after setBackground(null) for SWT.TIME DateTime",
!time.getBackground().equals(color));
color.dispose();
- color = new Color(time.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
time.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.TIME DateTime",
color, time.getBackground());
@@ -214,7 +214,7 @@
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.TIME DateTime",
!time.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(time.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
time.setBackground(color);
time.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.TIME DateTime",
@@ -230,10 +230,10 @@
@Test
public void test_setBackgroundAlphaTimeDateTime() {
DateTime time = new DateTime(shell, SWT.TIME);
- Color color = new Color (time.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
time.setBackground(color);
assertEquals(color, time.getBackground());
- Color fg = new Color(time.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
time.setForeground(fg);
assertEquals(color, time.getBackground());
color.dispose();
@@ -244,7 +244,7 @@
@Test
public void test_setBackgroundDateDateTime() {
DateTime date = new DateTime(shell, SWT.DATE);
- Color color = new Color(date.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
date.setBackground(color);
assertEquals("getBackground not equal after setBackground for SWT.DATE DateTime",
color, date.getBackground());
@@ -252,7 +252,7 @@
assertTrue("getBackground unchanged after setBackground(null) for SWT.DATE DateTime",
!date.getBackground().equals(color));
color.dispose();
- color = new Color(date.getDisplay(), 255, 0, 0, 0);
+ color = new Color(255, 0, 0, 0);
date.setBackground(color);
assertEquals("getBackground not equal after setBackground with 0 alpha for SWT.DATE DateTime",
color, date.getBackground());
@@ -260,7 +260,7 @@
assertTrue("getBackground unchanged after setBackground(null) with 0 alpha for SWT.DATE DateTime",
!date.getBackground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color fg = new Color(date.getDisplay(), 0, 255, 0);
+ Color fg = new Color(0, 255, 0);
date.setBackground(color);
date.setForeground(fg);
assertEquals("Setting a foreground disrupted the background color for SWT.DATE DateTime",
@@ -276,10 +276,10 @@
@Test
public void test_setBackgroundAlphaDateDateTime() {
DateTime date = new DateTime(shell, SWT.DATE);
- Color color = new Color (date.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
date.setBackground(color);
assertEquals(color, date.getBackground());
- Color fg = new Color(date.getDisplay(), 0, 255, 0, 0);
+ Color fg = new Color(0, 255, 0, 0);
date.setForeground(fg);
assertEquals(color, date.getBackground());
color.dispose();
@@ -416,13 +416,13 @@
@Test
public void test_setForegroundCalendarDateTime() {
DateTime calendar = new DateTime(shell, SWT.CALENDAR);
- Color color = new Color(calendar.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
calendar.setForeground(color);
assertEquals(color, calendar.getForeground());
calendar.setForeground(null);
assertFalse(calendar.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(calendar.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
calendar.setForeground(color);
calendar.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.CALENDAR DateTime",
@@ -440,10 +440,10 @@
DateTime calendar = new DateTime(shell, SWT.CALENDAR);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (calendar.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
calendar.setForeground(color);
assertEquals(color, calendar.getForeground());
- Color bg = new Color(calendar.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
calendar.setBackground(bg);
assertEquals(color, calendar.getForeground());
color.dispose();
@@ -454,13 +454,13 @@
@Test
public void test_setForegroundTimeDateTime() {
DateTime time = new DateTime(shell, SWT.TIME);
- Color color = new Color(time.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
time.setForeground(color);
assertEquals(color, time.getForeground());
time.setForeground(null);
assertFalse(time.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(time.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
time.setForeground(color);
time.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.TIME DateTime",
@@ -478,10 +478,10 @@
DateTime time = new DateTime(shell, SWT.TIME);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (time.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
time.setForeground(color);
assertEquals(color, time.getForeground());
- Color bg = new Color(time.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
time.setBackground(bg);
assertEquals(color, time.getForeground());
color.dispose();
@@ -492,13 +492,13 @@
@Test
public void test_setForegroundDateDateTime() {
DateTime date = new DateTime(shell, SWT.DATE);
- Color color = new Color(date.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
date.setForeground(color);
assertEquals(color, date.getForeground());
date.setForeground(null);
assertFalse(date.getForeground().equals(color));
if ("gtk".equals(SWT.getPlatform ())) {
- Color bg = new Color(date.getDisplay(), 0, 255, 0);
+ Color bg = new Color(0, 255, 0);
date.setForeground(color);
date.setBackground(bg);
assertEquals("Setting a background disrupted the foreground color for SWT.DATE DateTime",
@@ -516,10 +516,10 @@
DateTime date = new DateTime(shell, SWT.DATE);
assumeTrue("Alpha support for foreground colors does not exist on GTK2 or Win32",
SwtTestUtil.isCocoa || SwtTestUtil.isGTK);
- Color color = new Color (date.getDisplay(), 255, 0, 0, 0);
+ Color color = new Color (255, 0, 0, 0);
date.setForeground(color);
assertEquals(color, date.getForeground());
- Color bg = new Color(date.getDisplay(), 0, 255, 0, 0);
+ Color bg = new Color(0, 255, 0, 0);
date.setBackground(bg);
assertEquals(color, date.getForeground());
color.dispose();
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java
index b8ef51f..0c567b5 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Link.java
@@ -176,7 +176,7 @@
@Test
public void test_setLinkForegroundLorg_eclipse_swt_graphics_Color() {
assertNotNull(link.getLinkForeground());
- Color color = new Color(control.getDisplay(), 12, 34, 56);
+ Color color = new Color(12, 34, 56);
link.setLinkForeground(color);
assertEquals(color, link.getLinkForeground());
link.setLinkForeground(null);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java
index cfb4de6..59f0466 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java
@@ -1402,7 +1402,7 @@
@Test
public void test_setHeaderBackgroundLorg_eclipse_swt_graphics_Color() {
assertNotNull(table.getHeaderBackground());
- Color color = new Color(control.getDisplay(), 12, 34, 56);
+ Color color = new Color(12, 34, 56);
table.setHeaderBackground(color);
assertEquals(color, table.getHeaderBackground());
table.setHeaderBackground(null);
@@ -1413,7 +1413,7 @@
@Test
public void test_setHeaderForegroundLorg_eclipse_swt_graphics_Color() {
assertNotNull(table.getHeaderForeground());
- Color color = new Color(control.getDisplay(), 12, 34, 56);
+ Color color = new Color(12, 34, 56);
table.setHeaderForeground(color);
assertEquals(color, table.getHeaderForeground());
table.setHeaderForeground(null);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java
index 784a155..2cea892 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java
@@ -448,7 +448,7 @@
assertEquals(table.getBackground(),tableItem.getBackground(0));
try {
- Color color = new Color(display, 255, 0, 0);
+ Color color = new Color(255, 0, 0);
color.dispose();
tableItem.setBackground(color);
fail("No exception thrown for color disposed");
@@ -458,7 +458,7 @@
@Test
public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(tableItem.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
tableItem.setBackground(color);
assertEquals(color, tableItem.getBackground());
tableItem.setBackground(null);
@@ -601,7 +601,7 @@
assertEquals(table.getForeground(),tableItem.getForeground(0));
try {
- Color color = new Color(display, 255, 0, 0);
+ Color color = new Color(255, 0, 0);
color.dispose();
tableItem.setForeground(color);
fail("No exception thrown for color disposed");
@@ -611,7 +611,7 @@
@Test
public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(tableItem.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
tableItem.setForeground(color);
assertEquals(color, tableItem.getForeground());
tableItem.setForeground(null);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
index 89c15ca..aa256cf 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
@@ -369,7 +369,7 @@
@Test
public void test_setHeaderBackgroundLorg_eclipse_swt_graphics_Color() {
assertNotNull(tree.getHeaderBackground());
- Color color = new Color(control.getDisplay(), 12, 34, 56);
+ Color color = new Color(12, 34, 56);
tree.setHeaderBackground(color);
assertEquals(color, tree.getHeaderBackground());
tree.setHeaderBackground(null);
@@ -380,7 +380,7 @@
@Test
public void test_setHeaderForegroundLorg_eclipse_swt_graphics_Color() {
assertNotNull(tree.getHeaderForeground());
- Color color = new Color(control.getDisplay(), 12, 34, 56);
+ Color color = new Color(12, 34, 56);
tree.setHeaderForeground(color);
assertEquals(color, tree.getHeaderForeground());
tree.setHeaderForeground(null);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
index 01cf2ca..c5cb3c0 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
@@ -745,7 +745,7 @@
assertEquals(tree.getBackground(),treeItem.getBackground(0));
try {
- Color color = new Color(display, 255, 0, 0);
+ Color color = new Color(255, 0, 0);
color.dispose();
treeItem.setBackground(color);
fail("No exception thrown for color disposed");
@@ -755,7 +755,7 @@
@Test
public void test_setBackgroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(treeItem.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
treeItem.setBackground(color);
assertEquals(color, treeItem.getBackground());
treeItem.setBackground(null);
@@ -919,7 +919,7 @@
assertEquals(tree.getForeground(),treeItem.getForeground(0));
try {
- Color color = new Color(display, 255, 0, 0);
+ Color color = new Color(255, 0, 0);
color.dispose();
treeItem.setForeground(color);
fail("No exception thrown for color disposed");
@@ -929,7 +929,7 @@
@Test
public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(treeItem.getDisplay(), 255, 0, 0);
+ Color color = new Color(255, 0, 0);
treeItem.setForeground(color);
assertEquals(color, treeItem.getForeground());
treeItem.setForeground(null);
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java
index 2e9cab4..0ff14c8 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java
@@ -226,8 +226,8 @@
int width = 640;
int height = 480;
Image image = new Image(display, width, height);
- Color color1 = new Color(display, 0xff, 0, 0xff);
- Color color2 = new Color(display, 0, 0xff, 0xff);
+ Color color1 = new Color(0xff, 0, 0xff);
+ Color color2 = new Color(0, 0xff, 0xff);
int x1 = 0, y1 = height/2, x2 = width/2, y2 = 0;
meter.start();
GC gc = new GC(image);
@@ -277,8 +277,8 @@
while(display.readAndDispatch()){/*empty*/}
try { Thread.sleep(2000); } catch (Exception e) {}
while(display.readAndDispatch()){/*empty*/}
- Color color1 = new Color(display, 0xff, 0, 0xff);
- Color color2 = new Color(display, 0, 0xff, 0xff);
+ Color color1 = new Color(0xff, 0, 0xff);
+ Color color2 = new Color(0, 0xff, 0xff);
int x1 = 0, y1 = height/2, x2 = width/2, y2 = 0;
meter.start();
GC gc = new GC(c);
@@ -323,8 +323,8 @@
while(display.readAndDispatch()){/*empty*/}
try { Thread.sleep(2000); } catch (Exception e) {}
while(display.readAndDispatch()){/*empty*/}
- Color color1 = new Color(display, 0xff, 0, 0xff);
- Color color2 = new Color(display, 0, 0xff, 0xff);
+ Color color1 = new Color(0xff, 0, 0xff);
+ Color color2 = new Color(0, 0xff, 0xff);
Font font1 = new Font(display, "Helvetica", 20, SWT.NONE);
Font font2 = new Font(display, "Helvetica", 10, SWT.BOLD);
String testString = "The quick \tbr&own SWT jum&ped foxily o\nver the lazy dog.";
@@ -372,8 +372,8 @@
while(display.readAndDispatch()){/*empty*/}
try { Thread.sleep(2000); } catch (Exception e) {}
while(display.readAndDispatch()){/*empty*/}
- Color color1 = new Color(display, 0xff, 0, 0xff);
- Color color2 = new Color(display, 0, 0xff, 0xff);
+ Color color1 = new Color(0xff, 0, 0xff);
+ Color color2 = new Color(0, 0xff, 0xff);
Font font1 = new Font(display, "Helvetica", 20, SWT.NONE);
Font font2 = new Font(display, "Helvetica", 10, SWT.BOLD);
String testString = "The quick brown SWT jumped foxily over the lazy dog.";