To save typing, you can copy and paste the code example below from the Help Viewer to your source code by doing the following:
void menuItem5_actionPerformed(ActionEvent e) { // Handle the "Edit Font" menu item // Pick up the existing font from the TextArea // and put it into the FontChooser before showing // the FontChooser, so that we are editing the // existing / previous font. fontChooser1.setValue(textArea1.getFont()); // Show the FontChooser. // Since the FontChooser is modal by default, // the program will not return from the call // to show until the user dismisses the FontChooser // using OK or Cancel. fontChooser1.show(); // Now that the user has dismissed the FontChooser, // obtain the new Font from the FontChooser's // value property. First test the result property to see if the // user pressed OK. if (fontChooser1.getResult() == FontChooser.OK) { // Set the font of textArea1 to the font // value that can be obtained from the // value property of fontChooser1. This // font value is what the user entered // before pressing the OK button textArea1.setFont(fontChooser1.getValue()); } }