1 / 5

Miscellaneous Topics #4 Fonts and Custom Colors

Miscellaneous Topics #4 Fonts and Custom Colors. Inputting Numeric Types. JOptionPane.showInputDialog() can be used to input any of the numeric types when you use the following conversion methods:. Working with Fonts. To Create a font object with the font name, style, and point size, use:

gouin
Download Presentation

Miscellaneous Topics #4 Fonts and Custom Colors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Miscellaneous Topics #4 Fonts and Custom Colors

  2. Inputting Numeric Types JOptionPane.showInputDialog()can be used to input any of the numeric types when you use the following conversion methods:

  3. Working with Fonts To Create a font object with the font name, style, and point size, use: Font labelFont = new Font("TimesRoman",Font.BOLD,24); Font normalFont = new Font("Helvetica",Font.PLAIN,12); To set the current font: gObj.setFont(labelFont);

  4. Drawing Strings • To draw a string gObj.drawString("test string", leftX, baselineY); ascent leading leftX test string height baselineY descent

  5. Custom Colors You can define Custom Colors by declaring your own Color object with different RGB values as follows, where r,g,b are 3 values from 0 to 255: Color theColor = new Color(r,g,b); The above statement declares “theColor” to be a variable object (instead of a primitive) with Color as its type. The term “new” means that a new instance of the object will be created with the specified values. This is called “instantiation” and is done for many other types of objects as well.

More Related