Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4403207

setFont does not work for JFileChooser

XMLWordPrintable



      Name: boT120536 Date: 01/09/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      Run the following program, setFont() does not work:

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class FileChooserDemo extends JFrame implements ActionListener {
         JFileChooser fc = null;
         
          public FileChooserDemo() {
              super("FileChooserDemo");

              fc = new JFileChooser();
              
              //
              // setFont() at next line does not work.
              //
              fc.setFont(new Font("Dialog", Font.PLAIN, 18));

              JButton openButton = new JButton("Open a File...");
              openButton.addActionListener(this);
              
              JPanel buttonPanel = new JPanel();
              buttonPanel.add(openButton);
              Container contentPane = getContentPane();
              contentPane.add(buttonPanel, BorderLayout.NORTH);
          }
          public void actionPerformed(ActionEvent e)
          {
             int returnVal = fc.showOpenDialog(this);
          }

          public static void main(String[] args) {
              JFrame frame = new FileChooserDemo();

              frame.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });

              frame.pack();
              frame.setVisible(true);
          }
      }
      (Review ID: 114850)
      ======================================================================

            tr Tejesh R
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: