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

TextArea fails to display characters in certain fonts and sizes

XMLWordPrintable

    • generic
    • solaris_2.5

      Using certain fonts and sizes, the TextArea either fails to display cretain characters eg. '}' or overwrites characters in a string.

      When the Font is "Helvetica", Font.BOLD, size=14, the TextArea fails
      to display character '}'. Isn't that weird? I observed same behavior
      with following combinations.

      "Helvetica", Font.BOLD, size=8
      "Helvetica", Font.BOLD, size=10
      "Helvetica", Font.BOLD, size=12
      "Helvetica", Font.BOLD, size=14

      "Helvetica", Font.BOLD, size=16 seems to be OK! Also Font.PLAIN seem
      to be displaying '}' correctly.

      Here's a test case:

      import java.awt.*;
      import java.awt.event.*;

      public class TestFrame extends Frame implements ActionListener {
      private TextArea myTextArea;
          
      public TestFrame() {
      setLayout(new BorderLayout());
      setTitle ("Text Area Problem Display");
      // Font myFont = new Font("Helvetica", Font.BOLD, 16);
      // Font myFont = new Font("Helvetica", Font.PLAIN, 12);
              Font myFont = new Font("Helvetica", Font.BOLD, 14);
              setFont( myFont );
      myTextArea = new TextArea( "\n", 5, 60);
      myTextArea.setEditable(false);
      add ("Center", myTextArea);

      Panel p0 = new Panel();

              Button b = new Button("Quit") ;
              b.addActionListener( this );
              b.setActionCommand ( "Quit" );
              p0.add( b );

      add("South", p0);

              String eDump = "{\n";
              eDump = eDump + "}\n";
      myTextArea.append( eDump );
              
      setSize(400,300);
      }

          
      public static void main(String args[])
      {
      TestFrame f = new TestFrame();
      f.setVisible( true );
      }

      public void actionPerformed(ActionEvent e) {
      java.lang.Object source = e.getSource();

      if ( source instanceof Button ) {
      Button b = (Button) source;

      if ( b.getActionCommand().equals("Quit")) {
      System.exit(0);
      }
              }
      }
      }

            ehawkessunw Eric Hawkes (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: