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

getControlDarkShadow throws NullPointerException when printing.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs

      Description



      Name: stC104175 Date: 05/12/2000


      Java(TM) Plug-in: Version 1.3.0-C
      Using JRE version 1.3.0 Java HotSpot(TM) Client VM
        User home directory = C:\WINNT\Profiles\mslater
      Proxy Configuration: no proxy

      JAR cache disabled.



      Using the JSE 1.3 AppletViewer choose Print from the Applet menu. Using the
      Java Plug-in running the JRE 1.3 with Netscape Navigator, choose Print from the
      File menu.

      The exception output:

      Exception occurred during event dispatching:
      java.lang.NullPointerException
              at
      javax.swing.plaf.metal.MetalLookAndFeel.getControlDarkShadow(MetalLookAndFeel.j
      ava:1076)
              at
      javax.swing.plaf.metal.MetalUtils.drawFlush3DBorder(MetalUtils.java:35)
              at
      javax.swing.plaf.metal.MetalUtils.drawButtonBorder(MetalUtils.java:106)
              at
      javax.swing.plaf.metal.MetalBorders$ButtonBorder.paintBorder(MetalBorders.java:
      70)
              at
      javax.swing.border.CompoundBorder.paintBorder(CompoundBorder.java:95)
              at javax.swing.JComponent.paintBorder(JComponent.java:574)
              at javax.swing.AbstractButton.paintBorder(AbstractButton.java:1095)
              at javax.swing.JComponent.printBorder(JComponent.java:860)
              at javax.swing.JComponent.paint(JComponent.java:744)
              at javax.swing.JComponent.print(JComponent.java:820)
              at javax.swing.JComponent.paintChildren(JComponent.java:527)
              at javax.swing.JComponent.printChildren(JComponent.java:848)
              at javax.swing.JComponent.paint(JComponent.java:751)
              at javax.swing.JComponent.print(JComponent.java:820)
              at javax.swing.JComponent.paintChildren(JComponent.java:527)
              at javax.swing.JComponent.printChildren(JComponent.java:848)
              at javax.swing.JComponent.paint(JComponent.java:751)
              at javax.swing.JComponent.print(JComponent.java:820)
              at javax.swing.JComponent.paintChildren(JComponent.java:527)
              at javax.swing.JComponent.printChildren(JComponent.java:848)
              at javax.swing.JComponent.paint(JComponent.java:751)
              at javax.swing.JLayeredPane.paint(JLayeredPane.java:546)
              at javax.swing.JComponent.print(JComponent.java:820)
              at javax.swing.JComponent.paintChildren(JComponent.java:527)
              at javax.swing.JComponent.printChildren(JComponent.java:848)
              at javax.swing.JComponent.paint(JComponent.java:751)
              at javax.swing.JComponent.print(JComponent.java:820)
              at
      java.awt.GraphicsCallback$PrintCallback.run(GraphicsCallback.java:34)
              at
      sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:54)
              at
      sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91)
              at java.awt.Container.print(Container.java:1008)
              at sun.awt.windows.WComponentPeer.print(WComponentPeer.java:154)
              at sun.awt.windows.WCanvasPeer.print(WCanvasPeer.java:77)
              at sun.awt.windows.WPanelPeer.print(WPanelPeer.java:29)
              at
      java.awt.GraphicsCallback$PeerPrintCallback.run(GraphicsCallback.java:87)
              at
      sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:54)
              at java.awt.Component.printAll(Component.java:2162)
              at sun.applet.AppletViewer.appletPrint(AppletViewer.java:688)
              at sun.applet.AppletViewer.processUserAction(AppletViewer.java:834)
              at
      sun.applet.AppletViewer$UserActionListener.actionPerformed(AppletViewer.java:13
      1)
              at java.awt.MenuItem.processActionEvent(MenuItem.java:531)
              at java.awt.MenuItem.processEvent(MenuItem.java:495)
              at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:271)
              at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:261)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:321)
              at
      java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)


      The Applet code:

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

      public class FileTestApplet extends JApplet
      {
      private JLabel topLabel;
      private JLabel bottomLabel;

      private JButton errorCausingButton;

      public void init()
      {
      JPanel mainPanel = new JPanel();
      mainPanel.setLayout( new BoxLayout( mainPanel, BoxLayout.Y_AXIS
      ) );
      mainPanel.setBorder( BorderFactory.createEtchedBorder() );

      topLabel = new JLabel( "This label will not be printed." );

      errorCausingButton = new JButton(
      "Trying to paint this button while printing causes an
      exception." );

      bottomLabel = new JLabel( "this label will be printed." );

      mainPanel.add( Box.createVerticalGlue() );
      mainPanel.add( topLabel );

      mainPanel.add( Box.createVerticalStrut( 15 ) );
      mainPanel.add( errorCausingButton );

      mainPanel.add( Box.createVerticalStrut( 15 ) );
      mainPanel.add( bottomLabel );

      mainPanel.add( Box.createVerticalGlue() );

      this.getContentPane().setLayout(
      new BoxLayout( this.getContentPane(), BoxLayout.X_AXIS
      ) );

      this.getContentPane().add( Box.createHorizontalGlue() );
      this.getContentPane().add( mainPanel );
      this.getContentPane().add( Box.createHorizontalGlue() );
      }

      }



      Additional Info:

      In the printout (I wish there was some way to send that along too), the
      JButton's text is printed fully while there is no JButton border. The label
      added to mainPanel after the JButton is printed, however the text is cut off -
      the printed portion is "is label will be printed". The etched border added to
      mainPanel prints. This was tested with the AppletViewer and Netscape Navigator
      4.7.2. Simply compile and load the Applet. Once it is displayed, print it.
      (Review ID: 104711)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              svioletsunw Scott Violet (Inactive)
              Reporter:
              stompkinsunw Sean Tompkins (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: