--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Jun 19 17:59:09 2013 -0700
@@ -804,8 +804,6 @@
throw new RuntimeException("Unknown window state: " + windowState);
}
- nativeSynthesizeMouseEnteredExitedEvents();
-
// NOTE: the SWP.windowState field gets updated to the newWindowState
// value when the native notification comes to us
}
--- a/jdk/src/macosx/native/com/apple/laf/AquaFileView.m Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/macosx/native/com/apple/laf/AquaFileView.m Wed Jun 19 17:59:09 2013 -0700
@@ -187,13 +187,13 @@
JNF_COCOA_ENTER(env);
UInt8 pathCString[MAXPATHLEN + 1];
- size_t pathSize = sizeof(pathCString);
+ size_t maxPathLen = sizeof(pathCString) - 1;
jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
jsize length = (*env)->GetArrayLength(env, pathToAlias);
- if (length > pathSize) {
- length = pathSize;
+ if (length > maxPathLen) {
+ length = maxPathLen;
}
strncpy((char *)pathCString, (char *)byteArray, length);
// make sure it's null terminated
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m Wed Jun 19 17:59:09 2013 -0700
@@ -447,6 +447,8 @@
// TODO: create generic AWT assert
}
+ [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
+
NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIIIZ)V");
@@ -630,6 +632,7 @@
[self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_ENTER withEnv:env];
(*env)->DeleteLocalRef(env, platformWindow);
}
+ [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
}
- (void)windowWillExitFullScreen:(NSNotification *)notification {
@@ -652,6 +655,7 @@
[self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_EXIT withEnv:env];
(*env)->DeleteLocalRef(env, platformWindow);
}
+ [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
}
- (void)sendEvent:(NSEvent *)event {
@@ -891,8 +895,6 @@
// ensure we repaint the whole window after the resize operation
// (this will also re-enable screen updates, which were disabled above)
// TODO: send PaintEvent
-
- [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
}];
JNF_COCOA_EXIT(env);
--- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Wed Jun 19 17:59:09 2013 -0700
@@ -285,10 +285,17 @@
TimedWindowEvent we = (TimedWindowEvent)e;
long time = we.getWhen();
synchronized (this) {
- for (KeyEvent ke: enqueuedKeyEvents) {
- if (time >= ke.getWhen()) {
- SunToolkit.postEvent(AppContext.getAppContext(), new SequencedEvent(e));
- return true;
+ KeyEvent ke = enqueuedKeyEvents.isEmpty() ? null : enqueuedKeyEvents.getFirst();
+ if (ke != null && time >= ke.getWhen()) {
+ TypeAheadMarker marker = typeAheadMarkers.getFirst();
+ if (marker != null) {
+ Window toplevel = marker.untilFocused.getContainingWindow();
+ // Check that the component awaiting focus belongs to
+ // the current focused window. See 8015454.
+ if (toplevel != null && toplevel.isFocused()) {
+ SunToolkit.postEvent(AppContext.getAppContext(), new SequencedEvent(e));
+ return true;
+ }
}
}
}
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java Wed Jun 19 17:59:09 2013 -0700
@@ -1146,9 +1146,25 @@
* @see #resetChoosableFileFilters
*/
public boolean removeChoosableFileFilter(FileFilter f) {
- if(filters.contains(f)) {
+ int index = filters.indexOf(f);
+ if (index >= 0) {
if(getFileFilter() == f) {
- setFileFilter(null);
+ if (isAcceptAllFileFilterUsed()) {
+ // choose default filter if it is used
+ setFileFilter(getAcceptAllFileFilter());
+ }
+ else if (index > 0) {
+ // choose the first filter, because it is not removed
+ setFileFilter(filters.get(0));
+ }
+ else if (filters.size() > 1) {
+ // choose the second filter, because the first one is removed
+ setFileFilter(filters.get(1));
+ }
+ else {
+ // no more filters
+ setFileFilter(null);
+ }
}
FileFilter[] oldValue = getChoosableFileFilters();
filters.removeElement(f);
--- a/jdk/src/share/classes/javax/swing/JTree.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JTree.java Wed Jun 19 17:59:09 2013 -0700
@@ -3751,7 +3751,7 @@
* the nodes identified by in <code>e</code>.
*/
void removeDescendantSelectedPaths(TreeModelEvent e) {
- TreePath pPath = e.getTreePath();
+ TreePath pPath = SwingUtilities2.getTreePath(e, getModel());
Object[] oldChildren = e.getChildren();
TreeSelectionModel sm = getSelectionModel();
@@ -3785,7 +3785,7 @@
// and update BasicTreeUIs treeStructureChanged method
// to update descendants in response to a treeStructureChanged
// event, all the children of the event won't collapse!
- TreePath parent = e.getTreePath();
+ TreePath parent = SwingUtilities2.getTreePath(e, getModel());
if(parent == null)
return;
@@ -3822,7 +3822,7 @@
if(e == null)
return;
- TreePath parent = e.getTreePath();
+ TreePath parent = SwingUtilities2.getTreePath(e, getModel());
Object[] children = e.getChildren();
if(children == null)
--- a/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java Wed Jun 19 17:59:09 2013 -0700
@@ -128,7 +128,7 @@
public TreeModelEvent(Object source, Object[] path, int[] childIndices,
Object[] children)
{
- this(source, new TreePath(path), childIndices, children);
+ this(source, (path == null) ? null : new TreePath(path), childIndices, children);
}
/**
@@ -183,7 +183,7 @@
*/
public TreeModelEvent(Object source, Object[] path)
{
- this(source, new TreePath(path));
+ this(source, (path == null) ? null : new TreePath(path));
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java Wed Jun 19 17:59:09 2013 -0700
@@ -73,6 +73,9 @@
if ( anObject != null ) {
text = anObject.toString();
+ if (text == null) {
+ text = "";
+ }
oldValue = anObject;
} else {
text = "";
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Wed Jun 19 17:59:09 2013 -0700
@@ -3827,7 +3827,7 @@
//
public void treeNodesChanged(TreeModelEvent e) {
if(treeState != null && e != null) {
- TreePath parentPath = e.getTreePath();
+ TreePath parentPath = SwingUtilities2.getTreePath(e, getModel());
int[] indices = e.getChildIndices();
if (indices == null || indices.length == 0) {
// The root has changed
@@ -3882,7 +3882,7 @@
updateLeadSelectionRow();
- TreePath path = e.getTreePath();
+ TreePath path = SwingUtilities2.getTreePath(e, getModel());
if(treeState.isExpanded(path)) {
updateSize();
@@ -3907,7 +3907,7 @@
updateLeadSelectionRow();
- TreePath path = e.getTreePath();
+ TreePath path = SwingUtilities2.getTreePath(e, getModel());
if(treeState.isExpanded(path) ||
treeModel.getChildCount(path.getLastPathComponent()) == 0)
@@ -3921,7 +3921,7 @@
updateLeadSelectionRow();
- TreePath pPath = e.getTreePath();
+ TreePath pPath = SwingUtilities2.getTreePath(e, getModel());
if (pPath != null) {
pPath = pPath.getParentPath();
--- a/jdk/src/share/classes/javax/swing/text/View.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/View.java Wed Jun 19 17:59:09 2013 -0700
@@ -1174,7 +1174,7 @@
// formed by added elements (i.e. they will be updated
// by initialization.
index0 = Math.max(index0, 0);
- index1 = getViewIndex(elem.getDocument().getLength(), Position.Bias.Forward);
+ index1 = Math.max((getViewCount() - 1), 0);
for (int i = index0; i <= index1; i++) {
if (! ((i >= hole0) && (i <= hole1))) {
v = getView(i);
--- a/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java Wed Jun 19 17:59:09 2013 -0700
@@ -26,13 +26,14 @@
package javax.swing.tree;
import javax.swing.event.TreeModelEvent;
-import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.NoSuchElementException;
import java.util.Stack;
+import sun.swing.SwingUtilities2;
+
/**
* NOTE: This will become more open in a future release.
* <p>
@@ -346,7 +347,7 @@
if(e != null) {
int changedIndexs[];
FHTreeStateNode changedParent = getNodeForPath
- (e.getTreePath(), false, false);
+ (SwingUtilities2.getTreePath(e, getModel()), false, false);
int maxCounter;
changedIndexs = e.getChildIndices();
@@ -390,7 +391,7 @@
if(e != null) {
int changedIndexs[];
FHTreeStateNode changedParent = getNodeForPath
- (e.getTreePath(), false, false);
+ (SwingUtilities2.getTreePath(e, getModel()), false, false);
int maxCounter;
changedIndexs = e.getChildIndices();
@@ -429,7 +430,7 @@
if(e != null) {
int changedIndexs[];
int maxCounter;
- TreePath parentPath = e.getTreePath();
+ TreePath parentPath = SwingUtilities2.getTreePath(e, getModel());
FHTreeStateNode changedParentNode = getNodeForPath
(parentPath, false, false);
@@ -475,7 +476,7 @@
*/
public void treeStructureChanged(TreeModelEvent e) {
if(e != null) {
- TreePath changedPath = e.getTreePath();
+ TreePath changedPath = SwingUtilities2.getTreePath(e, getModel());
FHTreeStateNode changedNode = getNodeForPath
(changedPath, false, false);
--- a/jdk/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java Wed Jun 19 17:59:09 2013 -0700
@@ -26,7 +26,6 @@
package javax.swing.tree;
import javax.swing.event.TreeModelEvent;
-import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -34,6 +33,8 @@
import java.util.Stack;
import java.util.Vector;
+import sun.swing.SwingUtilities2;
+
/**
* NOTE: This will become more open in a future release.
* <p>
@@ -413,7 +414,7 @@
TreeStateNode changedNode;
changedIndexs = e.getChildIndices();
- changedNode = getNodeForPath(e.getTreePath(), false, false);
+ changedNode = getNodeForPath(SwingUtilities2.getTreePath(e, getModel()), false, false);
if(changedNode != null) {
Object changedValue = changedNode.getValue();
@@ -466,7 +467,7 @@
TreeStateNode changedParentNode;
changedIndexs = e.getChildIndices();
- changedParentNode = getNodeForPath(e.getTreePath(), false, false);
+ changedParentNode = getNodeForPath(SwingUtilities2.getTreePath(e, getModel()), false, false);
/* Only need to update the children if the node has been
expanded once. */
// PENDING(scott): make sure childIndexs is sorted!
@@ -540,7 +541,7 @@
TreeStateNode changedParentNode;
changedIndexs = e.getChildIndices();
- changedParentNode = getNodeForPath(e.getTreePath(), false, false);
+ changedParentNode = getNodeForPath(SwingUtilities2.getTreePath(e, getModel()), false, false);
// PENDING(scott): make sure that changedIndexs are sorted in
// ascending order.
if(changedParentNode != null && changedIndexs != null &&
@@ -628,7 +629,7 @@
public void treeStructureChanged(TreeModelEvent e) {
if(e != null)
{
- TreePath changedPath = e.getTreePath();
+ TreePath changedPath = SwingUtilities2.getTreePath(e, getModel());
TreeStateNode changedNode;
changedNode = getNodeForPath(changedPath, false, false);
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java Wed Jun 19 17:59:09 2013 -0700
@@ -33,18 +33,19 @@
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.print.PrinterGraphics;
-import java.text.Bidi;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import javax.swing.*;
-import javax.swing.plaf.*;
+import javax.swing.event.TreeModelEvent;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.DefaultCaret;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
import sun.swing.PrintColorUIResource;
import sun.swing.ImageIconUIResource;
@@ -1887,4 +1888,22 @@
}
return InputEvent.ALT_MASK;
}
+
+ /**
+ * Returns the {@link TreePath} that identifies the changed nodes.
+ *
+ * @param event changes in a tree model
+ * @param model corresponing tree model
+ * @return the path to the changed nodes
+ */
+ public static TreePath getTreePath(TreeModelEvent event, TreeModel model) {
+ TreePath path = event.getTreePath();
+ if ((path == null) && (model != null)) {
+ Object root = model.getRoot();
+ if (root != null) {
+ path = new TreePath(root);
+ }
+ }
+ return path;
+ }
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java Wed Jun 19 17:59:09 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -26,9 +26,11 @@
import java.awt.Component;
import java.awt.Window;
-import sun.util.logging.PlatformLogger;
+
+import sun.awt.AWTAccessor;
import sun.awt.CausedFocusEvent;
import sun.awt.KeyboardFocusManagerPeerImpl;
+import sun.util.logging.PlatformLogger;
public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XKeyboardFocusManagerPeer");
@@ -68,13 +70,13 @@
synchronized(this) {
if (currentFocusedWindow != null) {
- from = (XWindowPeer)currentFocusedWindow.getPeer();
+ from = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
}
currentFocusedWindow = win;
if (currentFocusedWindow != null) {
- to = (XWindowPeer)currentFocusedWindow.getPeer();
+ to = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
}
}
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c Wed Jun 19 17:59:09 2013 -0700
@@ -1366,12 +1366,18 @@
mid = (*env)->GetMethodID(env, clazz, "<init>", "(IIII)V");
if (mid != NULL) {
if (usingXinerama) {
- bounds = (*env)->NewObject(env, clazz, mid, fbrects[screen].x,
- fbrects[screen].y,
- fbrects[screen].width,
- fbrects[screen].height);
- }
- else {
+ if (0 <= screen && screen < awt_numScreens) {
+ bounds = (*env)->NewObject(env, clazz, mid, fbrects[screen].x,
+ fbrects[screen].y,
+ fbrects[screen].width,
+ fbrects[screen].height);
+ } else {
+ jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
+ if (exceptionClass != NULL) {
+ (*env)->ThrowNew(env, exceptionClass, "Illegal screen index");
+ }
+ }
+ } else {
XWindowAttributes xwa;
memset(&xwa, 0, sizeof(xwa));
--- a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c Wed Jun 19 17:59:09 2013 -0700
@@ -447,7 +447,7 @@
*/
#define INITIAL_LOOKUP_BUF_SIZE 512
-Bool
+Boolean
awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
{
JNIEnv *env = GetJNIEnv();
@@ -457,8 +457,8 @@
int mblen;
jstring javastr;
XIC ic;
- Bool result = True;
- static Bool composing = False;
+ Boolean result = True;
+ static Boolean composing = False;
/*
printf("lookupString: entering...\n");
--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c Wed Jun 19 17:59:09 2013 -0700
@@ -685,8 +685,7 @@
if (result == 0) {
/* poll() timed out -- update timeout value */
update_poll_timeout(TIMEOUT_TIMEDOUT);
- PRINT2("%s(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n",
- performPoll, curPollTimeout);
+ PRINT2("performPoll(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n", curPollTimeout);
}
if (pollFds[1].revents) {
int count;
@@ -695,14 +694,12 @@
do {
count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE );
} while (count == AWT_POLL_BUFSIZE );
- PRINT2("%s(): data on the AWT pipe: curPollTimeout = %d \n",
- performPoll, curPollTimeout);
+ PRINT2("performPoll(): data on the AWT pipe: curPollTimeout = %d \n", curPollTimeout);
}
if (pollFds[0].revents) {
// Events in X pipe
update_poll_timeout(TIMEOUT_EVENTS);
- PRINT2("%s(): TIMEOUT_EVENTS curPollTimeout = %ld \n",
- performPoll, curPollTimeout);
+ PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %ld \n", curPollTimeout);
}
return;
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp Wed Jun 19 17:59:09 2013 -0700
@@ -380,9 +380,11 @@
if (!sm_suppressFocusAndActivation) {
if (IsLightweightFrame() || IsEmbeddedFrame()) {
- AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
+ HWND oppositeToplevelHWnd = AwtComponent::GetTopLevelParentForWindow((HWND)wParam);
+ if (oppositeToplevelHWnd != AwtComponent::GetFocusedWindow()) {
+ AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
+ }
}
-
} else if (sm_restoreFocusAndActivation) {
if (AwtComponent::GetFocusedWindow() != NULL) {
AwtWindow *focusedWindow = (AwtWindow*)GetComponent(AwtComponent::GetFocusedWindow());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2013, 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
+ * @bug 4928019
+ * @summary Makes sure all the basic classes can be created with GTK.
+ * @author Scott Violet
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.basic.*;
+
+public class bug4928019 {
+ public static void main(String[] args) throws Throwable {
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+ } catch (UnsupportedLookAndFeelException ex) {
+ System.err.println("GTKLookAndFeel is not supported on this platform." +
+ " Test is considered passed.");
+ return;
+ } catch (ClassNotFoundException ex) {
+ System.err.println("GTKLookAndFeel class is not found." +
+ " Test is considered passed.");
+ return;
+ }
+ new JButton() {
+ public void updateUI() {
+ setUI(new BasicButtonUI());
+ }
+ };
+ new JCheckBox() {
+ public void updateUI() {
+ setUI(new BasicCheckBoxUI());
+ }
+ };
+ new JCheckBoxMenuItem() {
+ public void updateUI() {
+ setUI(new BasicCheckBoxMenuItemUI());
+ }
+ };
+ new JColorChooser() {
+ public void updateUI() {
+ setUI(new BasicColorChooserUI());
+ }
+ };
+ new JComboBox() {
+ public void updateUI() {
+ setUI(new BasicComboBoxUI());
+ }
+ };
+ new JDesktopPane() {
+ public void updateUI() {
+ setUI(new BasicDesktopPaneUI());
+ }
+ };
+ new JEditorPane() {
+ public void updateUI() {
+ setUI(new BasicEditorPaneUI());
+ }
+ };
+ new JFileChooser() {
+ public void updateUI() {
+ setUI(new BasicFileChooserUI(null));
+ }
+ };
+ new JFormattedTextField() {
+ public void updateUI() {
+ setUI(new BasicFormattedTextFieldUI());
+ }
+ };
+ new JInternalFrame() {
+ public void updateUI() {
+ setUI(new BasicInternalFrameUI(null));
+ }
+ };
+ new JLabel() {
+ public void updateUI() {
+ setUI(new BasicLabelUI());
+ }
+ };
+ new JList() {
+ public void updateUI() {
+ setUI(new BasicListUI());
+ }
+ };
+ new JMenuBar() {
+ public void updateUI() {
+ setUI(new BasicMenuBarUI());
+ }
+ };
+ new JMenuItem() {
+ public void updateUI() {
+ setUI(new BasicMenuItemUI());
+ }
+ };
+ new JMenu() {
+ public void updateUI() {
+ setUI(new BasicMenuUI());
+ }
+ };
+ new JOptionPane() {
+ public void updateUI() {
+ setUI(new BasicOptionPaneUI());
+ }
+ };
+ new JPanel() {
+ public void updateUI() {
+ setUI(new BasicPanelUI());
+ }
+ };
+ new JPasswordField() {
+ public void updateUI() {
+ setUI(new BasicPasswordFieldUI());
+ }
+ };
+ new JPopupMenu() {
+ public void updateUI() {
+ setUI(new BasicPopupMenuUI());
+ }
+ };
+ new JProgressBar() {
+ public void updateUI() {
+ setUI(new BasicProgressBarUI());
+ }
+ };
+ new JRadioButton() {
+ public void updateUI() {
+ setUI(new BasicRadioButtonUI());
+ }
+ };
+ new JRadioButtonMenuItem() {
+ public void updateUI() {
+ setUI(new BasicRadioButtonMenuItemUI());
+ }
+ };
+ new JRootPane() {
+ public void updateUI() {
+ setUI(new BasicRootPaneUI());
+ }
+ };
+ new JScrollBar() {
+ public void updateUI() {
+ setUI(new BasicScrollBarUI());
+ }
+ };
+ new JScrollPane() {
+ public void updateUI() {
+ setUI(new BasicScrollPaneUI());
+ }
+ };
+ new JSeparator() {
+ public void updateUI() {
+ setUI(new BasicSeparatorUI());
+ }
+ };
+ new JSlider() {
+ public void updateUI() {
+ setUI(new BasicSliderUI(null));
+ }
+ };
+ new JSpinner() {
+ public void updateUI() {
+ setUI(new BasicSpinnerUI());
+ }
+ };
+ new JSplitPane() {
+ public void updateUI() {
+ setUI(new BasicSplitPaneUI());
+ }
+ };
+ new JTabbedPane() {
+ public void updateUI() {
+ setUI(new BasicTabbedPaneUI());
+ }
+ };
+ new JTable() {
+ public void updateUI() {
+ setUI(new BasicTableUI());
+ }
+ };
+ new JTextArea() {
+ public void updateUI() {
+ setUI(new BasicTextAreaUI());
+ }
+ };
+ new JTextField() {
+ public void updateUI() {
+ setUI(new BasicTextFieldUI());
+ }
+ };
+ new JTextPane() {
+ public void updateUI() {
+ setUI(new BasicTextPaneUI());
+ }
+ };
+ new JToggleButton() {
+ public void updateUI() {
+ setUI(new BasicToggleButtonUI());
+ }
+ };
+ new JToolBar() {
+ public void updateUI() {
+ setUI(new BasicToolBarUI());
+ }
+ };
+ new JToolTip() {
+ public void updateUI() {
+ setUI(new BasicToolTipUI());
+ }
+ };
+ new JTree() {
+ public void updateUI() {
+ setUI(new BasicTreeUI());
+ }
+ };
+ new JViewport() {
+ public void updateUI() {
+ setUI(new BasicViewportUI());
+ }
+ };
+ System.out.println("DONE");
+ }
+}
--- a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html Wed Jun 19 17:59:09 2013 -0700
@@ -1,6 +1,5 @@
<html>
<!--
-
@test
@bug 8005932
@summary Java 7 on mac os x only provides text clipboard formats
@@ -9,10 +8,9 @@
@library ../../regtesthelpers/process
@build Util
@build ProcessResults ProcessCommunicator
-
+ @run applet/othervm MissedHtmlAndRtfBug.html
+-->
- @run applet/othervm MissedHtmlAndRtfBug.html
-*/>
<head>
<title>Java 7 on mac os x only provides text clipboard formats</title>
</head>
--- a/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java Wed Jun 19 17:59:09 2013 -0700
@@ -22,7 +22,6 @@
*/
/*
- @test
@bug 8005932
@summary Java 7 on mac os x only provides text clipboard formats
@author mikhail.cherkasov@oracle.com
@@ -30,10 +29,9 @@
@library ../../regtesthelpers/process
@build Util
@build ProcessResults ProcessCommunicator
-
-
@run applet/othervm MissedHtmlAndRtfBug.html
*/
+
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.event.*;
--- a/jdk/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java Wed Jun 19 17:59:09 2013 -0700
@@ -132,6 +132,7 @@
}
protected synchronized void enqueueKeyEvents(long after, Component untilFocused) {
super.enqueueKeyEvents(after, untilFocused);
+ robot.delay(1);
robot.keyPress(KeyEvent.VK_SPACE);
robot.delay(50);
robot.keyRelease(KeyEvent.VK_SPACE);
--- a/jdk/test/java/awt/GraphicsDevice/CheckDisplayModes.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/test/java/awt/GraphicsDevice/CheckDisplayModes.java Wed Jun 19 17:59:09 2013 -0700
@@ -37,6 +37,10 @@
public static void main(String[] args) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
+ if (!graphicDevice.isDisplayChangeSupported()) {
+ System.err.println("Display mode change is not supported on this host. Test is considered passed.");
+ return;
+ }
DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
checkDisplayMode(defaultDisplayMode);
graphicDevice.setDisplayMode(defaultDisplayMode);
--- a/jdk/test/java/awt/Mixing/MixingInHwPanel.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/test/java/awt/Mixing/MixingInHwPanel.java Wed Jun 19 17:59:09 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, 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
@@ -22,7 +22,7 @@
*/
/*
- @test %W% %E%
+ @test
@bug 6829858
@summary Mixing should work inside heavyweight containers
@author anthony.petrov@sun.com: area=awt.mixing
@@ -104,7 +104,7 @@
// And click the part of the button that has been previously hidden
Point bLoc = button.getLocationOnScreen();
- robot.mouseMove(bLoc.x + button.getWidth() - 6, bLoc.y + button.getHeight() / 2);
+ robot.mouseMove(bLoc.x + button.getWidth() - 15, bLoc.y + button.getHeight() / 2);
Util.waitForIdle(robot);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2013 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.
+*/
+
+import sun.misc.OSEnvironment;
+import test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/*
+ * @test
+ * @bug 8013468
+ * @summary Cursor does not update properly when in fullscreen mode on Mac
+ * The core reason of the issue was the lack of a mouse entered event in fullscreen
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author Petr Pchelko area=awt.event
+ * @run main FullscreenEnterEventTest
+ */
+public class FullscreenEnterEventTest {
+
+ private static String OS = System.getProperty("os.name").toLowerCase();
+
+ private static JFrame frame;
+
+ private static volatile int mouseEnterCount = 0;
+
+ private static volatile boolean windowEnteringFullScreen = false;
+ private static volatile boolean windowEnteredFullScreen = false;
+
+ public static void main(String[] args) throws Exception {
+
+ if (!OS.contains("mac")) {
+ System.out.println("The test is applicable only to Mac OS X. Passed");
+ return;
+ }
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ //Move the mouse away from the frame and check the View-base full screen mode
+ Robot r = Util.createRobot();
+ Util.waitForIdle(r);
+ r.mouseMove(500, 500);
+ Util.waitForIdle(r);
+ mouseEnterCount = 0;
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);
+ }
+ });
+ Util.waitForIdle(r);
+ if (mouseEnterCount != 1) {
+ throw new RuntimeException("No MouseEntered event for view-base full screen. Failed.");
+ }
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null);
+ }
+ });
+
+ //Test native full screen support
+ Point fullScreenButtonPos = frame.getLocation();
+ fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
+ r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);
+ mouseEnterCount = 0;
+
+ //Cant use waitForIdle for full screen transition.
+ int waitCount = 0;
+ while (!windowEnteringFullScreen) {
+ r.mousePress(InputEvent.BUTTON1_MASK);
+ r.mouseRelease(InputEvent.BUTTON1_MASK);
+ Thread.sleep(100);
+ if (waitCount++ > 10) throw new RuntimeException("Can't enter full screen mode. Failed");
+ }
+
+ waitCount = 0;
+ while (!windowEnteredFullScreen) {
+ Thread.sleep(200);
+ if (waitCount++ > 10) throw new RuntimeException("Can't enter full screen mode. Failed");
+ }
+
+ if (mouseEnterCount != 1) {
+ throw new RuntimeException("No MouseEntered event for native full screen. Failed.");
+ }
+ }
+
+ private static void createAndShowGUI() {
+ frame = new JFrame(" Fullscreen OSX Bug ");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ enableFullScreen(frame);
+ frame.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ mouseEnterCount++;
+ }
+ });
+ frame.setBounds(100, 100, 100, 100);
+ frame.pack();
+ frame.setVisible(true);
+
+ }
+
+ /*
+ * Use reflection to make a test compilable on not Mac OS X
+ */
+ private static void enableFullScreen(Window window) {
+ try {
+ Class fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
+ Method setWindowCanFullScreen = fullScreenUtilities.getMethod("setWindowCanFullScreen", Window.class, boolean.class);
+ setWindowCanFullScreen.invoke(fullScreenUtilities, window, true);
+ Class fullScreenListener = Class.forName("com.apple.eawt.FullScreenListener");
+ Object listenerObject = Proxy.newProxyInstance(fullScreenListener.getClassLoader(), new Class[]{fullScreenListener}, new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ switch (method.getName()) {
+ case "windowEnteringFullScreen":
+ windowEnteringFullScreen = true;
+ break;
+ case "windowEnteredFullScreen":
+ windowEnteredFullScreen = true;
+ break;
+ }
+ return null;
+ }
+ });
+ Method addFullScreenListener = fullScreenUtilities.getMethod("addFullScreenListenerTo", Window.class, fullScreenListener);
+ addFullScreenListener.invoke(fullScreenUtilities, window, listenerObject);
+ } catch (Exception e) {
+ throw new RuntimeException("FullScreen utilities not available", e);
+ }
+ }
+
+}
--- a/jdk/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java Wed Jun 19 17:57:12 2013 -0700
+++ b/jdk/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java Wed Jun 19 17:59:09 2013 -0700
@@ -39,7 +39,6 @@
import java.util.Hashtable;
/*
-@test
@bug 8010009
@summary [macosx] Unable type into online word games on MacOSX
@author petr.pchelko : area=awt.keyboard
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8013442/Test8013442.java Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013, 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
+ * @bug 8013442
+ * @summary Tests that at least one file filter is selected
+ * @author Sergey Malenkov
+ */
+
+import java.io.File;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+import javax.swing.filechooser.FileFilter;
+
+public class Test8013442 extends FileFilter implements Runnable, Thread.UncaughtExceptionHandler {
+ private static final CountDownLatch LATCH = new CountDownLatch(1);
+
+ public static void main(String[] args) throws InterruptedException {
+ SwingUtilities.invokeLater(new Test8013442());
+ LATCH.await(); // workaround for jtreg
+ }
+
+ private int index;
+ private LookAndFeelInfo[] infos;
+ private JFileChooser chooser;
+
+ @Override
+ public boolean accept(File file) {
+ return !file.isFile() || file.getName().toLowerCase().endsWith(".txt");
+ }
+
+ @Override
+ public String getDescription() {
+ return "Text files";
+ }
+
+ @Override
+ public void run() {
+ if (this.infos == null) {
+ this.infos = UIManager.getInstalledLookAndFeels();
+ Thread.currentThread().setUncaughtExceptionHandler(this);
+ }
+ if (this.infos.length == this.index) {
+ LATCH.countDown(); // release main thread
+ } else if (this.chooser == null) {
+ // change LaF before creation of Swing components
+ LookAndFeelInfo info = this.infos[this.index];
+ System.out.println(info.getName());
+ try {
+ UIManager.setLookAndFeel(info.getClassName());
+ }
+ catch (Exception exception) {
+ throw new Error("could not change look and feel", exception);
+ }
+ // create and show new file chooser
+ JFrame frame = new JFrame(getClass().getSimpleName());
+ frame.add(this.chooser = new JFileChooser());
+ frame.setSize(800, 600);
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ SwingUtilities.invokeLater(this);
+ }
+ else {
+ int count = this.chooser.getChoosableFileFilters().length;
+ System.out.println("count = " + count + "; " + this.chooser.isAcceptAllFileFilterUsed());
+ if (count == 0) {
+ if (null != this.chooser.getFileFilter()) {
+ throw new Error("file filter is selected");
+ }
+ // close window and stop testing file chooser for current LaF
+ SwingUtilities.getWindowAncestor(this.chooser).dispose();
+ this.chooser = null;
+ this.index++;
+ } else {
+ if (null == this.chooser.getFileFilter()) {
+ throw new Error("file filter is not selected");
+ }
+ if (count == 2) {
+ // remove default file filter
+ this.chooser.setAcceptAllFileFilterUsed(false);
+ } else if (this.chooser.isAcceptAllFileFilterUsed()) {
+ // remove add file filter
+ this.chooser.addChoosableFileFilter(this);
+ } else {
+ // remove custom file filter
+ this.chooser.removeChoosableFileFilter(this);
+ }
+ }
+ SwingUtilities.invokeLater(this);
+ }
+ }
+
+ public void uncaughtException(Thread thread, Throwable throwable) {
+ throwable.printStackTrace();
+ System.exit(1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenu/4692443/bug4692443.java Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2009, 2013, 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
+ * @library ../../regtesthelpers
+ * @build Util
+ * @bug 4692443 7105030
+ * @summary JMenu: MenuListener.menuSelected() event fired too late when using mnemonics
+ * @author Alexander Zuev
+ * @run main bug4692443
+ */
+
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import sun.awt.SunToolkit;
+
+public class bug4692443 {
+
+ public static PassedListener pass;
+ public static FailedListener fail;
+ public static volatile Boolean passed;
+
+ public static void main(String args[]) throws Throwable {
+
+ fail = new FailedListener();
+ pass = new PassedListener();
+ passed = false;
+ Robot robo = new Robot();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ toolkit.realSync();
+
+ try {
+ robo = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Robot could not be created");
+ }
+ int altKey = java.awt.event.KeyEvent.VK_ALT;
+ robo.setAutoDelay(100);
+ Util.hitMnemonics(robo, KeyEvent.VK_F); // Enter File menu
+ robo.keyPress(KeyEvent.VK_S); // Enter submenu
+ robo.keyRelease(KeyEvent.VK_S);
+ robo.keyPress(KeyEvent.VK_O); // Launch "One" action
+ robo.keyRelease(KeyEvent.VK_O);
+ robo.keyPress(KeyEvent.VK_M); // Launch "One" action
+ robo.keyRelease(KeyEvent.VK_M);
+
+ toolkit.realSync();
+
+ if (!passed) {
+ throw new RuntimeException("Test failed.");
+ }
+
+ }
+
+ private static void createAndShowGUI() {
+ JFrame mainFrame = new JFrame("Bug 4692443");
+ JMenuBar mbar = new JMenuBar();
+ JMenu menu = new JMenu("File");
+ menu.setMnemonic('F');
+ menu.add(new JMenuItem("Menu Item 1")).setMnemonic('I');
+ final JMenu submenu = new JMenu("Submenu");
+ submenu.setMnemonic('S');
+ submenu.addMenuListener(new MenuListener() {
+ public void menuSelected(MenuEvent e) {
+ JMenuItem item = submenu.add(new JMenuItem("One", 'O'));
+ item.addActionListener(pass);
+ submenu.add(new JMenuItem("Two", 'w'));
+ submenu.add(new JMenuItem("Three", 'r'));
+ }
+ public void menuDeselected(MenuEvent e) {
+ submenu.removeAll();
+ }
+ public void menuCanceled(MenuEvent e) {
+ submenu.removeAll();
+ }
+ });
+ menu.add(submenu);
+ JMenuItem menuItem = menu.add(new JMenuItem("Menu Item 2"));
+ menuItem.setMnemonic('M');
+ menuItem.addActionListener(fail);
+ mbar.add(menu);
+ mainFrame.setJMenuBar(mbar);
+
+ mainFrame.setSize(200, 200);
+ mainFrame.setLocation(200, 200);
+ mainFrame.setVisible(true);
+ mainFrame.toFront();
+ }
+
+ public static class FailedListener implements ActionListener {
+ public void actionPerformed(ActionEvent ev) {
+ throw new RuntimeException("Test failed.");
+ }
+ }
+
+ public static class PassedListener implements ActionListener {
+ public void actionPerformed(ActionEvent ev) {
+ passed = true;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/8013571/Test8013571.java Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+
+/*
+ * @test
+ * @bug 8016545
+ * @summary Tests beans with public fields
+ * @author Sergey Malenkov
+ */
+
+public class Test8013571 extends DefaultTreeModel {
+ public static void main(String[] args) {
+ DefaultMutableTreeNode root = create("root");
+ root.add(create("colors", "blue", "violet", "red", "yellow"));
+ root.add(create("sports", "basketball", "soccer", "football", "hockey"));
+ root.add(create("food", "hot dogs", "pizza", "ravioli", "bananas"));
+ Test8013571 model = new Test8013571(root);
+ JTree tree = new JTree(model);
+ model.fireTreeChanged(tree);
+ }
+
+ private static DefaultMutableTreeNode create(String name, String... values) {
+ DefaultMutableTreeNode node = new DefaultMutableTreeNode(name);
+ for (String value : values) {
+ node.add(create(value));
+ }
+ return node;
+ }
+
+ private Test8013571(DefaultMutableTreeNode root) {
+ super(root);
+ }
+
+ private void fireTreeChanged(Object source) {
+ fireTreeNodesInserted(source, null, null, null);
+ fireTreeNodesChanged(source, null, null, null);
+ fireTreeNodesRemoved(source, null, null, null);
+ fireTreeStructureChanged(source, null, null, null);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import javax.swing.JComboBox;
+
+/*
+ * @test
+ * @bug 8015336
+ * @summary No NPE for BasicComboBoxEditor.setItem(null)
+ * @author Sergey Malenkov
+ */
+public class Test8015336 {
+ public static void main(String[] args) throws Exception {
+ new JComboBox().getEditor().setItem(new Test8015336());
+ }
+
+ @Override
+ public String toString() {
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/View/8015853/bug8015853.java Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, 2013, 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
+ * @bug 8015853
+ * @summary Tests the rendering of a large HTML document
+ * @author Dmitry Markov
+ * @run main bug8015853
+ */
+
+import java.io.*;
+import java.net.URL;
+import java.util.Scanner;
+import javax.swing.*;
+import javax.swing.text.html.HTMLEditorKit;
+
+public class bug8015853 {
+
+ private static String text = "";
+
+ public static void main(String[] args) throws Exception {
+
+ try {
+ URL path = ClassLoader.getSystemResource("bug8015853.txt");
+ File file = new File(path.toURI());
+ Scanner scanner = new Scanner(file);
+ while (scanner.hasNextLine()) {
+ text += scanner.nextLine() + "\n";
+ }
+ scanner.close();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+
+ text += text;
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+ }
+
+ private static void createAndShowGUI() {
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ JFrame frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ JEditorPane editorPane = new JEditorPane();
+ HTMLEditorKit editorKit = new HTMLEditorKit();
+ editorPane.setEditorKit(editorKit);
+ editorPane.setText(text);
+
+ frame.add(editorPane);
+ frame.setVisible(true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/View/8015853/bug8015853.txt Wed Jun 19 17:59:09 2013 -0700
@@ -0,0 +1,67 @@
+</font><font size=2 color="#0000aa"><i>/*
+ * Copyright (c) 2007, 2013, 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.
+ */</font></i><font size=2 color=black>
+<b>import</b> java.io.*;
+<b>import</b> java.net.URL;
+<b>import</b> java.util.Scanner;
+<b>import</b> javax.swing.*;
+<b>import</b> javax.swing.text.html.HTMLEditorKit;
+<b>public</b> <b>class</b> bug8015853 {
+ <b>private</b> <b>static</b> String text = </font><font size=2 color="#00bb00">""</font><font size=2 color=black>;
+ <b>public</b> <b>static</b> <b>void</b> main(String[] args) throws Exception {
+
+ <b>try</b> {
+ URL path = ClassLoader.getSystemResource(</font><font size=2 color="#00bb00">"bug8015853.txt"</font><font size=2 color=black>);
+ File file = <b>new</b> File(path.toURI());
+ Scanner scanner = <b>new</b> Scanner(file);
+ <b>while</b> (scanner.hasNextLine()) {
+ text += scanner.nextLine() + </font><font size=2 color="#00bb00">"\n"</font><font size=2 color=black>;
+ }
+ scanner.close();
+ } <b>catch</b> (Exception ex) {
+ <b>throw</b> <b>new</b> RuntimeException(ex);
+ }
+
+ System.out.println(text);
+
+ SwingUtilities.invokeAndWait(<b>new</b> Runnable() {
+ <b>public</b> <b>void</b> run() {
+ createAndShowGUI();
+ }
+ });
+ }
+ <b>private</b> <b>static</b> <b>void</b> createAndShowGUI() {
+ <b>try</b> {
+ UIManager.setLookAndFeel(</font><font size=2 color="#00bb00">"javax.swing.plaf.metal.MetalLookAndFeel"</font><font size=2 color=black>);
+ } <b>catch</b> (Exception ex) {
+ <b>throw</b> <b>new</b> RuntimeException(ex);
+ }
+ JFrame frame = <b>new</b> JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JEditorPane editorPane = <b>new</b> JEditorPane();
+ HTMLEditorKit editorKit = <b>new</b> HTMLEditorKit();
+ editorPane.setEditorKit(editorKit);
+ editorPane.setText(text);
+ frame.add(editorPane);
+ frame.setVisible(<b>true</b>);
+ }
+}
\ No newline at end of file