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

JTextField doesn't render properly selected bidirectional text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • x86
    • windows_98



      Name: rmT116609 Date: 11/27/2000


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


      Compile and run the following code:
      -------------------------------------------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class BidiBug extends JPanel {
          public JTextField field;
          public BidiBug() {
           field = new JTextField(4);
           add(field);
          }
          public static void main(String[] args) {
      try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
      } catch (Exception ex) {
      System.err.println("Failed to set look and feel:" + ex);
      System.exit(0);
      }
              JFrame frame = new JFrame("TextField");
              frame.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {System.exit(0);}
              });


              BidiBug bb = new BidiBug();
              frame.getContentPane().add(bb, BorderLayout.CENTER);
              frame.setSize(new Dimension(200,200));
              frame.setVisible(true);
              bb.field.setText("\u05ea\u05ea\u05ea\u05ea\u05ea\u05ea\u05ea\u05ea\u05ea\u05ea");
              bb.field.selectAll();
          }
      }
      --------------------------------------------------
      You can see that the selected text is painted not only in
      the field, but also on the enclosing panel.
      I use here Hebrew letters - with English text it works fine.
      It works good also when the text is completely in the field
      (In my case the field doesn't have enough place for the text).
      The problem occurs only when using Windows L&F.
      I also tried to rewrite "create" function
      in BasicTextFieldUI to return always FieldView and not
      I18NFieldView, and in this case it works OK also. The problem in this
      workaround that I don't want to lose all bidirectional features.
      I would highly appreciate any possible workaround.
      Thank you.
      (Review ID: 112846)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: