summaryrefslogtreecommitdiff
path: root/odk/examples
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-11-02 09:47:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-11-02 12:00:24 +0100
commitcb982f14796aa4dc4362bc6fde74161afa11777b (patch)
tree58267840e3cc2a2d6e344337fe3d735063900711 /odk/examples
parenta71da3b7a80ca32b595a8ca0ea3da650b0af376c (diff)
'new Float' is deprecated in Java
replace with Float.valueOf Change-Id: Ib6408b24dac2953789d0ec67e73b8be8aefca252 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158784 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'odk/examples')
-rw-r--r--odk/examples/DevelopersGuide/Charts/ChartInCalc.java6
-rw-r--r--odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java2
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java2
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java4
-rw-r--r--odk/examples/DevelopersGuide/Text/TextDocuments.java2
-rw-r--r--odk/examples/java/Drawing/SDraw.java3
-rw-r--r--odk/examples/java/NotesAccess/NotesAccess.java2
-rw-r--r--odk/examples/java/Spreadsheet/ChartTypeChange.java2
-rw-r--r--odk/examples/java/Spreadsheet/SCalc.java2
-rw-r--r--odk/examples/java/Text/HardFormatting.java2
-rw-r--r--odk/examples/java/Text/StyleCreation.java4
-rw-r--r--odk/examples/java/Text/TextDocumentStructure.java2
12 files changed, 16 insertions, 17 deletions
diff --git a/odk/examples/DevelopersGuide/Charts/ChartInCalc.java b/odk/examples/DevelopersGuide/Charts/ChartInCalc.java
index d974d6e45e95..2ca6546f5a66 100644
--- a/odk/examples/DevelopersGuide/Charts/ChartInCalc.java
+++ b/odk/examples/DevelopersGuide/Charts/ChartInCalc.java
@@ -260,9 +260,9 @@ public class ChartInCalc
// add a label text with bold font, bordeaux red 14pt
aPointProp.setPropertyValue( "DataCaption", Integer.valueOf( ChartDataCaption.VALUE ));
- aPointProp.setPropertyValue( "CharHeight", new Float( 14.0 ));
+ aPointProp.setPropertyValue( "CharHeight", Float.valueOf( 14.0f ));
aPointProp.setPropertyValue( "CharColor", Integer.valueOf( 0x993366 ));
- aPointProp.setPropertyValue( "CharWeight", new Float( FontWeight.BOLD ));
+ aPointProp.setPropertyValue( "CharWeight", Float.valueOf( FontWeight.BOLD ));
}
catch( IndexOutOfBoundsException ex )
{
@@ -318,7 +318,7 @@ public class ChartInCalc
if( aTitleProp != null )
{
aTitleProp.setPropertyValue( "String", "Random Scatter Chart" );
- aTitleProp.setPropertyValue( "CharHeight", new Float(14.0) );
+ aTitleProp.setPropertyValue( "CharHeight", Float.valueOf(14.0f) );
}
// align title with y axis
diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java
index 2dd4e9c0e68d..66bb2d8d6420 100644
--- a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java
+++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java
@@ -319,7 +319,7 @@ public class HelloTextTableShape {
xCursorProps.setPropertyValue("CharPosture",
com.sun.star.awt.FontSlant.ITALIC);
xCursorProps.setPropertyValue("CharWeight",
- new Float(com.sun.star.awt.FontWeight.BOLD));
+ Float.valueOf(com.sun.star.awt.FontWeight.BOLD));
// add more text at the end of the text using insertString
xTextCursor.gotoEnd(false);
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java
index 0696a866cdc3..872337013c26 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java
+++ b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java
@@ -244,7 +244,7 @@ public class SpreadsheetDocHelper
xCell.setFormula( aHeadline );
xPropSet = UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xCell );
xPropSet.setPropertyValue( "CharColor", Integer.valueOf( 0x003399 ) );
- xPropSet.setPropertyValue( "CharWeight", new Float( com.sun.star.awt.FontWeight.BOLD ) );
+ xPropSet.setPropertyValue( "CharWeight", Float.valueOf( com.sun.star.awt.FontWeight.BOLD ) );
}
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java
index ce65555289fc..bbf54af0eb22 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java
+++ b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java
@@ -263,7 +263,7 @@ public class SpreadsheetSample extends SpreadsheetDocHelper
xPropSet = UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xCell );
// from styles.CharacterProperties
xPropSet.setPropertyValue( "CharColor", Integer.valueOf( 0x003399 ) );
- xPropSet.setPropertyValue( "CharHeight", new Float( 20.0 ) );
+ xPropSet.setPropertyValue( "CharHeight", Float.valueOf( 20.0f ) );
// from styles.ParagraphProperties
xPropSet.setPropertyValue( "ParaLeftMargin", Integer.valueOf( 500 ) );
// from table.CellProperties
@@ -314,7 +314,7 @@ public class SpreadsheetSample extends SpreadsheetDocHelper
xPropSet = UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xCellRange );
// from com.sun.star.styles.CharacterProperties
xPropSet.setPropertyValue( "CharColor", Integer.valueOf( 0x003399 ) );
- xPropSet.setPropertyValue( "CharHeight", new Float( 20.0 ) );
+ xPropSet.setPropertyValue( "CharHeight", Float.valueOf( 20.0f ) );
// from com.sun.star.styles.ParagraphProperties
xPropSet.setPropertyValue( "ParaLeftMargin", Integer.valueOf( 500 ) );
// from com.sun.star.table.CellProperties
diff --git a/odk/examples/DevelopersGuide/Text/TextDocuments.java b/odk/examples/DevelopersGuide/Text/TextDocuments.java
index 1a1a82762612..2ccd270e281d 100644
--- a/odk/examples/DevelopersGuide/Text/TextDocuments.java
+++ b/odk/examples/DevelopersGuide/Text/TextDocuments.java
@@ -533,7 +533,7 @@ public class TextDocuments {
XPropertySet xCursorProps = UnoRuntime.queryInterface(
XPropertySet.class, mxDocCursor );
xCursorProps.setPropertyValue ( "CharWeight",
- new Float(com.sun.star.awt.FontWeight.BOLD) );
+ Float.valueOf(com.sun.star.awt.FontWeight.BOLD) );
// replace the '.' at the end of the sentence with a new string
xSentenceCursor.gotoEndOfSentence( false );
diff --git a/odk/examples/java/Drawing/SDraw.java b/odk/examples/java/Drawing/SDraw.java
index 5d2f9a52e941..a02d41ee01d9 100644
--- a/odk/examples/java/Drawing/SDraw.java
+++ b/odk/examples/java/Drawing/SDraw.java
@@ -221,8 +221,7 @@ public class SDraw {
size.Height = height;
size.Width = width;
position.X = (x+(i*40));
- position.Y =
- (new Float(y+(Math.sin((i*Math.PI)/180))*5000)).intValue();
+ position.Y = (int)(y+(Math.sin((i*Math.PI)/180))*5000);
xShape.setSize(size);
xShape.setPosition(position);
diff --git a/odk/examples/java/NotesAccess/NotesAccess.java b/odk/examples/java/NotesAccess/NotesAccess.java
index 0d0a0bb5ee60..8945a9e9984e 100644
--- a/odk/examples/java/NotesAccess/NotesAccess.java
+++ b/odk/examples/java/NotesAccess/NotesAccess.java
@@ -271,7 +271,7 @@ public class NotesAccess implements Runnable {
System.out.println( "Could not get Cell" );
}
if ( stringFlag.equals( "V" )) {
- xCell.setValue((new Float(stringValue)).floatValue());
+ xCell.setValue((Float.valueOf(stringValue)).floatValue());
}
else {
xCell.setFormula(stringValue);
diff --git a/odk/examples/java/Spreadsheet/ChartTypeChange.java b/odk/examples/java/Spreadsheet/ChartTypeChange.java
index d436b388925e..78f8b14bb417 100644
--- a/odk/examples/java/Spreadsheet/ChartTypeChange.java
+++ b/odk/examples/java/Spreadsheet/ChartTypeChange.java
@@ -336,7 +336,7 @@ public class ChartTypeChange {
System.out.println( "Could not get cell." );
}
if ( stringFlag.equals( "V" ) ) {
- xcell.setValue( ( new Float( stringValue ) ).floatValue() );
+ xcell.setValue( ( Float.valueOf( stringValue ) ).floatValue() );
}
else {
xcell.setFormula( stringValue );
diff --git a/odk/examples/java/Spreadsheet/SCalc.java b/odk/examples/java/Spreadsheet/SCalc.java
index 90c5ce00f41d..db1bee8a803a 100644
--- a/odk/examples/java/Spreadsheet/SCalc.java
+++ b/odk/examples/java/Spreadsheet/SCalc.java
@@ -374,7 +374,7 @@ public class SCalc {
}
if (flag.equals("V")) {
- xCell.setValue((new Float(theValue)).floatValue());
+ xCell.setValue((Float.valueOf(theValue)).floatValue());
} else {
xCell.setFormula(theValue);
}
diff --git a/odk/examples/java/Text/HardFormatting.java b/odk/examples/java/Text/HardFormatting.java
index 81a294c86320..2dcc7b084e36 100644
--- a/odk/examples/java/Text/HardFormatting.java
+++ b/odk/examples/java/Text/HardFormatting.java
@@ -119,7 +119,7 @@ public class HardFormatting {
xPropertySet = UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xWordCursor);
xPropertySet.setPropertyValue("CharWeight",
- new Float(com.sun.star.awt.FontWeight.BOLD));
+ Float.valueOf(com.sun.star.awt.FontWeight.BOLD));
xPropertySet.setPropertyValue("CharColor", Integer.valueOf( 255 ) );
System.out.println(
diff --git a/odk/examples/java/Text/StyleCreation.java b/odk/examples/java/Text/StyleCreation.java
index d5151eca7c29..5ad1c9498a26 100644
--- a/odk/examples/java/Text/StyleCreation.java
+++ b/odk/examples/java/Text/StyleCreation.java
@@ -93,11 +93,11 @@ public class StyleCreation {
xPropertySet.setPropertyValue("CharFontName", "Helvetica" );
System.out.println( "set name of the font to 'Helvetica'" );
- xPropertySet.setPropertyValue("CharHeight", new Float( 36 ) );
+ xPropertySet.setPropertyValue("CharHeight", Float.valueOf( 36 ) );
System.out.println( "Change the height of th font to 36" );
xPropertySet.setPropertyValue("CharWeight",
- new Float( com.sun.star.awt.FontWeight.BOLD ) );
+ Float.valueOf( com.sun.star.awt.FontWeight.BOLD ) );
System.out.println( "set the font attribute 'Bold'" );
xPropertySet.setPropertyValue("CharAutoKerning", Boolean.TRUE );
diff --git a/odk/examples/java/Text/TextDocumentStructure.java b/odk/examples/java/Text/TextDocumentStructure.java
index 7f284556d3f5..a1043a44775f 100644
--- a/odk/examples/java/Text/TextDocumentStructure.java
+++ b/odk/examples/java/Text/TextDocumentStructure.java
@@ -186,7 +186,7 @@ public class TextDocumentStructure {
UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xWordCursor );
xPropertySet.setPropertyValue("CharWeight",
- new Float( com.sun.star.awt.FontWeight.BOLD ));
+ Float.valueOf( com.sun.star.awt.FontWeight.BOLD ));
System.out.println("create example data");
}