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

Motif look and feel throws exception when clicking on empty JInternalFrame area

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • generic
    • generic



      Name: ks88420 Date: 09/14/2000


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


      Details of problem and steps to reproduce is containted
      within the source.
      ----------------------------------------------------------

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

      public class bugdemo2 {

      JFrame jFrame;
      Font originalInternalFrameFont;
      Font originalInternalFrameTitleFont;
      String fontKey = "InternalFrame.font";
      String titleFontKey = "InternalFrame.titleFont";
      UIManager ui = new UIManager();

      public static void main(String[] para) {
      bugdemo2 demo = new bugdemo2();
      demo.display();
      }

      public void display() {

      originalInternalFrameFont = (Font) ui.get( fontKey );
      originalInternalFrameTitleFont = (Font) ui.get( titleFontKey );

      jFrame = new JFrame("JFrame Title");
      JDesktopPane desktop = new JDesktopPane();
      jFrame.setContentPane( desktop );

      JInternalFrame iFrame = new JInternalFrame( "", true, true, true, true );
      desktop.add( iFrame );


              JInternalFrame anotherIFrame = new JInternalFrame(
                  "Use Motif and click on this 'body' a few times - Exceptions thrown", true, true, true, true );
              JTextArea demo2text = new JTextArea();
              demo2text.append( "a) Select Motif Look and Feel.\n" );
              demo2text.append( "b) After Look and Feel updated, click on this\n" );
              demo2text.append( " frame's empty body (below this text area) a fewtimes.\n" );
              demo2text.append( " Exceptions should be thrown at the commandprompt.\n" );
              demo2text.append( "NOTE :\n" );
              demo2text.append( " 1) Exceptions are not thrown for other LAF, exceptMotif.\n" );
              demo2text.append( " 2) After Exceptions are thrown, selecting theother\n" );
              demo2text.append( " internal frame may not set it to the frontand\n" );
              demo2text.append( " 'ghost border' may be seen after iconizing theinternal frame.\n");
              demo2text.append( " 3) However, Exceptions will not be thrown (byMotif's LAF)\n" );
              demo2text.append( " if you first select this frame by clicking onthe title bar.\n" );
              demo2text.append( "Test platform : Java 2, 1.3 - Win98" );
              anotherIFrame.getContentPane().add( demo2text, BorderLayout.NORTH );
              desktop.add( anotherIFrame );

              anotherIFrame.setBounds( 10,10,580,350 );

              jFrame.setBounds( 30,10,620,450 );
              iFrame.setBounds( 50,350,500,100 );

      iFrame.getContentPane().setLayout(new BoxLayout( iFrame.getContentPane(),BoxLayout.Y_AXIS));

      JButton buttonCross = new JButton( "Cross LAF" );
      JButton buttonWin = new JButton( "Win LAF" );
      JButton buttonMotif = new JButton( "Motif LAF" );

      JPanel pane1 = new JPanel();
      pane1.setLayout( new BoxLayout( pane1, BoxLayout.X_AXIS));
      pane1.add( buttonCross );
      pane1.add( buttonWin );
      pane1.add( buttonMotif );

      iFrame.getContentPane().add( pane1 );

      jFrame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
      System.exit(0);
      }
      });

      buttonCross.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e ){
      setLAF("javax.swing.plaf.metal.MetalLookAndFeel" );
      }
      });

      buttonWin.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e ){
      setLAF("com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
      }
      });

      buttonMotif.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e ){
      setLAF("com.sun.java.swing.plaf.motif.MotifLookAndFeel" );
      }
      });

              anotherIFrame.setVisible( true );
      iFrame.setVisible( true );
      jFrame.setVisible( true );

      }

      public void setLAF( String LAF ) {
      try {
      UIManager.setLookAndFeel( LAF );
      } catch (Exception ex) {
      System.out.println( ex );
      }
      SwingUtilities.updateComponentTreeUI(jFrame);
      }

      }

      Exception :
      ---------------
      Exception occurred during event dispatching:
      java.lang.NullPointerException
              at com.sun.java.swing.plaf.motif.MotifDesktopPaneUI$MotifDesktopManager.endDraggingFrame(MotifDesktopPaneUI.java:112)
              at javax.swing.plaf.basic.BasicInternalFrameUI$BorderListener.mouseReleased(BasicInternalFrameUI.java:668)
              at java.awt.Component.processMouseEvent(Component.java:3715)
              at java.awt.Component.processEvent(Component.java:3544)
              at java.awt.Container.processEvent(Container.java:1165)
              at java.awt.Component.dispatchEventImpl(Component.java:2593)
              at java.awt.Container.dispatchEventImpl(Container.java:1214)
              at java.awt.Component.dispatchEvent(Component.java:2497)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2452)
              at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2217)
              at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2126)
              at java.awt.Container.dispatchEventImpl(Container.java:1201)
              at java.awt.Window.dispatchEventImpl(Window.java:912)
              at java.awt.Component.dispatchEvent(Component.java:2497)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:333)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

      (Review ID: 109554)
      ======================================================================

            joutwatesunw Joshua Outwater (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: