Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2021-02-03 10:43:57 -0500
committerNiraj Modi2021-02-05 07:11:13 -0500
commite32288f2845a719e5ca9c3f78320f5b7ae94d117 (patch)
treeef4acc9ed26a52b1cb60fc1082ecd0e386e679ba /examples
parentbae9ed02b080e68149b88f41b271b476173a0039 (diff)
downloadeclipse.platform.swt-e32288f2845a719e5ca9c3f78320f5b7ae94d117.tar.gz
eclipse.platform.swt-e32288f2845a719e5ca9c3f78320f5b7ae94d117.tar.xz
eclipse.platform.swt-e32288f2845a719e5ca9c3f78320f5b7ae94d117.zip
[Cleanup] Use Integer.toString directly in SWT examples
Replace Integer.valueOf(i).toString()) with Integer.valueOf(nextNumber).toString()) using JDT cleanup "Primitive serialization". Change-Id: Ica0e196621f46f47d8af32a60fe325eee03fb832 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/BarChart.java8
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CountDownTab.java4
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/BarChart.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/BarChart.java
index 24af0d3248..396c260242 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/BarChart.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/BarChart.java
@@ -71,7 +71,7 @@ public class BarChart extends Canvas {
Rectangle rect = getClientArea();
Display display = getDisplay();
int count = data.size();
- Point valueSize = gc.stringExtent (Integer.valueOf(valueMax).toString());
+ Point valueSize = gc.stringExtent (Integer.toString(valueMax));
int leftX = rect.x + 2 * GAP + valueSize.x;
int bottomY = rect.y + rect.height - 2 * GAP - valueSize.y;
int unitWidth = (rect.width - 4 * GAP - valueSize.x - AXIS_WIDTH) / count - GAP;
@@ -87,7 +87,7 @@ public class BarChart extends Canvas {
for (int i1 = valueMin; i1 <= valueMax; i1+=valueIncrement) {
int y = bottomY - i1 * unitHeight;
gc.drawLine(leftX, y, leftX - GAP, y);
- gc.drawString(Integer.valueOf(i1).toString(), rect.x + GAP, y - valueSize.y);
+ gc.drawString(Integer.toString(i1), rect.x + GAP, y - valueSize.y);
}
// draw the x axis and item labels
gc.drawLine(leftX, bottomY, rect.x + rect.width - GAP, bottomY);
@@ -319,7 +319,7 @@ public class BarChart extends Canvas {
int count = data.size();
GC gc = new GC (this);
int titleWidth = gc.stringExtent (title).x;
- Point valueSize = gc.stringExtent (Integer.valueOf(valueMax).toString());
+ Point valueSize = gc.stringExtent (Integer.toString(valueMax));
int itemWidth = 0;
for (int i = 0; i < count; i++) {
Object [] dataItem = data.get(i);
@@ -405,7 +405,7 @@ public class BarChart extends Canvas {
Rectangle itemBounds(int index) {
Rectangle rect = getClientArea();
GC gc = new GC (BarChart.this);
- Point valueSize = gc.stringExtent (Integer.valueOf(valueMax).toString());
+ Point valueSize = gc.stringExtent (Integer.toString(valueMax));
gc.dispose();
int leftX = rect.x + 2 * GAP + valueSize.x;
int bottomY = rect.y + rect.height - 2 * GAP - valueSize.y;
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CountDownTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CountDownTab.java
index 944bd8255e..a7e4ffa96f 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CountDownTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/CountDownTab.java
@@ -213,12 +213,12 @@ public class CountDownTab extends AnimatedGraphicsTab {
gc.fillPath(path);
path.dispose();
- Point point = gc.stringExtent(Integer.valueOf(nextNumber).toString());
+ Point point = gc.stringExtent(Integer.toString(nextNumber));
int textWidth = point.x;
int textHeight = point.y;
// draw the number
- gc.drawString(Integer.valueOf(nextNumber).toString(),
+ gc.drawString(Integer.toString(nextNumber),
(width-textWidth)/2, (height-textHeight)/2, true);
// draw the rotating arm

Back to the top