Package org.sm.smtools.swing.util
Class JGraphics
java.lang.Object
org.sm.smtools.swing.util.JGraphics
The
JGraphics
class provides static methodes for changing fonts, colors, ...
Note that this class cannot be subclassed!
- Version:
- 22/08/2019
- Author:
- Sven Maerivoet
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getFontHeight
(Graphics2D g2D) Helper method to return the current font's height.static int
getFontSize
(Graphics2D g2D) Helper method to return the current font size.static void
Sets a color by also taking a specified transparency into account.static void
setFontBold
(Graphics2D g2D) Helper method to set the font style to bold.static void
Helper method to set the font style to bold and italic.static void
setFontItalic
(Graphics2D g2D) Helper method to set the font style to italic.static void
Helper method to set the font to monospaced.static void
setFontSize
(Graphics2D g2D, int fontSize) Helper method to set the current font size.
-
Method Details
-
getFontSize
Helper method to return the current font size.- Parameters:
g2D
- a handle to theGraphics2D
object- Returns:
- the current font size
-
setFontSize
Helper method to set the current font size.- Parameters:
g2D
- a handle to theGraphics2D
objectfontSize
- the new font size
-
getFontHeight
Helper method to return the current font's height.- Parameters:
g2D
- a handle to theGraphics2D
object- Returns:
- the current font height
-
setFontMonospaced
Helper method to set the font to monospaced.- Parameters:
g2D
- a handle to theGraphics2D
object
-
setFontBold
Helper method to set the font style to bold.- Parameters:
g2D
- a handle to theGraphics2D
object
-
setFontItalic
Helper method to set the font style to italic.- Parameters:
g2D
- a handle to theGraphics2D
object
-
setFontBoldItalic
Helper method to set the font style to bold and italic.- Parameters:
g2D
- a handle to theGraphics2D
object
-
setColor
Sets a color by also taking a specified transparency into account.- Parameters:
g2D
- a handle to theGraphics2D
objectcolor
- the color to usetransparency
- the transparency to use (between 0.0 and 1.0)
-