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

b32, Arabic,Israeli currency symbols should be displayed to the left of digits i

    XMLWordPrintable

Details

    Backports

      Description

        Name: jbT81659 Date: 01/27/2004

        Locale: ar_SA, ar_EG, iw_IL
        Regression: NO
        Build: b32

        Describtion
        The Israeli curency symbol is displayed to the right of the
        number in JTextField. The Israeli currency symbol should always
        be displayed to the left of the number.
        Arabic currency symbols (Egyptian a Saudi) are displayed in JLabels and
        JTextFields to the right of the number which is wrong


        To reproduce bug
        1. Compile and run the following test case
        2. Note that in the first JLabel (iw_IL), the currency symbol is diplayed
        to the left of the number (expected symbol location)
        3. Note that in the first JTextField (iw_IL), the currency symbol
        is diplayed to the right of the number (wrong symbol location)
        4. Note that for the ar_SA and ar_EG locales, both JLabel and JTextField display
        the currency symbol to the right of the number which is wrong.
        5. Note that for the en_US locale the currency symbol is displayed correctly in
        JLabel and JTextField

        ----------------currencyTest.java--------------

        /* Copyright (c) Sun Microsystems 2004
        $Header: $
        */

        import java.applet.*;
        import javax.swing.*;
        import java.awt.*;
        import javax.swing.event.*;
        import javax.swing.text.*;
        import javax.swing.border.*;
        import java.awt.event.*;
        import java.text.*;
        import java.util.*;

        public class currencyTest extends JApplet
        {
            public void init()
            {
                currTest test = new currTest();
                getContentPane().add(test);
            }
                public static void main(String[] argv)
                {
                    JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
                    frame.setContentPane(new currTest());
                    frame.setSize(800, 800);
                    frame.setVisible(true);
                    frame.addWindowListener( new WindowAdapter()
                    {
                       public void windowClosing( WindowEvent e)
                       {
                        System.exit(0);
                       }
                    });
                }
        }

        class currTest extends JPanel
        {
            public currTest()
            {
                JTextField f;
                JTextPane describtion;
                JLabel l, locale;
                JPanel p, panel, last;
                p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
                Locale[] locales = { new Locale("iw","IL"),
                                     new Locale("ar","SA"),
                                     new Locale("ar","EG"),
                                     new Locale("en","US") };

                Double currency;
                NumberFormat currencyFormatter;
                String currencyOut;


                p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                currency = new Double(9876543.21);
                currencyFormatter = NumberFormat.getCurrencyInstance(locales[0]);
                currencyOut = currencyFormatter.format(currency);
                locale = new JLabel(locales[0].toString()+" ");
                locale.setForeground(Color.blue);
                l = new JLabel(currencyOut);
                f = new JTextField(currencyOut);
                f.setPreferredSize(new Dimension(150,30));
                l.setPreferredSize(new Dimension(150,30));
                l.setBorder(new EtchedBorder());
                locale.setPreferredSize(new Dimension(150,30));
                p.setPreferredSize(new Dimension(480,60));
                p.add(locale,BorderLayout.WEST);
                p.add(l, BorderLayout.CENTER);
                p.add(f, BorderLayout.EAST);
                panel.add(p);

                p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                currency = new Double(9876543.21);
                currencyFormatter = NumberFormat.getCurrencyInstance(locales[1]);
                currencyOut = currencyFormatter.format(currency);
                locale = new JLabel(locales[1].toString()+" ");
                locale.setForeground(Color.blue);
                l = new JLabel(currencyOut);
                f = new JTextField(currencyOut);
                f.setPreferredSize(new Dimension(150,30));
                l.setPreferredSize(new Dimension(150,30));
                l.setBorder(new EtchedBorder());
                locale.setPreferredSize(new Dimension(150,30));
                p.setPreferredSize(new Dimension(480,60));
                p.add(locale,BorderLayout.WEST);
                p.add(l, BorderLayout.CENTER);
                p.add(f, BorderLayout.EAST);
                panel.add(p);

                p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                currency = new Double(9876543.21);
                currencyFormatter = NumberFormat.getCurrencyInstance(locales[2]);
                currencyOut = currencyFormatter.format(currency);
                locale = new JLabel(locales[2].toString()+" ");
                locale.setForeground(Color.blue);
                l = new JLabel(currencyOut );
                f = new JTextField(currencyOut);
                f.setPreferredSize(new Dimension(150,30));
                l.setPreferredSize(new Dimension(150,30));
                l.setBorder(new EtchedBorder());
                locale.setPreferredSize(new Dimension(150,30));
                p.setPreferredSize(new Dimension(480,60));
                p.add(locale,BorderLayout.WEST);
                p.add(l, BorderLayout.CENTER);
                p.add(f, BorderLayout.EAST);
                panel.add(p);

                p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                currency = new Double(9876543.21);
                currencyFormatter = NumberFormat.getCurrencyInstance(locales[3]);
                currencyOut = currencyFormatter.format(currency);
                locale = new JLabel(locales[3].toString()+" ");
                locale.setForeground(Color.blue);
                l = new JLabel(currencyOut);
                f = new JTextField(currencyOut);
                f.setPreferredSize(new Dimension(150,30));
                l.setPreferredSize(new Dimension(150,30));
                l.setBorder(new EtchedBorder());
                locale.setPreferredSize(new Dimension(150,30));
                p.setPreferredSize(new Dimension(480,60));
                p.add(locale,BorderLayout.WEST);
                p.add(l, BorderLayout.CENTER);
                p.add(f, BorderLayout.EAST);
                panel.add(p);

                p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
                p.setPreferredSize(new Dimension(600,100));
                describtion = new JTextPane();
                describtion.setContentType("text/html");
                describtion.setEditable(false);
                describtion.setText("<html><body><br>1. Verify that the locale is displayed as the first item to the left <br>2. Verify that the currency symbol is displayed to the left of the number in JLabel <br> 3. Verify that the currency symbol is displayed to the left of the number in JTextField <br>4. If the currency symbol is displayed to the right of the number, the test case fails</body></html>");

                describtion.setBackground(Color.lightGray);
                describtion.setPreferredSize(new Dimension(600,100));
                p.add(describtion,BorderLayout.CENTER);
                panel.add(p);
                panel.setPreferredSize(new Dimension(800,1000));
                add(panel);


            }
        }

        -----------------------------------------------
        ======================================================================

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                jbenavrasunw Jonathan Benavraham (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: