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

XAWT text components inherit properties from installed swing L&F

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P5
    • None
    • 6
    • client-libs
    • generic
    • generic

    Description

      XAWT uses Swing for its editable text components.
      These need to emulate behaviour of Motif components which would
      suggest that the MotifUI needs to be used - and for the most part it is.
      However Swing does not support displaying components from multiple L&Fs
      concurrently and since the default installed L&F for Swing is "Metal"
      it is possible for the swing text components to pick up some properties
      that are associated with the installed L&F.
      The particular example is that in mustang Metal uses the desktop font smoothing
      setting which on Gnome desktops is typically greyscale antialiased text.
      This gets inherited by the XAWT TextArea. By contrast (inconsistently)
      the non-editable text such as a "java.awt.Label" doesn't get so affected
      as this just uses Graphics.drawString(..) directly rather than
      going via Swing components.

      Run the small program below on mustang on the Solaris 10 gnome desktop
      and use "xmag" to see that the text is antialiased in the text area.
      Run it again with an arg to see that it is not antialiased when
      the Motif L&F is installed.


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

      public class XAWTUI {

              public static void main(String[] args) {

              String motif = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

              try {
                  if (args.length > 0) UIManager.setLookAndFeel(motif);
              } catch (Exception e) {
                  System.out.println(e);
              }

              Frame f = new Frame("TextLengthTest");
              Panel p = new Panel();
              TextArea ta = new TextArea(15, 30);
              ta.setText("Hello");
              p.add("Center", ta);
              p.add("South", new Label("Hello World"));
              f.add(p);
              f.setSize(400, 400);
              f.setVisible(true);
          }
      }

      The Swing view is that since using the MotifUI when the installed L&F
      is Metal is not supported this is not a bug in Swing.
      I'm not sure if its at all worth fixing since although its inconsistent
      it doesn't appear to be bad! Remote display won't be a perfomance problem
      either since Swing turns off AA for remote display for just that reason.

      In fact the more noticeable problems are related to repainting for the
      blinking text caret
       - it clears an area including part of the border/scroll bars which
         contributes to excessive flicker
       - the caret is a vertical bar '|' whereas the native motif one is more
         like an 'I' (as displayed in the Courier New font with horizontal bars
         at top and bottom).

      1) The are tha
      1) Excessive flicker
      2) The care

      Attachments

        Activity

          People

            denis Denis Fokin (Inactive)
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: