Hello Jason

Your test case is really helpful, thank you very much

I reopened this bug and upgraded its priority

Thanks again
alexp

Bug 6219960 has marked Closed, will not be fixed because the evaluator could not create a test case. Attached is a test case that will produce the null pointer without using custom components (JDK6u4). Hopefully this is enough proof that this is a real bug. Jason Mehrens

------------------------------------------------------------------------
Climb to the top of the charts! Play the word scramble challenge with star power. Play now! <http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan>


------------------------------------------------------------------------

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

public class SinglePixelTooltip implements Runnable {

  static volatile Robot robot;

  static JFrame frame;
  static JButton save;
  static JTable table;

  public static void main(String[] args) throws Exception {
    robot = new Robot();
    SwingUtilities.invokeAndWait(new SinglePixelTooltip());
    robot.waitForIdle();
    Thread.sleep(5L * 1000L);
    showModal("The tooltip should be showing. Press ok with mouse. And don't move 
it.");
    showModal("Now press ok and move the mouse inside the table (don't leave 
it).");

    Thread.sleep(5L * 1000L);
    showModal("Notice the error happens on mouse move.\n"+
              "Press ok and move the mouse over the "+
              "button to stop the errors.\n"+
              "When the tooltip is shown the 1x1 pixel is gone.");
  }


  public void run() {
    ToolTipManager.sharedInstance().setDismissDelay(10 * 60 * 1000);
    frame = new JFrame();
    frame.setLocation(20, 20);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JDesktopPane desk = new JDesktopPane();
    JInternalFrame iframe = new JInternalFrame();
    iframe.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    desk.add(iframe);
    save = new JButton();
    save.setToolTipText("Wait for dialog to show.");
    save.setText("Wait for the tooltip to show.");
    JPanel panel = new JPanel(new GridLayout(1, 2));
    panel.add(save);
    table = createTable();
    panel.add(new JScrollPane(table));
    iframe.setContentPane(panel);
    frame.getContentPane().add(desk);
    frame.setSize(800, 600);
    iframe.setSize(640, 480);
    iframe.validate();
    iframe.setVisible(true);
    frame.validate();
    frame.setVisible(true);
    try {
      iframe.setSelected(true);
    }
    catch(Exception E) {
      throw new AssertionError(E);
    }

    Point pt = frame.getLocation();
    robot.mouseMove(pt.x + 100, pt.y + 100);
  }

  private static void showModal(final String msg) throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {
      public void run() {
        JOptionPane.showInternalMessageDialog(table, msg,
                                              Thread.currentThread().toString(),
                                              JOptionPane.PLAIN_MESSAGE);
      }
    });
  }

  private static JTable createTable() {
    DefaultTableModel model = new DefaultTableModel();
    JTable table = new JTable(model);
    table.setFillsViewportHeight(true);
    return table;
  }
}

Reply via email to