This page contains the exercises for all the lessons in this tutorial. When you click the submit button for each set of questions, another page appears with the correct answers.
String aString=boldFont.getFamily();
String aString=boldFont.getFontName();
String aString=boldFont.getName();
Font boldFont=aFont.deriveFont(Font.BOLD, 12);
TextAttribute
fillPattern
Font
Image
Shape
TextLayout's
Font f=new Font("Times", Font.BOLD, 24); AttributedString ats=new AttributedString("Magic"); ats.addAttribute(TextAttribute.FONT, f); ats.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); AttributedCharacterIterator iter=ats.getIterator(); FontRenderContext frc=g2.getFontRenderContext(); tl=new TextLayout(iter, frc); g2.setColor(Color.red); tl.draw(g2, (float)30, (float)50);
TextHitInfo
TextLayout.getCaretShapes
B. By starting with a TextHitInfo object that represents the current insertion point, and calling TextLayout.getHitTestChar when the right arrow key is pressed.
TextLayout.getHitTestChar
C. By starting with a TextHitInfo object that represents the current insertion point, and calling TextLayout.getNextLeftHit when the right arrow key is pressed.
TextLayout.getNextLeftHit
D. By starting with a TextHitInfo object that represents the current insertion point, and calling TextLayout.getNextRightHit when the right arrow key is pressed.
TextLayout.getNextRightHit
TextLayout
TextLayout.CaretPolicy