From 8c26397da5a366b6c2b6bb6e46ce4411dfb74fd9 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Fri, 8 May 2015 15:37:38 +0300 Subject: [PATCH 01/36] 6980209: Make tracking SecondaryLoop.enter/exit methods easier Reviewed-by: serb, ant --- .../classes/java/awt/WaitDispatchSupport.java | 210 +++++++-------- .../awt/EventQueue/6980209/bug6980209.java | 241 ++++++++++++++++++ 2 files changed, 350 insertions(+), 101 deletions(-) create mode 100644 jdk/test/java/awt/EventQueue/6980209/bug6980209.java diff --git a/jdk/src/java.desktop/share/classes/java/awt/WaitDispatchSupport.java b/jdk/src/java.desktop/share/classes/java/awt/WaitDispatchSupport.java index 15129a457ea..d3a692ab5a8 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/WaitDispatchSupport.java +++ b/jdk/src/java.desktop/share/classes/java/awt/WaitDispatchSupport.java @@ -65,6 +65,7 @@ class WaitDispatchSupport implements SecondaryLoop { private AtomicBoolean keepBlockingEDT = new AtomicBoolean(false); private AtomicBoolean keepBlockingCT = new AtomicBoolean(false); + private AtomicBoolean afterExit = new AtomicBoolean(false); private static synchronized void initializeTimer() { if (timer == null) { @@ -114,7 +115,7 @@ class WaitDispatchSupport implements SecondaryLoop { } boolean extEvaluate = (extCondition != null) ? extCondition.evaluate() : true; - if (!keepBlockingEDT.get() || !extEvaluate) { + if (!keepBlockingEDT.get() || !extEvaluate || afterExit.get()) { if (timerTask != null) { timerTask.cancel(); timerTask = null; @@ -174,110 +175,116 @@ class WaitDispatchSupport implements SecondaryLoop { log.fine("The secondary loop is already running, aborting"); return false; } + try { + if (afterExit.get()) { + log.fine("Exit was called already, aborting"); + return false; + } - final Runnable run = new Runnable() { - public void run() { - log.fine("Starting a new event pump"); - if (filter == null) { - dispatchThread.pumpEvents(condition); - } else { - dispatchThread.pumpEventsForFilter(condition, filter); - } - } - }; - - // We have two mechanisms for blocking: if we're on the - // dispatch thread, start a new event pump; if we're - // on any other thread, call wait() on the treelock - - Thread currentThread = Thread.currentThread(); - if (currentThread == dispatchThread) { - if (log.isLoggable(PlatformLogger.Level.FINEST)) { - log.finest("On dispatch thread: " + dispatchThread); - } - if (interval != 0) { - if (log.isLoggable(PlatformLogger.Level.FINEST)) { - log.finest("scheduling the timer for " + interval + " ms"); - } - timer.schedule(timerTask = new TimerTask() { - @Override - public void run() { - if (keepBlockingEDT.compareAndSet(true, false)) { - wakeupEDT(); - } - } - }, interval); - } - // Dispose SequencedEvent we are dispatching on the current - // AppContext, to prevent us from hang - see 4531693 for details - SequencedEvent currentSE = KeyboardFocusManager. - getCurrentKeyboardFocusManager().getCurrentSequencedEvent(); - if (currentSE != null) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("Dispose current SequencedEvent: " + currentSE); - } - currentSE.dispose(); - } - // In case the exit() method is called before starting - // new event pump it will post the waking event to EDT. - // The event will be handled after the new event pump - // starts. Thus, the enter() method will not hang. - // - // Event pump should be privileged. See 6300270. - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - run.run(); - return null; - } - }); - } else { - if (log.isLoggable(PlatformLogger.Level.FINEST)) { - log.finest("On non-dispatch thread: " + currentThread); - } - synchronized (getTreeLock()) { - if (filter != null) { - dispatchThread.addEventFilter(filter); - } - try { - EventQueue eq = dispatchThread.getEventQueue(); - eq.postEvent(new PeerEvent(this, run, PeerEvent.PRIORITY_EVENT)); - keepBlockingCT.set(true); - if (interval > 0) { - long currTime = System.currentTimeMillis(); - while (keepBlockingCT.get() && - ((extCondition != null) ? extCondition.evaluate() : true) && - (currTime + interval > System.currentTimeMillis())) - { - getTreeLock().wait(interval); - } + final Runnable run = new Runnable() { + public void run() { + log.fine("Starting a new event pump"); + if (filter == null) { + dispatchThread.pumpEvents(condition); } else { - while (keepBlockingCT.get() && - ((extCondition != null) ? extCondition.evaluate() : true)) - { - getTreeLock().wait(); - } - } - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get()); - } - } catch (InterruptedException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("Exception caught while waiting: " + e); - } - } finally { - if (filter != null) { - dispatchThread.removeEventFilter(filter); + dispatchThread.pumpEventsForFilter(condition, filter); } } - // If the waiting process has been stopped because of the - // time interval passed or an exception occurred, the state - // should be changed - keepBlockingEDT.set(false); - keepBlockingCT.set(false); - } - } + }; - return true; + // We have two mechanisms for blocking: if we're on the + // dispatch thread, start a new event pump; if we're + // on any other thread, call wait() on the treelock + + Thread currentThread = Thread.currentThread(); + if (currentThread == dispatchThread) { + if (log.isLoggable(PlatformLogger.Level.FINEST)) { + log.finest("On dispatch thread: " + dispatchThread); + } + if (interval != 0) { + if (log.isLoggable(PlatformLogger.Level.FINEST)) { + log.finest("scheduling the timer for " + interval + " ms"); + } + timer.schedule(timerTask = new TimerTask() { + @Override + public void run() { + if (keepBlockingEDT.compareAndSet(true, false)) { + wakeupEDT(); + } + } + }, interval); + } + // Dispose SequencedEvent we are dispatching on the current + // AppContext, to prevent us from hang - see 4531693 for details + SequencedEvent currentSE = KeyboardFocusManager. + getCurrentKeyboardFocusManager().getCurrentSequencedEvent(); + if (currentSE != null) { + if (log.isLoggable(PlatformLogger.Level.FINE)) { + log.fine("Dispose current SequencedEvent: " + currentSE); + } + currentSE.dispose(); + } + // In case the exit() method is called before starting + // new event pump it will post the waking event to EDT. + // The event will be handled after the new event pump + // starts. Thus, the enter() method will not hang. + // + // Event pump should be privileged. See 6300270. + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + run.run(); + return null; + } + }); + } else { + if (log.isLoggable(PlatformLogger.Level.FINEST)) { + log.finest("On non-dispatch thread: " + currentThread); + } + keepBlockingCT.set(true); + synchronized (getTreeLock()) { + if (afterExit.get()) return false; + if (filter != null) { + dispatchThread.addEventFilter(filter); + } + try { + EventQueue eq = dispatchThread.getEventQueue(); + eq.postEvent(new PeerEvent(this, run, PeerEvent.PRIORITY_EVENT)); + if (interval > 0) { + long currTime = System.currentTimeMillis(); + while (keepBlockingCT.get() && + ((extCondition != null) ? extCondition.evaluate() : true) && + (currTime + interval > System.currentTimeMillis())) + { + getTreeLock().wait(interval); + } + } else { + while (keepBlockingCT.get() && + ((extCondition != null) ? extCondition.evaluate() : true)) + { + getTreeLock().wait(); + } + } + if (log.isLoggable(PlatformLogger.Level.FINE)) { + log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get()); + } + } catch (InterruptedException e) { + if (log.isLoggable(PlatformLogger.Level.FINE)) { + log.fine("Exception caught while waiting: " + e); + } + } finally { + if (filter != null) { + dispatchThread.removeEventFilter(filter); + } + } + } + } + return true; + } + finally { + keepBlockingEDT.set(false); + keepBlockingCT.set(false); + afterExit.set(false); + } } /** @@ -288,7 +295,8 @@ class WaitDispatchSupport implements SecondaryLoop { log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() + ", blockingCT=" + keepBlockingCT.get()); } - if (keepBlockingEDT.compareAndSet(true, false)) { + afterExit.set(true); + if (keepBlockingEDT.getAndSet(false)) { wakeupEDT(); return true; } diff --git a/jdk/test/java/awt/EventQueue/6980209/bug6980209.java b/jdk/test/java/awt/EventQueue/6980209/bug6980209.java new file mode 100644 index 00000000000..d39235ae44c --- /dev/null +++ b/jdk/test/java/awt/EventQueue/6980209/bug6980209.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2015, 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 6980209 + @summary Make tracking SecondaryLoop.enter/exit methods easier + @author Semyon Sadetsky + */ + +import sun.util.logging.PlatformLogger; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; + +public class bug6980209 implements ActionListener { + private final static PlatformLogger log = + PlatformLogger.getLogger("java.awt.event.WaitDispatchSupport"); + public static final int ATTEMPTS = 100; + public static final int EVENTS = 5; + + private static boolean runInEDT; + private static JFrame frame; + private static int disorderCounter = 0; + private static Boolean enterReturn; + private static Boolean exitReturn; + private static int dispatchedEvents; + + public static void main(String[] args) throws Exception { + System.out.println( + "PLEASE DO NOT TOUCH KEYBOARD AND MOUSE DURING THE TEST RUN!"); + // log.setLevel(PlatformLogger.Level.FINE); + // log.setLevel(PlatformLogger.Level.FINEST); + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame(); + frame.setUndecorated(true); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setup(frame); + } + }); + testExitBeforeEnter(); + System.out.println("Run random test in EDT"); + runInEDT = true; + testRandomly(); + System.out.println("Run random test in another thread"); + runInEDT = false; + testRandomly(); + System.out.println("ok"); + + } finally { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame.dispose(); + } + }); + } + } + + private static void testExitBeforeEnter() throws Exception { + final SecondaryLoop loop = + Toolkit.getDefaultToolkit().getSystemEventQueue() + .createSecondaryLoop(); + loop.exit(); + Robot robot = new Robot(); + robot.mouseWheel(1); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + if(loop.enter()) { + throw new RuntimeException("Wrong enter() return value"); + } + } + }); + } + + private static void testRandomly() throws AWTException { + disorderCounter = 0; + final Robot robot = new Robot(); + for (int i = 0; i < ATTEMPTS; i++) { + enterReturn = null; + exitReturn = null; + dispatchedEvents = 0; + synchronized (bug6980209.class) { + try { + for (int j = 0; j < EVENTS; j++) { + robot.keyPress(KeyEvent.VK_1); + robot.keyRelease(KeyEvent.VK_1); + } + + // trigger the button action that starts secondary loop + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SPACE); + + for (int j = 0; j < EVENTS; j++) { + robot.keyPress(KeyEvent.VK_1); + robot.keyRelease(KeyEvent.VK_1); + } + long time = System.nanoTime(); + // wait for enter() returns + bug6980209.class.wait(1000); + if (enterReturn == null) { + System.out.println("wait time=" + + ((System.nanoTime() - time) / 1E9) + + " seconds"); + throw new RuntimeException( + "It seems the secondary loop will never end"); + } + if (!enterReturn) disorderCounter++; + + robot.waitForIdle(); + if (dispatchedEvents < + 2 * EVENTS) { //check that all events are dispatched + throw new RuntimeException( + "KeyEvent.VK_1 has been lost!"); + } + + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted!"); + } + } + } + if (disorderCounter == 0) { + System.out.println( + "Zero disordered enter/exit caught. It is recommended to run scenario again"); + } else { + System.out.println( + "Disordered calls is " + disorderCounter + " from " + + ATTEMPTS); + } + } + + private static void setup(final JFrame frame) { + JButton jButton = new JButton("Button"); + frame.getContentPane().add(jButton); + jButton.addActionListener(new bug6980209()); + frame.pack(); + frame.setVisible(true); + jButton.setFocusable(true); + jButton.requestFocus(); + jButton.addKeyListener(new KeyListener() { + @Override + public void keyTyped(KeyEvent e) { + } + + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyChar() == '1') dispatchedEvents++; + } + + @Override + public void keyReleased(KeyEvent e) { + if (e.getKeyChar() == '1') dispatchedEvents++; + } + }); + } + + + @Override + public void actionPerformed(ActionEvent e) { + if (runInEDT) { + runSecondaryLoop(); + return; + } + new Thread("Secondary loop run thread") { + @Override + public void run() { + runSecondaryLoop(); + } + }.start(); + } + + private static void runSecondaryLoop() { + log.fine("\n---TEST START---"); + + final SecondaryLoop loop = + Toolkit.getDefaultToolkit().getSystemEventQueue() + .createSecondaryLoop(); + + final Object LOCK = new Object(); //lock to start simultaneously + Thread exitThread = new Thread("Exit thread") { + @Override + public void run() { + synchronized (LOCK) { + LOCK.notify(); + } + Thread.yield(); + exitReturn = loop.exit(); + log.fine("exit() returns " + exitReturn); + } + }; + + synchronized (LOCK) { + try { + exitThread.start(); + LOCK.wait(); + } catch (InterruptedException e1) { + throw new RuntimeException("What?"); + } + } + + enterReturn = loop.enter(); + log.fine("enter() returns " + enterReturn); + + try { + exitThread.join(); + } catch (InterruptedException e) { + throw new RuntimeException("What?"); + } + synchronized (bug6980209.class) { + bug6980209.class.notifyAll(); + } + log.fine("\n---TEST END---"); + } +} From 25b0a009bc27acbd91e907aa947799ab1ed13782 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Fri, 8 May 2015 16:46:24 +0300 Subject: [PATCH 02/36] 7072653: JComboBox popup mispositioned if its height exceeds the screen height Reviewed-by: alexsch, azvegint --- .../com/apple/laf/AquaComboBoxPopup.java | 20 ++- .../swing/plaf/basic/BasicComboPopup.java | 25 +++- .../BasicComboPopup/7072653/bug7072653.java | 127 ++++++++++++++++++ 3 files changed, 160 insertions(+), 12 deletions(-) create mode 100644 jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java index 0f466e188e6..ecc6d20690e 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -204,7 +204,8 @@ class AquaComboBoxPopup extends BasicComboPopup { if ((p.x + comboBoxBounds.width < 0) || (p.y + comboBoxBounds.height < 0) || (p.x > scrSize.width) || (p.y > scrSize.height)) { return null; } - return new Rectangle(0, 22, scrSize.width, scrSize.height - 22); + Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(comboBox.getGraphicsConfiguration()); + return new Rectangle(0, insets.top, scrSize.width, scrSize.height - insets.top - insets.bottom); } for (final GraphicsDevice gd : gs) { @@ -314,10 +315,17 @@ class AquaComboBoxPopup extends BasicComboPopup { } final Rectangle r = new Rectangle(px, py, pw, ph); - // Check whether it goes below the bottom of the screen, if so flip it - if (r.y + r.height < top.y + scrBounds.y + scrBounds.height) return r; - - return new Rectangle(px, -r.height + comboBoxInsets.top, r.width, r.height); + if (py + ph > scrBounds.y + scrBounds.height) { + if (ph <= -scrBounds.y ) { + // popup goes above + r.y = -ph ; + } else { + // a full screen height popup + r.y = scrBounds.y + Math.max(0, (scrBounds.height - ph) / 2 ); + r.height = Math.min(scrBounds.height, ph); + } + } + return r; } // The one to use when itemCount <= maxRowCount. Size never adjusts for arrows diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java index 47b5f73ec47..c70c06cad89 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -1287,11 +1287,24 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { else { screenBounds = new Rectangle(p, toolkit.getScreenSize()); } - - Rectangle rect = new Rectangle(px,py,pw,ph); - if (py+ph > screenBounds.y+screenBounds.height - && ph < screenBounds.height) { - rect.y = -rect.height; + int borderHeight = 0; + Border popupBorder = getBorder(); + if (popupBorder != null) { + Insets borderInsets = popupBorder.getBorderInsets(this); + borderHeight = borderInsets.top + borderInsets.bottom; + screenBounds.width -= (borderInsets.left + borderInsets.right); + screenBounds.height -= borderHeight; + } + Rectangle rect = new Rectangle(px, py, pw, ph); + if (py + ph > screenBounds.y + screenBounds.height) { + if (ph <= -screenBounds.y - borderHeight) { + // popup goes above + rect.y = -ph - borderHeight; + } else { + // a full screen height popup + rect.y = screenBounds.y + Math.max(0, (screenBounds.height - ph) / 2 ); + rect.height = Math.min(screenBounds.height, ph); + } } return rect; } diff --git a/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java b/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java new file mode 100644 index 00000000000..ccecdc2c311 --- /dev/null +++ b/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2015, 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 7072653 + @summary JComboBox popup mispositioned if its height exceeds the screen height + @author Semyon Sadetsky + */ + + +import javax.swing.*; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import java.awt.*; +import java.awt.Toolkit; + +public class bug7072653 { + + private static JComboBox combobox; + private static JFrame frame; + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new JFrame("JComboBox Test"); + setup(frame); + } + }); + test(); + } + finally { + frame.dispose(); + } + + } + + static void setup(JFrame frame) { + + + frame.setUndecorated(true); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + frame.setSize(320, 200); + + frame.getContentPane().setLayout(new FlowLayout()); + + combobox = new JComboBox(new DefaultComboBoxModel() { + public Object getElementAt(int index) { return "Element " + index; } + public int getSize() { + return 1000; + } + }); + + + combobox.setMaximumRowCount(100); + frame.getContentPane().add(combobox); + + frame.setVisible(true); + + } + + static void test() throws Exception{ + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + combobox.addPopupMenuListener(new PopupMenuListener() { + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + int height = 0; + for (Window window : JFrame.getWindows()) { + if (Window.Type.POPUP == window.getType()) { + height = window.getSize().height; + break; + } + } + GraphicsConfiguration gc = + combobox.getGraphicsConfiguration(); + Insets screenInsets = Toolkit.getDefaultToolkit() + .getScreenInsets(gc); + + if (height == gc.getBounds().height - screenInsets.top - + screenInsets.bottom ) { + System.out.println("ok"); + return; + } + throw new RuntimeException( + "Popup window height is wrong " + height); + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + } + }); + combobox.setPopupVisible(true); + combobox.setPopupVisible(false); + } + }); + } + + +} From 3a2ff1374b9ab1af79ef93a39a8236da86fd2747 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Fri, 8 May 2015 17:35:15 +0300 Subject: [PATCH 03/36] 7155957: closed/java/awt/MenuBar/MenuBarStress1/MenuBarStress1.java hangs on win 64 bit with jdk8 Reviewed-by: serb, ant --- .../java.desktop/share/classes/java/awt/Menu.java | 2 +- .../share/classes/java/awt/MenuBar.java | 4 ++-- .../share/classes/java/awt/MenuComponent.java | 14 ++++++++------ .../classes/sun/awt/windows/WObjectPeer.java | 4 ++-- .../windows/native/libawt/windows/awt_Menu.cpp | 8 +++++--- .../windows/native/libawt/windows/awt_MenuBar.cpp | 5 ++++- .../windows/native/libawt/windows/awt_MenuItem.cpp | 1 + .../windows/native/libawt/windows/awt_new.cpp | 3 +++ 8 files changed, 26 insertions(+), 15 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/java/awt/Menu.java b/jdk/src/java.desktop/share/classes/java/awt/Menu.java index 4f4a2099c55..af7d4c6b734 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Menu.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Menu.java @@ -413,9 +413,9 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { items.removeElementAt(index); MenuPeer peer = (MenuPeer)this.peer; if (peer != null) { + peer.delItem(index); mi.removeNotify(); mi.parent = null; - peer.delItem(index); } } } diff --git a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java index 648441e68ef..5ba87f646b9 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java +++ b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java @@ -222,7 +222,6 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible if (m.parent != null) { m.parent.remove(m); } - menus.addElement(m); m.parent = this; MenuBarPeer peer = (MenuBarPeer)this.peer; @@ -232,6 +231,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible } peer.addMenu(m); } + menus.addElement(m); return m; } } @@ -248,9 +248,9 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible menus.removeElementAt(index); MenuBarPeer peer = (MenuBarPeer)this.peer; if (peer != null) { + peer.delMenu(index); m.removeNotify(); m.parent = null; - peer.delMenu(index); } if (helpMenu == m) { helpMenu = null; diff --git a/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java b/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java index 6c1bbf200d6..b99e1c3eb7f 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/MenuComponent.java @@ -77,7 +77,7 @@ public abstract class MenuComponent implements java.io.Serializable { * @see #setFont(Font) * @see #getFont() */ - Font font; + volatile Font font; /** * The menu component's name, which defaults to null. @@ -302,11 +302,13 @@ public abstract class MenuComponent implements java.io.Serializable { * @see java.awt.font.TextAttribute */ public void setFont(Font f) { - font = f; - //Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font) - MenuComponentPeer peer = this.peer; - if (peer != null) { - peer.setFont(f); + synchronized (getTreeLock()) { + font = f; + //Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font) + MenuComponentPeer peer = this.peer; + if (peer != null) { + peer.setFont(f); + } } } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WObjectPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WObjectPeer.java index 843b15f83d1..83f7c586f2a 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WObjectPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WObjectPeer.java @@ -31,9 +31,9 @@ abstract class WObjectPeer { } // The Windows handle for the native widget. - long pData; + volatile long pData; // if the native peer has been destroyed - boolean destroyed = false; + volatile boolean destroyed = false; // The associated AWT object. Object target; diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp index 8bea41c88e3..d452f148012 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp @@ -239,6 +239,7 @@ AwtMenuItem* AwtMenu::GetItem(jobject target, jint index) } jobject menuItem = env->CallObjectMethod(target, AwtMenu::getItemMID, index); + if (!menuItem) return NULL; // menu item was removed concurrently DASSERT(!safe_ExceptionOccurred(env)); jobject wMenuItemPeer = GetPeerForTarget(env, menuItem); @@ -264,9 +265,9 @@ void AwtMenu::DrawItems(DRAWITEMSTRUCT& drawInfo) } /* target is a java.awt.Menu */ jobject target = GetTarget(env); - + if(!target || env->ExceptionCheck()) return; int nCount = CountItem(target); - for (int i = 0; i < nCount; i++) { + for (int i = 0; i < nCount && !env->ExceptionCheck(); i++) { AwtMenuItem* awtMenuItem = GetItem(target, i); if (awtMenuItem != NULL) { SendDrawItem(awtMenuItem, drawInfo); @@ -294,8 +295,9 @@ void AwtMenu::MeasureItems(HDC hDC, MEASUREITEMSTRUCT& measureInfo) } /* target is a java.awt.Menu */ jobject target = GetTarget(env); + if(!target || env->ExceptionCheck()) return; int nCount = CountItem(target); - for (int i = 0; i < nCount; i++) { + for (int i = 0; i < nCount && !env->ExceptionCheck(); i++) { AwtMenuItem* awtMenuItem = GetItem(target, i); if (awtMenuItem != NULL) { SendMeasureItem(awtMenuItem, hDC, measureInfo); diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp index c600d8d36ac..d15e2809a73 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp @@ -156,13 +156,16 @@ AwtMenuItem* AwtMenuBar::GetItem(jobject target, long index) } jobject menu = env->CallObjectMethod(target, AwtMenuBar::getMenuMID,index); + if (!menu) return NULL; // menu item was removed concurrently DASSERT(!safe_ExceptionOccurred(env)); jobject menuItemPeer = GetPeerForTarget(env, menu); PDATA pData; - JNI_CHECK_PEER_RETURN_NULL(menuItemPeer); + JNI_CHECK_PEER_GOTO(menuItemPeer, done); + AwtMenuItem* awtMenuItem = (AwtMenuItem*)pData; +done: env->DeleteLocalRef(menu); env->DeleteLocalRef(menuItemPeer); diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp index c0a0120c79e..ba0488187c5 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp @@ -112,6 +112,7 @@ void AwtMenuItem::Dispose() JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); if (m_peerObject != NULL) { + JNI_SET_DESTROYED(m_peerObject); JNI_SET_PDATA(m_peerObject, NULL); env->DeleteGlobalRef(m_peerObject); m_peerObject = NULL; diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_new.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_new.cpp index e5adec25b56..b2d133f2350 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_new.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_new.cpp @@ -172,6 +172,9 @@ safe_ExceptionOccurred(JNIEnv *env) throw (std::bad_alloc) { env->ExceptionClear(); // rethrow exception env->Throw(xcp); + // temp solution to reveal all concurrency issues in jtreg and JCK + // we will switch it back to silent mode before the release + env->ExceptionDescribe(); return xcp; } } From 443304485b870390f9cdd019c3e2b06d5a2b46ad Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Fri, 8 May 2015 17:40:43 +0300 Subject: [PATCH 04/36] 7190544: Nimbus LaF: regression UnitTest failure Reviewed-by: alexsch, azvegint, serb --- .../share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java index f82ccb37fab..667d6ded258 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -134,6 +134,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI value = Integer.valueOf(6); } LookAndFeel.installProperty(splitPane, "dividerSize", value); + dividerSize = ((Number)value).intValue(); value = style.get(context, "SplitPane.oneTouchExpandable"); if (value != null) { From ee650b24f55daf92f35322653d566a28305dc7b0 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 8 May 2015 19:14:16 +0300 Subject: [PATCH 05/36] 8078149: [macosx] The text of the TextArea is not wrapped at word boundaries Reviewed-by: azvegint, alexsch --- .../macosx/classes/sun/lwawt/LWTextAreaPeer.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java index 5db1b6ca296..f313c466643 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWTextAreaPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -23,7 +23,6 @@ * questions. */ - package sun.lwawt; import java.awt.Component; @@ -40,7 +39,6 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; import javax.swing.text.Document; -import javax.swing.text.JTextComponent; /** * Lightweight implementation of {@link TextAreaPeer}. Delegates most of the @@ -75,12 +73,13 @@ final class LWTextAreaPeer super.initializeImpl(); final int visibility = getTarget().getScrollbarVisibility(); synchronized (getDelegateLock()) { + getTextComponent().setWrapStyleWord(true); setScrollBarVisibility(visibility); } } @Override - JTextComponent getTextComponent() { + JTextArea getTextComponent() { return getDelegate().getView(); } @@ -165,7 +164,7 @@ final class LWTextAreaPeer // JTextArea.replaceRange() is called. final Document document = getTextComponent().getDocument(); document.removeDocumentListener(this); - getDelegate().getView().replaceRange(text, start, end); + getTextComponent().replaceRange(text, start, end); revalidate(); postEvent(new TextEvent(getTarget(), TextEvent.TEXT_VALUE_CHANGED)); document.addDocumentListener(this); From 2e5926125a4394bae934832d7eac243f94724dd8 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 8 May 2015 19:31:09 +0300 Subject: [PATCH 06/36] 5036022: JSpinner does not reflect new font on subsequent calls to setFont Reviewed-by: azvegint, alexsch --- .../classes/com/apple/laf/AquaSpinnerUI.java | 10 +- .../swing/plaf/basic/BasicSpinnerUI.java | 8 +- .../WrongEditorTextFieldFont.java | 114 ++++++++++++++++++ 3 files changed, 123 insertions(+), 9 deletions(-) create mode 100644 jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java index 1f9cc03dadc..9b07d8645a1 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -232,12 +232,12 @@ public class AquaSpinnerUI extends SpinnerUI { editor.setInheritsPopupMenu(true); if (editor.getFont() instanceof UIResource) { - editor.setFont(spinner.getFont()); + editor.setFont(new FontUIResource(spinner.getFont())); } final JFormattedTextField editorTextField = ((DefaultEditor)editor).getTextField(); if (editorTextField.getFont() instanceof UIResource) { - editorTextField.setFont(spinner.getFont()); + editorTextField.setFont(new FontUIResource(spinner.getFont())); } final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); final InputMap editorInputMap = editorTextField.getInputMap(); @@ -648,12 +648,12 @@ public class AquaSpinnerUI extends SpinnerUI { ui.updateToolTipTextForChildren(spinner); } else if ("font".equals(propertyName)) { JComponent editor = spinner.getEditor(); - if (editor != null && editor instanceof JSpinner.DefaultEditor) { + if (editor instanceof JSpinner.DefaultEditor) { JTextField tf = ((JSpinner.DefaultEditor) editor).getTextField(); if (tf != null) { if (tf.getFont() instanceof UIResource) { - tf.setFont(spinner.getFont()); + tf.setFont(new FontUIResource(spinner.getFont())); } } } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java index ee9cdefbe90..f6d211f5f9f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -989,7 +989,7 @@ public class BasicSpinnerUI extends SpinnerUI ((JSpinner.DefaultEditor)newEditor).getTextField(); if (tf != null) { if (tf.getFont() instanceof UIResource) { - tf.setFont(spinner.getFont()); + tf.setFont(new FontUIResource(spinner.getFont())); } tf.addFocusListener(nextButtonHandler); tf.addFocusListener(previousButtonHandler); @@ -1002,12 +1002,12 @@ public class BasicSpinnerUI extends SpinnerUI } else if ("font".equals(propertyName)) { JComponent editor = spinner.getEditor(); - if (editor!=null && editor instanceof JSpinner.DefaultEditor) { + if (editor instanceof JSpinner.DefaultEditor) { JTextField tf = ((JSpinner.DefaultEditor)editor).getTextField(); if (tf != null) { if (tf.getFont() instanceof UIResource) { - tf.setFont(spinner.getFont()); + tf.setFont(new FontUIResource(spinner.getFont())); } } } diff --git a/jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java b/jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java new file mode 100644 index 00000000000..0236298c1e6 --- /dev/null +++ b/jdk/test/javax/swing/JSpinner/WrongEditorTextFieldFont/WrongEditorTextFieldFont.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2015, 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 java.awt.FlowLayout; +import java.awt.Font; + +import javax.swing.JFrame; +import javax.swing.JSpinner; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.plaf.UIResource; + +import static javax.swing.JSpinner.*; +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/** + * @test + * @bug 5036022 + * @author Sergey Bylokhov + */ +public class WrongEditorTextFieldFont implements Runnable { + + private static final Font USERS_FONT = new Font("dialog", Font.BOLD, 41); + + public static void main(final String[] args) throws Exception { + for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) { + SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf)); + SwingUtilities.invokeAndWait(new WrongEditorTextFieldFont()); + } + } + + @Override + public void run() { + final JFrame frame1 = new JFrame(); + try { + testDefaultFont(frame1); + } finally { + frame1.dispose(); + } + } + + private static void testDefaultFont(final JFrame frame) { + final JSpinner spinner = new JSpinner(); + final JSpinner spinner_u = new JSpinner(); + frame.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 50)); + frame.getContentPane().add(spinner); + frame.getContentPane().add(spinner_u); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + final DefaultEditor ed = (DefaultEditor) spinner.getEditor(); + final DefaultEditor ed_u = (DefaultEditor) spinner_u.getEditor(); + ed_u.getTextField().setFont(USERS_FONT); + + for (int i = 5; i < 40; i += 5) { + /* + * Validate that the font of the text field is changed to the + * font of JSpinner if the font of text field was not set by the + * user. + */ + final Font tff = ed.getTextField().getFont(); + if (!(tff instanceof UIResource)) { + throw new RuntimeException("Font must be UIResource"); + } + if (spinner.getFont().getSize() != tff.getSize()) { + throw new RuntimeException("Rrong size"); + } + spinner.setFont(new Font("dialog", Font.BOLD, i)); + /* + * Validate that the font of the text field is NOT changed to the + * font of JSpinner if the font of text field was set by the user. + */ + final Font tff_u = ed_u.getTextField().getFont(); + if (tff_u instanceof UIResource || !tff_u.equals(USERS_FONT)) { + throw new RuntimeException("Font must NOT be UIResource"); + } + if (spinner_u.getFont().getSize() == tff_u.getSize()) { + throw new RuntimeException("Wrong size"); + } + spinner_u.setFont(new Font("dialog", Font.BOLD, i)); + } + } + + private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) { + try { + UIManager.setLookAndFeel(laf.getClassName()); + System.out.println("LookAndFeel: " + laf.getClassName()); + } catch (ClassNotFoundException | InstantiationException | + UnsupportedLookAndFeelException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } +} From f00ee27f3c0238138b6d966b269c9247735daff0 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 8 May 2015 20:06:08 +0300 Subject: [PATCH 07/36] 8013820: JavaDoc for JSpinner contains errors Reviewed-by: azvegint, alexsch --- .../share/classes/javax/swing/JSpinner.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java index 81ef955dee4..064e6e47638 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -42,8 +42,6 @@ import java.text.spi.NumberFormatProvider; import javax.accessibility.*; import sun.util.locale.provider.LocaleProviderAdapter; import sun.util.locale.provider.LocaleResources; -import sun.util.locale.provider.LocaleServiceProviderPool; - /** * A single line input field that lets the user select a @@ -77,12 +75,12 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * try { * spinner.commitEdit(); * } - * catch (ParseException pe) {{ + * catch (ParseException pe) { * // Edited value is invalid, spinner.getValue() will return * // the last valid value, you could revert the spinner to show that: - * JComponent editor = spinner.getEditor() + * JComponent editor = spinner.getEditor(); * if (editor instanceof DefaultEditor) { - * ((DefaultEditor)editor).getTextField().setValue(spinner.getValue(); + * ((DefaultEditor)editor).getTextField().setValue(spinner.getValue()); * } * // reset the value to some known value: * spinner.setValue(fallbackValue); From ad5afe4557b84dfba7f10e2d40dc197c7abe27f8 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 8 May 2015 20:43:46 +0300 Subject: [PATCH 08/36] 8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D Reviewed-by: azvegint, yan --- .../ScrollbarMouseWheelTest.java | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 jdk/test/java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java diff --git a/jdk/test/java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java b/jdk/test/java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java new file mode 100644 index 00000000000..8ae91678a36 --- /dev/null +++ b/jdk/test/java/awt/Scrollbar/ScrollbarMouseWheelTest/ScrollbarMouseWheelTest.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1998, 2015, 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 java.awt.*; +import java.awt.event.*; + +/** + * @test + * @bug 4449139 + * @summary test MouseWheelEvent generation by Scrollbar component + */ +public final class ScrollbarMouseWheelTest + implements MouseWheelListener, WindowListener { + + final static String tk = Toolkit.getDefaultToolkit().getClass().getName(); + final static int REPS = 5; + // There is a bug on Windows: 4616935. + // Wheel events comes to every component in the hierarchy so we should + // check a platform. + // There are two scrollbars within one Panel and both accept 5 clicks, so + // Panel would accept 5*2 clicks on Windows. + final static int PANEL_REPS = tk.equals("sun.awt.windows.WToolkit")? REPS * 2: REPS; + + Scrollbar sb1; + Scrollbar sb2; + Panel pnl; + class Sema { + boolean flag; + boolean getVal() { return flag;} + void setVal(boolean b) { flag = b;} + } + Sema sema = new Sema(); + + Robot robot; + + int sb1upevents, sb2upevents, pnlupevents; + int sb1downevents, sb2downevents, pnldownevents; + + public static void main(final String[] args) { + new ScrollbarMouseWheelTest().test(); + } + + public void test() { + // Move mouse to upper-right area + try { + robot = new Robot(); + } catch (AWTException e) { + System.out.println("Problem creating Robot. FAIL."); + throw new RuntimeException("Problem creating Robot. FAIL."); + + } + + robot.setAutoDelay(500); + robot.setAutoWaitForIdle(true); + + // Show test Frame + Frame frame = new Frame("ScrollbarMouseWheelTest"); + frame.addWindowListener(this); + pnl = new Panel(); + pnl.setLayout(new GridLayout(1, 2)); + pnl.addMouseWheelListener(this); + sb1 = new Scrollbar(); + sb1.addMouseWheelListener(this); + pnl.add(sb1); + sb2 = new Scrollbar(); + pnl.add(sb2); + frame.add(pnl); + frame.setSize(200, 400); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.toFront(); + + // When Frame is active, start testing (handled in windowActivated()) + while (true) { + synchronized (sema) { + if (sema.getVal()) { + break; + } + } + } + // up on sb1 + testComp(sb1, true); + // down on sb1 + testComp(sb1, false); + // up on sb2 + testComp(sb2, true); + // down on sb2 + testComp(sb2, false); + frame.dispose(); + System.out.println("Test done."); + if (sb1upevents == REPS && + sb2upevents == 0 && + pnlupevents == PANEL_REPS && + sb1downevents == REPS && + sb2downevents == 0 && + pnldownevents == PANEL_REPS) { + System.out.println("PASSED."); + } else { + System.out.println("Test Failed:" + + "\n\tsb1upevents =" + sb1upevents + + "\n\tsb2upevents = " + sb2upevents + + "\n\tpnlupevents = " + pnlupevents + + "\n\tsb1downevents =" + sb1downevents + + "\n\tsb2downevents = " + sb2downevents + + "\n\tpnldownevents = " + pnldownevents); + throw new RuntimeException("Test FAILED."); + } + } + + public void testComp(Component comp, boolean up) { + Point loc = comp.getLocationOnScreen(); + robot.mouseMove(loc.x + comp.getWidth() / 2, + loc.y + comp.getHeight() / 2); + for (int loop = 0; loop < REPS; loop++) { + System.out.println("Robot.mouseWheel() on " + comp.getName()); + robot.mouseWheel(up ? -1 : 1); + } + } + + public void mouseWheelMoved(MouseWheelEvent mwe) { + Component src = mwe.getComponent(); + System.out.println("mouseWheelMoved() on " + src.getName()); + if (mwe.getWheelRotation() == -1) { + if (src == sb1) { + sb1upevents++; + } else if (src == sb2) { + sb2upevents++; + } else if (src == pnl) { + pnlupevents++; + } else { + System.out.println("weird source component"); + } + } else if (mwe.getWheelRotation() == 1) { + if (src == sb1) { + sb1downevents++; + } else if (src == sb2) { + sb2downevents++; + } else if (src == pnl) { + pnldownevents++; + } else { + System.out.println("weird source component"); + } + } else { + System.out.println("weird wheel rotation"); + } + } + + public void windowActivated(WindowEvent we) { + synchronized (sema) { + sema.setVal(true); + } + } + + public void windowClosed(WindowEvent we) {} + public void windowClosing(WindowEvent we) {} + public void windowDeactivated(WindowEvent we) {} + public void windowDeiconified(WindowEvent we) {} + public void windowIconified(WindowEvent we) {} + public void windowOpened(WindowEvent we) {} +}// class ScrollbarMouseWheelTest From eea06f70fc6154be12d066df6669e7c6d8c0bc09 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Sat, 9 May 2015 02:08:15 +0300 Subject: [PATCH 09/36] 8035568: [macosx] Cursor management unification Reviewed-by: anthony, serb --- .../classes/sun/lwawt/LWMouseInfoPeer.java | 10 ++- .../macosx/classes/sun/lwawt/LWToolkit.java | 4 +- .../classes/sun/lwawt/LWWindowPeer.java | 10 +-- .../classes/sun/lwawt/PlatformWindow.java | 4 +- .../lwawt/macosx/CPlatformEmbeddedFrame.java | 7 +- .../sun/lwawt/macosx/CPlatformLWWindow.java | 7 +- .../sun/lwawt/macosx/CPlatformWindow.java | 6 +- .../classes/sun/lwawt/macosx/CRobot.java | 35 +++++++- .../macosx/CViewPlatformEmbeddedFrame.java | 7 +- .../classes/sun/lwawt/macosx/LWCToolkit.java | 5 ++ .../native/libawt_lwawt/awt/AWTWindow.m | 15 ++-- .../native/libawt_lwawt/awt/CCursorManager.m | 14 ++- .../macosx/native/libawt_lwawt/awt/CRobot.m | 41 +-------- .../awt/MouseInfo/GetPointerInfoTest.java | 73 +++++++++++++++ .../awt/MouseInfo/MultiscreenPointerInfo.java | 90 +++++++++++++++++++ 15 files changed, 235 insertions(+), 93 deletions(-) create mode 100644 jdk/test/java/awt/MouseInfo/GetPointerInfoTest.java create mode 100644 jdk/test/java/awt/MouseInfo/MultiscreenPointerInfo.java diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWMouseInfoPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWMouseInfoPeer.java index 1920a73d3b0..a507b75a904 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWMouseInfoPeer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWMouseInfoPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -51,8 +51,12 @@ public class LWMouseInfoPeer implements MouseInfoPeer { return false; } - final Object windowPeer = AWTAccessor.getComponentAccessor().getPeer(w); - return LWWindowPeer.getWindowUnderCursor() == windowPeer; + LWWindowPeer windowPeer = AWTAccessor.getComponentAccessor().getPeer(w); + if (windowPeer == null) { + return false; + } + + return LWToolkit.getLWToolkit().getPlatformWindowUnderMouse() == windowPeer.getPlatformWindow(); } } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java index 9aea94cdc6c..4ab5c410830 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -396,6 +396,8 @@ public abstract class LWToolkit extends SunToolkit implements Runnable { return new LWMouseInfoPeer(); } + protected abstract PlatformWindow getPlatformWindowUnderMouse(); + @Override public final PrintJob getPrintJob(Frame frame, String doctitle, Properties props) { diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java index 1db30c021fa..fa6be35ad96 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -749,11 +749,10 @@ public class LWWindowPeer lastMouseEventPeer = targetPeer; } } else { - PlatformWindow topmostPlatforWindow = - platformWindow.getTopmostPlatformWindowUnderMouse(); + PlatformWindow topmostPlatformWindow = LWToolkit.getLWToolkit().getPlatformWindowUnderMouse(); LWWindowPeer topmostWindowPeer = - topmostPlatforWindow != null ? topmostPlatforWindow.getPeer() : null; + topmostPlatformWindow != null ? topmostPlatformWindow.getPeer() : null; // topmostWindowPeer == null condition is added for the backward // compatibility with applets. It can be removed when the @@ -764,8 +763,7 @@ public class LWWindowPeer screenX, screenY, modifiers, clickCount, popupTrigger, targetPeer); } else { - LWComponentPeer topmostTargetPeer = - topmostWindowPeer != null ? topmostWindowPeer.findPeerAt(r.x + x, r.y + y) : null; + LWComponentPeer topmostTargetPeer = topmostWindowPeer.findPeerAt(r.x + x, r.y + y); topmostWindowPeer.generateMouseEnterExitEventsForComponents(when, button, x, y, screenX, screenY, modifiers, clickCount, popupTrigger, topmostTargetPeer); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java index 3142aa0c402..93bd1928dbb 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -107,8 +107,6 @@ public interface PlatformWindow { public void setAlwaysOnTop(boolean value); - public PlatformWindow getTopmostPlatformWindowUnderMouse(); - public void updateFocusableWindowState(); public boolean rejectFocusRequest(CausedFocusEvent.Cause cause); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java index 0e8b0b0d2ec..f6ab6bbb4ad 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -129,11 +129,6 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { @Override public void setAlwaysOnTop(boolean value) {} - // This method should be properly implemented for applets. - // It returns null just as a stub. - @Override - public PlatformWindow getTopmostPlatformWindowUnderMouse() { return null; } - @Override public void updateFocusableWindowState() {} diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java index 9c2edf22742..0d9f9744c41 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -161,11 +161,6 @@ public class CPlatformLWWindow extends CPlatformWindow { public void setAlwaysOnTop(boolean isAlwaysOnTop) { } - @Override - public PlatformWindow getTopmostPlatformWindowUnderMouse(){ - return null; - } - @Override public void setOpacity(float opacity) { } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 949a9a168d9..043c08d5273 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -61,9 +61,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled); private static native void nativeSynthesizeMouseEnteredExitedEvents(); private static native void nativeDispose(long nsWindowPtr); - private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse(); private static native void nativeEnterFullScreenMode(long nsWindowPtr); private static native void nativeExitFullScreenMode(long nsWindowPtr); + static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse(); // Loger to report issues happened during execution but that do not affect functionality private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow"); @@ -750,10 +750,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo setStyleBits(ALWAYS_ON_TOP, isAlwaysOnTop); } - public PlatformWindow getTopmostPlatformWindowUnderMouse(){ - return CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse(); - } - @Override public void setOpacity(float opacity) { CWrapper.NSWindow.setAlphaValue(getNSWindowPtr(), opacity); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java index 0ff5f67955f..e8bdb1fe6c8 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -78,7 +78,7 @@ class CRobot implements RobotPeer { @Override public void mousePress(int buttons) { mouseButtonsState |= buttons; - + checkMousePos(); mouseEvent(fDevice.getCGDisplayID(), mouseLastX, mouseLastY, buttons, true, false); } @@ -92,11 +92,40 @@ class CRobot implements RobotPeer { @Override public void mouseRelease(int buttons) { mouseButtonsState &= ~buttons; - + checkMousePos(); mouseEvent(fDevice.getCGDisplayID(), mouseLastX, mouseLastY, buttons, false, false); } + /** + * Set unknown mouse location, if needed. + */ + private void checkMousePos() { + if (mouseLastX == MOUSE_LOCATION_UNKNOWN || + mouseLastY == MOUSE_LOCATION_UNKNOWN) { + + Rectangle deviceBounds = fDevice.getDefaultConfiguration().getBounds(); + Point mousePos = CCursorManager.getInstance().getCursorPosition(); + + if (mousePos.x < deviceBounds.x) { + mousePos.x = deviceBounds.x; + } + else if (mousePos.x > deviceBounds.x + deviceBounds.width) { + mousePos.x = deviceBounds.x + deviceBounds.width; + } + + if (mousePos.y < deviceBounds.y) { + mousePos.y = deviceBounds.y; + } + else if (mousePos.y > deviceBounds.y + deviceBounds.height) { + mousePos.y = deviceBounds.y + deviceBounds.height; + } + + mouseLastX = mousePos.x; + mouseLastY = mousePos.y; + } + } + @Override public native void mouseWheel(int wheelAmt); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java index 6c194c75bbd..1c11789713f 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CViewPlatformEmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -143,11 +143,6 @@ public class CViewPlatformEmbeddedFrame implements PlatformWindow { public void setAlwaysOnTop(boolean value) { } - @Override - public PlatformWindow getTopmostPlatformWindowUnderMouse() { - return null; - } - @Override public void updateFocusableWindowState() { } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index 1f9b30ae18f..e2dcd71733b 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -929,4 +929,9 @@ public final class LWCToolkit extends LWToolkit { !path.endsWith("/") && !path.endsWith("."); } + + @Override + protected PlatformWindow getPlatformWindowUnderMouse() { + return CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse(); + } } diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m index 8a7083e0dac..47442027e02 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -1131,15 +1131,16 @@ JNIEXPORT jobject JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeGetTopmostPlatformWindowUnderMouse (JNIEnv *env, jclass clazz) { - jobject topmostWindowUnderMouse = nil; + __block jobject topmostWindowUnderMouse = nil; JNF_COCOA_ENTER(env); - AWT_ASSERT_APPKIT_THREAD; - AWTWindow *awtWindow = [AWTWindow getTopmostWindowUnderMouse]; - if (awtWindow != nil) { - topmostWindowUnderMouse = [awtWindow.javaPlatformWindow jObject]; - } + [ThreadUtilities performOnMainThreadWaiting:YES block:^{ + AWTWindow *awtWindow = [AWTWindow getTopmostWindowUnderMouse]; + if (awtWindow != nil) { + topmostWindowUnderMouse = [awtWindow.javaPlatformWindow jObject]; + } + }]; JNF_COCOA_EXIT(env); diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m index e3b9e803980..eaff0e8a671 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -118,13 +118,11 @@ Java_sun_lwawt_macosx_CCursorManager_nativeGetCursorPosition JNF_COCOA_ENTER(env); - __block NSPoint pt = NSZeroPoint; - - [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ - pt = ConvertNSScreenPoint(env, [NSEvent mouseLocation]); - }]; - - jpt = NSToJavaPoint(env, pt); + CGEventRef event = CGEventCreate(NULL); + CGPoint globalPos = CGEventGetLocation(event); + CFRelease(event); + + jpt = NSToJavaPoint(env, globalPos); JNF_COCOA_EXIT(env); diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m index 8d4f2a052be..7fc6f62ec55 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -146,47 +146,10 @@ Java_sun_lwawt_macosx_CRobot_mouseEvent // This is the native method called when Robot mouse events occur. // The CRobot tracks the mouse position, and which button was - // pressed. If the mouse position is unknown it is obtained from - // CGEvents. The peer also tracks the mouse button desired state, + // pressed. The peer also tracks the mouse button desired state, // the appropriate key modifier state, and whether the mouse action // is simply a mouse move with no mouse button state changes. - CGError err = kCGErrorSuccess; - - CGRect globalDeviceBounds = CGDisplayBounds(displayID); - - // Set unknown mouse location, if needed. - if ((mouseLastX == sun_lwawt_macosx_CRobot_MOUSE_LOCATION_UNKNOWN) || - (mouseLastY == sun_lwawt_macosx_CRobot_MOUSE_LOCATION_UNKNOWN)) - { - CGEventRef event = CGEventCreate(NULL); - if (event == NULL) { - return; - } - - CGPoint globalPos = CGEventGetLocation(event); - CFRelease(event); - - // Normalize the coords within this display device, as - // per Robot rules. - if (globalPos.x < CGRectGetMinX(globalDeviceBounds)) { - globalPos.x = CGRectGetMinX(globalDeviceBounds); - } - else if (globalPos.x > CGRectGetMaxX(globalDeviceBounds)) { - globalPos.x = CGRectGetMaxX(globalDeviceBounds); - } - - if (globalPos.y < CGRectGetMinY(globalDeviceBounds)) { - globalPos.y = CGRectGetMinY(globalDeviceBounds); - } - else if (globalPos.y > CGRectGetMaxY(globalDeviceBounds)) { - globalPos.y = CGRectGetMaxY(globalDeviceBounds); - } - - mouseLastX = (jint)globalPos.x; - mouseLastY = (jint)globalPos.y; - } - // volatile, otherwise it warns that it might be clobbered by 'longjmp' volatile CGPoint point; diff --git a/jdk/test/java/awt/MouseInfo/GetPointerInfoTest.java b/jdk/test/java/awt/MouseInfo/GetPointerInfoTest.java new file mode 100644 index 00000000000..c812cce16eb --- /dev/null +++ b/jdk/test/java/awt/MouseInfo/GetPointerInfoTest.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2014, 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 + @summary unit test for getPointerInfo() from MouseInfo class + @author dav@sparc.spb.su: area= + @bug 4009555 + @run main GetPointerInfoTest +*/ + +import java.awt.*; + +/** + * Simply check the result on non-null and results are correct. + */ +public class GetPointerInfoTest { + private static final String successStage = "Test stage completed.Passed."; + + public static void main(String[] args) throws Exception { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gds = ge.getScreenDevices(); + int gdslen = gds.length; + System.out.println("There are " + gdslen + " Graphics Devices"); + if (gdslen == 0) { + System.out.println("Nothing to be done."); + return; + } + Robot robot = new Robot(gds[0]); + robot.setAutoDelay(0); + robot.setAutoWaitForIdle(true); + robot.delay(10); + robot.waitForIdle(); + Point p = new Point(101, 99); + robot.mouseMove(p.x, p.y); + + PointerInfo pi = MouseInfo.getPointerInfo(); + if (pi == null) { + throw new RuntimeException("Test failed. getPointerInfo() returned null value."); + } else { + System.out.println(successStage); + } + Point piLocation = pi.getLocation(); + + if (piLocation.x != p.x || piLocation.y != p.y) { + throw new RuntimeException("Test failed.getPointerInfo() returned incorrect result."); + } else { + System.out.println(successStage); + } + + System.out.println("Test PASSED."); + } +} diff --git a/jdk/test/java/awt/MouseInfo/MultiscreenPointerInfo.java b/jdk/test/java/awt/MouseInfo/MultiscreenPointerInfo.java new file mode 100644 index 00000000000..288ab4b0315 --- /dev/null +++ b/jdk/test/java/awt/MouseInfo/MultiscreenPointerInfo.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2014, 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 + @summary unit test for getPointerInfo() from MouseInfo class + @author prs@sparc.spb.su: area= + @bug 4009555 + @run main MultiscreenPointerInfo +*/ + +import java.awt.*; + +/** + * Simply check the result on non-null and results are correct. + */ +public class MultiscreenPointerInfo +{ + private static final String successStage = "Test stage completed.Passed."; + + public static void main(String[] args) throws Exception { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gds = ge.getScreenDevices(); + int gdslen = gds.length; + System.out.println("There are " + gdslen + " Graphics Devices"); + if (gdslen < 2) { + System.out.println("Nothing to be done. PASSED automatically."); + return; + } + Rectangle rx = gds[1].getDefaultConfiguration().getBounds(); + Robot robot; + + if (rx.x == 0 && rx.y == 0) { + // Assuming independent graphics devices + robot = new Robot(gds[1]); + } else { + // Means we have a virtual device + robot = new Robot(gds[0]); + } + robot.setAutoDelay(0); + robot.setAutoWaitForIdle(true); + robot.delay(10); + robot.waitForIdle(); + Point p = new Point(rx.x + 101, rx.y + 99); + robot.mouseMove(p.x, p.y); + PointerInfo pi = MouseInfo.getPointerInfo(); + if (pi == null) { + throw new RuntimeException("Test failed. getPointerInfo() returned null value."); + } else { + System.out.println(successStage); + } + + Point piLocation = pi.getLocation(); + + if (piLocation.x != p.x || piLocation.y != p.y) { + throw new RuntimeException("Test failed.getPointerInfo() returned incorrect location."); + } else { + System.out.println(successStage); + } + + GraphicsDevice dev = pi.getDevice(); + + if (dev != gds[1]) { + throw new RuntimeException("Test failed.getPointerInfo() returned incorrect device."); + } else { + System.out.println(successStage); + } + System.out.println("Test PASSED."); + } +} From 1c0f1c478fb6731eb1ca94683a0e9e432750c357 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 12 May 2015 09:18:31 +0300 Subject: [PATCH 10/36] 8001470: JTextField's size is computed incorrectly when it contains Indic or Thai characters Reviewed-by: serb, alexsch --- .../javax/swing/plaf/basic/BasicTextUI.java | 4 +- .../basic/BasicTextUI/8001470/bug8001470.java | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 0a04b314218..3b38e77d94d 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -939,7 +939,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { if ((d.width > (i.left + i.right)) && (d.height > (i.top + i.bottom))) { rootView.setSize(d.width - i.left - i.right, d.height - i.top - i.bottom); } - else if (d.width == 0 && d.height == 0) { + else if (d.width == 0 || d.height == 0) { // Probably haven't been layed out yet, force some sort of // initial sizing. rootView.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE); diff --git a/jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java b/jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java new file mode 100644 index 00000000000..a63a769a9cb --- /dev/null +++ b/jdk/test/javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2015, 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 8001470 + @summary JTextField's size is computed incorrectly when it contains Indic or Thai characters + @author Semyon Sadetsky + */ + +import javax.swing.*; +import java.awt.*; + +public class bug8001470 { + + private static JFrame frame; + private static JTextField textField1; + private static JTextField textField2; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new JFrame("JTextField Test"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel container = (JPanel) frame.getContentPane(); + container.setLayout(new GridLayout(2,1)); + + textField1 = new JTextField("\u0e01"); + textField2 = new JTextField("\u0c01"); + + container.add(textField1); + container.add(textField2); + frame.setVisible(true); + frame.pack(); + } + }); + if( textField1.getHeight() < 10 || textField2.getHeight() < 10 ) + throw new Exception("Wrong field height"); + System.out.println("ok"); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + frame.dispose(); + } + }); + } +} From 11215eaec0ee3b14be940f0bfb80983ac495999f Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 12 May 2015 09:22:53 +0300 Subject: [PATCH 11/36] 8078483: Apparent endless loop running JEditorPanePaintTest Reviewed-by: serb, alexsch --- .../share/classes/javax/swing/plaf/basic/BasicTextUI.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 3b38e77d94d..1567a76c4c4 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -936,8 +936,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { ((AbstractDocument)doc).readLock(); } try { - if ((d.width > (i.left + i.right)) && (d.height > (i.top + i.bottom))) { - rootView.setSize(d.width - i.left - i.right, d.height - i.top - i.bottom); + if ((d.width > (i.left + i.right + caretMargin)) && (d.height > (i.top + i.bottom))) { + rootView.setSize(d.width - i.left - i.right - + caretMargin, d.height - i.top - i.bottom); } else if (d.width == 0 || d.height == 0) { // Probably haven't been layed out yet, force some sort of From e52bc6a831807006a20720f849e975428353cd17 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Tue, 12 May 2015 16:43:32 +0400 Subject: [PATCH 12/36] 8079255: [macosx] Test closed/java/awt/Robot/RobotWheelTest/RobotWheelTest fails for Mac only Reviewed-by: serb --- .../Robot/RobotWheelTest/RobotWheelTest.java | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 jdk/test/java/awt/Robot/RobotWheelTest/RobotWheelTest.java diff --git a/jdk/test/java/awt/Robot/RobotWheelTest/RobotWheelTest.java b/jdk/test/java/awt/Robot/RobotWheelTest/RobotWheelTest.java new file mode 100644 index 00000000000..928648fc7a3 --- /dev/null +++ b/jdk/test/java/awt/Robot/RobotWheelTest/RobotWheelTest.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1998, 2015, 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 java.awt.Button; +import java.awt.Frame; +import java.awt.Rectangle; +import java.awt.Robot; +import jdk.testlibrary.OSInfo; + +/* + * @test 1.2 98/08/05 + * @bug 4373478 8079255 + * @summary Test mouse wheel functionality of Robot + * @author bchristi: area=Robot + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo + * @run main RobotWheelTest + */ +public class RobotWheelTest { + + private static final int NUMTESTS = 20; + private static volatile int wheelRotation; + + public static void main(String[] args) throws Exception { + + Frame frame = null; + try { + int wheelSign = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ? -1 : 1; + + frame = new Frame(); + frame.setSize(200, 200); + Button button = new Button("WheelButton"); + button.addMouseWheelListener(e -> wheelRotation = e.getWheelRotation()); + frame.add(button); + frame.setVisible(true); + + Robot robot = new Robot(); + robot.setAutoDelay(100); + robot.waitForIdle(); + + Rectangle bounds = frame.getBounds(); + int centerX = bounds.x + bounds.width / 2; + int centerY = bounds.y + bounds.height / 2; + robot.mouseMove(centerX, centerY); + robot.waitForIdle(); + + for (int i = -NUMTESTS; i <= NUMTESTS; i++) { + if (i == 0) { + continue; + } + robot.mouseWheel(i); + robot.waitForIdle(); + if (i != wheelSign * wheelRotation) { + throw new RuntimeException("wheelRotation = " + wheelRotation + + ", expected value = " + i); + } + } + } finally { + if (frame != null) { + frame.dispose(); + } + } + } +} \ No newline at end of file From 5c80a9e763298586dae65e97743bacf422f3d6d5 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Tue, 12 May 2015 20:30:48 +0300 Subject: [PATCH 13/36] 8077584: Value of java.awt.font.OpenType.TAG_OPBD is incorrect Reviewed-by: serb, prr --- .../share/classes/java/awt/font/OpenType.java | 2 +- .../font/OpenType/OpticalBoundsTagTest.java | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/awt/font/OpenType/OpticalBoundsTagTest.java diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/OpenType.java b/jdk/src/java.desktop/share/classes/java/awt/font/OpenType.java index e32503ab5ed..ebe6cb39adf 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/OpenType.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/OpenType.java @@ -331,7 +331,7 @@ public interface OpenType { * Optical bounds. Table tag "opbd" in the Open * Type Specification. */ - public final static int TAG_OPBD = 0x6d6f7274; + public final static int TAG_OPBD = 0x6F706264; /** * Glyph properties. Table tag "prop" in the Open diff --git a/jdk/test/java/awt/font/OpenType/OpticalBoundsTagTest.java b/jdk/test/java/awt/font/OpenType/OpticalBoundsTagTest.java new file mode 100644 index 00000000000..7d36506889c --- /dev/null +++ b/jdk/test/java/awt/font/OpenType/OpticalBoundsTagTest.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2015, 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 java.awt.font.OpenType; +import java.io.IOException; + +/** + * @test + * @bug 8077584 + * @summary Test for TAG_OPBD tag. Should be unique and not same as TAG_MORT. + * @run main OpticalBoundsTagTest + */ + +public class OpticalBoundsTagTest { + + public static void main(String[] a) throws Exception { + + int tag_opbd = java.awt.font.OpenType.TAG_OPBD; + if (tag_opbd == java.awt.font.OpenType.TAG_MORT) { + System.out.println("Test failed: TAG_OPBD:" + tag_opbd); + throw new RuntimeException("TAG_OPBD same as TAG_MORT"); + } else { + System.out.println("Test passed: TAG_OPBD: " + tag_opbd); + } + } +} From a7bea0d0c4fc835e2921b0584566ace434669b11 Mon Sep 17 00:00:00 2001 From: Vivi An Date: Tue, 12 May 2015 13:45:49 -0700 Subject: [PATCH 14/36] 8075609: java.lang.IllegalArgumentException: aContainer is not a focus cycle root of aComponent Reviewed-by: alexsch, ant --- .../swing/plaf/basic/BasicRadioButtonUI.java | 2 +- .../JRadioButton/8075609/bug8075609.java | 115 ++++++++++++++++++ 2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java index 89066d20695..9c73734b72a 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java @@ -438,7 +438,7 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI // to the button group or not Component getFocusTransferBaseComponent(boolean next){ Component focusBaseComp = activeBtn; - Window container = SwingUtilities.getWindowAncestor(activeBtn); + Container container = focusBaseComp.getFocusCycleRootAncestor(); if (container != null) { FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); Component comp = next ? policy.getComponentAfter(container, activeBtn) diff --git a/jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java b/jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java new file mode 100644 index 00000000000..9bffc80ce88 --- /dev/null +++ b/jdk/test/javax/swing/JRadioButton/8075609/bug8075609.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2015, 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 8075609 + * @summary IllegalArgumentException when transferring focus from JRadioButton using tab + * @author Vivi An + * @run main bug8075609 + */ + +import javax.swing.*; +import javax.swing.event.*; +import java.awt.event.*; +import java.awt.*; +import sun.awt.SunToolkit; + +public class bug8075609 { + private static Robot robot; + private static SunToolkit toolkit; + private static JTextField textField; + + public static void main(String args[]) throws Throwable { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + robot = new Robot(); + Thread.sleep(100); + + robot.setAutoDelay(100); + toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + // Radio button group tab key test + runTest1(); + } + + private static void createAndShowGUI() { + JFrame mainFrame = new JFrame("Bug 8075609 - 1 test"); + + JPanel rootPanel = new JPanel(); + rootPanel.setLayout(new BorderLayout()); + + JPanel formPanel = new JPanel(); + formPanel.setFocusTraversalPolicy(new LayoutFocusTraversalPolicy()); + formPanel.setFocusCycleRoot(true); + + JRadioButton option1 = new JRadioButton("Option 1", true); + JRadioButton option2 = new JRadioButton("Option 2"); + + ButtonGroup radioButtonGroup = new ButtonGroup(); + radioButtonGroup.add(option1); + radioButtonGroup.add(option2); + + formPanel.add(option1); + formPanel.add(option2); + textField = new JTextField("Another focusable component"); + formPanel.add(textField); + + rootPanel.add(formPanel, BorderLayout.CENTER); + + JButton okButton = new JButton("OK"); + rootPanel.add(okButton, BorderLayout.SOUTH); + + mainFrame.add(rootPanel); + mainFrame.pack(); + mainFrame.setVisible(true); + mainFrame.toFront(); + } + + // Radio button Group as a single component when traversing through tab key + private static void runTest1() throws Exception{ + hitKey(robot, KeyEvent.VK_TAB); + + robot.setAutoDelay(1000 ); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (textField.hasFocus()) { + System.out.println("Radio Button Group Go To Next Component through Tab Key failed"); + throw new RuntimeException("Focus is not on textField as Expected"); + } + } + }); + } + + private static void hitKey(Robot robot, int keycode) { + robot.keyPress(keycode); + robot.keyRelease(keycode); + toolkit.realSync(); + } +} From 619677d0dc21f949807c86bea80c69475ff7a914 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Wed, 13 May 2015 18:06:19 +0300 Subject: [PATCH 15/36] 8072775: Tremendous memory usage by JTextArea Reviewed-by: vadim, prr --- .../classes/sun/font/StandardTextSource.java | 107 +++++++----------- .../classes/sun/font/TextLabelFactory.java | 12 +- .../JTextArea/TextViewOOM/TextViewOOM.java | 95 ++++++++++++++++ 3 files changed, 140 insertions(+), 74 deletions(-) create mode 100644 jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java diff --git a/jdk/src/java.desktop/share/classes/sun/font/StandardTextSource.java b/jdk/src/java.desktop/share/classes/sun/font/StandardTextSource.java index 38389ec1e0d..afda090946e 100644 --- a/jdk/src/java.desktop/share/classes/sun/font/StandardTextSource.java +++ b/jdk/src/java.desktop/share/classes/sun/font/StandardTextSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -33,42 +33,43 @@ import java.awt.Font; import java.awt.font.FontRenderContext; import java.awt.font.LineMetrics; -public class StandardTextSource extends TextSource { - char[] chars; - int start; - int len; - int cstart; - int clen; - int level; // assumed all uniform - int flags; // see GlyphVector.java - Font font; - FontRenderContext frc; - CoreMetrics cm; +final class StandardTextSource extends TextSource { - /** - * Create a simple implementation of a TextSource. - * - * Chars is an array containing clen chars in the context, in - * logical order, contiguously starting at cstart. Start and len - * represent that portion of the context representing the true - * source; start, like cstart, is relative to the start of the - * character array. - * - * Level is the bidi level (0-63 for the entire context. Flags is - * the layout flags. Font is the font, frc is the render context, - * and lm is the line metrics for the entire source text, but not - * necessarily the context. - */ - public StandardTextSource(char[] chars, - int start, - int len, - int cstart, - int clen, - int level, - int flags, - Font font, - FontRenderContext frc, - CoreMetrics cm) { + private final char[] chars; + private final int start; + private final int len; + private final int cstart; + private final int clen; + private final int level; // assumed all uniform + private final int flags; // see GlyphVector.java + private final Font font; + private final FontRenderContext frc; + private final CoreMetrics cm; + + /** + * Create a simple implementation of a TextSource. + * + * Chars is an array containing clen chars in the context, in + * logical order, contiguously starting at cstart. Start and len + * represent that portion of the context representing the true + * source; start, like cstart, is relative to the start of the + * character array. + * + * Level is the bidi level (0-63 for the entire context. Flags is + * the layout flags. Font is the font, frc is the render context, + * and lm is the line metrics for the entire source text, but not + * necessarily the context. + */ + StandardTextSource(char[] chars, + int start, + int len, + int cstart, + int clen, + int level, + int flags, + Font font, + FontRenderContext frc, + CoreMetrics cm) { if (chars == null) { throw new IllegalArgumentException("bad chars: null"); } @@ -97,7 +98,7 @@ public class StandardTextSource extends TextSource { throw new IllegalArgumentException("bad frc: null"); } - this.chars = chars.clone(); + this.chars = chars; this.start = start; this.len = len; this.cstart = cstart; @@ -115,40 +116,10 @@ public class StandardTextSource extends TextSource { } } - /** Create a StandardTextSource whose context is coextensive with the source. */ - public StandardTextSource(char[] chars, - int start, - int len, - int level, - int flags, - Font font, - FontRenderContext frc, - CoreMetrics cm) { - this(chars, start, len, start, len, level, flags, font, frc, cm); - } - - /** Create a StandardTextSource whose context and source are coextensive with the entire char array. */ - public StandardTextSource(char[] chars, - int level, - int flags, - Font font, - FontRenderContext frc) { - this(chars, 0, chars.length, 0, chars.length, level, flags, font, frc, null); - } - - /** Create a StandardTextSource whose context and source are all the text in the String. */ - public StandardTextSource(String str, - int level, - int flags, - Font font, - FontRenderContext frc) { - this(str.toCharArray(), 0, str.length(), 0, str.length(), level, flags, font, frc, null); - } - // TextSource API public char[] getChars() { - return chars.clone(); + return chars; } public int getStart() { diff --git a/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java b/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java index a42b396c087..1f9ba94159c 100644 --- a/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java +++ b/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -48,12 +48,12 @@ import java.text.Bidi; * @see TextLayout */ -public class TextLabelFactory { - private FontRenderContext frc; - private char[] text; - private Bidi bidi; +public final class TextLabelFactory { + private final FontRenderContext frc; + private final char[] text; + private final Bidi bidi; private Bidi lineBidi; - private int flags; + private final int flags; private int lineStart; private int lineLimit; diff --git a/jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java b/jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java new file mode 100644 index 00000000000..e75c7053d08 --- /dev/null +++ b/jdk/test/javax/swing/JTextArea/TextViewOOM/TextViewOOM.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2015, 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 java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +/** + * @test + * @bug 8072775 + * @run main/othervm -Xmx80m TextViewOOM + */ +public class TextViewOOM { + + private static JFrame frame; + private static JTextArea ta; + private static final String STRING = "\uDC00\uD802\uDFFF"; + private static final int N = 5000; + + private static void createAndShowGUI() { + frame = new JFrame(); + final JScrollPane jScrollPane1 = new JScrollPane(); + ta = new JTextArea(); + + ta.setEditable(false); + ta.setColumns(20); + ta.setRows(5); + jScrollPane1.setViewportView(ta); + frame.add(ta); + + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(final String[] args) throws Exception { + /* Create and display the form */ + EventQueue.invokeAndWait(TextViewOOM::createAndShowGUI); + for (int i = 0; i < 10; i++) { + System.gc(); + Thread.sleep(1000); + } + long mem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + System.err.println("Memory before creating the text: "+mem); + final StringBuilder sb = new StringBuilder(N * STRING.length()); + for (int i = 0; i < N; i++) { + sb.append(STRING); + } + for (int i = 0; i < 10; i++) { + System.gc(); + Thread.sleep(1000); + } + mem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + System.err.println("Memory after creating the text: "+mem); + + EventQueue.invokeAndWait(() -> { + ta.setText(sb.toString()); + for (int i = 0; i < 10; i++) { + System.gc(); + try {Thread.sleep(200);} catch (InterruptedException iex) {} + } + long mem1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + System.err.println("Memory after setting the text: " + mem1); + }); + for (int i = 0; i < 10; i++) { + System.gc(); + Thread.sleep(1000); + } + mem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + System.err.println("Final memory after everything: " + mem); + EventQueue.invokeAndWait(frame::dispose); + } +} From acbb57df0f75796467e38464dd8b46065c27f611 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Wed, 13 May 2015 19:19:03 +0300 Subject: [PATCH 16/36] 5109918: Wrong documentation for JSpinner.DateEditor constructor Reviewed-by: alexsch, azvegint --- jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java index 064e6e47638..42b1dc39b3b 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java @@ -970,7 +970,7 @@ public class JSpinner extends JComponent implements Accessible * and editing the value of a SpinnerDateModel * with a JFormattedTextField. This * DateEditor becomes both a ChangeListener - * on the spinners model and a PropertyChangeListener + * on the spinner and a PropertyChangeListener * on the new JFormattedTextField. * * @param spinner the spinner whose model this editor will monitor From 88dd747a1a34608c4376c022630f3c6e0cb434ae Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 14 May 2015 02:05:02 +0300 Subject: [PATCH 17/36] 6368321: MetalRootPaneUI calls to deprecated code Reviewed-by: alexsch, azvegint --- .../share/classes/javax/swing/JApplet.java | 28 +++--- .../share/classes/javax/swing/JDialog.java | 11 +-- .../share/classes/javax/swing/JFrame.java | 8 +- .../swing/plaf/metal/MetalRootPaneUI.java | 28 +++--- .../SilenceOfDeprecatedMenuBar.java | 90 +++++++++++++++++++ 5 files changed, 122 insertions(+), 43 deletions(-) create mode 100644 jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java b/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java index 4e74e411a61..6a00de486d2 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -24,14 +24,18 @@ */ package javax.swing; -import java.awt.*; -import java.awt.event.*; import java.applet.Applet; -import java.beans.PropertyChangeListener; -import java.util.Locale; -import java.util.Vector; -import java.io.Serializable; -import javax.accessibility.*; +import java.awt.AWTEvent; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Graphics; +import java.awt.HeadlessException; +import java.awt.LayoutManager; + +import javax.accessibility.Accessible; +import javax.accessibility.AccessibleContext; /** * An extended version of java.applet.Applet that adds support for @@ -243,9 +247,8 @@ public class JApplet extends Applet implements Accessible, * hidden: true * description: The menubar for accessing pulldown menus from this applet. */ - @SuppressWarnings("deprecation") - public void setJMenuBar(JMenuBar menuBar) { - getRootPane().setMenuBar(menuBar); + public void setJMenuBar(final JMenuBar menuBar) { + getRootPane().setJMenuBar(menuBar); } /** @@ -254,9 +257,8 @@ public class JApplet extends Applet implements Accessible, * @return the menubar set on this applet * @see #setJMenuBar */ - @SuppressWarnings("deprecation") public JMenuBar getJMenuBar() { - return getRootPane().getMenuBar(); + return getRootPane().getJMenuBar(); } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java b/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java index b9eb3e55475..b33bb15f30d 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -849,9 +849,8 @@ public class JDialog extends Dialog implements WindowConstants, * hidden: true * description: The menubar for accessing pulldown menus from this dialog. */ - @SuppressWarnings("deprecation") - public void setJMenuBar(JMenuBar menu) { - getRootPane().setMenuBar(menu); + public void setJMenuBar(final JMenuBar menu) { + getRootPane().setJMenuBar(menu); } /** @@ -860,12 +859,10 @@ public class JDialog extends Dialog implements WindowConstants, * @return the menubar set on this dialog * @see #setJMenuBar */ - @SuppressWarnings("deprecation") public JMenuBar getJMenuBar() { - return getRootPane().getMenuBar(); + return getRootPane().getJMenuBar(); } - /** * Returns whether calls to {@code add} and * {@code setLayout} are forwarded to the {@code contentPane}. diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java b/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java index be6b5ba96ba..c8415e70f58 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java @@ -486,9 +486,8 @@ public class JFrame extends Frame implements WindowConstants, * hidden: true * description: The menubar for accessing pulldown menus from this frame. */ - @SuppressWarnings("deprecation") - public void setJMenuBar(JMenuBar menubar) { - getRootPane().setMenuBar(menubar); + public void setJMenuBar(final JMenuBar menubar) { + getRootPane().setJMenuBar(menubar); } /** @@ -497,9 +496,8 @@ public class JFrame extends Frame implements WindowConstants, * * @see #setJMenuBar */ - @SuppressWarnings("deprecation") public JMenuBar getJMenuBar() { - return getRootPane().getMenuBar(); + return getRootPane().getJMenuBar(); } /** diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java index bd5f203f434..1d163f22bfa 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -27,15 +27,11 @@ package javax.swing.plaf.metal; import java.awt.event.*; import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import javax.swing.*; -import javax.swing.border.*; import javax.swing.event.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; import java.awt.*; -import java.io.*; -import java.security.*; /** * Provides the metal look and feel implementation of RootPaneUI. @@ -441,7 +437,6 @@ public class MetalRootPaneUI extends BasicRootPaneUI * @param the Container for which this layout manager is being used * @return a Dimension object containing the layout's preferred size */ - @SuppressWarnings("deprecation") public Dimension preferredLayoutSize(Container parent) { Dimension cpd, mbd, tpd; int cpWidth = 0; @@ -463,8 +458,8 @@ public class MetalRootPaneUI extends BasicRootPaneUI cpHeight = cpd.height; } - if(root.getMenuBar() != null) { - mbd = root.getMenuBar().getPreferredSize(); + if(root.getJMenuBar() != null) { + mbd = root.getJMenuBar().getPreferredSize(); if (mbd != null) { mbWidth = mbd.width; mbHeight = mbd.height; @@ -494,7 +489,6 @@ public class MetalRootPaneUI extends BasicRootPaneUI * @param the Container for which this layout manager is being used * @return a Dimension object containing the layout's minimum size */ - @SuppressWarnings("deprecation") public Dimension minimumLayoutSize(Container parent) { Dimension cpd, mbd, tpd; int cpWidth = 0; @@ -516,8 +510,8 @@ public class MetalRootPaneUI extends BasicRootPaneUI cpHeight = cpd.height; } - if(root.getMenuBar() != null) { - mbd = root.getMenuBar().getMinimumSize(); + if(root.getJMenuBar() != null) { + mbd = root.getJMenuBar().getMinimumSize(); if (mbd != null) { mbWidth = mbd.width; mbHeight = mbd.height; @@ -546,7 +540,6 @@ public class MetalRootPaneUI extends BasicRootPaneUI * @param the Container for which this layout manager is being used * @return a Dimension object containing the layout's maximum size */ - @SuppressWarnings("deprecation") public Dimension maximumLayoutSize(Container target) { Dimension cpd, mbd, tpd; int cpWidth = Integer.MAX_VALUE; @@ -566,8 +559,8 @@ public class MetalRootPaneUI extends BasicRootPaneUI } } - if(root.getMenuBar() != null) { - mbd = root.getMenuBar().getMaximumSize(); + if(root.getJMenuBar() != null) { + mbd = root.getJMenuBar().getMaximumSize(); if (mbd != null) { mbWidth = mbd.width; mbHeight = mbd.height; @@ -610,7 +603,6 @@ public class MetalRootPaneUI extends BasicRootPaneUI * * @param the Container for which this layout manager is being used */ - @SuppressWarnings("deprecation") public void layoutContainer(Container parent) { JRootPane root = (JRootPane) parent; Rectangle b = root.getBounds(); @@ -640,9 +632,9 @@ public class MetalRootPaneUI extends BasicRootPaneUI } } } - if(root.getMenuBar() != null) { - Dimension mbd = root.getMenuBar().getPreferredSize(); - root.getMenuBar().setBounds(0, nextY, w, mbd.height); + if(root.getJMenuBar() != null) { + Dimension mbd = root.getJMenuBar().getPreferredSize(); + root.getJMenuBar().setBounds(0, nextY, w, mbd.height); nextY += mbd.height; } if(root.getContentPane() != null) { diff --git a/jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java b/jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java new file mode 100644 index 00000000000..a59ac067f30 --- /dev/null +++ b/jdk/test/javax/swing/JRootPane/SilenceOfDeprecatedMenuBar/SilenceOfDeprecatedMenuBar.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2015, 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.JFrame; +import javax.swing.JMenuBar; +import javax.swing.JRootPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.UIManager.getInstalledLookAndFeels; + +/** + * @test + * @bug 6368321 + * @author Sergey Bylokhov + */ +public final class SilenceOfDeprecatedMenuBar implements Runnable { + + public static void main(final String[] args) throws Exception { + for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) { + SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf)); + SwingUtilities.invokeAndWait(new SilenceOfDeprecatedMenuBar()); + } + } + + @Override + public void run() { + final JFrame frame = new DeprecatedFrame(); + try { + final JMenuBar bar = new JMenuBar(); + frame.setJMenuBar(bar); + frame.setBounds(100, 100, 100, 100); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + if (bar != frame.getJMenuBar()) { + throw new RuntimeException("Wrong JMenuBar"); + } + } finally { + frame.dispose(); + } + } + + private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) { + try { + UIManager.setLookAndFeel(laf.getClassName()); + System.out.println("LookAndFeel: " + laf.getClassName()); + } catch (ClassNotFoundException | InstantiationException | + UnsupportedLookAndFeelException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + private static class DeprecatedFrame extends JFrame { + + @Override + protected JRootPane createRootPane() { + return new JRootPane() { + @Override + public JMenuBar getMenuBar() { + throw new RuntimeException("Should not be here"); + } + @Override + public void setMenuBar(final JMenuBar menu) { + throw new RuntimeException("Should not be here"); + } + }; + } + } +} From 26076d63aca5cddabcb910a96171b7a7a64f7d11 Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Thu, 14 May 2015 18:23:39 +0300 Subject: [PATCH 18/36] 8033069: mouse wheel scroll closes combobox popup Reviewed-by: serb, alexsch --- .../swing/plaf/basic/BasicComboBoxUI.java | 44 +++-- .../swing/plaf/basic/BasicComboPopup.java | 29 ++- .../swing/plaf/basic/BasicPopupMenuUI.java | 4 +- .../8033069/bug8033069NoScrollBar.java | 182 ++++++++++++++++++ .../8033069/bug8033069ScrollBar.java | 52 +++++ 5 files changed, 295 insertions(+), 16 deletions(-) create mode 100644 jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java create mode 100644 jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java index 33f1540feae..5a3f67da230 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -150,6 +150,8 @@ public class BasicComboBoxUI extends ComboBoxUI { */ protected KeyListener popupKeyListener; + private MouseWheelListener mouseWheelListener; + // This is used for knowing when to cache the minimum preferred size. // If the data in the list changes, the cached value get marked for recalc. // Added to the current JComboBox model @@ -413,6 +415,10 @@ public class BasicComboBoxUI extends ComboBoxUI { comboBox.getModel().addListDataListener( listDataListener ); } } + + if ((mouseWheelListener = createMouseWheelListener()) != null) { + comboBox.addMouseWheelListener(mouseWheelListener); + } } /** @@ -459,6 +465,9 @@ public class BasicComboBoxUI extends ComboBoxUI { comboBox.getModel().removeListDataListener( listDataListener ); } } + if (mouseWheelListener != null) { + comboBox.removeMouseWheelListener(mouseWheelListener); + } } /** @@ -572,6 +581,10 @@ public class BasicComboBoxUI extends ComboBoxUI { return handler; } + private MouseWheelListener createMouseWheelListener() { + return getHandler(); + } + // // end UI Initialization //====================== @@ -1723,7 +1736,8 @@ public class BasicComboBoxUI extends ComboBoxUI { // private class Handler implements ActionListener, FocusListener, KeyListener, LayoutManager, - ListDataListener, PropertyChangeListener { + ListDataListener, PropertyChangeListener, + MouseWheelListener { // // PropertyChangeListener // @@ -1997,21 +2011,25 @@ public class BasicComboBoxUI extends ComboBoxUI { public void actionPerformed(ActionEvent evt) { Object item = comboBox.getEditor().getItem(); if (item != null) { - if(!comboBox.isPopupVisible() && !item.equals(comboBox.getSelectedItem())) { - comboBox.setSelectedItem(comboBox.getEditor().getItem()); - } - ActionMap am = comboBox.getActionMap(); - if (am != null) { - Action action = am.get("enterPressed"); - if (action != null) { - action.actionPerformed(new ActionEvent(comboBox, evt.getID(), - evt.getActionCommand(), - evt.getModifiers())); + if (!comboBox.isPopupVisible() && !item.equals(comboBox.getSelectedItem())) { + comboBox.setSelectedItem(comboBox.getEditor().getItem()); + } + ActionMap am = comboBox.getActionMap(); + if (am != null) { + Action action = am.get("enterPressed"); + if (action != null) { + action.actionPerformed(new ActionEvent(comboBox, evt.getID(), + evt.getActionCommand(), + evt.getModifiers())); + } } } - } + } + + public void mouseWheelMoved(MouseWheelEvent e) { + e.consume(); + } } - } class DefaultKeySelectionManager implements JComboBox.KeySelectionManager, UIResource { private String prefix = ""; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java index c70c06cad89..3b3d33cc9d7 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java @@ -184,6 +184,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { */ protected ItemListener itemListener; + private MouseWheelListener scrollerMouseWheelListener; + /** * This protected field is implementation specific. Do not access directly * or override. @@ -311,6 +313,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { uninstallComboBoxModelListeners(comboBox.getModel()); uninstallKeyboardActions(); uninstallListListeners(); + uninstallScrollerListeners(); // We do this, otherwise the listener the ui installs on // the model (the combobox model in this case) will keep a // reference to the list, causing the list (and us) to never get gced. @@ -608,6 +611,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { scroller.setFocusable( false ); scroller.getVerticalScrollBar().setFocusable( false ); scroller.setBorder( null ); + installScrollerListeners(); } /** @@ -624,6 +628,20 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { setFocusable( false ); } + private void installScrollerListeners() { + scrollerMouseWheelListener = getHandler(); + if (scrollerMouseWheelListener != null) { + scroller.addMouseWheelListener(scrollerMouseWheelListener); + } + } + + private void uninstallScrollerListeners() { + if (scrollerMouseWheelListener != null) { + scroller.removeMouseWheelListener(scrollerMouseWheelListener); + scrollerMouseWheelListener = null; + } + } + /** * This method adds the necessary listeners to the JComboBox. */ @@ -835,8 +853,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { private class Handler implements ItemListener, MouseListener, - MouseMotionListener, PropertyChangeListener, - Serializable { + MouseMotionListener, MouseWheelListener, + PropertyChangeListener, Serializable { // // MouseListener // NOTE: this is added to both the JList and JComboBox @@ -1024,6 +1042,13 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { setListSelection(comboBox.getSelectedIndex()); } } + + // + // MouseWheelListener + // + public void mouseWheelMoved(MouseWheelEvent e) { + e.consume(); + } } // diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java index e9d878a2ca2..4a4d0baf32b 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java @@ -914,7 +914,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { processMouseEvent(me); break; case MouseEvent.MOUSE_WHEEL: - if (isInPopup(src)) { + if (isInPopup(src) + || ((src instanceof JComboBox) && ((JComboBox) src).isPopupVisible())) { + return; } cancelPopupMenu(); diff --git a/jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java b/jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java new file mode 100644 index 00000000000..9850aa2ba5c --- /dev/null +++ b/jdk/test/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2015, 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 java.awt.AWTException; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; + +/* @test + * @bug 8033069 + * @summary Checks that JComboBox popup does not close when mouse wheel is + * rotated over combo box and over its popup. The case where popup + * has no scroll bar. + * @library ../../regtesthelpers + * @build Util + * @run main bug8033069NoScrollBar + * @author Alexey Ivanov + */ +public class bug8033069NoScrollBar implements Runnable { + + private static final String[] NO_SCROLL_ITEMS = new String[] { + "A", "B", "C", "D", "E", "F" + }; + + private final Robot robot; + + private final String[] items; + + private JFrame frame; + private JComboBox cb1; + private JComboBox cb2; + + public static void main(String[] args) throws Exception { + iterateLookAndFeels(new bug8033069NoScrollBar(NO_SCROLL_ITEMS)); + } + + protected static void iterateLookAndFeels(final bug8033069NoScrollBar test) throws Exception { + LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); + for (LookAndFeelInfo info : lafInfo) { + try { + UIManager.setLookAndFeel(info.getClassName()); + System.out.println("Look and Feel: " + info.getClassName()); + test.runTest(); + } catch (UnsupportedLookAndFeelException e) { + System.out.println("Skipping unsupported LaF: " + info); + } + } + } + + public bug8033069NoScrollBar(String[] items) throws AWTException { + this.items = items; + + robot = new Robot(); + robot.setAutoDelay(200); + } + + private void setupUI() { + frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + cb1 = new JComboBox<>(items); + cb2 = new JComboBox<>(items); + JPanel panel = new JPanel(new GridLayout(1, 2)); + panel.add(cb1); + panel.add(cb2); + + frame.add(panel); + + frame.pack(); + frame.setVisible(true); + } + + public void runTest() throws Exception { + try { + SwingUtilities.invokeAndWait(this); + + robot.waitForIdle(); + assertFalse("cb1 popup is visible", + Util.invokeOnEDT(cb1::isPopupVisible)); + + // Move mouse pointer to the center of the fist combo box + Point p = cb1.getLocationOnScreen(); + Dimension d = cb1.getSize(); + robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2); + // Click it to open popup + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + robot.waitForIdle(); + assertTrue("cb1 popup is not visible", + Util.invokeOnEDT(cb1::isPopupVisible)); + + robot.mouseWheel(1); + robot.waitForIdle(); + assertTrue("cb1 popup is not visible after mouse wheel up on combo box", + Util.invokeOnEDT(cb1::isPopupVisible)); + + robot.mouseWheel(-1); + robot.waitForIdle(); + assertTrue("cb1 popup is not visible after mouse wheel down on combo box", + Util.invokeOnEDT(cb1::isPopupVisible)); + + // Move mouse down on the popup + robot.mouseMove(p.x + d.width / 2, p.y + d.height * 3); + + robot.mouseWheel(1); + robot.waitForIdle(); + assertTrue("cb1 popup is not visible after mouse wheel up on popup", + Util.invokeOnEDT(cb1::isPopupVisible)); + + robot.mouseWheel(-1); + robot.waitForIdle(); + assertTrue("cb1 popup is not visible after mouse wheel down on popup", + Util.invokeOnEDT(cb1::isPopupVisible)); + + + // Move mouse pointer to the center of the second combo box + p = cb2.getLocationOnScreen(); + d = cb2.getSize(); + robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2); + + robot.mouseWheel(1); + robot.waitForIdle(); + assertFalse("cb1 popup is visible after mouse wheel up on cb2", + Util.invokeOnEDT(cb1::isPopupVisible)); + } finally { + if (frame != null) { + frame.dispose(); + } + } + + System.out.println("Test passed"); + } + + @Override + public void run() { + setupUI(); + } + + private static void assertTrue(String message, boolean value) { + assertEquals(message, true, value); + } + + private static void assertFalse(String message, boolean value) { + assertEquals(message, false, value); + } + + private static void assertEquals(String message, boolean expected, boolean actual) { + if (expected != actual) { + throw new RuntimeException(message); + } + } +} diff --git a/jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java b/jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java new file mode 100644 index 00000000000..fed71e654b1 --- /dev/null +++ b/jdk/test/javax/swing/JComboBox/8033069/bug8033069ScrollBar.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2015, 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 java.awt.AWTException; + +/* @test + * @bug 8033069 + * @summary Checks that JComboBox popup does not close when mouse wheel is + * rotated over combo box and over its popup. The case where + * popup has scroll bar. + * @library ../../regtesthelpers + * @build Util + * @run main bug8033069ScrollBar + * @author Alexey Ivanov + */ +public class bug8033069ScrollBar extends bug8033069NoScrollBar { + + private static final String[] SCROLL_ITEMS = new String[] { + "A", "B", "C", "D", "E", "F", + "G", "H", "I", "J", "K", "L", + "M", "N", "O", "P", "Q", "R" + }; + + public static void main(String[] args) throws Exception { + iterateLookAndFeels(new bug8033069ScrollBar(SCROLL_ITEMS)); + } + + public bug8033069ScrollBar(String[] items) throws AWTException { + super(items); + } + +} From ae5cc01781a1200bd101934559d10708420d4bc2 Mon Sep 17 00:00:00 2001 From: Alexander Zvegintsev Date: Fri, 15 May 2015 14:18:20 +0300 Subject: [PATCH 19/36] 8072448: Can not input Japanese in JTextField on RedHat Linux Reviewed-by: alexsch, serb --- .../unix/native/libawt_xawt/awt/awt_InputMethod.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c index 93a69ad7940..07588c80f5e 100644 --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c +++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -904,7 +904,6 @@ static void adjustStatusWindow(Window shell){ static Bool createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w) { - XIC active_ic, passive_ic; XVaNestedList preedit = NULL; XVaNestedList status = NULL; XIMStyle on_the_spot_styles = XIMPreeditCallbacks, @@ -974,6 +973,12 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w) } if (active_styles == on_the_spot_styles) { + pX11IMData->ic_passive = XCreateIC(X11im, + XNClientWindow, w, + XNFocusWindow, w, + XNInputStyle, passive_styles, + NULL); + callbacks = (XIMCallback *)malloc(sizeof(XIMCallback) * NCALLBACKS); if (callbacks == (XIMCallback *)NULL) return False; @@ -1024,12 +1029,6 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w) NULL); XFree((void *)preedit); #endif /* __linux__ || MACOSX */ - pX11IMData->ic_passive = XCreateIC(X11im, - XNClientWindow, w, - XNFocusWindow, w, - XNInputStyle, passive_styles, - NULL); - } else { pX11IMData->ic_active = XCreateIC(X11im, XNClientWindow, w, From 6ff1090e7dc1961cd2107f25f295c099408765ad Mon Sep 17 00:00:00 2001 From: David Dehaven Date: Thu, 14 May 2015 09:12:16 -0700 Subject: [PATCH 20/36] 8080343: Incorrect GPL header causes RE script to miss swap to commercial header for licensee source bundle Reviewed-by: prr, serb --- jdk/src/java.desktop/macosx/native/include/jawt_md.h | 2 +- jdk/src/java.desktop/unix/native/common/awt/utility/rect.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.desktop/macosx/native/include/jawt_md.h b/jdk/src/java.desktop/macosx/native/include/jawt_md.h index 1d66461bf42..c6859fdbf90 100644 --- a/jdk/src/java.desktop/macosx/native/include/jawt_md.h +++ b/jdk/src/java.desktop/macosx/native/include/jawt_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/jdk/src/java.desktop/unix/native/common/awt/utility/rect.h b/jdk/src/java.desktop/unix/native/common/awt/utility/rect.h index 063caa3e1d7..ceea38f4349 100644 --- a/jdk/src/java.desktop/unix/native/common/awt/utility/rect.h +++ b/jdk/src/java.desktop/unix/native/common/awt/utility/rect.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, 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 From 828fc948f2eab523b234484b4d6ac880dc91e77d Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 15 May 2015 22:11:14 +0300 Subject: [PATCH 21/36] 8080341: Incorrect GPL header causes RE script to miss swap to commercial header for licensee source bundle Reviewed-by: alexsch, prr --- .../classes/com/sun/beans/decoder/ArrayElementHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/ArrayElementHandler.java b/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/ArrayElementHandler.java index 9a6d2284516..ce0aeb31a7a 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/ArrayElementHandler.java +++ b/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/ArrayElementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 From 8be69405fdf1f1f98620abdaf62cd2633b2fa1fe Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Sat, 16 May 2015 02:37:16 +0300 Subject: [PATCH 22/36] 8030087: Avoid public native methods in sun.awt packages Reviewed-by: azvegint, prr --- .../classes/sun/awt/DefaultMouseInfoPeer.java | 4 ++-- .../share/classes/sun/awt/HToolkit.java | 3 +-- .../unix/classes/sun/awt/FcFontManager.java | 5 ++--- .../unix/classes/sun/awt/X11FontManager.java | 1 - .../classes/sun/awt/X11GraphicsConfig.java | 7 ++----- .../classes/sun/awt/X11GraphicsDevice.java | 13 +++++------- .../sun/awt/X11GraphicsEnvironment.java | 21 ++++--------------- .../unix/classes/sun/awt/X11InputMethod.java | 11 ++-------- .../classes/sun/awt/Win32FontManager.java | 6 +++--- .../classes/sun/awt/Win32GraphicsDevice.java | 2 +- .../sun/awt/Win32GraphicsEnvironment.java | 19 +++++------------ 11 files changed, 27 insertions(+), 65 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/sun/awt/DefaultMouseInfoPeer.java b/jdk/src/java.desktop/share/classes/sun/awt/DefaultMouseInfoPeer.java index d4b578b9e21..9ac06c4b8bf 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/DefaultMouseInfoPeer.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/DefaultMouseInfoPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -29,7 +29,7 @@ import java.awt.Point; import java.awt.Window; import java.awt.peer.MouseInfoPeer; -public class DefaultMouseInfoPeer implements MouseInfoPeer { +public final class DefaultMouseInfoPeer implements MouseInfoPeer { /** * Package-private constructor to prevent instantiation. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/HToolkit.java b/jdk/src/java.desktop/share/classes/sun/awt/HToolkit.java index 4eaf3ed5615..dd93654f573 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/HToolkit.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/HToolkit.java @@ -45,8 +45,7 @@ import java.util.Properties; * with the HeadlessToolkit. It is primarily used * in embedded JRE's that do not have sun/awt/X11 classes. */ -public class HToolkit extends SunToolkit - implements ComponentFactory { +public final class HToolkit extends SunToolkit implements ComponentFactory { private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() { @Override diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/FcFontManager.java b/jdk/src/java.desktop/unix/classes/sun/awt/FcFontManager.java index 5ffa3490db6..f9f3bc8b46a 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/FcFontManager.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/FcFontManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -98,8 +98,7 @@ public class FcFontManager extends SunFontManager { return info; } - protected native String getFontPathNative(boolean noType1Fonts, - boolean isX11GE); + native String getFontPathNative(boolean noType1Fonts, boolean isX11GE); protected synchronized String getFontPath(boolean noType1Fonts) { return getFontPathNative(noType1Fonts, false); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java index 79581c49c52..f49d4d44f35 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11FontManager.java @@ -44,7 +44,6 @@ import sun.font.MFontConfiguration; import sun.font.CompositeFont; import sun.font.FontManager; import sun.font.SunFontManager; -import sun.font.FontConfigManager; import sun.font.FcFontConfiguration; import sun.font.FontAccess; import sun.font.FontUtilities; diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java index 9055bf0e2d6..7432c8b7159 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -27,7 +27,6 @@ package sun.awt; import java.awt.AWTException; import java.awt.BufferCapabilities; -import java.awt.BufferCapabilities.FlipContents; import java.awt.Component; import java.awt.Toolkit; import java.awt.GraphicsConfiguration; @@ -35,7 +34,6 @@ import java.awt.GraphicsDevice; import java.awt.Image; import java.awt.ImageCapabilities; import java.awt.Transparency; -import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.color.ColorSpace; import java.awt.image.ComponentColorModel; @@ -55,7 +53,6 @@ import sun.java2d.x11.X11SurfaceData; import sun.awt.image.OffScreenImage; import sun.awt.image.SunVolatileImage; import sun.awt.image.SurfaceManager; -import sun.awt.X11ComponentPeer; /** * This is an implementation of a GraphicsConfiguration object for a @@ -314,7 +311,7 @@ public class X11GraphicsConfig extends GraphicsConfiguration return pGetBounds(screen.getScreen()); } - public native Rectangle pGetBounds(int screenNum); + private native Rectangle pGetBounds(int screenNum); private static class XDBECapabilities extends BufferCapabilities { public XDBECapabilities() { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java index 98a8d510e98..a80994eef96 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java @@ -52,10 +52,8 @@ import sun.misc.InnocuousThread; * @see GraphicsEnvironment * @see GraphicsConfiguration */ -public class X11GraphicsDevice - extends GraphicsDevice - implements DisplayChangedListener -{ +public final class X11GraphicsDevice extends GraphicsDevice + implements DisplayChangedListener { int screen; HashMap x11ProxyKeyMap = new HashMap<>(); @@ -201,16 +199,15 @@ public class X11GraphicsDevice /* * Returns the depth for the given index of graphics configurations. */ - public native int getConfigDepth (int index, int screen); + private native int getConfigDepth(int index, int screen); /* * Returns the colormap for the given index of graphics configurations. */ - public native int getConfigColormap (int index, int screen); - + private native int getConfigColormap(int index, int screen); // Whether or not double-buffering extension is supported - public static native boolean isDBESupported(); + static native boolean isDBESupported(); // Callback for adding a new double buffer visual into our set private void addDoubleBufferVisual(int visNum) { doubleBufferVisuals.add(Integer.valueOf(visNum)); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java index e7cc88d2110..fec7daa620b 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -29,13 +29,6 @@ import java.awt.AWTError; import java.awt.GraphicsDevice; import java.awt.Point; import java.awt.Rectangle; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.IOException; -import java.io.StreamTokenizer; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; @@ -43,11 +36,6 @@ import java.net.UnknownHostException; import java.util.*; -import sun.font.MFontConfiguration; -import sun.font.FcFontConfiguration; -import sun.font.Font2D; -import sun.font.FontManager; -import sun.font.NativeFont; import sun.java2d.SunGraphicsEnvironment; import sun.java2d.SurfaceManagerFactory; import sun.java2d.UnixSurfaceManagerFactory; @@ -62,9 +50,8 @@ import sun.java2d.xr.XRSurfaceData; * @see GraphicsDevice * @see GraphicsConfiguration */ -public class X11GraphicsEnvironment - extends SunGraphicsEnvironment -{ +public final class X11GraphicsEnvironment extends SunGraphicsEnvironment { + private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11GraphicsEnvironment"); private static final PlatformLogger screenLog = PlatformLogger.getLogger("sun.awt.screen.X11GraphicsEnvironment"); @@ -200,7 +187,7 @@ public class X11GraphicsEnvironment return new X11GraphicsDevice(screennum); } - protected native int getDefaultScreenNum(); + private native int getDefaultScreenNum(); /** * Returns the default screen graphics device. */ diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java index 444a2a66aaf..5fc2825306e 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -35,16 +35,9 @@ import java.awt.Component; import java.awt.Container; import java.awt.EventQueue; import java.awt.Window; -import java.awt.im.InputContext; import java.awt.im.InputMethodHighlight; import java.awt.im.spi.InputMethodContext; import sun.awt.im.InputMethodAdapter; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.FocusEvent; -import java.awt.event.ComponentEvent; -import java.awt.event.WindowEvent; import java.awt.event.InputMethodEvent; import java.awt.font.TextAttribute; import java.awt.font.TextHitInfo; @@ -1095,7 +1088,7 @@ public abstract class X11InputMethod extends InputMethodAdapter { /* * Native methods */ - protected native String resetXIC(); + private native String resetXIC(); private native void disposeXIC(); private native boolean setCompositionEnabledNative(boolean enable); private native boolean isCompositionEnabledNative(); diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java b/jdk/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java index 0be9eb49584..ee50f24a293 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, 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 @@ -279,9 +279,9 @@ public final class Win32FontManager extends SunFontManager { }); } - protected static native void registerFontWithPlatform(String fontName); + private static native void registerFontWithPlatform(String fontName); - protected static native void deRegisterFontWithPlatform(String fontName); + private static native void deRegisterFontWithPlatform(String fontName); /** * populate the map with the most common windows fonts. diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java b/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java index 7235e4c0e24..85c1453b196 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java @@ -226,7 +226,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements * are disabled. Do not call this function with an index of 0. * @param index a PixelFormat index */ - protected native boolean isPixFmtSupported(int index, int screen); + private native boolean isPixFmtSupported(int index, int screen); /** * Returns the PixelFormatID of the default graphics configuration diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java index a1c57b6e555..ac54216bf2c 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -28,19 +28,11 @@ package sun.awt; import java.awt.AWTError; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.Toolkit; import java.awt.peer.ComponentPeer; -import java.io.File; -import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.ListIterator; -import java.util.NoSuchElementException; -import java.util.StringTokenizer; -import sun.awt.DisplayChangedListener; -import sun.awt.SunDisplayChanger; -import sun.awt.windows.WPrinterJob; + import sun.awt.windows.WToolkit; import sun.java2d.SunGraphicsEnvironment; import sun.java2d.SurfaceManagerFactory; @@ -57,9 +49,8 @@ import sun.java2d.windows.WindowsFlags; * @see GraphicsConfiguration */ -public class Win32GraphicsEnvironment - extends SunGraphicsEnvironment -{ +public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment { + static { // Ensure awt is loaded already. Also, this forces static init // of WToolkit and Toolkit, which we depend upon @@ -91,7 +82,7 @@ public class Win32GraphicsEnvironment } protected native int getNumScreens(); - protected native int getDefaultScreen(); + private native int getDefaultScreen(); public GraphicsDevice getDefaultScreenDevice() { GraphicsDevice[] screens = getScreenDevices(); From c0d815c3d47f4a0754dc04411ae3925f9324cae6 Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 19 May 2015 16:27:33 +0300 Subject: [PATCH 23/36] 7172652: With JDK 1.7 text field does not obtain focus when using mnemonic Alt/Key combin Reviewed-by: alexsch, azvegint --- .../javax/swing/plaf/basic/BasicLabelUI.java | 78 ++++++-- .../plaf/basic/BasicLabelUI/bug7172652.java | 172 ++++++++++++++++++ 2 files changed, 233 insertions(+), 17 deletions(-) create mode 100644 jdk/test/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java index e5576c2aca9..8e99c38fa18 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -504,7 +504,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener doPress(label); } else if (key == RELEASE) { - doRelease(label); + doRelease(label, e.getActionCommand() != null); } } @@ -517,33 +517,77 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener SwingUtilities.replaceUIInputMap(label, JComponent.WHEN_FOCUSED, inputMap); } int dka = label.getDisplayedMnemonic(); - inputMap.put(KeyStroke.getKeyStroke(dka, BasicLookAndFeel.getFocusAcceleratorKeyMask(), true), RELEASE); + putOnRelease(inputMap, dka, BasicLookAndFeel + .getFocusAcceleratorKeyMask()); // Need this when the sticky keys are enabled - inputMap.put(KeyStroke.getKeyStroke(dka, 0, true), RELEASE); + putOnRelease(inputMap, dka, 0); // Need this if ALT is released before the accelerator - inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true), RELEASE); + putOnRelease(inputMap, KeyEvent.VK_ALT, 0); label.requestFocus(); } } - private void doRelease(JLabel label) { + private void doRelease(JLabel label, boolean isCommand) { Component labelFor = label.getLabelFor(); if (labelFor != null && labelFor.isEnabled()) { - InputMap inputMap = SwingUtilities.getUIInputMap(label, JComponent.WHEN_FOCUSED); - if (inputMap != null) { - // inputMap should never be null. + if (label.hasFocus()) { + InputMap inputMap = SwingUtilities.getUIInputMap(label, + JComponent.WHEN_FOCUSED); + if (inputMap != null) { + // inputMap should never be null. + int dka = label.getDisplayedMnemonic(); + removeOnRelease(inputMap, dka, BasicLookAndFeel + .getFocusAcceleratorKeyMask()); + removeOnRelease(inputMap, dka, 0); + removeOnRelease(inputMap, KeyEvent.VK_ALT, 0); + } + inputMap = SwingUtilities.getUIInputMap(label, + JComponent.WHEN_IN_FOCUSED_WINDOW); + if (inputMap == null) { + inputMap = new InputMapUIResource(); + SwingUtilities.replaceUIInputMap(label, + JComponent.WHEN_IN_FOCUSED_WINDOW, inputMap); + } int dka = label.getDisplayedMnemonic(); - inputMap.remove(KeyStroke.getKeyStroke(dka, BasicLookAndFeel.getFocusAcceleratorKeyMask(), true)); - inputMap.remove(KeyStroke.getKeyStroke(dka, 0, true)); - inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true)); - } - if (labelFor instanceof Container && - ((Container) labelFor).isFocusCycleRoot()) { - labelFor.requestFocus(); + if (isCommand) { + putOnRelease(inputMap, KeyEvent.VK_ALT, 0); + } else { + putOnRelease(inputMap, dka, BasicLookAndFeel + .getFocusAcceleratorKeyMask()); + // Need this when the sticky keys are enabled + putOnRelease(inputMap, dka, 0); + } + if (labelFor instanceof Container && + ((Container) labelFor).isFocusCycleRoot()) { + labelFor.requestFocus(); + } else { + SwingUtilities2.compositeRequestFocus(labelFor); + } } else { - SwingUtilities2.compositeRequestFocus(labelFor); + InputMap inputMap = SwingUtilities.getUIInputMap(label, + JComponent.WHEN_IN_FOCUSED_WINDOW); + int dka = label.getDisplayedMnemonic(); + if (inputMap != null) { + if (isCommand) { + removeOnRelease(inputMap, dka, BasicLookAndFeel + .getFocusAcceleratorKeyMask()); + removeOnRelease(inputMap, dka, 0); + } else { + removeOnRelease(inputMap, KeyEvent.VK_ALT, 0); + } + } } } } + + private void putOnRelease(InputMap inputMap, int keyCode, int modifiers) { + inputMap.put(KeyStroke.getKeyStroke(keyCode, modifiers, true), + RELEASE); + } + + private void removeOnRelease(InputMap inputMap, int keyCode, int modifiers) { + inputMap.remove(KeyStroke.getKeyStroke(keyCode, modifiers, true)); + } + } } diff --git a/jdk/test/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java b/jdk/test/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java new file mode 100644 index 00000000000..ea9999e86eb --- /dev/null +++ b/jdk/test/javax/swing/plaf/basic/BasicLabelUI/bug7172652.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2015, 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 7172652 + @summary With JDK 1.7 text field does not obtain focus when using mnemonic Alt/Key combin + @author Semyon Sadetsky + @library /lib/testlibrary + @build jdk.testlibrary.OSInfo + @run main bug7172652 + */ + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.KeyEvent; +import jdk.testlibrary.OSInfo; + +public class bug7172652 { + + private static JMenu menu; + private static JFrame frame; + private static Boolean selected; + + public static void main(String[] args) throws Exception { + if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) { + System.out.println("ok"); + return; + } + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + setup(); + } + }); + + test(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + frame.dispose(); + } + }); + } + + private static void test() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + menu.getModel().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + selected = menu.isSelected(); + } + }); + } + }); + + Robot robot = new Robot(); + robot.setAutoDelay(200); + + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_ALT); + + robot.waitForIdle(); + if( selected != null ) { + throw new RuntimeException("Menu is notified selected= " + selected); + } + + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_ALT); + if( selected != null ) { + throw new RuntimeException("Menu is notified selected= " + selected); + } + + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_ALT); + if( selected != null ) { + throw new RuntimeException("Menu is notified selected= " + selected); + } + + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_ALT); + if( selected != null ) { + throw new RuntimeException("Menu is notified selected= " + selected); + } + + robot.waitForIdle(); + + System.out.printf("ok"); + } + + private static void setup() { + JLabel firstLbl = new JLabel("First name"); + JLabel lastLbl = new JLabel("Last name"); + JMenuBar menuBar = new JMenuBar(); + + JTextField firstTxtFld = new JTextField(20); + JTextField lastTxtFld = new JTextField(20); + JDesktopPane desktopPane = new JDesktopPane(); + JInternalFrame iframe = new JInternalFrame("A frame", true, true, true, true); + + // Set an initial size + iframe.setSize(200, 220); + + // By default, internal frames are not visible; make it visible + iframe.setVisible(true); + + JPanel pane = new JPanel(); + pane.setLayout(new FlowLayout()); + + pane.add(firstLbl); + pane.add(firstTxtFld); + pane.add(lastLbl); + pane.add(lastTxtFld); + + firstLbl.setLabelFor(firstTxtFld); + firstLbl.setDisplayedMnemonic('F'); + + lastLbl.setLabelFor(lastTxtFld); + lastLbl.setDisplayedMnemonic('L'); + + iframe.getContentPane().add(pane); + iframe.setJMenuBar(menuBar); + menu = new JMenu("FirstMenu"); + //m.setMnemonic('i'); + menuBar.add(menu); + desktopPane.add(iframe); + + frame = new JFrame(); + frame.setUndecorated(true); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.getContentPane().add(desktopPane); + frame.setSize(300, 300); + frame.setVisible(true); + } + +} \ No newline at end of file From d349244b4574c880ac6df7b3e08822049726011a Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 19 May 2015 19:00:04 +0300 Subject: [PATCH 24/36] 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate Reviewed-by: alexsch, azvegint --- .../sun/java/swing/plaf/gtk/GTKEngine.java | 6 ++-- .../java/swing/plaf/gtk/GTKLookAndFeel.java | 14 ++++++++-- .../native/libawt_xawt/awt/gtk2_interface.c | 28 +++++++++---------- .../native/libawt_xawt/awt/gtk2_interface.h | 6 ++-- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java index 30b08313278..742a9f9ad1e 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -93,7 +93,9 @@ class GTKEngine { */ static enum Settings { GTK_FONT_NAME, - GTK_ICON_SIZES + GTK_ICON_SIZES, + GTK_CURSOR_BLINK, + GTK_CURSOR_BLINK_TIME } /* Custom regions are needed for representing regions that don't exist diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java index cfdd8672303..912e87e271c 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -371,7 +371,17 @@ public class GTKLookAndFeel extends SynthLookAndFeel { int vProgWidth = 22 - (progXThickness * 2); int vProgHeight = 80 - (progYThickness * 2); - Integer caretBlinkRate = Integer.valueOf(500); + Integer caretBlinkRate; + if (Boolean.FALSE.equals(GTKEngine.INSTANCE.getSetting( + GTKEngine.Settings.GTK_CURSOR_BLINK))) { + caretBlinkRate = Integer.valueOf(0); + } else { + caretBlinkRate = (Integer) GTKEngine.INSTANCE.getSetting( + GTKEngine.Settings.GTK_CURSOR_BLINK_TIME); + if (caretBlinkRate == null) { + caretBlinkRate = Integer.valueOf(500); + } + } Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0); Double defaultCaretAspectRatio = new Double(0.025); diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c index e8a45cb2059..e5711df06c3 100644 --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c +++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c @@ -1313,9 +1313,6 @@ static GtkWidget *gtk2_get_widget(WidgetType widget_type) { result = gtk2_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE] = (*fp_gtk_entry_new)(); - - GtkSettings* settings = fp_gtk_widget_get_settings(result); - fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL); } result = gtk2_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE]; break; @@ -1360,10 +1357,6 @@ static GtkWidget *gtk2_get_widget(WidgetType widget_type) { gtk2_widgets[_GTK_ENTRY_TYPE] = (*fp_gtk_entry_new)(); - - GtkSettings* settings = - fp_gtk_widget_get_settings(gtk2_widgets[_GTK_ENTRY_TYPE]); - fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL); } result = gtk2_widgets[_GTK_ENTRY_TYPE]; break; @@ -1555,9 +1548,6 @@ static GtkWidget *gtk2_get_widget(WidgetType widget_type) { result = gtk2_widgets[_GTK_SPIN_BUTTON_TYPE] = (*fp_gtk_spin_button_new)(NULL, 0, 0); - - GtkSettings* settings = fp_gtk_widget_get_settings(result); - fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL); } result = gtk2_widgets[_GTK_SPIN_BUTTON_TYPE]; break; @@ -2507,14 +2497,20 @@ jobject get_string_property(JNIEnv *env, GtkSettings* settings, const gchar* key return result; } -/* + jobject get_integer_property(JNIEnv *env, GtkSettings* settings, const gchar* key) { - gint intval = NULL; - + gint intval = NULL; (*fp_g_object_get)(settings, key, &intval, NULL); return create_Integer(env, intval); -}*/ +} + +jobject get_boolean_property(JNIEnv *env, GtkSettings* settings, const gchar* key) +{ + gint intval = NULL; + (*fp_g_object_get)(settings, key, &intval, NULL); + return create_Boolean(env, intval); +} jobject gtk2_get_setting(JNIEnv *env, Setting property) { @@ -2526,6 +2522,10 @@ jobject gtk2_get_setting(JNIEnv *env, Setting property) return get_string_property(env, settings, "gtk-font-name"); case GTK_ICON_SIZES: return get_string_property(env, settings, "gtk-icon-sizes"); + case GTK_CURSOR_BLINK: + return get_boolean_property(env, settings, "gtk-cursor-blink"); + case GTK_CURSOR_BLINK_TIME: + return get_integer_property(env, settings, "gtk-cursor-blink-time"); } return NULL; diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h index 3498e380813..5891a66d5ff 100644 --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h +++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -140,7 +140,9 @@ typedef enum _ColorType typedef enum _Setting { GTK_FONT_NAME, - GTK_ICON_SIZES + GTK_ICON_SIZES, + GTK_CURSOR_BLINK, + GTK_CURSOR_BLINK_TIME } Setting; /* GTK types, here to eliminate need for GTK headers at compile time */ From 36c9dc6b0d6e3a76eff3ab8261aa6c456b88d118 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Tue, 19 May 2015 21:58:47 +0300 Subject: [PATCH 25/36] 8080488: JNI exception pending in jdk/src/windows/native/sun/windows/awt_Frame.cpp Reviewed-by: dcherepanov, aivanov --- jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp index 6ac3c5f603b..2c25e975d39 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp @@ -1864,6 +1864,7 @@ Java_sun_awt_windows_WEmbeddedFrame_initIDs(JNIEnv *env, jclass cls) AwtFrame::activateEmbeddingTopLevelMID = env->GetMethodID(cls, "activateEmbeddingTopLevel", "()V"); DASSERT(AwtFrame::activateEmbeddingTopLevelMID != NULL); + CHECK_NULL(AwtFrame::activateEmbeddingTopLevelMID); AwtFrame::isEmbeddedInIEID = env->GetFieldID(cls, "isEmbeddedInIE", "Z"); DASSERT(AwtFrame::isEmbeddedInIEID != NULL); From c3e2e7af685f0d5e18c1c4039b8f45465a14ee39 Mon Sep 17 00:00:00 2001 From: Peter Brunet Date: Tue, 19 May 2015 20:40:49 -0500 Subject: [PATCH 26/36] 8078408: Java version applet hangs with Voice over turned on Add null check to fix NPE Reviewed-by: prr, serb, alexsch --- .../macosx/classes/sun/lwawt/macosx/CAccessibility.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java index 736a1ffbb25..d3ab6a651de 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -630,7 +630,7 @@ class CAccessibility implements PropertyChangeListener { if (!allowIgnored) { final AccessibleRole role = context.getAccessibleRole(); - if (role != null && ignoredRoles.contains(roleKey(role))) { + if (role != null && ignoredRoles != null && ignoredRoles.contains(roleKey(role))) { // Get the child's unignored children. _addChildren(child, whichChildren, false, childrenAndRoles); } else { From fc00fd2ffb4c5be2750376117a4044ed3734613e Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Wed, 20 May 2015 17:10:15 +0300 Subject: [PATCH 27/36] 8015368: javax/print/attribute/URLPDFPrinting.java fails on solaris with java.net.ConnectException: Connection timed out Reviewed-by: prr, serb --- .../javax/print/attribute/URLPDFPrinting.java | 117 ++++++++++++++++++ jdk/test/javax/print/attribute/hello.pdf | Bin 0 -> 11242 bytes 2 files changed, 117 insertions(+) create mode 100644 jdk/test/javax/print/attribute/URLPDFPrinting.java create mode 100644 jdk/test/javax/print/attribute/hello.pdf diff --git a/jdk/test/javax/print/attribute/URLPDFPrinting.java b/jdk/test/javax/print/attribute/URLPDFPrinting.java new file mode 100644 index 00000000000..6876bb72498 --- /dev/null +++ b/jdk/test/javax/print/attribute/URLPDFPrinting.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2014, 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 4899773 + * @summary Test for DocFlavor.URL.PDF support. No exception should be thrown. + * @run main URLPDFPrinting +*/ + +import java.awt.*; +import javax.print.*; +import javax.print.attribute.standard.*; +import javax.print.attribute.*; +import java.io.*; +import java.util.Locale; +import java.net.URL; + +public class URLPDFPrinting { + /** + * Constructor + */ + public URLPDFPrinting() { + super(); + } + /** + * Starts the application. + */ + public static void main(java.lang.String[] args) { + URLPDFPrinting pd = new URLPDFPrinting(); + PrintService service[] = null, defService = null; + + service = PrintServiceLookup.lookupPrintServices(DocFlavor.URL.PDF, null); + if (service.length == 0) { + System.out.println("No PrintService support DocFlavor.URL.PDF"); + return; + } else { + defService = service[0]; + System.out.println("Print Service which supports DocFlavor.URL.PDF: "+defService); + } + + System.out.println("is DocFlavor.URL.PDF supported? "+defService.isDocFlavorSupported(DocFlavor.URL.PDF)); + HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet(); + prSet.add(new Destination(new File("./dest.prn").toURI())); + + DocPrintJob pj = defService.createPrintJob(); + PrintDocument prDoc = new PrintDocument(); + try { + pj.print(prDoc, prSet); + } catch (Exception e) { + e.printStackTrace(); + } + + } +} + +class PrintDocument implements Doc { + InputStream fStream = null; + DocFlavor flavor = null; + HashDocAttributeSet docSet = new HashDocAttributeSet(); + URL url = null; + + public PrintDocument() { + try { + url = PrintDocument.class.getResource("hello.pdf"); + try{ Thread.sleep(6000); }catch(Exception e){ e.printStackTrace();} + fStream = url.openStream(); + System.out.println("URL input stream "+fStream); + } catch(Exception e) { + e.printStackTrace(); + } + docSet.add(OrientationRequested.LANDSCAPE); + } + + public DocAttributeSet getAttributes() { + System.out.println("getAttributes called"); + return docSet; + } + + public DocFlavor getDocFlavor() { + System.out.println("getDocFlavor called"); + return DocFlavor.URL.PDF; + } + + public Object getPrintData(){ + System.out.println("getPrintData called"); + return url; + } + + public Reader getReaderForText() { + return null; + } + + public InputStream getStreamForBytes() { + System.out.println("getStreamForBytes called"); + return fStream; + } +} diff --git a/jdk/test/javax/print/attribute/hello.pdf b/jdk/test/javax/print/attribute/hello.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d25b783a94007b0b477137241a3f1160cacabf08 GIT binary patch literal 11242 zcmeHNX*iVa+eelt*~=DVODbkD3>r(e>^qSx!wijWFoUu0Swr?+WsOiOOOZW0*^(`? zMAniJ;vMQ~dH%isyfIuH27`hXpkT0wC?5CE9q zKNjbVLfBJNU4LU?fuuDzw=j1mp+7Dv6Y!9(NrIey^cb(5QBEAEO#UY$=cxRLqH5G`OijPl0Q<0kL2e{N!5YSIZ|AZ9) z2Kmb&Q4mlUAT0Kqk>=*+D1wz%L?o0~$o1-uHeEQ*PEDd@abK&m?qzFTM;%~Z@9owR zZW^c@mPY;*55J5bF;NhXH0KYd9-#9*gVa$t1QLNm0KkWcX(6mpSinK>b-tk{M_9AN zSpUoy@Gox2VH|KM2OO4=c!wNv&KO5o4Bq&FL=+4Gz{DXYKy^ZvApT>PkWK{7@0xT_ zSd5FaB|$S-^iYrv21m#u0O*?y2S)v3z=5vs*8c&=?>Pa6`~n}ISRv{eRf7zzf@kei z{ME`7BlTDIO!cCm7#c%MF87$3{d&4%MLUy@RmTL63B=}5f?GPPs&41U@ZKxiz^Um~ zs0*+)7_cYB=qAS70)wWdecbLYwYLtY(--p?yxclsV(T@icutr)VCU4%W$EL>Vh*em=>bZvl#{|_M`p!46nP((XpaR3PPuZ$2D0TJ$H=r=qxEo^jg_P=JweH~ld zKoH~C^P4;K4jfmR!e5RIyW%YMHi_Pcbds|@IG38ZG68%TP5oj69VFx2UA396DjOo> z=P{{$TWX8=C6SmD0@_d@v?z*}7h2BEHc&KYy1_h@AZnP}XKZmyV_w&IE^L5BO5IXz zR=czj)TqFyF3%5>sTwR+AFu2{<<@^X8b#AwG%_!EoIS*XH?>Ny`IX~9<30F$@<@hA zRc&0I(W+$1K#Lu1LZDVyrQF*jxN!TP1kyYD~ zY~8Vkb&veoMiKSt{M^$1m~F0(C@bcE!?v3ZC%K;9WY{^&AM<3Y15= zqAgLEoe}PT+6({6OOTk@!LIx>dU)bseRVrFeOeCdp%aA-;YS|ppHJZ5yQ+YGOvy-p z?siFr1e$xOizY^g$$qHkD2WTjh^Ep$j~Io>z4F-DeAm^P_QmRj>VS9e2lz8p+OCUt%#u61pTj-Xa1*zM z`U*lmFk4NcRC6g`L@g@qEqkqas|qBJjdeVi=n);y?SO#pxR7-SQoMs}tMIq4r(|-{ zyKshh&Ew|5K5Sd{BkRZ$Tkr=bM@jnR$lfbWKosg>C*|AR&L?I>x;(;eJbW*V84@?} zaYcM4eR9ufcZ2(#u)Z&je#>ZbQ{56tRY`;II!05*E@84cXe&INS8e-XiZeBAmj7f? zKag0OCa_2u{CfR$Mi`WPNd_Hto_1^9M`$_QXQ=>5-$8du5%`L_FlV zhQ-lkzFXRffiD<4Sj-IXzYDLcRIT!E7rRFChH5u|Rb$O0n)aS?j>+V+Nweio4fGu$ zeyUL>GtXioo?Zw%+ag()6*Tz1*KmL5WtNrk#wSd(1eE+ZM_7?Yn z_Qwr-^egT?-R6De<09*=aat!txd2!|F)%j>&uLuPYkd*2Oj2DkR}Xs=Jd~F|RFD}t zHx{+c(c?LHlW$+YWA|Oxgv5n$*D-8pQI##0WMho?a%=I)#eK#{Tyb6|7k6ei#oNFI7_Y-fr0jZc}W#ZI^Br?s2^AIoj&oqWMGV-GJivD*q`F4!wLQduvisLqss zywUCBFp+zDz||(&#(f#F>|`&yIJkkPcx*occ;zQrxcs86+jZi#lZbnHtfXzPU6a+L zSayA;-R;o6I%`RxOx*}8+6sky9`b;K6DO=D_xszi!Bt8%0dJlRm@N27ob1sy7!Ofq zT}{5nmHD_+=}cBzZ0ow!4dEjxjgfTT*mijxL?!q6nQayR z-2S}5XK#Nce;rXY;6a+m;4)}ivr*`_()rqb{q1s1zsB;kYr^2pgN!H@=S}fTiq~|L zd@DVkFRhM7uRiQq9i8iF)405IM39!kr0&w!(|5`fZkxV3b&nEg#%2@ImPb<{Szi69 zkuEOy0+B;kd-=1W7s&SlL>bE~B5aB+{58b4-Jd_ye^ zUf|71qC=L<7-xp1&mR?Le~{IB{L?_Sq(3hv;A`bF*^cz^N;xObLUhUoN;g_=qo!PB zgP%XhY18j3r7<(QbNb;sVm4|?q*>ayt(o@i5nGSO`@VIiY8#`~9y^iT`QA^LtG!jM z3}s_K*@@feCLCBa!?O-<=kjAt!l+Z zG2pWTSfupn`|al(L!7eR6!i@-uKIZwpS@V=E@|!L-7D{(YMjcLVs|P`=CKOn=oQF| zXp2>bsCieY6qItO@F|o1I;XC@XduA%tO}sI&jlIzV zc)Hle*V0HmF^dyuJq?BzUjxB|KBXB~#7sq)QyO#?L_qP(ofIsb)VAiTHr6RsozRO9 zD;qZD^y6%*bmn$HpcK=_jK^tXHirY&^n$}i0^SsI~|m;*X$p7zDDr5zXm3Mf@zJ6BCTVTt)+NSvfRM)%Y;$UwUqlNMny)a-MX&c z46iaWD$+i@hDYz0dSrkdYUog#D1YoNcte4#~6QE#x*G5IcS9|ca@knDo`7L ztSm_A!J2N}3EHnQ^XYwxiSp8?H2lG3qTABfDD4*z!G<~a8KWArKd`eCQCDktog5?U zsbjgO-m{^@9I)v~qL%k4DFif7SBrpd3*8U8Qs7IG?q}jidmL&dm=oi||1_ITd4qo9 zIL&3VfG{mm4*+%B4Ub*8TIihk;%?>s|BiG3H!dUqD80ZoZPI z@uPIU!@i)r17eqhxe1L>S)Jut%?vS<;jE@Mo0bz}w7==9*rOq2*MHK&dzxIH+RClw-Sdivh zp_ZI&yV{N^vnmKu5gR>!pXYA)k3`?-F za}K9AFKqI!82gmh1xdXXzG=L>sf5kBxR!QZc|C4^6W63NnUf(9B4J3*^>kD;nOr*m z*=x;NqU8}~JVkfGtZt_tVk=XN2zrMp-$F1!;+o%iC#L6qmkZc+y}v~DDuM)6k?0G7 zA`h&}6I~ukmk9}Fq&0QTtxTTK67Q;MF_{wjNRri*{~=)){<^+&)=hV~v9_D$LoHKy z@UU!#W7Y$f%mWTRHPIkzc5m_Oy)BdKSMC!u&Q@}+r$+#Z}OFl zjT3E$oF@plN=B z{LMP-ajv1&!t2hhnP*ZqD+>$P7>Aj-73R+=Fi5tasIu_l9KI8I>=yc(Ch+q$cXdt7 z{d~9k{H&*QwNjH7KRjb!EA*R+tWA76z zY3x2#cON}znV9M5Xl^tOkV{G`VrMsfd7hyI1bZBI!Z5jL{X>UAQV-DhT2tIj?2g>| zneAZWTHyHm;^60U@Bo6Z8W{^pi}v>&#yB$0Aj22PNnl!|1~Lb z`)TWUwP9Dp_M?g-A=oQHS3S-lG5xM2SLo6h1s(_HERa*Eca)PJfjF?Z$bKaJXDO^? z+tF}@6}z@xy;4>5#M*_y|5yac5ra~FNiS3Z&2hu(llrY4l6G&dP31h3PKWVhqWTiW zy3#C{Pwmt8@2^z$rNXjylSdX5EQxLh_}OxN5xAIG6j9ka%$;i^5Rf^m5X4||DQEPW z!d_m)omF{*&xwnh3w0XtSJj3hY zT#_ANP@-kg+&ev=QgOFM`|b5y^Qmzg)f(txMalYEw1*msc~8w2ht0no;UUX}uVeO<)@T^}Lu6z9zCx(2_oS=FSP=YVCB;MI@YeqQO^Fy1^k6$p@&Y)_{qPSTZn(;xRH8;${sM>-ZaTr4~q*r(tR zk2LuVO=L|HHW@#X-=XY4#-x_7tz;H<*2B71szLb0Zr&~7wo#UI4GJ*Iw^MAF@UN)3 zu0h_t7YkBto1-UtYwQaTvW}LkT-rYB*|K|ve=erNlx;pJKi~rqCT^lD6vgnP({`--^n((KL3h1QCWsgYl|JwswoGpt?CtOsC-P1732~0^ zITtaToFlN#EyK&wNMs$xn1Wx)27Qp1sotVvze7h1^+8f!falv=(@9`7b3r&VG{MTPBSHbEIg*<9mzg?mHD=7wauRO*QjNcG+qH z4_9Q-%Sz~sj~8?O%lgXtrUY_%a>>3Zw?l%%gbGc(tzXXyTPtn}HyHDH+YL8YE!DNk zx=6xMvn$!3kH<5P@S&Y*Dla`Vt);G5ljSoI=DgB8q%!-|0iCu2z1W;VuenG~{B_)- z=y{s`Y*&`yp@R`ZLJfCTcmGzfLq!o%h0i)(G zZQWeQg0=b{M;A8rIRc$A(IrICO6?PjY|=r#W?AdW4-1tW3IZ-yug8 zzt~6r-0V&S_6tLjRlfu1YLVUDC0Jc){r; zmR0KyD+8o%H_UrknwqvcNsaT&yVAvsIv*RtQ+yp)(2>MY=S*!xO%gqY0Ka+8-;{ROXO*{vbwv5Fkc^_K$HpC(DuMAg^* zr1;(hI(-x>iqj*}k2RX}7vs^7k2(`{Gk1NSepanLWgYNl=;)@1sO&jJdg@fV9|6hk zWFzM2yNUy}BVmeXMnY=&DUM<&(Mad>X`Hh*cOXeJ|z5bZR=NvtuY?nk-M zhlsk$-J)mGvk9K0kGhf_yk^3?VXdm`ZM&)M>4k|R8G@&a5<`?YADxqQ4hs*B-}fMqFP2{n zcHsStENeM^o3Tu_gt$j}P{8{%u z9Z>u{pZI<*Dl8&SD0;Y9;0{YQ>T2Iky8o(9{5+X}OXD38mbNGyzyf8Bc97&=eOAj2 zKqDo&uZXCF)E(te*U?HI&L~|E4LwT_TT5{yx3m-$94~>lceE$eIskZkI|r-;UXmL@ zD1V_O2;+lkAUEKU1ZOMBed%BUV5qJIki$5m03t%7f|ejcK}-xR1Qvlo#6&ItARsUl z2!;?YK@dm+Dl9=*{{G^YIw<c93_B2H#avSH(?=+vo#Pb zE-nrPL4Xj5Ab~;<>+XO<-~}D9Jl}-;B}X2GwRA>1;?Niez=2$Z1;zy@$<6(fPhaN{4XS+i!NJ}8f4rPB(r~wjO0RD-OfX)v_2dvN`HbRyddmtX+NMHi}k;(BF zuYO}9ED)H4|Hwqpq^|zob=lhke*kcR0n$>!3gc{#z)2w-9qrJThyx^m1SN3b&!wMW z9MD@5ihG30efFo?gV0IXAsnnFx$%NXloi6o4#)jRTYeXEXv?3q9@v9Jpb-HcOkzZ zV~75uB~nT#J3GubFznEO6L<*G?-CEq`nz&CA?y-z2SGu}6W&sU8%RVD1Qmop^uQt# z5SRp5^eP2o?r`#1KeJl!ch+Uvhup{Vw-gGX1ix9cI^KSAjS&A)K{fa0GF{)OwGp!9?0U$}li z@lOW-!u3y3`a$#G;G+8Z$Vce3ljL?IJkb5&k@BDPQ;Gl8P9<{Cg9G{Bx~U-gAT5wC zNL2U1!(O*;VApwV(7n})1nTf=$sbl_N z)h~@ge<;L%>+<^1
    l03J4M9y|m8XOov+WEWL{46}k6%2k52J6alirDx2(zX{%(rO*X}7;K!m8{+%1? zp_7-`&pJQIsE6I_aJgfRvu|hhthy8}G#Vx5U+a(VgLX)f94Cs*l=$=qAb#mc_y<;Q>N8zmw+qj<05xZ3gEdYJ$OYmE5}X}HNFGA9;hf6{4RKcXW< Via^qne?a4xUQsYu^hdYo{{Tv1aaI5T literal 0 HcmV?d00001 From 83dcd6803343db6a37fcc7381a30b011db8c565b Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 22 May 2015 15:19:05 +0400 Subject: [PATCH 28/36] 8065739: [macosx] Frame warps to lower left of screen when 7124365: [macosx] setMaximizedBounds() should be implemented Reviewed-by: serb, azvegint --- .../classes/sun/lwawt/LWWindowPeer.java | 47 +++++- .../classes/sun/lwawt/PlatformWindow.java | 5 + .../sun/lwawt/macosx/CPlatformWindow.java | 18 ++- .../native/libawt_lwawt/awt/AWTWindow.h | 3 +- .../native/libawt_lwawt/awt/AWTWindow.m | 31 ++++ .../MaximizedToUnmaximized.java | 79 ++++++++++ .../MaximizedMovedWindow.java | 127 ++++++++++++++++ .../SetMaximizedBounds.java | 135 ++++++++++++------ 8 files changed, 387 insertions(+), 58 deletions(-) create mode 100644 jdk/test/java/awt/Frame/MaximizedToUnmaximized/MaximizedToUnmaximized.java create mode 100644 jdk/test/java/awt/Frame/SetMaximizedBounds/MaximizedMovedWindow.java diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java index fa6be35ad96..619675890e0 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -61,6 +61,7 @@ public class LWWindowPeer private static final int MINIMUM_HEIGHT = 1; private Insets insets = new Insets(0, 0, 0, 0); + private Rectangle maximizedBounds; private GraphicsDevice graphicsDevice; private GraphicsConfiguration graphicsConfig; @@ -176,8 +177,10 @@ public class LWWindowPeer if (getTarget() instanceof Frame) { - setTitle(((Frame) getTarget()).getTitle()); - setState(((Frame) getTarget()).getExtendedState()); + Frame frame = (Frame) getTarget(); + setTitle(frame.getTitle()); + setState(frame.getExtendedState()); + setMaximizedBounds(frame.getMaximizedBounds()); } else if (getTarget() instanceof Dialog) { setTitle(((Dialog) getTarget()).getTitle()); } @@ -543,9 +546,40 @@ public class LWWindowPeer return windowState; } + private boolean isMaximizedBoundsSet() { + synchronized (getStateLock()) { + return maximizedBounds != null; + } + } + + private Rectangle getDefaultMaximizedBounds() { + GraphicsConfiguration config = getGraphicsConfiguration(); + Insets screenInsets = ((CGraphicsDevice) config.getDevice()) + .getScreenInsets(); + Rectangle gcBounds = config.getBounds(); + return new Rectangle( + gcBounds.x + screenInsets.left, + gcBounds.y + screenInsets.top, + gcBounds.width - screenInsets.left - screenInsets.right, + gcBounds.height - screenInsets.top - screenInsets.bottom); + } + @Override public void setMaximizedBounds(Rectangle bounds) { - // TODO: not implemented + boolean isMaximizedBoundsSet; + synchronized (getStateLock()) { + this.maximizedBounds = (isMaximizedBoundsSet = (bounds != null)) + ? constrainBounds(bounds) : null; + } + + setPlatformMaximizedBounds(isMaximizedBoundsSet ? maximizedBounds + : getDefaultMaximizedBounds()); + } + + private void setPlatformMaximizedBounds(Rectangle bounds) { + platformWindow.setMaximizedBounds( + bounds.x, bounds.y, + bounds.width, bounds.height); } @Override @@ -635,6 +669,10 @@ public class LWWindowPeer // Second, update the graphics config and surface data final boolean isNewDevice = updateGraphicsDevice(); + if (isNewDevice && !isMaximizedBoundsSet()) { + setPlatformMaximizedBounds(getDefaultMaximizedBounds()); + } + if (resized || isNewDevice) { replaceSurfaceData(); updateMinimumSize(); @@ -1055,6 +1093,9 @@ public class LWWindowPeer public final void displayChanged() { if (updateGraphicsDevice()) { updateMinimumSize(); + if (!isMaximizedBoundsSet()) { + setPlatformMaximizedBounds(getDefaultMaximizedBounds()); + } } // Replace surface unconditionally, because internal state of the // GraphicsDevice could be changed. diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java index 93bd1928dbb..06bc5f48a83 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformWindow.java @@ -66,6 +66,11 @@ public interface PlatformWindow { */ public void setBounds(int x, int y, int w, int h); + /* + * Sets the maximized bounds. + */ + public default void setMaximizedBounds(int x, int y, int w, int h){} + /* * Returns the graphics device where the window is. */ diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 043c08d5273..f89d27a2543 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -51,6 +51,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr); private static native Insets nativeGetNSWindowInsets(long nsWindowPtr); private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h); + private static native void nativeSetNSWindowStandardFrame(long nsWindowPtr, + double x, double y, double w, double h); private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH); private static native void nativePushNSWindowToBack(long nsWindowPtr); private static native void nativePushNSWindowToFront(long nsWindowPtr); @@ -474,6 +476,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h); } + public void setMaximizedBounds(int x, int y, int w, int h) { + nativeSetNSWindowStandardFrame(getNSWindowPtr(), x, y, w, h); + } + private boolean isMaximized() { return undecorated ? this.normalBounds != null : CWrapper.NSWindow.isZoomed(getNSWindowPtr()); @@ -979,13 +985,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo } private void checkZoom() { - if (target instanceof Frame && isVisible()) { - Frame targetFrame = (Frame)target; - if (targetFrame.getExtendedState() != Frame.MAXIMIZED_BOTH && isMaximized()) { - deliverZoom(true); - } else if (targetFrame.getExtendedState() == Frame.MAXIMIZED_BOTH && !isMaximized()) { - deliverZoom(false); - } + int state = peer.getState(); + if (state != Frame.MAXIMIZED_BOTH && isMaximized()) { + deliverZoom(true); + } else if (state == Frame.MAXIMIZED_BOTH && !isMaximized()) { + deliverZoom(false); } } diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.h index 7f7bac777bc..7b8fa5e6477 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.h +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.h @@ -46,6 +46,7 @@ NSWindow *nsWindow; AWTWindow *ownerWindow; jint preFullScreenLevel; + NSRect standardFrame; } // An instance of either AWTWindow_Normal or AWTWindow_Panel @@ -59,7 +60,7 @@ @property (nonatomic) jint styleBits; @property (nonatomic) BOOL isEnabled; @property (nonatomic) jint preFullScreenLevel; - +@property (nonatomic) NSRect standardFrame; - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow ownerWindow:owner diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m index 47442027e02..749c64b54be 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m @@ -184,6 +184,7 @@ AWT_NS_WINDOW_IMPLEMENTATION @synthesize isEnabled; @synthesize ownerWindow; @synthesize preFullScreenLevel; +@synthesize standardFrame; - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { @@ -509,6 +510,12 @@ AWT_ASSERT_APPKIT_THREAD; // window exposing in _setVisible:(BOOL) } +- (NSRect)windowWillUseStandardFrame:(NSWindow *)window + defaultFrame:(NSRect)newFrame { + + return [self standardFrame]; +} + - (void) _deliverIconify:(BOOL)iconify { AWT_ASSERT_APPKIT_THREAD; @@ -951,6 +958,30 @@ JNF_COCOA_ENTER(env); JNF_COCOA_EXIT(env); } +/* + * Class: sun_lwawt_macosx_CPlatformWindow + * Method: nativeSetNSWindowStandardFrame + * Signature: (JDDDD)V + */ +JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowStandardFrame +(JNIEnv *env, jclass clazz, jlong windowPtr, jdouble originX, jdouble originY, + jdouble width, jdouble height) +{ + JNF_COCOA_ENTER(env); + + NSRect jrect = NSMakeRect(originX, originY, width, height); + + NSWindow *nsWindow = OBJC(windowPtr); + [ThreadUtilities performOnMainThreadWaiting:NO block:^(){ + + NSRect rect = ConvertNSScreenRect(NULL, jrect); + AWTWindow *window = (AWTWindow*)[nsWindow delegate]; + window.standardFrame = rect; + }]; + + JNF_COCOA_EXIT(env); +} + /* * Class: sun_lwawt_macosx_CPlatformWindow * Method: nativeSetNSWindowMinMax diff --git a/jdk/test/java/awt/Frame/MaximizedToUnmaximized/MaximizedToUnmaximized.java b/jdk/test/java/awt/Frame/MaximizedToUnmaximized/MaximizedToUnmaximized.java new file mode 100644 index 00000000000..b77ff712cd0 --- /dev/null +++ b/jdk/test/java/awt/Frame/MaximizedToUnmaximized/MaximizedToUnmaximized.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2015, 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 java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; + +/** + * @test + * @bug 8065739 + * @summary [macosx] Frame warps to lower left of screen when displayed + * @author Alexandr Scherbatiy + */ +public class MaximizedToUnmaximized { + + public static void main(String[] args) throws Exception { + testFrame(false); + testFrame(true); + } + + static void testFrame(boolean isUndecorated) throws Exception { + Frame frame = new Frame(); + try { + Robot robot = new Robot(); + robot.setAutoDelay(100); + + frame.setUndecorated(isUndecorated); + GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice().getDefaultConfiguration(); + Rectangle bounds = gc.getBounds(); + Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); + int x = bounds.x + insets.left; + int y = bounds.y + insets.top; + int width = bounds.width - insets.left - insets.right; + int height = bounds.height - insets.top - insets.bottom; + Rectangle rect = new Rectangle(x, y, width, height); + frame.pack(); + frame.setBounds(rect); + frame.setVisible(true); + robot.waitForIdle(); + robot.delay(500); + + if (frame.getWidth() <= width / 2 + || frame.getHeight() <= height / 2) { + throw new RuntimeException("Frame size is small!"); + } + + if (!isUndecorated && frame.getExtendedState() != Frame.MAXIMIZED_BOTH) { + throw new RuntimeException("Frame state does not equal" + + " MAXIMIZED_BOTH!"); + } + } finally { + frame.dispose(); + } + } +} \ No newline at end of file diff --git a/jdk/test/java/awt/Frame/SetMaximizedBounds/MaximizedMovedWindow.java b/jdk/test/java/awt/Frame/SetMaximizedBounds/MaximizedMovedWindow.java new file mode 100644 index 00000000000..8632de10186 --- /dev/null +++ b/jdk/test/java/awt/Frame/SetMaximizedBounds/MaximizedMovedWindow.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2015, 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 java.awt.*; + +/* + * @test + * @bug 8065739 + * @summary Moved window is maximazed to new screen + * @author Alexandr Scherbatiy + * + * @run main MaximizedMovedWindow + */ +public class MaximizedMovedWindow { + + public static void main(String[] args) throws Exception { + + //Supported platforms are Windows and OS X. + String os = System.getProperty("os.name").toLowerCase(); + if (!os.contains("os x")) { + return; + } + + if (!Toolkit.getDefaultToolkit(). + isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { + return; + } + + GraphicsEnvironment ge = GraphicsEnvironment. + getLocalGraphicsEnvironment(); + + if (ge.isHeadlessInstance()) { + return; + } + + GraphicsDevice[] devices = ge.getScreenDevices(); + + if (devices.length < 2) { + return; + } + + Frame frame = null; + try { + + GraphicsConfiguration gc1 = devices[0].getDefaultConfiguration(); + GraphicsConfiguration gc2 = devices[1].getDefaultConfiguration(); + + Robot robot = new Robot(); + robot.setAutoDelay(50); + + frame = new Frame(); + Rectangle maxArea1 = getMaximizedScreenArea(gc1); + frame.setBounds(getSmallerRectangle(maxArea1)); + frame.setVisible(true); + robot.waitForIdle(); + + frame.setExtendedState(Frame.MAXIMIZED_BOTH); + robot.waitForIdle(); + robot.delay(1000); + + Rectangle bounds = frame.getBounds(); + if (!bounds.equals(maxArea1)) { + throw new RuntimeException("The bounds of the Frame do not equal" + + " to screen 1 size"); + } + + frame.setExtendedState(Frame.NORMAL); + robot.waitForIdle(); + robot.delay(1000); + + Rectangle maxArea2 = getMaximizedScreenArea(gc2); + frame.setBounds(getSmallerRectangle(maxArea2)); + robot.waitForIdle(); + robot.delay(1000); + + frame.setExtendedState(Frame.MAXIMIZED_BOTH); + robot.waitForIdle(); + robot.delay(1000); + + bounds = frame.getBounds(); + if (!bounds.equals(maxArea2)) { + throw new RuntimeException("The bounds of the Frame do not equal" + + " to screen 2 size"); + } + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + static Rectangle getSmallerRectangle(Rectangle rect) { + return new Rectangle( + rect.x + rect.width / 6, + rect.y + rect.height / 6, + rect.width / 3, + rect.height / 3); + } + static Rectangle getMaximizedScreenArea(GraphicsConfiguration gc) { + Rectangle bounds = gc.getBounds(); + Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); + return new Rectangle( + bounds.x + insets.left, + bounds.y + insets.top, + bounds.width - insets.left - insets.right, + bounds.height - insets.top - insets.bottom); + } +} diff --git a/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java b/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java index da5b3800eae..613e662bcae 100644 --- a/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java +++ b/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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,67 +22,108 @@ */ import java.awt.*; - /* * @test * @summary When Frame.setExtendedState(Frame.MAXIMIZED_BOTH) * is called for a Frame after been called setMaximizedBounds() with * certain value, Frame bounds must equal to this value. * - * @library ../../../../lib/testlibrary - * @build ExtendedRobot * @run main SetMaximizedBounds */ public class SetMaximizedBounds { - Frame frame; - Rectangle bound; - boolean supported; - ExtendedRobot robot; - static Rectangle max = new Rectangle(100,100,400,400); + public static void main(String[] args) throws Exception { - public void doTest() throws Exception { - robot = new ExtendedRobot(); - - EventQueue.invokeAndWait( () -> { - frame = new Frame( "TestFrame "); - frame.setLayout(new FlowLayout()); - - if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { - supported = true; - frame.setMaximizedBounds(max); - } else { - supported = false; - } - - frame.setSize(200, 200); - frame.setVisible(true); - }); - - robot.waitForIdle(2000); - if (supported) { - EventQueue.invokeAndWait( () -> { - frame.setExtendedState(Frame.MAXIMIZED_BOTH); - }); - robot.waitForIdle(2000); - bound = frame.getBounds(); - if(!bound.equals(max)) - throw new RuntimeException("The bounds of the Frame do not equal to what" - + " is specified when the frame is in Frame.MAXIMIZED_BOTH state"); - } else { - System.out.println("Frame.MAXIMIZED_BOTH not supported"); + //Supported platforms are Windows and OS X. + String os = System.getProperty("os.name").toLowerCase(); + if (!os.contains("windows") && !os.contains("os x")) { + return; } - frame.dispose(); + if (!Toolkit.getDefaultToolkit(). + isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { + return; + } + + GraphicsEnvironment ge = GraphicsEnvironment. + getLocalGraphicsEnvironment(); + + if (ge.isHeadlessInstance()) { + return; + } + + for (GraphicsDevice gd : ge.getScreenDevices()) { + for (GraphicsConfiguration gc : gd.getConfigurations()) { + testMaximizedBounds(gc); + } + } } - public static void main(String[] args) throws Exception { - String os = System.getProperty("os.name").toLowerCase(); - System.out.println(os); - if (os.contains("windows") || os.contains("os x")) - new SetMaximizedBounds().doTest(); - else - System.out.println("Platform "+os+" is not supported. Supported platforms are Windows and OS X."); + static void testMaximizedBounds(GraphicsConfiguration gc) throws Exception { + + Frame frame = null; + try { + + Rectangle maxArea = getMaximizedScreenArea(gc); + + Robot robot = new Robot(); + robot.setAutoDelay(50); + + frame = new Frame(); + Rectangle maximizedBounds = new Rectangle( + maxArea.x + maxArea.width / 6, + maxArea.y + maxArea.height / 6, + maxArea.width / 3, + maxArea.height / 3); + frame.setMaximizedBounds(maximizedBounds); + frame.setSize(maxArea.width / 8, maxArea.height / 8); + frame.setVisible(true); + robot.waitForIdle(); + + frame.setExtendedState(Frame.MAXIMIZED_BOTH); + robot.waitForIdle(); + robot.delay(1000); + + Rectangle bounds = frame.getBounds(); + if (!bounds.equals(maximizedBounds)) { + throw new RuntimeException("The bounds of the Frame do not equal to what" + + " is specified when the frame is in Frame.MAXIMIZED_BOTH state"); + } + + frame.setExtendedState(Frame.NORMAL); + robot.waitForIdle(); + robot.delay(1000); + + maximizedBounds = new Rectangle( + maxArea.x + maxArea.width / 10, + maxArea.y + maxArea.height / 10, + maxArea.width / 5, + maxArea.height / 5); + frame.setMaximizedBounds(maximizedBounds); + frame.setExtendedState(Frame.MAXIMIZED_BOTH); + robot.waitForIdle(); + robot.delay(1000); + + bounds = frame.getBounds(); + if (!bounds.equals(maximizedBounds)) { + throw new RuntimeException("The bounds of the Frame do not equal to what" + + " is specified when the frame is in Frame.MAXIMIZED_BOTH state"); + } + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + static Rectangle getMaximizedScreenArea(GraphicsConfiguration gc) { + Rectangle bounds = gc.getBounds(); + Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); + return new Rectangle( + bounds.x + insets.left, + bounds.y + insets.top, + bounds.width - insets.left - insets.right, + bounds.height - insets.top - insets.bottom); } } From 2e68b719a3aa01baa727ab4175d8d82393e72161 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 22 May 2015 15:27:28 +0400 Subject: [PATCH 29/36] 8080137: Dragged events for extra mouse buttons (4, 5, 6) are not generated on JSplitPane Reviewed-by: serb, azvegint --- .../share/classes/java/awt/Container.java | 33 +++--- .../MouseDragEvent/MouseDraggedTest.java | 103 ++++++++++++++++++ 2 files changed, 119 insertions(+), 17 deletions(-) create mode 100644 jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java diff --git a/jdk/src/java.desktop/share/classes/java/awt/Container.java b/jdk/src/java.desktop/share/classes/java/awt/Container.java index cbd01b957ee..5b8d28dea04 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Container.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java @@ -4420,6 +4420,18 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener { private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.LightweightDispatcher"); + private static final int BUTTONS_DOWN_MASK; + + static { + int[] buttonsDownMask = AWTAccessor.getInputEventAccessor(). + getButtonDownMasks(); + int mask = 0; + for (int buttonDownMask : buttonsDownMask) { + mask |= buttonDownMask; + } + BUTTONS_DOWN_MASK = mask; + } + LightweightDispatcher(Container nativeContainer) { this.nativeContainer = nativeContainer; mouseEventTarget = new WeakReference<>(null); @@ -4488,25 +4500,12 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener { private boolean isMouseGrab(MouseEvent e) { int modifiers = e.getModifiersEx(); - if(e.getID() == MouseEvent.MOUSE_PRESSED - || e.getID() == MouseEvent.MOUSE_RELEASED) - { - switch (e.getButton()) { - case MouseEvent.BUTTON1: - modifiers ^= InputEvent.BUTTON1_DOWN_MASK; - break; - case MouseEvent.BUTTON2: - modifiers ^= InputEvent.BUTTON2_DOWN_MASK; - break; - case MouseEvent.BUTTON3: - modifiers ^= InputEvent.BUTTON3_DOWN_MASK; - break; - } + if (e.getID() == MouseEvent.MOUSE_PRESSED + || e.getID() == MouseEvent.MOUSE_RELEASED) { + modifiers ^= InputEvent.getMaskForButton(e.getButton()); } /* modifiers now as just before event */ - return ((modifiers & (InputEvent.BUTTON1_DOWN_MASK - | InputEvent.BUTTON2_DOWN_MASK - | InputEvent.BUTTON3_DOWN_MASK)) != 0); + return ((modifiers & BUTTONS_DOWN_MASK) != 0); } /** diff --git a/jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java b/jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java new file mode 100644 index 00000000000..272b21144d3 --- /dev/null +++ b/jdk/test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2015, 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 java.awt.*; +import java.awt.event.*; +import javax.swing.*; +/* + * @test + * @bug 8080137 + * @summary Dragged events for extra mouse buttons (4,5,6) are not generated + * on JSplitPane + * @author alexandr.scherbatiy area=awt.event + * @run main MouseDraggedTest + */ +public class MouseDraggedTest { + + private static JFrame frame; + private static Rectangle frameBounds; + private static volatile boolean mouseDragged; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeAndWait(MouseDraggedTest::createAndShowGUI); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> frameBounds = frame.getBounds()); + robot.waitForIdle(); + + for (int i = 1; i <= MouseInfo.getNumberOfButtons(); i++) { + testMouseDrag(i, robot); + } + } finally { + SwingUtilities.invokeLater(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void testMouseDrag(int button, Robot robot) { + + mouseDragged = false; + int x1 = frameBounds.x + frameBounds.width / 4; + int y1 = frameBounds.y + frameBounds.height / 4; + int x2 = frameBounds.x + frameBounds.width / 2; + int y2 = frameBounds.y + frameBounds.height / 2; + + robot.mouseMove(x1, y1); + robot.waitForIdle(); + + int buttonMask = InputEvent.getMaskForButton(button); + robot.mousePress(buttonMask); + robot.mouseMove(x2, y2); + robot.mouseRelease(buttonMask); + robot.waitForIdle(); + + if (!mouseDragged) { + throw new RuntimeException("Mouse button " + button + + " is not dragged"); + } + } + + static void createAndShowGUI() { + + frame = new JFrame(); + frame.setSize(400, 400); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel panel = new JPanel(new BorderLayout()); + panel.addMouseMotionListener(new MouseAdapter() { + + @Override + public void mouseDragged(MouseEvent e) { + mouseDragged = true; + } + }); + frame.add(panel, BorderLayout.CENTER); + frame.setVisible(true); + } +} \ No newline at end of file From 4f33aa2348b697da34d827e24c6f644db4dbc6b2 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Sat, 16 May 2015 21:31:36 +0300 Subject: [PATCH 30/36] 8041654: OutOfMemoryError: RepaintManager doesn't clean up cache of volatile images Reviewed-by: azvegint, ant --- .../classes/javax/swing/RepaintManager.java | 26 ++++-- .../unix/classes/sun/awt/X11/XToolkit.java | 48 +++++++---- .../DisplayListenerLeak.java | 82 +++++++++++++++++++ 3 files changed, 132 insertions(+), 24 deletions(-) create mode 100644 jdk/test/javax/swing/RepaintManager/DisplayListenerLeak/DisplayListenerLeak.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java index bc50cb734a6..5f7755a159b 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java @@ -182,9 +182,16 @@ public class RepaintManager */ private final ProcessingRunnable processingRunnable; - private final static JavaSecurityAccess javaSecurityAccess = - SharedSecrets.getJavaSecurityAccess(); + private static final JavaSecurityAccess javaSecurityAccess = + SharedSecrets.getJavaSecurityAccess(); + /** + * Listener installed to detect display changes. When display changes, + * schedules a callback to notify all RepaintManagers of the display + * changes. + */ + private static final DisplayChangedListener displayChangedHandler = + new DisplayChangedHandler(); static { SwingAccessor.setRepaintManagerAccessor(new SwingAccessor.RepaintManagerAccessor() { @@ -226,8 +233,8 @@ public class RepaintManager GraphicsEnvironment ge = GraphicsEnvironment. getLocalGraphicsEnvironment(); if (ge instanceof SunGraphicsEnvironment) { - ((SunGraphicsEnvironment)ge).addDisplayChangedListener( - new DisplayChangedHandler()); + ((SunGraphicsEnvironment) ge).addDisplayChangedListener( + displayChangedHandler); } Toolkit tk = Toolkit.getDefaultToolkit(); if ((tk instanceof SunToolkit) @@ -1679,6 +1686,12 @@ public class RepaintManager */ private static final class DisplayChangedHandler implements DisplayChangedListener { + // Empty non private constructor was added because access to this + // class shouldn't be generated by the compiler using synthetic + // accessor method + DisplayChangedHandler() { + } + public void displayChanged() { scheduleDisplayChanges(); } @@ -1686,11 +1699,10 @@ public class RepaintManager public void paletteChanged() { } - private void scheduleDisplayChanges() { + private static void scheduleDisplayChanges() { // To avoid threading problems, we notify each RepaintManager // on the thread it was created on. - for (Object c : AppContext.getAppContexts()) { - AppContext context = (AppContext) c; + for (AppContext context : AppContext.getAppContexts()) { synchronized(context) { if (!context.isDisposed()) { EventQueue eventQueue = (EventQueue)context.get( diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java index 4da0bb5032b..32b2d8bccaf 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java @@ -616,14 +616,19 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } } } - if( keyEventLog.isLoggable(PlatformLogger.Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { - keyEventLog.fine("before XFilterEvent:"+ev); + if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && ( + ev.get_type() == XConstants.KeyPress + || ev.get_type() == XConstants.KeyRelease)) { + keyEventLog.fine("before XFilterEvent:" + ev); } if (XlibWrapper.XFilterEvent(ev.getPData(), w)) { continue; } - if( keyEventLog.isLoggable(PlatformLogger.Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) { - keyEventLog.fine("after XFilterEvent:"+ev); // IS THIS CORRECT? + if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && ( + ev.get_type() == XConstants.KeyPress + || ev.get_type() == XConstants.KeyRelease)) { + keyEventLog.fine( + "after XFilterEvent:" + ev); // IS THIS CORRECT? } dispatchEvent(ev); @@ -639,21 +644,28 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } } + /** + * Listener installed to detect display changes. + */ + private static final DisplayChangedListener displayChangedHandler = + new DisplayChangedListener() { + @Override + public void displayChanged() { + // 7045370: Reset the cached values + XToolkit.screenWidth = -1; + XToolkit.screenHeight = -1; + } + + @Override + public void paletteChanged() { + } + }; + static { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); if (ge instanceof SunGraphicsEnvironment) { - ((SunGraphicsEnvironment)ge).addDisplayChangedListener( - new DisplayChangedListener() { - @Override - public void displayChanged() { - // 7045370: Reset the cached values - XToolkit.screenWidth = -1; - XToolkit.screenHeight = -1; - } - - @Override - public void paletteChanged() {} - }); + ((SunGraphicsEnvironment) ge).addDisplayChangedListener( + displayChangedHandler); } } @@ -663,7 +675,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { try { XWindowAttributes pattr = new XWindowAttributes(); try { - XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), pattr.pData); + XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), + XToolkit.getDefaultRootWindow(), + pattr.pData); screenWidth = pattr.get_width(); screenHeight = pattr.get_height(); } finally { diff --git a/jdk/test/javax/swing/RepaintManager/DisplayListenerLeak/DisplayListenerLeak.java b/jdk/test/javax/swing/RepaintManager/DisplayListenerLeak/DisplayListenerLeak.java new file mode 100644 index 00000000000..ea924bb5541 --- /dev/null +++ b/jdk/test/javax/swing/RepaintManager/DisplayListenerLeak/DisplayListenerLeak.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2015, 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 java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.GraphicsEnvironment; + +import javax.swing.JFrame; +import javax.swing.JLabel; + +import sun.java2d.SunGraphicsEnvironment; + +/** + * @test + * @bug 8041654 + * @run main/othervm -Xmx80m DisplayListenerLeak + */ +public final class DisplayListenerLeak { + + private static JFrame frame; + private volatile static boolean failed = false; + + private static void createAndShowGUI() { + Thread.currentThread().setUncaughtExceptionHandler((t, e) -> { + e.printStackTrace(); + failed = true; + }); + frame = new JFrame(); + JLabel emptyLabel = new JLabel(""); + emptyLabel.setPreferredSize(new Dimension(600, 400)); + frame.getContentPane().add(emptyLabel, BorderLayout.CENTER); + frame.pack(); + frame.setVisible(true); + } + + public static void main(final String[] args) throws Exception { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + if (!(ge instanceof SunGraphicsEnvironment)) { + return; + } + EventQueue.invokeAndWait(() -> createAndShowGUI()); + SunGraphicsEnvironment sge = (SunGraphicsEnvironment) ge; + final long startTime = System.nanoTime(); + while (!failed) { + if (System.nanoTime() - startTime > 60_000_000_000L) { + break; + } + System.gc(); // clear all weak references + EventQueue.invokeAndWait(() -> { + frame.setSize(frame.getHeight(), frame.getWidth()); + frame.pack(); + }); + EventQueue.invokeAndWait(sge::displayChanged); + } + EventQueue.invokeAndWait(frame::dispose); + if (failed) { + throw new RuntimeException(); + } + } +} \ No newline at end of file From 13711e78f09509ab216db83e33be0d0b6c6aec7d Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 22 May 2015 19:27:33 +0300 Subject: [PATCH 31/36] 8071306: GUI perfomance are very slow compared java 1.6.0_45 Reviewed-by: azvegint, ant --- .../share/classes/java/awt/Component.java | 23 +++- .../share/classes/java/awt/Container.java | 105 +++++++++--------- .../SetEnabledPerformance.java | 72 ++++++++++++ 3 files changed, 145 insertions(+), 55 deletions(-) create mode 100644 jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java diff --git a/jdk/src/java.desktop/share/classes/java/awt/Component.java b/jdk/src/java.desktop/share/classes/java/awt/Component.java index 84ae7652c55..99b2d570bd7 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Component.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java @@ -1311,6 +1311,25 @@ public abstract class Component implements ImageObserver, MenuContainer, return visible && (parent == null || parent.isRecursivelyVisible()); } + /** + * Determines the bounds of a visible part of the component relative to its + * parent. + * + * @return the visible part of bounds + */ + private Rectangle getRecursivelyVisibleBounds() { + final Component container = getContainer(); + final Rectangle bounds = getBounds(); + if (container == null) { + // we are top level window or haven't a container, return our bounds + return bounds; + } + // translate the container's bounds to our coordinate space + final Rectangle parentsBounds = container.getRecursivelyVisibleBounds(); + parentsBounds.setLocation(0, 0); + return parentsBounds.intersection(bounds); + } + /** * Translates absolute coordinates into coordinates in the coordinate * space of this component. @@ -1487,7 +1506,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ComponentPeer peer = this.peer; if (peer != null) { peer.setEnabled(true); - if (visible) { + if (visible && !getRecursivelyVisibleBounds().isEmpty()) { updateCursorImmediately(); } } @@ -1541,7 +1560,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ComponentPeer peer = this.peer; if (peer != null) { peer.setEnabled(false); - if (visible) { + if (visible && !getRecursivelyVisibleBounds().isEmpty()) { updateCursorImmediately(); } } diff --git a/jdk/src/java.desktop/share/classes/java/awt/Container.java b/jdk/src/java.desktop/share/classes/java/awt/Container.java index 5b8d28dea04..0ed78e598df 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Container.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java @@ -44,6 +44,7 @@ import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.security.AccessController; +import java.util.ArrayList; import java.util.EventListener; import java.util.HashSet; import java.util.Set; @@ -100,7 +101,7 @@ public class Container extends Component { * @see #add * @see #getComponents */ - private java.util.List component = new java.util.ArrayList(); + private java.util.List component = new ArrayList<>(); /** * Layout manager for this container. @@ -2568,28 +2569,24 @@ public class Container extends Component { if (!contains(x, y)) { return null; } + Component lightweight = null; synchronized (getTreeLock()) { - // Two passes: see comment in sun.awt.SunGraphicsCallback - for (int i = 0; i < component.size(); i++) { - Component comp = component.get(i); - if (comp != null && - !(comp.peer instanceof LightweightPeer)) { - if (comp.contains(x - comp.x, y - comp.y)) { + // Optimized version of two passes: + // see comment in sun.awt.SunGraphicsCallback + for (final Component comp : component) { + if (comp.contains(x - comp.x, y - comp.y)) { + if (!comp.isLightweight()) { + // return heavyweight component as soon as possible return comp; } - } - } - for (int i = 0; i < component.size(); i++) { - Component comp = component.get(i); - if (comp != null && - comp.peer instanceof LightweightPeer) { - if (comp.contains(x - comp.x, y - comp.y)) { - return comp; + if (lightweight == null) { + // save and return later the first lightweight component + lightweight = comp; } } } } - return this; + return lightweight != null ? lightweight : this; } /** @@ -2693,52 +2690,54 @@ public class Container extends Component { return null; } - final Component findComponentAtImpl(int x, int y, boolean ignoreEnabled){ - checkTreeLock(); + final Component findComponentAtImpl(int x, int y, boolean ignoreEnabled) { + // checkTreeLock(); commented for a performance reason if (!(contains(x, y) && visible && (ignoreEnabled || enabled))) { return null; } - - // Two passes: see comment in sun.awt.SunGraphicsCallback - for (int i = 0; i < component.size(); i++) { - Component comp = component.get(i); - if (comp != null && - !(comp.peer instanceof LightweightPeer)) { - if (comp instanceof Container) { - comp = ((Container)comp).findComponentAtImpl(x - comp.x, - y - comp.y, - ignoreEnabled); - } else { - comp = comp.getComponentAt(x - comp.x, y - comp.y); + Component lightweight = null; + // Optimized version of two passes: + // see comment in sun.awt.SunGraphicsCallback + for (final Component comp : component) { + final int x1 = x - comp.x; + final int y1 = y - comp.y; + if (!comp.contains(x1, y1)) { + continue; // fast path + } + if (!comp.isLightweight()) { + final Component child = getChildAt(comp, x1, y1, ignoreEnabled); + if (child != null) { + // return heavyweight component as soon as possible + return child; } - if (comp != null && comp.visible && - (ignoreEnabled || comp.enabled)) - { - return comp; - } - } - } - for (int i = 0; i < component.size(); i++) { - Component comp = component.get(i); - if (comp != null && - comp.peer instanceof LightweightPeer) { - if (comp instanceof Container) { - comp = ((Container)comp).findComponentAtImpl(x - comp.x, - y - comp.y, - ignoreEnabled); - } else { - comp = comp.getComponentAt(x - comp.x, y - comp.y); - } - if (comp != null && comp.visible && - (ignoreEnabled || comp.enabled)) - { - return comp; + } else { + if (lightweight == null) { + // save and return later the first lightweight component + lightweight = getChildAt(comp, x1, y1, ignoreEnabled); } } } + return lightweight != null ? lightweight : this; + } - return this; + /** + * Helper method for findComponentAtImpl. Finds a child component using + * findComponentAtImpl for Container and getComponentAt for Component. + */ + private static Component getChildAt(Component comp, int x, int y, + boolean ignoreEnabled) { + if (comp instanceof Container) { + comp = ((Container) comp).findComponentAtImpl(x, y, + ignoreEnabled); + } else { + comp = comp.getComponentAt(x, y); + } + if (comp != null && comp.visible && + (ignoreEnabled || comp.enabled)) { + return comp; + } + return null; } /** diff --git a/jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java b/jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java new file mode 100644 index 00000000000..c898ef7ef4b --- /dev/null +++ b/jdk/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2015, 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 java.awt.Component; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Robot; + +import javax.swing.JButton; +import javax.swing.SwingUtilities; + +/** + * @test + * @bug 8071306 + * @author Sergey Bylokhov + */ +public final class SetEnabledPerformance { + + private static Frame frame; + + private static void createAndShowGUI() { + frame = new Frame(); + frame.setLayout(new FlowLayout(FlowLayout.CENTER, 25, 0)); + frame.setSize(600, 600); + frame.setLocationRelativeTo(null); + for (int i = 1; i < 10001; ++i) { + frame.add(new JButton("Button " + i)); + } + frame.setVisible(true); + } + + public static void main(final String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); + final Robot robot = new Robot(); + robot.waitForIdle(); + robot.mouseMove(frame.getX() + 15, frame.getY() + 300); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + long m = System.currentTimeMillis(); + for (final Component comp : frame.getComponents()) { + comp.setEnabled(false); + } + m = System.currentTimeMillis() - m; + System.err.println("Disabled in " + m + " ms"); + frame.dispose(); + // we should be much faster, but leaves 1000 for the slow systems + if (m > 1000) { + throw new RuntimeException("Too slow"); + } + }); + } +} \ No newline at end of file From b081f20d610dbeb25de006931580f6d2b623fda2 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 22 May 2015 23:26:00 +0300 Subject: [PATCH 32/36] 6587235: Incorrect javadoc: "no parameter" in 2d source code Reviewed-by: azvegint, prr --- .../classes/sun/applet/AppletClassLoader.java | 4 +-- .../classes/sun/applet/AppletSecurity.java | 4 +-- .../share/classes/sun/awt/AppContext.java | 4 +-- .../share/classes/sun/awt/EmbeddedFrame.java | 6 ---- .../share/classes/sun/awt/SunToolkit.java | 8 +++--- .../sun/awt/datatransfer/SunClipboard.java | 6 ++-- .../classes/sun/awt/geom/PathConsumer2D.java | 10 +++---- .../awt/im/ExecutableInputMethodManager.java | 2 +- .../sun/awt/image/ByteBandedRaster.java | 24 ++++++++-------- .../sun/awt/image/ByteComponentRaster.java | 20 ++++++------- .../sun/awt/image/ByteInterleavedRaster.java | 20 ++++++------- .../sun/awt/image/BytePackedRaster.java | 20 ++++++------- .../classes/sun/awt/image/ImageFetchable.java | 4 +-- .../sun/awt/image/IntegerComponentRaster.java | 12 ++++---- .../awt/image/IntegerInterleavedRaster.java | 12 ++++---- .../sun/awt/image/ShortBandedRaster.java | 22 +++++++-------- .../sun/awt/image/ShortComponentRaster.java | 20 ++++++------- .../sun/awt/image/ShortInterleavedRaster.java | 20 ++++++------- .../sun/awt/shell/ShellFolderColumnInfo.java | 2 +- .../sun/awt/util/IdentityArrayList.java | 2 +- .../sun/awt/util/IdentityLinkedList.java | 6 ++-- .../share/classes/sun/font/ScriptRun.java | 4 +-- .../classes/sun/font/TextLabelFactory.java | 4 +-- .../classes/sun/java2d/NullSurfaceData.java | 4 +-- .../sun/java2d/SunCompositeContext.java | 20 ++++++------- .../classes/sun/java2d/SunGraphics2D.java | 23 ++++++++------- .../share/classes/sun/java2d/SurfaceData.java | 4 +-- .../pipe/PixelToParallelogramConverter.java | 2 +- .../sun/java2d/pipe/RenderingEngine.java | 10 +++---- .../pipe/hw/AccelDeviceEventNotifier.java | 2 +- .../java2d/pipe/hw/AccelGraphicsConfig.java | 2 +- .../java2d/pipe/hw/ContextCapabilities.java | 2 +- .../sun/java2d/pisces/PiscesCache.java | 2 -- .../java2d/pisces/PiscesRenderingEngine.java | 8 +++--- .../share/classes/sun/print/DialogOwner.java | 5 ++-- .../share/classes/sun/print/OpenBook.java | 8 +++--- .../classes/sun/print/PSPathGraphics.java | 4 +-- .../share/classes/sun/print/PeekGraphics.java | 26 ++++++++--------- .../share/classes/sun/print/PrintJob2D.java | 6 ++-- .../classes/sun/print/ProxyGraphics2D.java | 28 +++++++++---------- .../classes/sun/print/ProxyPrintGraphics.java | 2 +- .../classes/sun/print/RasterPrinterJob.java | 12 ++++---- .../classes/sun/swing/CachedPainter.java | 2 +- .../share/classes/sun/swing/UIAction.java | 1 - .../swing/plaf/synth/DefaultSynthStyle.java | 8 ++---- .../sun/swing/plaf/synth/Paint9Painter.java | 2 +- .../swing/text/TextComponentPrintable.java | 2 +- .../unix/classes/sun/awt/UNIXToolkit.java | 2 +- .../unix/classes/sun/awt/X11/XAtom.java | 1 - .../classes/sun/awt/X11/XComponentPeer.java | 1 - .../unix/classes/sun/awt/X11/XListPeer.java | 2 -- .../classes/sun/awt/X11/XMenuBarPeer.java | 8 +++--- .../classes/sun/awt/X11/XMenuItemPeer.java | 2 +- .../unix/classes/sun/awt/X11/XMenuWindow.java | 6 ++-- .../unix/classes/sun/awt/X11/XScrollbar.java | 15 ++++------ .../classes/sun/awt/X11GraphicsConfig.java | 2 +- .../sun/awt/X11GraphicsEnvironment.java | 2 +- .../unix/classes/sun/awt/X11InputMethod.java | 2 +- .../classes/sun/font/FontConfigManager.java | 6 ---- .../sun/awt/windows/WComponentPeer.java | 2 +- .../sun/awt/windows/WPathGraphics.java | 4 +-- .../classes/sun/awt/windows/WPrinterJob.java | 2 +- .../java2d/d3d/D3DScreenUpdateManager.java | 4 +-- .../sun/java2d/d3d/D3DSurfaceData.java | 2 +- .../sun/java2d/opengl/WGLSurfaceData.java | 2 +- 65 files changed, 228 insertions(+), 258 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java index 13b000d5582..721c2a07473 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java @@ -802,7 +802,7 @@ public void grab() { /** * Determine if applet is targeted for JDK 1.1. * - * @param applet Applet class. + * @param clazz Applet class. * @return TRUE if applet is targeted for JDK 1.1; * FALSE if applet is not; * null if applet is unknown. @@ -815,7 +815,7 @@ public void grab() { /** * Determine if applet is targeted for JDK 1.2. * - * @param applet Applet class. + * @param clazz Applet class. * @return TRUE if applet is targeted for JDK 1.2; * FALSE if applet is not; * null if applet is unknown. diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java index e2287986da8..0eba476fe82 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java @@ -270,10 +270,10 @@ class AppletSecurity extends AWTSecurityManager { * The checkPackageAccess method for class * SecurityManager calls * checkPermission with the - * RuntimePermission("accessClassInPackage."+pkg) + * RuntimePermission("accessClassInPackage."+ pkgname) * permission. * - * @param pkg the package name. + * @param pkgname the package name. * @exception SecurityException if the caller does not have * permission to access the specified package. * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean) diff --git a/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java b/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java index 44edefc31df..2125618d466 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java @@ -190,7 +190,7 @@ public final class AppContext { * * @see #addPropertyChangeListener * @see #removePropertyChangeListener - * @see #firePropertyChange + * @see PropertyChangeSupport#firePropertyChange */ private PropertyChangeSupport changeSupport = null; @@ -809,7 +809,7 @@ public final class AppContext { * * @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) * @see #getPropertyChangeListeners(java.lang.String) - * @see #removePropertyChangeListener(java.beans.PropertyChangeListener) + * @see PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) */ public synchronized void removePropertyChangeListener( String propertyName, diff --git a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java index 8863845566a..d90132e35e9 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java @@ -552,16 +552,10 @@ public abstract class EmbeddedFrame extends Frame } public void setModalBlocked(Dialog blocker, boolean blocked) {} - /** - * @see java.awt.peer.ContainerPeer#restack - */ public void restack() { throw new UnsupportedOperationException(); } - /** - * @see java.awt.peer.ContainerPeer#isRestackSupported - */ public boolean isRestackSupported() { return false; } diff --git a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 91b555a2fce..80b58f37e1c 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -366,8 +366,8 @@ public abstract class SunToolkit extends Toolkit * status to synchronous for any of its windows, then further focus * behaviour is unspecified. *

    - * @param w window for which the lightweight focus request status - * should be set + * @param changed the window for which the lightweight focus request + * status should be set * @param status the value of lightweight focus request status */ @@ -1459,9 +1459,9 @@ public abstract class SunToolkit extends Toolkit *

    Notice that realSync isn't guaranteed to work if recurring * actions occur, such as if during processing of some event * another request which may generate some events occurs. By - * default, sync tries to perform as much as {@value MAX_ITERS} + * default, sync tries to perform as much as {@value #MAX_ITERS} * cycles of event processing, allowing for roughly {@value - * MAX_ITERS} additional requests. + * #MAX_ITERS} additional requests. * *

    For example, requestFocus() generates native request, which * generates one or two Java focus events, which then generate a diff --git a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java b/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java index 6178f779be0..3b743cbbaab 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java @@ -151,7 +151,7 @@ public abstract class SunClipboard extends Clipboard /** - * @see java.awt.Clipboard#getAvailableDataFlavors + * @see java.awt.datatransfer.Clipboard#getAvailableDataFlavors * @since 1.5 */ public DataFlavor[] getAvailableDataFlavors() { @@ -167,7 +167,7 @@ public abstract class SunClipboard extends Clipboard } /** - * @see java.awt.Clipboard#isDataFlavorAvailable + * @see java.awt.datatransfer.Clipboard#isDataFlavorAvailable * @since 1.5 */ public boolean isDataFlavorAvailable(DataFlavor flavor) { @@ -186,7 +186,7 @@ public abstract class SunClipboard extends Clipboard } /** - * @see java.awt.Clipboard#getData + * @see java.awt.datatransfer.Clipboard#getData * @since 1.5 */ public Object getData(DataFlavor flavor) diff --git a/jdk/src/java.desktop/share/classes/sun/awt/geom/PathConsumer2D.java b/jdk/src/java.desktop/share/classes/sun/awt/geom/PathConsumer2D.java index 7adcc323979..eac6bd88c9e 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/geom/PathConsumer2D.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/geom/PathConsumer2D.java @@ -27,30 +27,30 @@ package sun.awt.geom; public interface PathConsumer2D { /** - * @see java.awt.geom.Path2D.Float.moveTo + * @see java.awt.geom.Path2D.Float#moveTo */ public void moveTo(float x, float y); /** - * @see java.awt.geom.Path2D.Float.lineTo + * @see java.awt.geom.Path2D.Float#lineTo */ public void lineTo(float x, float y); /** - * @see java.awt.geom.Path2D.Float.quadTo + * @see java.awt.geom.Path2D.Float#quadTo */ public void quadTo(float x1, float y1, float x2, float y2); /** - * @see java.awt.geom.Path2D.Float.curveTo + * @see java.awt.geom.Path2D.Float#curveTo */ public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3); /** - * @see java.awt.geom.Path2D.Float.closePath + * @see java.awt.geom.Path2D.Float#closePath */ public void closePath(); diff --git a/jdk/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java b/jdk/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java index 11619ba453d..88ee71163b1 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java @@ -519,7 +519,7 @@ class ExecutableInputMethodManager extends InputMethodManager * Writes the preferred input method descriptor class name into * the user's Preferences tree in accordance with the given locale. * - * @param inputMethodLocator input method locator to remember. + * @param locator input method locator to remember. */ private synchronized void putPreferredInputMethod(InputMethodLocator locator) { InputMethodDescriptor descriptor = locator.getDescriptor(); diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java index a0431baf4ac..699c1ea2f43 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java @@ -176,7 +176,7 @@ public class ByteBandedRaster extends SunWritableRaster { * Returns data offset for the specified band. The data offset * is the index into the band's data array * in which the first sample of the first scanline is stored. - * @param The band whose offset is returned. + * @param band The band whose offset is returned. */ public int getDataOffset(int band) { return dataOffsets[band]; @@ -222,11 +222,11 @@ public class ByteBandedRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. - * @return An object reference to an array of type defined by + * @return An object reference to an array of type defined by * getTransferType() with the request pixel data. */ public Object getDataElements(int x, int y, Object obj) { @@ -267,9 +267,9 @@ public class ByteBandedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -320,8 +320,8 @@ public class ByteBandedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param band The band to return. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. @@ -368,8 +368,8 @@ public class ByteBandedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. * @return Data array with data elements for all bands. @@ -412,7 +412,7 @@ public class ByteBandedRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -505,7 +505,7 @@ public class ByteBandedRaster extends SunWritableRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java index b5f4f7095aa..2ac4d180152 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java @@ -253,7 +253,7 @@ public class ByteComponentRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -299,9 +299,9 @@ public class ByteComponentRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -352,8 +352,8 @@ public class ByteComponentRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param band The band to return. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. @@ -415,8 +415,8 @@ public class ByteComponentRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. * @return Data array with data elements for all bands. @@ -458,7 +458,7 @@ public class ByteComponentRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -577,7 +577,7 @@ public class ByteComponentRaster extends SunWritableRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java index ec0fef12623..52f01b30b63 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java @@ -305,7 +305,7 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -351,9 +351,9 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -376,8 +376,8 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param band The band to return. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. @@ -437,8 +437,8 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. * @return Data array with data elements for all bands. @@ -536,7 +536,7 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -666,7 +666,7 @@ public class ByteInterleavedRaster extends ByteComponentRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java index 3e60f193ac2..ef78c83d2ce 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java @@ -234,7 +234,7 @@ public class BytePackedRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -306,9 +306,9 @@ public class BytePackedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -358,8 +358,8 @@ public class BytePackedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param band The band to return, is ignored. * @param outData If non-null, data elements * at the specified locations are returned in this array. @@ -383,8 +383,8 @@ public class BytePackedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param outData If non-null, data elements * at the specified locations are returned in this array. * @return Byte array with data elements. @@ -499,7 +499,7 @@ public class BytePackedRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -857,7 +857,7 @@ public class BytePackedRaster extends SunWritableRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetchable.java b/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetchable.java index 39b51d0d051..489248efbf6 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetchable.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetchable.java @@ -33,7 +33,7 @@ package sun.awt.image; * threads which manage the applications User Interface. * * @see ImageFetcher - * @see ImageProducer + * @see java.awt.image.ImageProducer * * @author Jim Graham */ @@ -42,7 +42,7 @@ public interface ImageFetchable { * This method is called by one of the ImageFetcher threads to start * the flow of information from the ImageProducer to the ImageConsumer. * @see ImageFetcher - * @see ImageProducer + * @see java.awt.image.ImageProducer */ public void doFetch(); } diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java index f7e8bf37100..a420f95f003 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java @@ -263,7 +263,7 @@ public class IntegerComponentRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -309,9 +309,9 @@ public class IntegerComponentRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -358,7 +358,7 @@ public class IntegerComponentRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -489,7 +489,7 @@ public class IntegerComponentRaster extends SunWritableRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java index b226f07efcb..a852080a701 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java @@ -206,7 +206,7 @@ public class IntegerInterleavedRaster extends IntegerComponentRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -249,9 +249,9 @@ public class IntegerInterleavedRaster extends IntegerComponentRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -291,7 +291,7 @@ public class IntegerInterleavedRaster extends IntegerComponentRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -410,7 +410,7 @@ public class IntegerInterleavedRaster extends IntegerComponentRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java index ccf7740ad53..fd5c610504d 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java @@ -172,7 +172,7 @@ public class ShortBandedRaster extends SunWritableRaster { * Returns the data offset for the specified band. The data offset * is the index into the band's data array * in which the first sample of the first scanline is stored. - * @param The band whose offset is returned. + * @param band The band whose offset is returned. */ public int getDataOffset(int band) { return dataOffsets[band]; @@ -218,7 +218,7 @@ public class ShortBandedRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -262,9 +262,9 @@ public class ShortBandedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -315,8 +315,8 @@ public class ShortBandedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param band The band to return. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. @@ -363,8 +363,8 @@ public class ShortBandedRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. * @return Data array with data elements for all bands. @@ -407,7 +407,7 @@ public class ShortBandedRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -503,7 +503,7 @@ public class ShortBandedRaster extends SunWritableRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java index 14ffe5539cf..aa1c56a064d 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java @@ -252,7 +252,7 @@ public class ShortComponentRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -298,9 +298,9 @@ public class ShortComponentRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -351,8 +351,8 @@ public class ShortComponentRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the sample rectangle. - * @param height Height of the sample rectangle. + * @param w Width of the sample rectangle. + * @param h Height of the sample rectangle. * @param band The band to return. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. @@ -414,8 +414,8 @@ public class ShortComponentRaster extends SunWritableRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. * @return Data array with data elements for all bands. @@ -456,7 +456,7 @@ public class ShortComponentRaster extends SunWritableRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -553,7 +553,7 @@ public class ShortComponentRaster extends SunWritableRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java index 4602c19aab0..05310891fe5 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java @@ -225,7 +225,7 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param outData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -271,9 +271,9 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. - * @param outData An object reference to an array of type defined by + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements(). * If null an array of appropriate type and size will be * allocated. @@ -324,8 +324,8 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the sample rectangle. - * @param height Height of the sample rectangle. + * @param w Width of the sample rectangle. + * @param h Height of the sample rectangle. * @param band The band to return. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. @@ -387,8 +387,8 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * * @param x The X coordinate of the upper left pixel location. * @param y The Y coordinate of the upper left pixel location. - * @param width Width of the pixel rectangle. - * @param height Height of the pixel rectangle. + * @param w Width of the pixel rectangle. + * @param h Height of the pixel rectangle. * @param outData If non-null, data elements for all bands * at the specified location are returned in this array. * @return Data array with data elements for all bands. @@ -429,7 +429,7 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * and references anything other than an array of transferType. * @param x The X coordinate of the pixel location. * @param y The Y coordinate of the pixel location. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length getNumDataElements() * containing the pixel data to place at x,y. */ @@ -525,7 +525,7 @@ public class ShortInterleavedRaster extends ShortComponentRaster { * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. - * @param inData An object reference to an array of type defined by + * @param obj An object reference to an array of type defined by * getTransferType() and length w*h*getNumDataElements() * containing the pixel data to place between x,y and * x+h, y+h. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolderColumnInfo.java b/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolderColumnInfo.java index 88dffacec2b..3926b558ba3 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolderColumnInfo.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolderColumnInfo.java @@ -40,7 +40,7 @@ public class ShellFolderColumnInfo { private SortOrder sortOrder; private Comparator comparator; /** - * false (default) if the {@link comparator} expects folders as arguments, + * false (default) if the {@link #comparator} expects folders as arguments, * and true if folder's column values. The first option is used default for comparison * on Windows and also for separating files from directories when sorting using * ShellFolderManager's inner comparator. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java b/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java index c88452289cb..b6d107b62f6 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java @@ -68,7 +68,7 @@ import java.util.RandomAccess; * synchronizing on some object that naturally encapsulates the list. * * If no such object exists, the list should be "wrapped" using the - * {@link Collections#synchronizedList Collections.synchronizedList} + * {@link java.util.Collections#synchronizedList Collections.synchronizedList} * method. This is best done at creation time, to prevent accidental * unsynchronized access to the list:

      *   List list = Collections.synchronizedList(new IdentityArrayList(...));
    diff --git a/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityLinkedList.java b/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityLinkedList.java index 690264ab4d9..f92509fefb4 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityLinkedList.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/util/IdentityLinkedList.java @@ -41,7 +41,7 @@ import java.util.NoSuchElementException; * the IdentityLinkedList class provides uniformly named methods to * get, remove and insert an element at the * beginning and end of the list. These operations allow linked lists to be - * used as a stack, {@linkplain Queue queue}, or {@linkplain Deque + * used as a stack, {@linkplain java.util.Queue queue}, or {@linkplain Deque * double-ended queue}.

    * * The class implements the Deque interface, providing @@ -62,7 +62,7 @@ import java.util.NoSuchElementException; * encapsulates the list. * * If no such object exists, the list should be "wrapped" using the - * {@link Collections#synchronizedList Collections.synchronizedList} + * {@link java.util.Collections#synchronizedList Collections.synchronizedList} * method. This is best done at creation time, to prevent accidental * unsynchronized access to the list:

      *   List list = Collections.synchronizedList(new IdentityLinkedList(...));
    @@ -478,7 +478,7 @@ public class IdentityLinkedList * Adds the specified element as the tail (last element) of this list. * * @param e the element to add - * @return true (as specified by {@link Queue#offer}) + * @return true (as specified by {@link java.util.Queue#offer}) * @since 1.5 */ public boolean offer(E e) { diff --git a/jdk/src/java.desktop/share/classes/sun/font/ScriptRun.java b/jdk/src/java.desktop/share/classes/sun/font/ScriptRun.java index d023a51c69b..485002ded79 100644 --- a/jdk/src/java.desktop/share/classes/sun/font/ScriptRun.java +++ b/jdk/src/java.desktop/share/classes/sun/font/ScriptRun.java @@ -138,7 +138,7 @@ public final class ScriptRun * Get the script code for the script of the current script run. * * @return the script code for the script of the current script run. - * @see #Script + * @see Script */ public int getScriptCode() { return scriptCode; @@ -274,7 +274,7 @@ public final class ScriptRun * @param scriptOne one of the script codes. * @param scriptTwo the other script code. * @return true if the two scripts are the same. - * @see com.ibm.icu.lang.Script + * @see Script */ private static boolean sameScript(int scriptOne, int scriptTwo) { return scriptOne == scriptTwo || scriptOne <= Script.INHERITED || scriptTwo <= Script.INHERITED; diff --git a/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java b/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java index 1f9ba94159c..d245f33b8af 100644 --- a/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java +++ b/jdk/src/java.desktop/share/classes/sun/font/TextLabelFactory.java @@ -41,11 +41,11 @@ import java.text.Bidi; * * @see Font * @see FontRenderContext - * @see GlyphVector + * @see java.awt.font.GlyphVector * @see TextLabel * @see ExtendedTextLabel * @see Bidi - * @see TextLayout + * @see java.awt.font.TextLayout */ public final class TextLabelFactory { diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/NullSurfaceData.java b/jdk/src/java.desktop/share/classes/sun/java2d/NullSurfaceData.java index a83e7566be3..c085da0d537 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/NullSurfaceData.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/NullSurfaceData.java @@ -86,7 +86,7 @@ public class NullSurfaceData extends SurfaceData { * In most cases, the returned Raster might contain more pixels * than requested. * - * @see useTightBBoxes + * @see #useTightBBoxes */ public Raster getRaster(int x, int y, int w, int h) { throw new InvalidPipeException("should be NOP"); @@ -101,7 +101,7 @@ public class NullSurfaceData extends SurfaceData { * the pixels has to be made when doing a getRaster. The * fewer pixels copied, the faster the operation will go. * - * @see getRaster + * @see #getRaster */ public boolean useTightBBoxes() { return false; diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/SunCompositeContext.java b/jdk/src/java.desktop/share/classes/sun/java2d/SunCompositeContext.java index 012e8438063..3fb910e7c52 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/SunCompositeContext.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunCompositeContext.java @@ -88,13 +88,13 @@ public class SunCompositeContext implements CompositeContext { * @param src2 The second source tile for the compositing operation. * @param dst The tile where the result of the operation is stored. */ - public void compose(Raster srcArg, Raster dstIn, WritableRaster dstOut) { + public void compose(Raster src1, Raster src2, WritableRaster dst) { WritableRaster src; int w; int h; - if (dstIn != dstOut) { - dstOut.setDataElements(0, 0, dstIn); + if (src2 != dst) { + dst.setDataElements(0, 0, src2); } // REMIND: We should be able to create a SurfaceData from just @@ -102,20 +102,20 @@ public class SunCompositeContext implements CompositeContext { // create a SurfaceData from a BufferedImage then we need to // make a WritableRaster since it is needed to construct a // BufferedImage. - if (srcArg instanceof WritableRaster) { - src = (WritableRaster) srcArg; + if (src1 instanceof WritableRaster) { + src = (WritableRaster) src1; } else { - src = srcArg.createCompatibleWritableRaster(); - src.setDataElements(0, 0, srcArg); + src = src1.createCompatibleWritableRaster(); + src.setDataElements(0, 0, src1); } - w = Math.min(src.getWidth(), dstIn.getWidth()); - h = Math.min(src.getHeight(), dstIn.getHeight()); + w = Math.min(src.getWidth(), src2.getWidth()); + h = Math.min(src.getHeight(), src2.getHeight()); BufferedImage srcImg = new BufferedImage(srcCM, src, srcCM.isAlphaPremultiplied(), null); - BufferedImage dstImg = new BufferedImage(dstCM, dstOut, + BufferedImage dstImg = new BufferedImage(dstCM, dst, dstCM.isAlphaPremultiplied(), null); diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java index 864b5fb8da2..f3c08ac332c 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java @@ -874,13 +874,13 @@ public final class SunGraphics2D * space. The rendering attributes taken into account include the * clip, transform, and stroke attributes. * @param rect The area in device space to check for a hit. - * @param p The path to check for a hit. + * @param s The path to check for a hit. * @param onStroke Flag to choose between testing the stroked or * the filled path. * @return True if there is a hit, false otherwise. * @see #setStroke - * @see #fillPath - * @see #drawPath + * @see #fill(Shape) + * @see #draw(Shape) * @see #transform * @see #setTransform * @see #clip @@ -1295,7 +1295,7 @@ public final class SunGraphics2D /** * Returns the preferences for the rendering algorithms. - * @param hintCategory The category of hint to be set. The strings + * @param hintKey The category of hint to be set. The strings * are defined in the RenderingHints class. * @return The preferences for rendering algorithms. The strings * are defined in the RenderingHints class. @@ -1577,7 +1577,7 @@ public final class SunGraphics2D * Cx'(p) = Cx(Tx(p)). * A copy of the Tx is made, if necessary, so further * modifications to Tx do not affect rendering. - * @param Tx The Transform object to be composed with the current + * @param xform The Transform object to be composed with the current * transform. * @see #setTransform * @see AffineTransform @@ -1606,7 +1606,6 @@ public final class SunGraphics2D * Sets the Transform in the current graphics state. * @param Tx The Transform object to be used in the rendering process. * @see #transform - * @see TransformChain * @see AffineTransform */ @Override @@ -1789,8 +1788,8 @@ public final class SunGraphics2D * of the component, use appropriate methods of the component. * @param color The background color that should be used in * subsequent calls to clearRect(). - * @see getBackground - * @see Graphics.clearRect() + * @see #getBackground + * @see Graphics#clearRect */ public void setBackground(Color color) { backgroundColor = color; @@ -1798,7 +1797,7 @@ public final class SunGraphics2D /** * Returns the background color used for clearing a region. - * @see setBackground + * @see #setBackground */ public Color getBackground() { return backgroundColor; @@ -1806,7 +1805,7 @@ public final class SunGraphics2D /** * Returns the current Stroke in the Graphics2D state. - * @see setStroke + * @see #setStroke */ public Stroke getStroke() { return stroke; @@ -2056,7 +2055,7 @@ public final class SunGraphics2D * with the current transform in the Graphics2D state before being * intersected with the current clip. This method is used to make the * current clip smaller. To make the clip larger, use any setClip method. - * @param p The Path to be intersected with the current clip. + * @param s The Path to be intersected with the current clip. */ public void clip(Shape s) { s = transformShape(s); @@ -2483,7 +2482,7 @@ public final class SunGraphics2D * Strokes the outline of a Path using the settings of the current * graphics state. The rendering attributes applied include the * clip, transform, paint or color, composite and stroke attributes. - * @param p The path to be drawn. + * @param s The path to be drawn. * @see #setStroke * @see #setPaint * @see java.awt.Graphics#setColor diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/SurfaceData.java b/jdk/src/java.desktop/share/classes/sun/java2d/SurfaceData.java index c1b8bf79b70..81794b5d490 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/SurfaceData.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/SurfaceData.java @@ -939,7 +939,7 @@ public abstract class SurfaceData * In most cases, the returned Raster might contain more pixels * than requested. * - * @see useTightBBoxes + * @see #useTightBBoxes */ public abstract Raster getRaster(int x, int y, int w, int h); @@ -952,7 +952,7 @@ public abstract class SurfaceData * the pixels has to be made when doing a getRaster. The * fewer pixels copied, the faster the operation will go. * - * @see getRaster + * @see #getRaster */ public boolean useTightBBoxes() { // Note: The native equivalent would trigger on VISIBLE_TO_NATIVE diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java index 79fc8eb6780..eecefd97276 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java @@ -56,7 +56,7 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter * @param minPenSize minimum pen size for dropout control * @param normPosition sub-pixel location to normalize endpoints * for STROKE_NORMALIZE cases - * @param adjustFill boolean to control whethere normalization + * @param adjustfill boolean to control whethere normalization * constants are also applied to fill operations * (normally true for non-AA, false for AA) */ diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java index 034a6e8b218..d5fd254fe6c 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java @@ -66,7 +66,7 @@ import sun.awt.geom.PathConsumer2D; * line width can get before dropouts occur. Rendering with a BasicStroke * is defined to never allow the line to have breaks, gaps, or dropouts * even if the width is set to 0.0f, so this information allows the - * {@link SunGraphics2D} class to detect the "thin line" case and set + * {@link sun.java2d.SunGraphics2D} class to detect the "thin line" case and set * the rendering attributes accordingly. * * At startup the runtime will load a single instance of this class. @@ -177,11 +177,11 @@ public abstract class RenderingEngine { * The specified {@code src} {@link Shape} is widened according * to the parameters specified by the {@link BasicStroke} object. * Adjustments are made to the path as appropriate for the - * {@link VALUE_STROKE_NORMALIZE} hint if the {@code normalize} - * boolean parameter is true. + * {@link java.awt.RenderingHints#VALUE_STROKE_NORMALIZE} hint if the + * {@code normalize} boolean parameter is true. * Adjustments are made to the path as appropriate for the - * {@link VALUE_ANTIALIAS_ON} hint if the {@code antialias} - * boolean parameter is true. + * {@link java.awt.RenderingHints#VALUE_ANTIALIAS_ON} hint if the + * {@code antialias} boolean parameter is true. *

    * The geometry of the widened path is forwarded to the indicated * {@link PathConsumer2D} object as it is calculated. diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java index 69264c51c4a..9cca142c48f 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java @@ -137,7 +137,7 @@ public class AccelDeviceEventNotifier { * * @param screen a screen number with which the device which is a source of * the event is associated with - * @param eventType a type of the event + * @param deviceEventType a type of the event * @see #DEVICE_DISPOSED * @see #DEVICE_RESET */ diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelGraphicsConfig.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelGraphicsConfig.java index c503500a213..50712319180 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelGraphicsConfig.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelGraphicsConfig.java @@ -77,7 +77,7 @@ public interface AccelGraphicsConfig extends BufferedContextProvider { * events. * * Note: a hard link to the listener may be kept so it must be explicitly - * removed via {@link #removeDeviceEventListener()}. + * removed via {@link #removeDeviceEventListener}. * * @param l the listener * @see AccelDeviceEventListener diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java index 12aad7b2f11..833273ca70c 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/hw/ContextCapabilities.java @@ -65,7 +65,7 @@ public class ContextCapabilities { /** * Constructs a {@code ContextCapabilities} object. * @param caps an {@code int} representing the capabilities - * @param a {@code String} representing the name of the adapter, or null, + * @param adapterId {@code String} representing the name of the adapter, or null, * in which case the adapterId will be set to "unknown adapter". */ protected ContextCapabilities(int caps, String adapterId) { diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesCache.java b/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesCache.java index a26e7aa05f3..7e23ed4c5f1 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesCache.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesCache.java @@ -29,8 +29,6 @@ import java.util.Arrays; /** * An object used to cache pre-rendered complex paths. - * - * @see PiscesRenderer#render */ final class PiscesCache { diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java b/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java index f6057fe2b73..af2d25506cf 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java @@ -108,11 +108,11 @@ public class PiscesRenderingEngine extends RenderingEngine { * The specified {@code src} {@link Shape} is widened according * to the parameters specified by the {@link BasicStroke} object. * Adjustments are made to the path as appropriate for the - * {@link VALUE_STROKE_NORMALIZE} hint if the {@code normalize} - * boolean parameter is true. + * {@link java.awt.RenderingHints#VALUE_STROKE_NORMALIZE} hint if the + * {@code normalize} boolean parameter is true. * Adjustments are made to the path as appropriate for the - * {@link VALUE_ANTIALIAS_ON} hint if the {@code antialias} - * boolean parameter is true. + * {@link java.awt.RenderingHints#VALUE_ANTIALIAS_ON} hint if the + * {@code antialias} boolean parameter is true. *

    * The geometry of the widened path is forwarded to the indicated * {@link PathConsumer2D} object as it is calculated. diff --git a/jdk/src/java.desktop/share/classes/sun/print/DialogOwner.java b/jdk/src/java.desktop/share/classes/sun/print/DialogOwner.java index 96a67eb8106..a08c06bac58 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/DialogOwner.java +++ b/jdk/src/java.desktop/share/classes/sun/print/DialogOwner.java @@ -45,10 +45,9 @@ public final class DialogOwner private Frame dlgOwner; /** - * Construct a new dialog type selection enumeration value with the - * given integer value. + * Construct a new dialog owner attribute with the given frame. * - * @param value Integer value. + * @param frame the frame that owns the print dialog */ public DialogOwner(Frame frame) { dlgOwner = frame; diff --git a/jdk/src/java.desktop/share/classes/sun/print/OpenBook.java b/jdk/src/java.desktop/share/classes/sun/print/OpenBook.java index c16c5170e3a..4ce61b45456 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/OpenBook.java +++ b/jdk/src/java.desktop/share/classes/sun/print/OpenBook.java @@ -74,8 +74,8 @@ class OpenBook implements Pageable { /** * Return the PageFormat of the page specified by 'pageIndex'. - * @param int The zero based index of the page whose - * PageFormat is being requested. + * @param pageIndex The zero based index of the page whose + * PageFormat is being requested. * @return The PageFormat describing the size and orientation */ public PageFormat getPageFormat(int pageIndex) { @@ -85,8 +85,8 @@ class OpenBook implements Pageable { /** * Return the Printable instance responsible for rendering * the page specified by 'pageIndex'. - * @param int The zero based index of the page whose - * Printable is being requested. + * @param pageIndex The zero based index of the page whose + * Printable is being requested. * @return The Printable that will draw the page. */ public Printable getPrintable(int pageIndex) diff --git a/jdk/src/java.desktop/share/classes/sun/print/PSPathGraphics.java b/jdk/src/java.desktop/share/classes/sun/print/PSPathGraphics.java index 73a77ff6020..1b00d4b7851 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/PSPathGraphics.java +++ b/jdk/src/java.desktop/share/classes/sun/print/PSPathGraphics.java @@ -126,7 +126,7 @@ class PSPathGraphics extends PathGraphics { * such as Hebrew and Arabic, the glyphs can be rendered from right to * left, in which case the coordinate supplied is the location of the * leftmost character on the baseline. - * @param s the String to be rendered + * @param str the String to be rendered * @param x, y the coordinates where the String * should be rendered * @see #setPaint @@ -256,7 +256,7 @@ class PSPathGraphics extends PathGraphics { * is transformed by the supplied AffineTransform and * drawn using PS to the printer context. * - * @param img The image to be drawn. + * @param image The image to be drawn. * This method does nothing if img is null. * @param xform Used to transform the image before drawing. * This can be null. diff --git a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java index dd6e0e7472c..ffa0aabe25d 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java +++ b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java @@ -361,9 +361,9 @@ public class PeekGraphics extends Graphics2D * use this font. * @param font the font. * @see java.awt.Graphics#getFont - * @see java.awt.Graphics#drawChars(java.lang.String, int, int) - * @see java.awt.Graphics#drawString(byte[], int, int, int, int) - * @see java.awt.Graphics#drawBytes(char[], int, int, int, int) + * @see java.awt.Graphics#drawChars(char[], int, int, int, int) + * @see java.awt.Graphics#drawString(String, int, int) + * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int) * @since 1.0 */ public void setFont(Font font) { @@ -1446,7 +1446,7 @@ public class PeekGraphics extends Graphics2D * Draws a string of text. * The rendering attributes applied include the clip, transform, * paint or color, font and composite attributes. - * @param s The string to be drawn. + * @param str The string to be drawn. * @param x,y The coordinates where the string should be drawn. * @see #setPaint * @see java.awt.Graphics#setColor @@ -1548,7 +1548,7 @@ public class PeekGraphics extends Graphics2D * @param comp The Composite object to be used for drawing. * @see java.awt.Graphics#setXORMode * @see java.awt.Graphics#setPaintMode - * @see AlphaComposite + * @see java.awt.AlphaComposite */ public void setComposite(Composite comp) { mGraphics.setComposite(comp); @@ -1560,8 +1560,8 @@ public class PeekGraphics extends Graphics2D * @param paint The Paint object to be used to generate color in * the rendering process. * @see java.awt.Graphics#setColor - * @see GradientPaint - * @see TexturePaint + * @see java.awt.GradientPaint + * @see java.awt.TexturePaint */ public void setPaint(Paint paint) { mGraphics.setPaint(paint); @@ -1594,7 +1594,7 @@ public class PeekGraphics extends Graphics2D * Returns the preferences for the rendering algorithms. * @param hintCategory The category of hint to be set. * @return The preferences for rendering algorithms. - * @see RenderingHings + * @see RenderingHints */ public Object getRenderingHint(Key hintCategory) { return mGraphics.getRenderingHint(hintCategory); @@ -1647,7 +1647,6 @@ public class PeekGraphics extends Graphics2D * @param Tx The Transform object to be composed with the current * transform. * @see #setTransform - * @see TransformChain * @see AffineTransform */ public void transform(AffineTransform Tx) { @@ -1658,7 +1657,6 @@ public class PeekGraphics extends Graphics2D * Sets the Transform in the current graphics state. * @param Tx The Transform object to be used in the rendering process. * @see #transform - * @see TransformChain * @see AffineTransform */ public void setTransform(AffineTransform Tx) { @@ -1700,8 +1698,8 @@ public class PeekGraphics extends Graphics2D * of the component, use appropriate methods of the component. * @param color The background color that should be used in * subsequent calls to clearRect(). - * @see getBackground - * @see Graphics.clearRect() + * @see #getBackground + * @see Graphics#clearRect */ public void setBackground(Color color) { mGraphics.setBackground(color); @@ -1709,7 +1707,7 @@ public class PeekGraphics extends Graphics2D /** * Returns the background color used for clearing a region. - * @see setBackground + * @see #setBackground */ public Color getBackground() { return mGraphics.getBackground(); @@ -1717,7 +1715,7 @@ public class PeekGraphics extends Graphics2D /** * Returns the current Stroke in the Graphics2D state. - * @see setStroke + * @see #setStroke */ public Stroke getStroke() { return mGraphics.getStroke(); diff --git a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java index cab43fef354..0ae31dfb56e 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java +++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java @@ -79,7 +79,7 @@ import sun.print.SunMinMaxPage; * A class which initiates and executes a print job using * the underlying PrinterJob graphics conversions. * - * @see Toolkit#getPrintJob + * @see java.awt.Toolkit#getPrintJob * */ public class PrintJob2D extends PrintJob implements Printable, Runnable { @@ -750,7 +750,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable { * The page is sent to the printer when the graphics * object is disposed. This graphics object will also implement * the PrintGraphics interface. - * @see PrintGraphics + * @see java.awt.PrintGraphics */ public Graphics getGraphics() { @@ -937,7 +937,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable { * If the requested page does not exist then this method returns * NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. * The Graphics class or subclass implements the - * {@link PrinterGraphics} interface to provide additional + * {@link java.awt.PrintGraphics} interface to provide additional * information. If the Printable object * aborts the print job then it throws a {@link PrinterException}. * @param graphics the context into which the page is drawn diff --git a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java index 6187e639b69..57f8ec876b3 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java +++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java @@ -297,9 +297,9 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * use this font. * @param font the font. * @see java.awt.Graphics#getFont - * @see java.awt.Graphics#drawChars(java.lang.String, int, int) - * @see java.awt.Graphics#drawString(byte[], int, int, int, int) - * @see java.awt.Graphics#drawBytes(char[], int, int, int, int) + * @see java.awt.Graphics#drawChars(char[], int, int, int, int) + * @see java.awt.Graphics#drawString(String, int, int) + * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int) * @since 1.0 */ public void setFont(Font font) { @@ -1345,7 +1345,7 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * Draws a string of text. * The rendering attributes applied include the clip, transform, * paint or color, font and composite attributes. - * @param s The string to be drawn. + * @param str The string to be drawn. * @param x,y The coordinates where the string should be drawn. * @see #setPaint * @see java.awt.Graphics#setColor @@ -1432,7 +1432,7 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * @param comp The Composite object to be used for drawing. * @see java.awt.Graphics#setXORMode * @see java.awt.Graphics#setPaintMode - * @see AlphaComposite + * @see java.awt.AlphaComposite */ public void setComposite(Composite comp) { mGraphics.setComposite(comp); @@ -1444,8 +1444,8 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * @param paint The Paint object to be used to generate color in * the rendering process. * @see java.awt.Graphics#setColor - * @see GradientPaint - * @see TexturePaint + * @see java.awt.GradientPaint + * @see java.awt.TexturePaint */ public void setPaint(Paint paint) { mGraphics.setPaint(paint); @@ -1455,7 +1455,7 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * Sets the Stroke in the current graphics state. * @param s The Stroke object to be used to stroke a Shape in * the rendering process. - * @see BasicStroke + * @see java.awt.BasicStroke */ public void setStroke(Stroke s) { mGraphics.setStroke(s); @@ -1478,7 +1478,7 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * Returns the preferences for the rendering algorithms. * @param hintCategory The category of hint to be set. * @return The preferences for rendering algorithms. - * @see RenderingHings + * @see RenderingHints */ public Object getRenderingHint(Key hintCategory) { return mGraphics.getRenderingHint(hintCategory); @@ -1531,7 +1531,6 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * @param Tx The Transform object to be composed with the current * transform. * @see #setTransform - * @see TransformChain * @see AffineTransform */ public void transform(AffineTransform Tx) { @@ -1542,7 +1541,6 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * Sets the Transform in the current graphics state. * @param Tx The Transform object to be used in the rendering process. * @see #transform - * @see TransformChain * @see AffineTransform */ public void setTransform(AffineTransform Tx) { @@ -1584,8 +1582,8 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { * of the component, use appropriate methods of the component. * @param color The background color that should be used in * subsequent calls to clearRect(). - * @see getBackground - * @see Graphics.clearRect() + * @see #getBackground + * @see Graphics#clearRect */ public void setBackground(Color color) { mGraphics.setBackground(color); @@ -1593,7 +1591,7 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { /** * Returns the background color used for clearing a region. - * @see setBackground + * @see #setBackground */ public Color getBackground() { return mGraphics.getBackground(); @@ -1601,7 +1599,7 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { /** * Returns the current Stroke in the Graphics2D state. - * @see setStroke + * @see #setStroke */ public Stroke getStroke() { return mGraphics.getStroke(); diff --git a/jdk/src/java.desktop/share/classes/sun/print/ProxyPrintGraphics.java b/jdk/src/java.desktop/share/classes/sun/print/ProxyPrintGraphics.java index 7c5d17efd17..f46caed3ea3 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/ProxyPrintGraphics.java +++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyPrintGraphics.java @@ -69,7 +69,7 @@ public class ProxyPrintGraphics extends ProxyGraphics * Graphics object, but with a new translation and * clip area. * Refer to - * {@link sun.print.ProxyGraphics#createGraphics} + * {@link sun.print.ProxyGraphics#create(int, int, int, int)} * for a complete description of this method. *

    * @param x the x coordinate. diff --git a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java index 906058f8a81..a87c8123c7f 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java +++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java @@ -498,7 +498,7 @@ public abstract class RasterPrinterJob extends PrinterJob { * Throws PrinterException if the specified service * cannot support the Pageable and * Printable interfaces necessary to support 2D printing. - * @param a print service which supports 2D printing. + * @param service print service which supports 2D printing. * * @throws PrinterException if the specified service does not support * 2D printing or no longer available. @@ -1024,7 +1024,7 @@ public abstract class RasterPrinterJob extends PrinterJob { * The pages in the document to be printed by this PrinterJob * are drawn by the Printable object 'painter'. The PageFormat * for each page is the default page format. - * @param Printable Called to render each page of the document. + * @param painter Called to render each page of the document. */ public void setPrintable(Printable painter) { setPageable(new OpenBook(defaultPage(new PageFormat()), painter)); @@ -1034,9 +1034,9 @@ public abstract class RasterPrinterJob extends PrinterJob { * The pages in the document to be printed by this PrinterJob * are drawn by the Printable object 'painter'. The PageFormat * of each page is 'format'. - * @param Printable Called to render each page of the document. - * @param PageFormat The size and orientation of each page to - * be printed. + * @param painter Called to render each page of the document. + * @param format The size and orientation of each page to + * be printed. */ public void setPrintable(Printable painter, PageFormat format) { setPageable(new OpenBook(format, painter)); @@ -1048,7 +1048,7 @@ public abstract class RasterPrinterJob extends PrinterJob { * Pageable instance 'document'. 'document' will be queried * for the number of pages as well as the PageFormat and * Printable for each page. - * @param Pageable The document to be printed. It may not be null. + * @param document The document to be printed. It may not be null. * @exception NullPointerException the Pageable passed in was null. * @see PageFormat * @see Printable diff --git a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java index dedee99cc27..ef9a3c2baaf 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java @@ -89,7 +89,7 @@ public abstract class CachedPainter { * @param y Y-coordinate to render to * @param w Width to render in * @param h Height to render in - * @param arg Variable arguments that will be passed to paintToImage + * @param args Variable arguments that will be passed to paintToImage */ public void paint(Component c, Graphics g, int x, int y, int w, int h, Object... args) { diff --git a/jdk/src/java.desktop/share/classes/sun/swing/UIAction.java b/jdk/src/java.desktop/share/classes/sun/swing/UIAction.java index 097001e4045..98aa04c06c4 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/UIAction.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/UIAction.java @@ -54,7 +54,6 @@ import javax.swing.Action; * isEnabled(Component), and be aware that the passed in * Component may be null. * - * @see com.sun.java.swing.ExtendedAction * @see javax.swing.Action * @author Scott Violet */ diff --git a/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java b/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java index 8829f369460..8e4c2159679 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java @@ -289,7 +289,7 @@ public class DefaultSynthStyle extends SynthStyle implements Cloneable { /** * Sets the insets. * - * @param Insets. + * @param insets the new insets. */ public void setInsets(Insets insets) { this.insets = insets; @@ -300,7 +300,7 @@ public class DefaultSynthStyle extends SynthStyle implements Cloneable { * insets will be placed in it, otherwise a new Insets object will be * created and returned. * - * @param context SynthContext identifying requestor + * @param state SynthContext identifying requestor * @param to Where to place Insets * @return Insets. */ @@ -435,7 +435,7 @@ public class DefaultSynthStyle extends SynthStyle implements Cloneable { * Returns the default value for a particular property. This is only * invoked if this style doesn't define a property for key. * - * @param state SynthContext identifying requestor + * @param context SynthContext identifying requestor * @param key Property being requested. * @return Value of the named property */ @@ -724,8 +724,6 @@ public class DefaultSynthStyle extends SynthStyle implements Cloneable { * * @param state Component state(s) that this StateInfo should be used * for - * @param painter Painter responsible for rendering - * @param bgPainter Painter responsible for rendering the background * @param font Font for this state * @param colors Colors for this state */ diff --git a/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/Paint9Painter.java b/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/Paint9Painter.java index 2a7aa577e05..df9fed5c36b 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/Paint9Painter.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/Paint9Painter.java @@ -118,7 +118,7 @@ public class Paint9Painter extends CachedPainter { * @param dInsets Destination insets specifying the portion of the image * will be stretched or tiled, if null empty * Insets will be used. - * @param paintType Specifies what type of algorithm to use in painting + * @param type Specifies what type of algorithm to use in painting * @param mask Specifies portion of image to render, if * PAINT_ALL is specified, any other regions * specified will not be painted, for example diff --git a/jdk/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java b/jdk/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java index 63d3c5890dd..eace48bcc26 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java @@ -212,7 +212,7 @@ public class TextComponentPrintable implements CountingPrintable { * level {@code JEditorPanes}. For instance if there is a frame * inside the frame it will return the top frame only. * - * @param c the container to find all frames under + * @param container the container to find all frames under * @param list {@code List} to append the results too */ private static void getFrames(final Container container, List list) { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java b/jdk/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java index d03644ffec6..42dd34e6943 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java @@ -189,7 +189,7 @@ public abstract class UNIXToolkit extends SunToolkit * @param stockId String which defines the stock id of the gtk item. * For a complete list reference the API at www.gtk.org for StockItems. * @param iconSize One of the GtkIconSize values defined in GTKConstants - * @param textDirection One of the TextDirection values defined in + * @param direction One of the TextDirection values defined in * GTKConstants * @param detail Render detail that is passed to the native engine (feel * free to pass null) diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java index 3e14dda589d..01d17fdad21 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java @@ -338,7 +338,6 @@ public final class XAtom { /** Gets the window property for the specified window * @param window window id to use - * @param str value to set to. * @return string with the property. * @since 1.5 */ diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java index b84054ea4ed..3c5d162bd18 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java @@ -680,7 +680,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * obtained * @return the font metrics for font * @see #getFont - * @see #getPeer * @see java.awt.peer.ComponentPeer#getFontMetrics(Font) * @see Toolkit#getFontMetrics(Font) * @since 1.0 diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java index 77545589889..b744d5e8cbd 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java @@ -1952,7 +1952,6 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { * Paint the horizontal scrollbar to the screen * * @param g the graphics context to draw into - * @param colors the colors used to draw the scrollbar * @param paintAll paint the whole scrollbar if true, just the thumb if false */ void paintHorScrollbar(Graphics g, boolean paintAll) { @@ -1964,7 +1963,6 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { * Paint the vertical scrollbar to the screen * * @param g the graphics context to draw into - * @param colors the colors used to draw the scrollbar * @param paintAll paint the whole scrollbar if true, just the thumb if false */ void paintVerScrollbar(Graphics g, boolean paintAll) { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java index cf6ba6e1025..256767446e2 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java @@ -222,7 +222,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { } /** - * @see XBaseMenuWindow.map + * @see XBaseMenuWindow#map */ protected MappingData map() { XMenuItemPeer[] itemVector = copyItems(); @@ -292,7 +292,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { } /** - * @see XBaseMenuWindow.getSubmenuBounds + * @see XBaseMenuWindow#getSubmenuBounds */ protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) { Rectangle globalBounds = toGlobal(itemBounds); @@ -362,7 +362,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { ************************************************/ /** - * @see XBaseMenuWindow.doDispose() + * @see XBaseMenuWindow#doDispose() */ protected void doDispose() { super.doDispose(); @@ -388,7 +388,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { /** * Performs ungrabbing of input - * @see XBaseWindow.ungrabInputImpl() + * @see XBaseWindow#ungrabInputImpl() */ void ungrabInputImpl() { selectItem(null, false); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java index 7aa9c3c1b0d..dd576070ff2 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java @@ -437,7 +437,7 @@ public class XMenuItemPeer implements MenuItemPeer { * Sets mapping of item to window. * @param bounds bounds of item in container's coordinates * @param textOrigin point for drawString in container's coordinates - * @see XBaseMenuWindow.map() + * @see XBaseMenuWindow#map() */ void map(Rectangle bounds, Point textOrigin) { this.bounds = bounds; diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java index b5fbfca919c..a79753facf0 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java @@ -192,14 +192,14 @@ public class XMenuWindow extends XBaseMenuWindow { ************************************************/ /** - * @see XBaseMenuWindow.getParentMenuWindow() + * @see XBaseMenuWindow#getParentMenuWindow() */ protected XBaseMenuWindow getParentMenuWindow() { return (menuPeer != null) ? menuPeer.getContainer() : null; } /** - * @see XBaseMenuWindow.map() + * @see XBaseMenuWindow#map() */ protected MappingData map() { //TODO:Implement popup-menu caption mapping and painting and tear-off @@ -274,7 +274,7 @@ public class XMenuWindow extends XBaseMenuWindow { } /** - * @see XBaseMenuWindow.getSubmenuBounds() + * @see XBaseMenuWindow#getSubmenuBounds */ protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) { Rectangle globalBounds = toGlobal(itemBounds); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.java index 49381c05716..71aa8fe0de4 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.java @@ -161,8 +161,6 @@ abstract class XScrollbar { * paint the scrollbar * @param g the graphics context to paint into * @param colors the colors to use when painting the scrollbar - * @param width the width of the scrollbar - * @param height the height of the scrollbar * @param paintAll paint the whole scrollbar if true, just the thumb is false */ void paint(Graphics g, Color colors[], boolean paintAll) { @@ -393,7 +391,7 @@ abstract class XScrollbar { /** * Scroll one unit. - * @see notifyValue + * @see #notifyValue */ void scroll() { switch (mode) { @@ -607,7 +605,6 @@ abstract class XScrollbar { * @param minimum is the minimum value of the scrollbar * @param maximum is the maximum value of the scrollbar * @param unitSize is the unit size for increment or decrement of the value - * @param page is the block size for increment or decrement of the value * @see #setValues */ synchronized void setValues(int value, int visible, int minimum, int maximum, @@ -631,7 +628,7 @@ abstract class XScrollbar { /** * Sets the value of this Scrollbar to the specified value. - * @param value the new value of the Scrollbar. If this value is + * @param newValue the new value of the Scrollbar. If this value is * below the current minimum or above the current maximum minus * the visible amount, it becomes the new one of those values, * respectively. @@ -655,7 +652,7 @@ abstract class XScrollbar { /** * Sets the minimum value for this Scrollbar. - * @param minimum the minimum value of the scrollbar + * @param newMinimum the minimum value of the scrollbar */ synchronized void setMinimum(int newMinimum) { /* Use setValues so that a consistent policy @@ -675,7 +672,7 @@ abstract class XScrollbar { /** * Sets the maximum value for this Scrollbar. - * @param maximum the maximum value of the scrollbar + * @param newMaximum the maximum value of the scrollbar */ synchronized void setMaximum(int newMaximum) { /* Use setValues so that a consistent policy @@ -694,7 +691,7 @@ abstract class XScrollbar { /** * Sets the visible amount of this Scrollbar, which is the range * of values represented by the width of the scroll bar's bubble. - * @param visible the amount visible per page + * @param newAmount the amount visible per page */ synchronized void setVisibleAmount(int newAmount) { setValues(val, newAmount, min, max); @@ -759,7 +756,7 @@ abstract class XScrollbar { /** * Returns the scale factor for the thumbArea ( thumbAreaH / (max - min)). - * @see #getArrowAreaSize + * @see #getArrowAreaWidth */ private double getScaleFactor(){ double f = (double)(barLength - 2*getArrowAreaWidth()) / Math.max(1,(max - min)); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java index 7432c8b7159..9ac71d82993 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java @@ -58,7 +58,7 @@ import sun.awt.image.SurfaceManager; * This is an implementation of a GraphicsConfiguration object for a * single X11 visual. * - * @see GraphicsEnvironment + * @see java.awt.GraphicsEnvironment * @see GraphicsDevice */ public class X11GraphicsConfig extends GraphicsConfiguration diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java index fec7daa620b..81e6ae8375f 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java @@ -48,7 +48,7 @@ import sun.java2d.xr.XRSurfaceData; * for X11 environments. * * @see GraphicsDevice - * @see GraphicsConfiguration + * @see java.awt.GraphicsConfiguration */ public final class X11GraphicsEnvironment extends SunGraphicsEnvironment { diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java index 5fc2825306e..54153af8011 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java @@ -548,7 +548,7 @@ public abstract class X11InputMethod extends InputMethodAdapter { * method is invoked from the event handler in canvas.c in the * AWT Toolkit thread context and thus inside the AWT Lock. * @param str committed text - * @param long when + * @param when when */ // NOTE: This method may be called by privileged threads. // This functionality is implemented in a package-private method diff --git a/jdk/src/java.desktop/unix/classes/sun/font/FontConfigManager.java b/jdk/src/java.desktop/unix/classes/sun/font/FontConfigManager.java index 725ae4e060b..dcb99ba89ce 100644 --- a/jdk/src/java.desktop/unix/classes/sun/font/FontConfigManager.java +++ b/jdk/src/java.desktop/unix/classes/sun/font/FontConfigManager.java @@ -436,12 +436,6 @@ public class FontConfigManager { return (fcInfo.compFont = new CompositeFont(physFont, jdkFont)); } - /** - * - * @param locale - * @param fcFamily - * @return - */ public FcCompFont[] getFontConfigFonts() { return fontConfigFonts; } diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java index 3aa2387495c..6c40c230120 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java @@ -663,7 +663,7 @@ public abstract class WComponentPeer extends WObjectPeer * This method is intentionally not synchronized as it is called while * holding other locks. * - * @see sun.java2d.d3d.D3DScreenUpdateManager#validate(D3DWindowSurfaceData) + * @see sun.java2d.d3d.D3DScreenUpdateManager#validate */ public Color getBackgroundNoSync() { return background; diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java index 3b90f2fa215..75e51636ec2 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java @@ -386,7 +386,7 @@ final class WPathGraphics extends PathGraphics { * such as Hebrew and Arabic, the glyphs can be rendered from right to * left, in which case the coordinate supplied is the location of the * leftmost character on the baseline. - * @param s the String to be rendered + * @param str the String to be rendered * @param x, y the coordinates where the String * should be rendered * @see #setPaint @@ -877,7 +877,7 @@ final class WPathGraphics extends PathGraphics { * is transformed by the supplied AffineTransform and * drawn using GDI to the printer context. * - * @param img The image to be drawn. + * @param image The image to be drawn. * @param xform Used to transform the image before drawing. * This can be null. * @param bgcolor This color is drawn where the image has transparent diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java index 57e3e8bab0f..e365bd7cd96 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java @@ -591,7 +591,7 @@ public final class WPrinterJob extends RasterPrinterJob * Throws PrinterException if the specified service * cannot support the Pageable and * Printable interfaces necessary to support 2D printing. - * @param a print service which supports 2D printing. + * @param service print service which supports 2D printing. * * @throws PrinterException if the specified service does not support * 2D printing. diff --git a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java index 54bf7dc2485..e4ebb4b9cd8 100644 --- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java +++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java @@ -59,7 +59,7 @@ import sun.misc.InnocuousThread; * GDIWindowSurfaceData. A background thread handles the swap chain flips. * * There are some restrictions to which windows we would use this for. - * @see #createScreenSurface() + * @see #createScreenSurface */ public class D3DScreenUpdateManager extends ScreenUpdateManager implements Runnable @@ -290,7 +290,7 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager /** * Adds a surface to the list of tracked surfaces. * - * @param d3dw the surface to be added + * @param sd the surface to be added */ private void trackScreenSurface(SurfaceData sd) { if (!done && sd instanceof D3DWindowSurfaceData) { diff --git a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java index ffab9092a5a..4ff6f4c54c5 100644 --- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java +++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java @@ -118,7 +118,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface { /** * To be used with getNativeResource() only. - * @see #getNativeResource() + * @see #getNativeResource */ public static final int D3D_DEVICE_RESOURCE= 100; /* diff --git a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java index a96d58fa73c..75b691c54a5 100644 --- a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java +++ b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java @@ -244,7 +244,7 @@ public abstract class WGLSurfaceData extends OGLSurfaceData { * Updates the layered window with the contents of the surface. * * @param psdops pointer to the native ogl sd structure - * @param pData pointer to the AwtWindow peer data + * @param peer pointer to the AwtWindow peer data * @param w width of the window * @param h height of the window * @see sun.awt.windows.TranslucentWindowPainter From 243208ab2e5296571c8494888443a22373d7de3a Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Mon, 25 May 2015 16:10:12 +0300 Subject: [PATCH 33/36] 8003399: JFileChooser gives wrong path to selected file when saving to Libraries folder on Windows 7 Reviewed-by: serb, ant --- .../sun/awt/shell/Win32ShellFolder2.java | 65 ++++- .../native/libawt/windows/ShellFolder2.cpp | 223 +++++++++++++++++- .../awt/FileDialog/8003399/bug8003399.java | 61 +++++ 3 files changed, 346 insertions(+), 3 deletions(-) create mode 100644 jdk/test/java/awt/FileDialog/8003399/bug8003399.java diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java index 5fd7c34cad5..bb645e1a3a0 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -163,6 +163,27 @@ final class Win32ShellFolder2 extends ShellFolder { } } + // Known Folder data + static class KnownFolderDefinition { + String guid; + int category; + String name; + String description; + String parent; + String relativePath; + String parsingName; + String tooltip; + String localizedName; + String icon; + String security; + long attributes; + int defenitionFlags; + String ftidType; + String path; + String saveLocation; + static final List libraries = getLibraries(); + } + static class FolderDisposer implements sun.java2d.DisposerRecord { /* * This is cached as a concession to getFolderType(), which needs @@ -578,7 +599,22 @@ final class Win32ShellFolder2 extends ShellFolder { return s; } } - return getDisplayNameOf(parentIShellFolder, relativePIDL, SHGDN_FORPARSING); + String path = getDisplayNameOf(parentIShellFolder, relativePIDL, + SHGDN_FORPARSING); + // if this is a library its default save location is taken as a path + // this is a temp fix until java.io starts support Libraries + if( path != null && path.startsWith("::{") && + path.toLowerCase().endsWith(".library-ms")) { + for (KnownFolderDefinition kf : KnownFolderDefinition.libraries) { + if( path.toLowerCase().endsWith( + kf.relativePath.toLowerCase()) && + path.toUpperCase().startsWith( + kf.parsingName.substring(0, 40).toUpperCase()) ) { + return kf.saveLocation; + } + } + } + return path; } // Needs to be accessible to Win32ShellFolderManager2 @@ -848,6 +884,9 @@ final class Win32ShellFolder2 extends ShellFolder { long relativePIDL, int attrs); + // Returns data of all Known Folders registered in the system + private static native KnownFolderDefinition[] loadKnownFolders(); + /** * @return The name used to display this shell folder */ @@ -1178,4 +1217,26 @@ final class Win32ShellFolder2 extends ShellFolder { return result == null ? 0 : result; } } + + // Extracts libraries and their default save locations from Known Folders list + private static List getLibraries() { + return invoke(new Callable>() { + @Override + public List call() throws Exception { + KnownFolderDefinition[] all = loadKnownFolders(); + List folders = new ArrayList<>(); + if (all != null) { + for (KnownFolderDefinition kf : all) { + if (kf.relativePath == null || kf.parsingName == null || + kf.saveLocation == null) { + continue; + } + folders.add(kf); + } + } + return folders; + } + }); + } + } diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp index cdc60d9ee9c..cd3918bd4eb 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -64,6 +64,16 @@ DEFINE_SHLGUID(IID_IExtractIconW, 0x000214FAL, 0, 0); //#include +#define DEFINE_FIELD_ID(var, cls, field, type) \ + jfieldID var = env->GetFieldID(cls, field, type); \ + DASSERT(var != NULL); \ + CHECK_NULL_RETURN(var, NULL); + +#define EXCEPTION_CHECK \ + if(env->ExceptionCheck()) { \ + throw std::bad_alloc(); \ + } + // Shell Functions typedef BOOL (WINAPI *DestroyIconType)(HICON); typedef HINSTANCE (WINAPI *FindExecutableType)(LPCTSTR,LPCTSTR,LPTSTR); @@ -1263,5 +1273,216 @@ JNIEXPORT jint JNICALL return 0; } +/* + * Class: sun_awt_shell_Win32ShellFolder2 + * Method: loadKnownFolders + * Signature: (V)[BLsun/awt/shell/Win32ShellFolder2$KnownfolderDefenition; + */ +JNIEXPORT jobjectArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_loadKnownFolders + (JNIEnv* env, jclass cls ) +{ + CoInitialize(NULL); + IKnownFolderManager* pkfm = NULL; + HRESULT hr = CoCreateInstance(CLSID_KnownFolderManager, NULL, + CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pkfm)); + if (!SUCCEEDED(hr)) return NULL; + + TRY; + + jclass cl = env->FindClass("sun/awt/shell/Win32ShellFolder2$KnownFolderDefinition"); + CHECK_NULL_RETURN(cl, NULL); + DEFINE_FIELD_ID(field_guid, cl, "guid", "Ljava/lang/String;") + DEFINE_FIELD_ID(field_name, cl, "name", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_description, cl, "description", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_parent, cl, "parent", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_relativePath, cl, "relativePath", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_parsingName, cl, "parsingName", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_tooltip, cl, "tooltip", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_localizedName, cl, "localizedName", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_icon, cl, "icon", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_security, cl, "security", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_path, cl, "path", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_saveLocation, cl, "saveLocation", "Ljava/lang/String;"); + DEFINE_FIELD_ID(field_category, cl, "category", "I"); + DEFINE_FIELD_ID(field_attributes, cl, "attributes", "J"); + DEFINE_FIELD_ID(field_defenitionFlags, cl, "defenitionFlags", "I"); + DEFINE_FIELD_ID(field_ftidType, cl, "ftidType", "Ljava/lang/String;"); + + jobjectArray result; + KNOWNFOLDERID* pFoldersIds = NULL; + UINT count = 0; + if (SUCCEEDED(pkfm->GetFolderIds(&pFoldersIds, &count))) { + jmethodID initMethod; + try { + result = env->NewObjectArray(count, cl, NULL); + initMethod = env->GetMethodID(cl, "", "()V"); + EXCEPTION_CHECK + } catch (std::bad_alloc&) { + CoTaskMemFree(pFoldersIds); + pkfm->Release(); + throw; + } + for(UINT i = 0; i < count; ++i) + { + jobject fld; + const KNOWNFOLDERID& folderId = pFoldersIds[i]; + LPOLESTR guid = NULL; + try { + fld = env->NewObject(cl, initMethod); + if (fld) { + env->SetObjectArrayElement(result, i, fld); + } + EXCEPTION_CHECK + + if (SUCCEEDED(StringFromCLSID(folderId, &guid))) { + jstring jstr = JNU_NewStringPlatform(env, guid); + if (jstr) { + env->SetObjectField(fld, field_guid, jstr); + } + CoTaskMemFree(guid); + EXCEPTION_CHECK + } + } catch (std::bad_alloc&) { + CoTaskMemFree(pFoldersIds); + pkfm->Release(); + throw; + } + + IKnownFolder* pFolder = NULL; + if (SUCCEEDED(pkfm->GetFolder(folderId, &pFolder))) { + KNOWNFOLDER_DEFINITION kfDef; + if (SUCCEEDED(pFolder->GetFolderDefinition(&kfDef))) + { + try { + jstring jstr = JNU_NewStringPlatform(env, kfDef.pszName); + if(jstr) { + env->SetObjectField(fld, field_name, jstr); + } + EXCEPTION_CHECK + if (kfDef.pszDescription) { + jstr = JNU_NewStringPlatform(env, kfDef.pszDescription); + if (jstr) { + env->SetObjectField(fld, field_description, jstr); + } + EXCEPTION_CHECK + } + EXCEPTION_CHECK + if (SUCCEEDED(StringFromCLSID(kfDef.fidParent, &guid))) { + jstr = JNU_NewStringPlatform(env, guid); + if (jstr) { + env->SetObjectField(fld, field_parent, jstr); + } + CoTaskMemFree(guid); + EXCEPTION_CHECK + } + if (kfDef.pszRelativePath) { + jstr = JNU_NewStringPlatform(env, kfDef.pszRelativePath); + if (jstr) { + env->SetObjectField(fld, field_relativePath, jstr); + } + EXCEPTION_CHECK + } + if (kfDef.pszParsingName) { + jstr = JNU_NewStringPlatform(env, kfDef.pszParsingName); + if (jstr) { + env->SetObjectField(fld, field_parsingName, jstr); + } + EXCEPTION_CHECK + } + if (kfDef.pszTooltip) { + jstr = JNU_NewStringPlatform(env, kfDef.pszTooltip); + if (jstr) { + env->SetObjectField(fld, field_tooltip, jstr); + } + EXCEPTION_CHECK + } + if (kfDef.pszLocalizedName) { + jstr = JNU_NewStringPlatform(env, kfDef.pszLocalizedName); + if (jstr) { + env->SetObjectField(fld, field_localizedName, jstr); + } + EXCEPTION_CHECK + } + if (kfDef.pszIcon) { + jstr = JNU_NewStringPlatform(env, kfDef.pszIcon); + if (jstr) { + env->SetObjectField(fld, field_icon, jstr); + } + EXCEPTION_CHECK + } + if (kfDef.pszSecurity) { + jstr = JNU_NewStringPlatform(env, kfDef.pszSecurity); + if (jstr) { + env->SetObjectField(fld, field_security, jstr); + } + EXCEPTION_CHECK + } + if (SUCCEEDED(StringFromCLSID(kfDef.ftidType, &guid))) { + jstr = JNU_NewStringPlatform(env, guid); + if (jstr) { + env->SetObjectField(fld, field_ftidType, jstr); + } + CoTaskMemFree(guid); + EXCEPTION_CHECK + } + env->SetIntField(fld, field_category, kfDef.category); + env->SetIntField(fld, field_defenitionFlags, kfDef.kfdFlags); + env->SetLongField(fld, field_attributes, kfDef.dwAttributes); + + LPWSTR folderPath = NULL; + if (SUCCEEDED(pFolder->GetPath(KF_FLAG_NO_ALIAS, &folderPath)) + && folderPath) { + jstr = JNU_NewStringPlatform(env, folderPath); + if (jstr) { + env->SetObjectField(fld, field_path, jstr); + } + CoTaskMemFree(folderPath); + EXCEPTION_CHECK + } + + IShellLibrary *plib = NULL; + hr = CoCreateInstance(CLSID_ShellLibrary, NULL, + CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&plib)); + if (SUCCEEDED(hr)) { + hr = plib->LoadLibraryFromKnownFolder(folderId, STGM_READWRITE); + if (SUCCEEDED(hr)) { + IShellItem *item = NULL; + hr = plib->GetDefaultSaveFolder(DSFT_DETECT, + IID_PPV_ARGS(&item)); + if (SUCCEEDED(hr) && item) { + LPWSTR loc = NULL; + hr = item->GetDisplayName(SIGDN_FILESYSPATH, &loc); + if (SUCCEEDED(hr) && loc) + { + jstr = JNU_NewStringPlatform(env, loc); + if (jstr) { + env->SetObjectField(fld, field_saveLocation, jstr); + } + CoTaskMemFree(loc); + } + item->Release(); + } + } + plib->Release(); + EXCEPTION_CHECK + } + FreeKnownFolderDefinitionFields(&kfDef); + } catch (std::bad_alloc&) { + FreeKnownFolderDefinitionFields(&kfDef); + pFolder->Release(); + CoTaskMemFree(pFoldersIds); + pkfm->Release(); + throw; + } + } + } + pFolder->Release(); + } + CoTaskMemFree(pFoldersIds); + } + pkfm->Release(); + return result; + CATCH_BAD_ALLOC_RET(NULL); +} } // extern "C" diff --git a/jdk/test/java/awt/FileDialog/8003399/bug8003399.java b/jdk/test/java/awt/FileDialog/8003399/bug8003399.java new file mode 100644 index 00000000000..1049fe573ff --- /dev/null +++ b/jdk/test/java/awt/FileDialog/8003399/bug8003399.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2015, 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 8003399 + @summary JFileChooser gives wrong path to selected file when saving to Libraries folder on Windows 7 + @author Semyon Sadetsky + @library /lib/testlibrary + @build jdk.testlibrary.OSInfo + @run main bug8003399 + */ + +import jdk.testlibrary.OSInfo; + +import javax.swing.filechooser.FileSystemView; +import java.io.File; + +public class bug8003399 { + + public static void main(String[] args) throws Exception { + if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS && + OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_VISTA) > 0 ) { + FileSystemView fsv = FileSystemView.getFileSystemView(); + for (File file : fsv.getFiles(fsv.getHomeDirectory(), false)) { + if(file.isDirectory()) { + for (File file1 : fsv.getFiles(file, false)) { + if(file1.isDirectory()) + { + String path = file1.getPath(); + if(path.startsWith("::{") && + path.toLowerCase().endsWith(".library-ms")) { + throw new RuntimeException("Unconverted library link found"); + } + } + } + } + } + } + System.out.println("ok"); + } +} From 3ef1c8d4c37ace132fbdff2afde4059a70cf573e Mon Sep 17 00:00:00 2001 From: Semyon Sadetsky Date: Tue, 26 May 2015 08:33:32 +0300 Subject: [PATCH 34/36] 8079640: GroupLayout incorrect layout with large JTextArea Reviewed-by: serb, alexsch, azvegint --- .../classes/javax/swing/GroupLayout.java | 7 +- .../swing/GroupLayout/8079640/bug8079640.java | 99 +++++++++++++++++++ 2 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/GroupLayout.java b/jdk/src/java.desktop/share/classes/javax/swing/GroupLayout.java index 9dc7a034e6d..b1012ce1a8c 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/GroupLayout.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/GroupLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2015, 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 @@ -218,6 +218,9 @@ public class GroupLayout implements LayoutManager2 { private static final int UNSET = Integer.MIN_VALUE; + // Maximum spring size constrain to avoid integer overflow + private static final int INFINITE = Integer.MAX_VALUE >> 1; + /** * Indicates the size from the component or gap should be used for a * particular range value. @@ -1389,7 +1392,7 @@ public class GroupLayout implements LayoutManager2 { } int constrain(int value) { - return Math.min(value, Short.MAX_VALUE); + return Math.min(value, INFINITE); } int getBaseline() { diff --git a/jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java b/jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java new file mode 100644 index 00000000000..c61949fdeef --- /dev/null +++ b/jdk/test/javax/swing/GroupLayout/8079640/bug8079640.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2015, 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 8079640 + @summary GroupLayout incorrect layout with large JTextArea + @author Semyon Sadetsky + */ + + +import javax.swing.*; +import java.awt.*; + +public class bug8079640 { + + private static JFrame frame; + private static JComponent comp2; + + public static void main(String[] args) throws Exception { + + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame = new JFrame("A Frame"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setUndecorated(true); + setup(frame); + frame.setVisible(true); + } + }); + + test(); + System.out.println("ok"); + + } finally { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + frame.dispose(); + } + }); + } + } + + private static void test() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + if(comp2.getLocation().getY() > frame.getHeight()) + throw new RuntimeException("GroupLayout fails: comp2 is out of the window"); + } + }); + } + + + static void setup(JFrame frame) { + JPanel panel = new JPanel(); + JComponent comp1 = new JLabel("Test Label 1"); + comp1.setMinimumSize(new Dimension(1000, 40000)); + comp1.setPreferredSize(new Dimension(1000, 40000)); + JScrollPane scroll = new JScrollPane(comp1); + comp2 = new JLabel("Test Label 2"); + GroupLayout layout = new GroupLayout(panel); + layout.setHorizontalGroup( + layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(scroll) + .addComponent(comp2)); + layout.setVerticalGroup( + layout.createSequentialGroup() + .addComponent(scroll) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(comp2)); + panel.setLayout(layout); + frame.getContentPane().add(panel, BorderLayout.CENTER); + frame.setSize(800, 600); + } + +} From 8d0ec77fc6cf6873936c7f3b9961e427f0a80e2a Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Tue, 26 May 2015 14:47:12 +0300 Subject: [PATCH 35/36] 8080628: No mnemonics on Open and Save buttons in JFileChooser Reviewed-by: serb, alexsch --- .../swing/plaf/gtk/resources/gtk.properties | 6 +- .../plaf/gtk/resources/gtk_de.properties | 6 +- .../plaf/gtk/resources/gtk_es.properties | 6 +- .../plaf/gtk/resources/gtk_fr.properties | 6 +- .../plaf/gtk/resources/gtk_it.properties | 6 +- .../plaf/gtk/resources/gtk_ja.properties | 6 +- .../plaf/gtk/resources/gtk_ko.properties | 6 +- .../plaf/gtk/resources/gtk_pt_BR.properties | 6 +- .../plaf/gtk/resources/gtk_sv.properties | 6 +- .../plaf/gtk/resources/gtk_zh_CN.properties | 6 +- .../plaf/gtk/resources/gtk_zh_TW.properties | 6 +- .../plaf/basic/resources/basic.properties | 6 +- .../plaf/basic/resources/basic_de.properties | 6 +- .../plaf/basic/resources/basic_es.properties | 6 +- .../plaf/basic/resources/basic_fr.properties | 6 +- .../plaf/basic/resources/basic_it.properties | 6 +- .../basic/resources/basic_pt_BR.properties | 6 +- .../plaf/basic/resources/basic_sv.properties | 6 +- .../plaf/metal/resources/metal.properties | 2 - .../plaf/metal/resources/metal_de.properties | 2 - .../plaf/metal/resources/metal_es.properties | 2 - .../plaf/metal/resources/metal_fr.properties | 2 - .../plaf/metal/resources/metal_it.properties | 2 - .../plaf/metal/resources/metal_ja.properties | 2 - .../plaf/metal/resources/metal_ko.properties | 2 - .../metal/resources/metal_pt_BR.properties | 2 - .../plaf/metal/resources/metal_sv.properties | 2 - .../metal/resources/metal_zh_CN.properties | 2 - .../metal/resources/metal_zh_TW.properties | 2 - .../JFileChooser/8080628/bug8080628.java | 100 ++++++++++++++++++ 30 files changed, 154 insertions(+), 76 deletions(-) create mode 100644 jdk/test/javax/swing/JFileChooser/8080628/bug8080628.java diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties index dc84d130187..ab5a2e4db4b 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory FileChooser.deleteFileButton.textAndMnemonic=De&lete File FileChooser.renameFileButton.textAndMnemonic=&Rename File -FileChooser.cancelButton.textAndMnemonic=&Cancel -FileChooser.saveButton.textAndMnemonic=&OK -FileChooser.openButton.textAndMnemonic=&OK +FileChooser.cancelButton.textAndMnemonic=Cancel +FileChooser.saveButton.textAndMnemonic=OK +FileChooser.openButton.textAndMnemonic=OK FileChooser.saveDialogTitle.textAndMnemonic=Save FileChooser.openDialogTitle.textAndMnemonic=Open FileChooser.pathLabel.textAndMnemonic=&Selection: diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties index a8985ce605f..1720c8e384a 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fehler FileChooser.newFolderNoDirectoryError.textAndMnemonic=Fehler beim Erstellen von Verzeichnis "{0}": Datei oder Verzeichnis nicht vorhanden FileChooser.deleteFileButton.textAndMnemonic=Datei &l\u00F6schen FileChooser.renameFileButton.textAndMnemonic=Datei &umbenennen -FileChooser.cancelButton.textAndMnemonic=&Abbrechen -FileChooser.saveButton.textAndMnemonic=&OK -FileChooser.openButton.textAndMnemonic=&OK +FileChooser.cancelButton.textAndMnemonic=Abbrechen +FileChooser.saveButton.textAndMnemonic=OK +FileChooser.openButton.textAndMnemonic=OK FileChooser.saveDialogTitle.textAndMnemonic=Speichern FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen FileChooser.pathLabel.textAndMnemonic=Aus&wahl: diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties index 412938e1a50..f5e90e19ce8 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error al crear el directorio "{0}": no existe dicho archivo o directorio FileChooser.deleteFileButton.textAndMnemonic=Su&primir Archivo FileChooser.renameFileButton.textAndMnemonic=Cambiar Nomb&re de Archivo -FileChooser.cancelButton.textAndMnemonic=&Cancelar -FileChooser.saveButton.textAndMnemonic=&Aceptar -FileChooser.openButton.textAndMnemonic=&Aceptar +FileChooser.cancelButton.textAndMnemonic=Cancelar +FileChooser.saveButton.textAndMnemonic=Aceptar +FileChooser.openButton.textAndMnemonic=Aceptar FileChooser.saveDialogTitle.textAndMnemonic=Guardar FileChooser.openDialogTitle.textAndMnemonic=Abrir FileChooser.pathLabel.textAndMnemonic=&Selecci\u00F3n: diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties index 380f3d4426b..b436568b846 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erreur FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erreur lors de la cr\u00E9ation du r\u00E9pertoire "{0}" : ce fichier ou r\u00E9pertoire n''existe pas FileChooser.deleteFileButton.textAndMnemonic=Supprimer &le fichier FileChooser.renameFileButton.textAndMnemonic=&Renommer le fichier -FileChooser.cancelButton.textAndMnemonic=&Annuler -FileChooser.saveButton.textAndMnemonic=&OK -FileChooser.openButton.textAndMnemonic=&OK +FileChooser.cancelButton.textAndMnemonic=Annuler +FileChooser.saveButton.textAndMnemonic=OK +FileChooser.openButton.textAndMnemonic=OK FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer FileChooser.openDialogTitle.textAndMnemonic=Ouvrir FileChooser.pathLabel.textAndMnemonic=&S\u00E9lection : diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties index c629de5dad8..7e955bf1bf9 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Errore FileChooser.newFolderNoDirectoryError.textAndMnemonic=Errore durante la creazione della directory "{0}": file o directory inesistente FileChooser.deleteFileButton.textAndMnemonic=E&limina file FileChooser.renameFileButton.textAndMnemonic=&Rinomina file -FileChooser.cancelButton.textAndMnemonic=&Annulla -FileChooser.saveButton.textAndMnemonic=&OK -FileChooser.openButton.textAndMnemonic=&OK +FileChooser.cancelButton.textAndMnemonic=Annulla +FileChooser.saveButton.textAndMnemonic=OK +FileChooser.openButton.textAndMnemonic=OK FileChooser.saveDialogTitle.textAndMnemonic=Salva FileChooser.openDialogTitle.textAndMnemonic=Apri FileChooser.pathLabel.textAndMnemonic=&Selezione: diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties index 5f4343ea679..479abec7b8d 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u30A8\u30E9\u30FC FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: \u3053\u306E\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u5B58\u5728\u3057\u307E\u305B\u3093 FileChooser.deleteFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u524A\u9664(&L) FileChooser.renameFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(&R) -FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C) -FileChooser.saveButton.textAndMnemonic=OK(&O) -FileChooser.openButton.textAndMnemonic=OK(&O) +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=OK +FileChooser.openButton.textAndMnemonic=OK FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58 FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F FileChooser.pathLabel.textAndMnemonic=\u9078\u629E(&S): diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties index c3696a95a88..a43a8be7062 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\uC624\uB958 FileChooser.newFolderNoDirectoryError.textAndMnemonic="{0}" \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. FileChooser.deleteFileButton.textAndMnemonic=\uD30C\uC77C \uC0AD\uC81C(&L) FileChooser.renameFileButton.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(&R) -FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C(&C) -FileChooser.saveButton.textAndMnemonic=\uD655\uC778(&O) -FileChooser.openButton.textAndMnemonic=\uD655\uC778(&O) +FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C +FileChooser.saveButton.textAndMnemonic=\uD655\uC778 +FileChooser.openButton.textAndMnemonic=\uD655\uC778 FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5 FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30 FileChooser.pathLabel.textAndMnemonic=\uC120\uD0DD \uC0AC\uD56D(&S): diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties index 383fd9f7d6e..c6c6649a011 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erro FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erro ao criar o diret\u00F3rio "{0}": N\u00E3o h\u00E1 arquivo ou diret\u00F3rio FileChooser.deleteFileButton.textAndMnemonic=De&letar Arquivo FileChooser.renameFileButton.textAndMnemonic=&Renomear Arquivo -FileChooser.cancelButton.textAndMnemonic=&Cancelar -FileChooser.saveButton.textAndMnemonic=&OK -FileChooser.openButton.textAndMnemonic=&OK +FileChooser.cancelButton.textAndMnemonic=Cancelar +FileChooser.saveButton.textAndMnemonic=OK +FileChooser.openButton.textAndMnemonic=OK FileChooser.saveDialogTitle.textAndMnemonic=Salvar FileChooser.openDialogTitle.textAndMnemonic=Abrir FileChooser.pathLabel.textAndMnemonic=&Sele\u00E7\u00E3o: diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties index 1737b5761bd..5149f9e9b6a 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fel FileChooser.newFolderNoDirectoryError.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att skapa katalogen "{0}": Filen eller katalogen finns inte FileChooser.deleteFileButton.textAndMnemonic=Ta &bort fil FileChooser.renameFileButton.textAndMnemonic=&\u00C4ndra namn p\u00E5 filen -FileChooser.cancelButton.textAndMnemonic=&Avbryt -FileChooser.saveButton.textAndMnemonic=&OK -FileChooser.openButton.textAndMnemonic=&OK +FileChooser.cancelButton.textAndMnemonic=Avbryt +FileChooser.saveButton.textAndMnemonic=OK +FileChooser.openButton.textAndMnemonic=OK FileChooser.saveDialogTitle.textAndMnemonic=Spara FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna FileChooser.pathLabel.textAndMnemonic=&Urval: diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties index 9e00fe1f99e..12ab10ec21e 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u9519\u8BEF FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u521B\u5EFA\u76EE\u5F55 "{0}" \u65F6\u51FA\u9519: \u6CA1\u6709\u6B64\u7C7B\u6587\u4EF6\u6216\u76EE\u5F55 FileChooser.deleteFileButton.textAndMnemonic=\u5220\u9664\u6587\u4EF6(&L) FileChooser.renameFileButton.textAndMnemonic=\u91CD\u547D\u540D\u6587\u4EF6(&R) -FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C) -FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A(&O) -FileChooser.openButton.textAndMnemonic=\u786E\u5B9A(&O) +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A +FileChooser.openButton.textAndMnemonic=\u786E\u5B9A FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58 FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00 FileChooser.pathLabel.textAndMnemonic=\u9009\u5B9A\u5185\u5BB9(&S): diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties index 9ee492a4b73..807b0d31cc0 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties @@ -34,9 +34,9 @@ FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u932F\u8AA4 FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u5EFA\u7ACB\u76EE\u9304 "{0}" \u6642\u767C\u751F\u932F\u8AA4: \u6C92\u6709\u6B64\u6A94\u6848\u6216\u76EE\u9304 FileChooser.deleteFileButton.textAndMnemonic=\u522A\u9664\u6A94\u6848(&L) FileChooser.renameFileButton.textAndMnemonic=\u91CD\u65B0\u547D\u540D\u6A94\u6848(&R) -FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C) -FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A(&O) -FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A(&O) +FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88 +FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A +FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58 FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F FileChooser.pathLabel.textAndMnemonic=\u9078\u53D6(&S): diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties index 4a8d160c02c..01b5218a884 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties @@ -43,13 +43,13 @@ FileChooser.renameErrorFileExists.textAndMnemonic=Cannot rename {0}: A file with Specify a different file name. FileChooser.acceptAllFileFilter.textAndMnemonic=All Files FileChooser.cancelButton.textAndMnemonic=Cancel -FileChooser.saveButton.textAndMnemonic=&Save -FileChooser.openButton.textAndMnemonic=&Open +FileChooser.saveButton.textAndMnemonic=Save +FileChooser.openButton.textAndMnemonic=Open FileChooser.saveDialogTitle.textAndMnemonic=Save FileChooser.openDialogTitle.textAndMnemonic=Open FileChooser.updateButton.textAndMnemonic=&Update FileChooser.helpButton.textAndMnemonic=&Help -FileChooser.directoryOpenButton.textAndMnemonic=&Open +FileChooser.directoryOpenButton.textAndMnemonic=Open # File Size Units FileChooser.fileSizeKiloBytes={0} KB diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties index 5f3d8e2494c..bd8ad6d6af6 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties @@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic={0} kann nicht umbenannt werden FileChooser.renameErrorFileExists.textAndMnemonic={0} kann nicht umbenannt werden: Es ist bereits eine Datei mit dem angegebenen Namen vorhanden. Geben Sie einen anderen Dateinamen an. FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien FileChooser.cancelButton.textAndMnemonic=Abbrechen -FileChooser.saveButton.textAndMnemonic=&Speichern -FileChooser.openButton.textAndMnemonic=\u00D6&ffnen +FileChooser.saveButton.textAndMnemonic=Speichern +FileChooser.openButton.textAndMnemonic=\u00D6ffnen FileChooser.saveDialogTitle.textAndMnemonic=Speichern FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen FileChooser.updateButton.textAndMnemonic=A&ktualisieren FileChooser.helpButton.textAndMnemonic=&Hilfe -FileChooser.directoryOpenButton.textAndMnemonic=\u00D6&ffnen +FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ffnen # File Size Units FileChooser.fileSizeKiloBytes={0} KB diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties index 485ed06aeff..71d145cfbcf 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties @@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=No se puede cambiar el nombre de {0} FileChooser.renameErrorFileExists.textAndMnemonic=No se puede cambiar el nombre de {0}: ya existe un archivo con el nombre especificado. Especifique otro nombre de archivo. FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos FileChooser.cancelButton.textAndMnemonic=Cancelar -FileChooser.saveButton.textAndMnemonic=&Guardar -FileChooser.openButton.textAndMnemonic=&Abrir +FileChooser.saveButton.textAndMnemonic=Guardar +FileChooser.openButton.textAndMnemonic=Abrir FileChooser.saveDialogTitle.textAndMnemonic=Guardar FileChooser.openDialogTitle.textAndMnemonic=Abrir FileChooser.updateButton.textAndMnemonic=Act&ualizar FileChooser.helpButton.textAndMnemonic=A&yuda -FileChooser.directoryOpenButton.textAndMnemonic=&Abrir +FileChooser.directoryOpenButton.textAndMnemonic=Abrir # File Size Units FileChooser.fileSizeKiloBytes={0} KB diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties index ac89a2258be..3ee5668e23a 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties @@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=Impossible de renommer {0} FileChooser.renameErrorFileExists.textAndMnemonic=Impossible de renommer {0} : il existe d\u00E9j\u00E0 un fichier portant le nom indiqu\u00E9. Indiquez-en un autre. FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers FileChooser.cancelButton.textAndMnemonic=Annuler -FileChooser.saveButton.textAndMnemonic=Enregi&strer -FileChooser.openButton.textAndMnemonic=&Ouvrir +FileChooser.saveButton.textAndMnemonic=Enregistrer +FileChooser.openButton.textAndMnemonic=Ouvrir FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer FileChooser.openDialogTitle.textAndMnemonic=Ouvrir FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jo&ur FileChooser.helpButton.textAndMnemonic=&Aide -FileChooser.directoryOpenButton.textAndMnemonic=&Ouvrir +FileChooser.directoryOpenButton.textAndMnemonic=Ouvrir # File Size Units FileChooser.fileSizeKiloBytes={0} KB diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties index c86d214cc9c..7844f11f719 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties @@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=Impossibile rinominare {0} FileChooser.renameErrorFileExists.textAndMnemonic=Impossibile rinominare {0}: esiste gi\u00E0 un file con il nome specificato. Specificare un altro nome. FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file FileChooser.cancelButton.textAndMnemonic=Annulla -FileChooser.saveButton.textAndMnemonic=Sal&va -FileChooser.openButton.textAndMnemonic=&Apri +FileChooser.saveButton.textAndMnemonic=Salva +FileChooser.openButton.textAndMnemonic=Apri FileChooser.saveDialogTitle.textAndMnemonic=Salva FileChooser.openDialogTitle.textAndMnemonic=Apri FileChooser.updateButton.textAndMnemonic=Ag&giorna FileChooser.helpButton.textAndMnemonic=&? -FileChooser.directoryOpenButton.textAndMnemonic=&Apri +FileChooser.directoryOpenButton.textAndMnemonic=Apri # File Size Units FileChooser.fileSizeKiloBytes={0} KB diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties index 5c5ad20f963..f29f4ec5c05 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties @@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=N\u00E3o \u00E9 poss\u00EDvel renomear { FileChooser.renameErrorFileExists.textAndMnemonic=N\u00E3o \u00E9 poss\u00EDvel renomear {0}: Um arquivo com o nome especificado j\u00E1 existe. Especifique outro nome de arquivo. FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos FileChooser.cancelButton.textAndMnemonic=Cancelar -FileChooser.saveButton.textAndMnemonic=&Salvar -FileChooser.openButton.textAndMnemonic=A&brir +FileChooser.saveButton.textAndMnemonic=Salvar +FileChooser.openButton.textAndMnemonic=Abrir FileChooser.saveDialogTitle.textAndMnemonic=Salvar FileChooser.openDialogTitle.textAndMnemonic=Abrir FileChooser.updateButton.textAndMnemonic=At&ualizar FileChooser.helpButton.textAndMnemonic=Aj&uda -FileChooser.directoryOpenButton.textAndMnemonic=A&brir +FileChooser.directoryOpenButton.textAndMnemonic=Abrir # File Size Units FileChooser.fileSizeKiloBytes={0} KB diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties index 825a0257e96..8c8a501a294 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties @@ -42,13 +42,13 @@ FileChooser.renameError.textAndMnemonic=Kan inte namn\u00E4ndra {0} FileChooser.renameErrorFileExists.textAndMnemonic=Kan inte namn\u00E4ndra {0}: En fil med angivet namn finns redan. Ange ett annat filnamn. FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer FileChooser.cancelButton.textAndMnemonic=Avbryt -FileChooser.saveButton.textAndMnemonic=&Spara -FileChooser.openButton.textAndMnemonic=&\u00D6ppna +FileChooser.saveButton.textAndMnemonic=Spara +FileChooser.openButton.textAndMnemonic=\u00D6ppna FileChooser.saveDialogTitle.textAndMnemonic=Spara FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna FileChooser.updateButton.textAndMnemonic=Upp&datera FileChooser.helpButton.textAndMnemonic=&Hj\u00E4lp -FileChooser.directoryOpenButton.textAndMnemonic=&\u00D6ppna +FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ppna # File Size Units FileChooser.fileSizeKiloBytes={0} KB diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal.properties index 431d7124fac..cd35fd8bd1b 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Size FileChooser.fileTypeHeader.textAndMnemonic=Type FileChooser.fileDateHeader.textAndMnemonic=Modified FileChooser.fileAttrHeader.textAndMnemonic=Attributes -FileChooser.saveButton.textAndMnemonic=Save -FileChooser.openButton.textAndMnemonic=Open ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=&Restore diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties index 48315d3553b..af23756487f 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe FileChooser.fileTypeHeader.textAndMnemonic=Typ FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert FileChooser.fileAttrHeader.textAndMnemonic=Attribute -FileChooser.saveButton.textAndMnemonic=Speichern -FileChooser.openButton.textAndMnemonic=\u00D6ffnen ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=&Wiederherstellen diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties index 72ec82e2efa..09df76e76b7 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o FileChooser.fileTypeHeader.textAndMnemonic=Tipo FileChooser.fileDateHeader.textAndMnemonic=Modificado FileChooser.fileAttrHeader.textAndMnemonic=Atributos -FileChooser.saveButton.textAndMnemonic=Guardar -FileChooser.openButton.textAndMnemonic=Abrir ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=&Restaurar diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties index 05a1c7016b5..9dd46c0dec7 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Taille FileChooser.fileTypeHeader.textAndMnemonic=Type FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9 FileChooser.fileAttrHeader.textAndMnemonic=Attributs -FileChooser.saveButton.textAndMnemonic=Enregistrer -FileChooser.openButton.textAndMnemonic=Ouvrir ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=&Restaurer diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties index 61946214225..9b3e47142ef 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni FileChooser.fileTypeHeader.textAndMnemonic=Tipo FileChooser.fileDateHeader.textAndMnemonic=Modificato FileChooser.fileAttrHeader.textAndMnemonic=Attributi -FileChooser.saveButton.textAndMnemonic=Salva -FileChooser.openButton.textAndMnemonic=Apri ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=&Ripristina diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties index 8a8fef8b7ee..4aa9ebda3c3 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7 FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5 FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027 -FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58 -FileChooser.openButton.textAndMnemonic=\u958B\u304F ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=\u5FA9\u5143(&R) diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties index 264976c8974..f01b47d1ab7 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30 FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615 FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131 -FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5 -FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30 ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=\uBCF5\uC6D0(&R) diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties index 79c45cb338b..2edccf06dbf 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Tamanho FileChooser.fileTypeHeader.textAndMnemonic=Tipo FileChooser.fileDateHeader.textAndMnemonic=Modificado FileChooser.fileAttrHeader.textAndMnemonic=Atributos -FileChooser.saveButton.textAndMnemonic=Salvar -FileChooser.openButton.textAndMnemonic=Abrir ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=&Restaurar diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties index 1b9b7e217c7..08e642cda2a 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=Storlek FileChooser.fileTypeHeader.textAndMnemonic=Typ FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad FileChooser.fileAttrHeader.textAndMnemonic=Attribut -FileChooser.saveButton.textAndMnemonic=Spara -FileChooser.openButton.textAndMnemonic=\u00D6ppna ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=&\u00C5terst\u00E4ll diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties index 2d6cf13f3fa..d1bda4d699d 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027 -FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58 -FileChooser.openButton.textAndMnemonic=\u6253\u5F00 ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=\u8FD8\u539F(&R) diff --git a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties index 1d2b826d95b..45045af4813 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties +++ b/jdk/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties @@ -43,8 +43,6 @@ FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027 -FileChooser.saveButton.textAndMnemonic=\u5132\u5B58 -FileChooser.openButton.textAndMnemonic=\u958B\u555F ############ Used by MetalTitlePane if rendering window decorations############ MetalTitlePane.restore.titleAndMnemonic=\u56DE\u5FA9(&R) diff --git a/jdk/test/javax/swing/JFileChooser/8080628/bug8080628.java b/jdk/test/javax/swing/JFileChooser/8080628/bug8080628.java new file mode 100644 index 00000000000..fc72ef2fc96 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/8080628/bug8080628.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2015, 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 java.util.Locale; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UIManager.LookAndFeelInfo; + +import sun.swing.SwingUtilities2; + +/* + * @test + * @bug 8080628 + * @summary No mnemonics on Open and Save buttons in JFileChooser. + * @author Alexey Ivanov + * @run main bug8080628 + */ +public class bug8080628 { + public static final String[] MNEMONIC_KEYS = new String[] { + "FileChooser.saveButtonMnemonic", + "FileChooser.openButtonMnemonic", + "FileChooser.cancelButtonMnemonic", + "FileChooser.directoryOpenButtonMnemonic" + }; + + public static final Locale[] LOCALES = new Locale[] { + new Locale("en"), + new Locale("de"), + new Locale("es"), + new Locale("fr"), + new Locale("it"), + new Locale("ja"), + new Locale("ko"), + new Locale("pt", "BR"), + new Locale("sv"), + new Locale("zh", "CN"), + new Locale("zh", "TW") + }; + + private static volatile Exception exception; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + runTest(); + } + }); + + if (exception != null) { + throw exception; + } + } + + private static void runTest() { + try { + LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); + for (LookAndFeelInfo info : lafInfo) { + UIManager.setLookAndFeel(info.getClassName()); + + for (Locale locale : LOCALES) { + for (String key : MNEMONIC_KEYS) { + int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale); + if (mnemonic != 0) { + throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " + + "for '" + key + "' " + + "in locale '" + locale + "' " + + "in Look-and-Feel '" + + UIManager.getLookAndFeel().getClass().getName() + "'"); + } + } + } + } + System.out.println("Test passed"); + } catch (Exception e) { + exception = e; + } + } + +} From 6fe284e4018b2586f60876ca4f9452e52db44ae7 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 26 May 2015 15:06:42 -0700 Subject: [PATCH 36/36] 8081231: JDK9 client build broken on Windows Reviewed-by: azvegint --- .../windows/native/libawt/windows/ShellFolder2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp index cd3918bd4eb..0f5a0e8d942 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp @@ -64,6 +64,9 @@ DEFINE_SHLGUID(IID_IExtractIconW, 0x000214FAL, 0, 0); //#include +#ifndef DASSERT +#define DASSERT(x) +#endif #define DEFINE_FIELD_ID(var, cls, field, type) \ jfieldID var = env->GetFieldID(cls, field, type); \ DASSERT(var != NULL); \