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

Position of textcursor in JPassword field is wrong

XMLWordPrintable

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



      Name: diC59631 Date: 01/15/98


      Take the following demo source and do a
      javac Font1.java
      java Font1
      Type into the visible JTextfield some Text, e.g.
      10 times the character 'm'. Textcursor is fine.
      Type into the invisible JPasswordField the same
      text. You can see a '*' for every character typed
      in, which is correct. But a 'm' is wider than a '*'
      and the cursor is exactely positioned
      like in the visible JTextfield above.


      Demonstration Java Source Code:
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.swing.*;

      public class Font1 extends JPanel
      {
        Font1()
        {
          super();
          setLayout(new GridLayout(0,1));
          add(new JLabel("Enter some visible text"));
          add(new JTextField(30));
          add(new JLabel("Enter some invisible text"));
          add(new JPasswordField(30));
        }

        public static void main(String [] args)
        {
          JFrame mainFrame = new JFrame("Test Font");
          mainFrame.addWindowListener
          (
            new WindowAdapter()
            {
              public void windowClosing(WindowEvent e)
              {
                System.exit(0);
              }
            }
          );

          mainFrame.getContentPane().add(new Font1());
          mainFrame.pack();
          mainFrame.setVisible(true);
        }
      }
      (Review ID: 23117)
      ======================================================================
      daniel.indrigo@Canada 1998-01-1998

      Another user report the same problem with the JTextArea in the NotePad
      example provide with Swing.

            jkaulorcl Jeet Kaul (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: