/*
* Copyright ( c ) 2007 , 2011 , Oracle and / or its affiliates . All rights reserved .
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
*
* This code is free software ; you can redistribute it and / or modify it
* under the terms of the GNU General Public License version 2 only , as
* published by the Free Software Foundation .
*
* This code is distributed in the hope that it will be useful , but WITHOUT
* ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License
* version 2 for more details ( a copy is included in the LICENSE file that
* accompanied this code ) .
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work ; if not , write to the Free Software Foundation ,
* Inc . , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 USA .
*
* Please contact Oracle , 500 Oracle Parkway , Redwood Shores , CA 94065 USA
* or visit www . oracle . com if you need additional information or have any
* questions .
*/
/*
* @ test
* @ key headful
* @ bug 6827032 8197825
* @ summary Color chooser with drag enabled shouldn ' t throw NPE
* @ author Peter Zhelezniakov
* @ library . . / regtesthelpers
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
public class Test6827032 {
private static volatile Point point;
private static JFrame frame;
private static JColorChooser cc;
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
Robot robot = new Robot();
robot.setAutoDelay(100 );
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});
robot.waitForIdle();
robot.delay(1000 );
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel" );
point = previewPanel.getLocationOnScreen();
}
});
point.translate(5 , 5 );
robot.mouseMove(point.x, point.y);
robot.waitForIdle();
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.waitForIdle();
robot.delay(1000 );
} finally {
if (frame != null ) {
SwingUtilities.invokeAndWait(() -> frame.dispose());
}
}
}
private static void createAndShowGUI() {
frame = new JFrame(Test6827032.class .getName());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cc = new JColorChooser();
cc.setDragEnabled(true );
frame.add(cc);
frame.pack();
frame.setLocationRelativeTo(null );
frame.setVisible(true );
}
}
Messung V0.5 in Prozent C=99 H=96 G=97
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-10)
¤
*© Formatika GbR, Deutschland