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

setFont on JTextArea doesn't work.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • 2d
    • x86
    • solaris_2.6



      Name: rm29839 Date: 04/30/98


      setFont in JTextArea doesn't work under
      Solaris/X86 (JDK 1.2 beta 3).
      Even the NotePad demo of the JDK fails to
      use the specified Monospaced font.
      The following testcase demonstrates the bug.
      The font should be Monospaced. Instead it is
      a default proportional font.
      If the Swing components are replaced with their
      AWT counterparts (JTextArea==>TextArea,
      JFrame==>Frame), it works fine.
      -----------------------------------------------
      import java.awt.swing.JTextArea;
      import java.awt.swing.JFrame;
      import java.awt.Container;
      import java.awt.Font;

      class TT {
          static final String areaText =
              "wwwwwWWWW\n" +
              "iiiiiIIII\n"
              ;

          public static void main(String args[]){
              JTextArea area = new JTextArea(areaText);
              area.setFont(new Font("Monospaced",Font.PLAIN,24));

              JFrame frame = new JFrame();
              frame.getContentPane().add(area);
              frame.pack();
              frame.setSize(300,300);
              frame.setVisible(true);
              }
          }
      (Review ID: 27973)
      ======================================================================

            pcharltosunw Paul Charlton (Inactive)
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: