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

Graphics.drawText does not work properly with XOR-mode set under solaris

    Details

    • Subcomponent:
      2d
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description



      Name: el35337 Date: 09/17/98


      If you try the example, there'll show up a JButton
      with the text "drawText". If you push the button,
      the text "Hello" is written in XOR-mode.Instead of
      just writing the text "Hello", the whole area of
      the Graphics-context (which is the Graphics-context
      of MyJPanel, here) turns to be white. This works
      fine with java-JDK-1.1.6, though.

      Source code:

      import java.awt.Color;
      import java.awt.Dimension;
      import java.awt.Graphics;
      import java.awt.event.ActionListener;
      import java.awt.event.ActionEvent;
      import com.sun.java.swing.JFrame;
      import com.sun.java.swing.JPanel;
      import com.sun.java.swing.JButton;


      class MyJPanel extends JPanel
      {
        class MyJButton extends JButton implements ActionListener
        {
          public MyJButton(String name)
          {
            super(name);
            addActionListener(this);
          }

          public void actionPerformed(ActionEvent e)
          {
            Graphics g=MyJPanel.this.getGraphics();

            g.setColor(Color.black);
            g.setXORMode(MyJPanel.this.getBackground());


            g.drawString("Hello", 232, 100);
          }
        }

        public MyJPanel()
        {
          add(new MyJButton("drawText"));
          setBackground(Color.lightGray);
        }

        public Dimension getPreferredSize()
        {
          return new Dimension(500, 200);
        }
      }

      public class Test
      {
        private JFrame frame;
        public MyJPanel panel;


        public void init()
        {
          MyJPanel panel=new MyJPanel();

          frame.setContentPane(panel);
          frame.pack();
          frame.setVisible(true);
        }

        public Test()
        {
          frame=new JFrame();
        }

        public static void main(String args[])
        {
          Test test=new Test();

          test.init();
        }
      }



      When the program has started, it shows the
      following messges:

      Font specified in font.properties not found [-b&h-lucida sans typewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1]
      Font specified in font.properties not found [-b&h-lucida sans typewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1]
      Font specified in font.properties not found [-b&h-lucida sans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1]
      Font specified in font.properties not found [-b&h-lucida sans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1]
      Font specified in font.properties not found [-b&h-lucida sans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1]
      Font specified in font.properties not found [-b&h-lucida sans typewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1]
      Font specified in font.properties not found [-b&h-lucida sans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1]
      Font specified in font.properties not found [-b&h-lucida sans typewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1]
      Font specified in font.properties not found [-linotype-times-medium-r-normal--*-%d-*-*-p-*-iso8859-1]
      Warning:
          Cannot allocate colormap entry for default background
      (Review ID: 38981)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              pkejriwasunw Parry Kejriwal (Inactive)
              Reporter:
              elarsen Erik Larsen (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: