2525N/A/*
2525N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2525N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2525N/A *
2525N/A * This code is free software; you can redistribute it and/or modify it
2525N/A * under the terms of the GNU General Public License version 2 only, as
2525N/A * published by the Free Software Foundation.
2525N/A *
2525N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2525N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2525N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2525N/A * version 2 for more details (a copy is included in the LICENSE file that
2525N/A * accompanied this code).
2525N/A *
2525N/A * You should have received a copy of the GNU General Public License version
2525N/A * 2 along with this work; if not, write to the Free Software Foundation,
2525N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2525N/A *
2525N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2525N/A * or visit www.oracle.com if you need additional information or have any
2525N/A * questions.
2525N/A */
2525N/A
2525N/A/* @test
2525N/A @bug 6777378
2525N/A @summary NullPointerException in XPDefaultRenderer.paint()
2525N/A @author Alexander Potochkin
2525N/A @run main bug6777378
2525N/A*/
2525N/A
2525N/Aimport sun.awt.SunToolkit;
2525N/A
2525N/Aimport javax.swing.*;
2525N/Aimport javax.swing.table.AbstractTableModel;
2525N/Aimport javax.swing.table.JTableHeader;
2525N/Aimport javax.swing.plaf.metal.MetalLookAndFeel;
2525N/Aimport java.awt.event.MouseEvent;
2525N/Aimport java.awt.event.InputEvent;
2525N/Aimport java.awt.*;
2525N/A
2525N/Apublic class bug6777378 {
2525N/A private static JFrame frame;
2525N/A private static JTableHeader header;
2525N/A
2525N/A public static void main(String[] args) throws Exception {
2525N/A SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
2525N/A Robot robot = new Robot();
2525N/A robot.setAutoDelay(20);
2525N/A SwingUtilities.invokeAndWait(new Runnable() {
2525N/A public void run() {
2525N/A try {
2525N/A UIManager.setLookAndFeel(new MetalLookAndFeel());
2525N/A } catch (Exception e) {
2525N/A e.printStackTrace();
2525N/A }
2525N/A JTable table = new JTable(new AbstractTableModel() {
2525N/A public int getRowCount() {
2525N/A return 10;
2525N/A }
2525N/A
2525N/A public int getColumnCount() {
2525N/A return 10;
2525N/A }
2525N/A
2525N/A public Object getValueAt(int rowIndex, int columnIndex) {
2525N/A return "" + rowIndex + " " + columnIndex;
2525N/A }
2525N/A });
2525N/A
2525N/A header = new JTableHeader(table.getColumnModel());
2525N/A header.setToolTipText("hello");
2525N/A
2525N/A frame = new JFrame();
2525N/A frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
2525N/A frame.add(header);
2525N/A
2525N/A frame.setSize(300, 300);
2525N/A frame.setVisible(true);
2525N/A }
2525N/A });
2525N/A toolkit.realSync();
2525N/A Point point = header.getLocationOnScreen();
2525N/A robot.mouseMove(point.x + 20, point.y + 50);
2525N/A robot.mouseMove(point.x + 30, point.y + 50);
2525N/A robot.mousePress(InputEvent.BUTTON1_MASK);
2525N/A robot.mouseRelease(InputEvent.BUTTON1_MASK);
2525N/A }
2525N/A}