Java Reference
In-Depth Information
resultFont = null
null ;
resultName = null
null ;
resultSize = 0 ;
isBold = false
false ;
isItalic = false
false ;
dispose ();
setVisible ( false
false );
}
});
cp . add ( bot , BorderLayout . SOUTH );
previewFont (); // ensure view is up to date!
pack ();
setLocation ( 100 , 100 );
}
/** Called from the action handlers to get the font info,
* build a font, and set it.
*/
protected
protected void
void previewFont () {
resultName = ( String ) fontNameChoice . getSelectedValue ();
String resultSizeName = fontSizeChoice . getSelectedValue (). toString ();
int
int resultSize = Integer . parseInt ( resultSizeName );
isBold = bold . isSelected ();
isItalic = italic . isSelected ();
int
int attrs = Font . PLAIN ;
iif ( isBold ) attrs = Font . BOLD ;
iif ( isItalic ) attrs |= Font . ITALIC ;
resultFont = new
new Font ( resultName , attrs , resultSize );
// System.out.println("resultName = " + resultName + "; " +
// "resultFont = " + resultFont);
previewArea . setFont ( resultFont );
pack ();
// ensure Dialog is big enough.
}
/** Retrieve the selected font name. */
public
public String getSelectedName () {
return
return resultName ;
}
/** Retrieve the selected size */
public
public int
int getSelectedSize () {
return
return resultSize ;
}
Search WWH ::




Custom Search