--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonBorder.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonBorder.java Thu Mar 16 09:51:15 2017 -0700
@@ -37,7 +37,7 @@
import com.apple.laf.AquaUtils.*;
public abstract class AquaButtonBorder extends AquaBorder implements Border, UIResource {
- public static final RecyclableSingleton<Dynamic> fDynamic = new RecyclableSingletonFromDefaultConstructor<Dynamic>(Dynamic.class);
+ private static final RecyclableSingleton<Dynamic> fDynamic = new RecyclableSingletonFromDefaultConstructor<Dynamic>(Dynamic.class);
public static AquaButtonBorder getDynamicButtonBorder() {
return fDynamic.get();
}
@@ -47,12 +47,12 @@
return fToggle.get();
}
- public static final RecyclableSingleton<Toolbar> fToolBar = new RecyclableSingletonFromDefaultConstructor<Toolbar>(Toolbar.class);
+ private static final RecyclableSingleton<Toolbar> fToolBar = new RecyclableSingletonFromDefaultConstructor<Toolbar>(Toolbar.class);
public static Border getToolBarButtonBorder() {
return fToolBar.get();
}
- public static final RecyclableSingleton<Named> fBevel = new RecyclableSingleton<Named>() {
+ private static final RecyclableSingleton<Named> fBevel = new RecyclableSingleton<Named>() {
protected Named getInstance() {
return new Named(Widget.BUTTON_BEVEL, new SizeDescriptor(new SizeVariant().alterMargins(2, 4, 2, 4)));
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonCheckBoxUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonCheckBoxUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -34,8 +34,8 @@
import com.apple.laf.AquaUtils.*;
public class AquaButtonCheckBoxUI extends AquaButtonLabeledUI {
- protected static final RecyclableSingleton<AquaButtonCheckBoxUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaButtonCheckBoxUI>(AquaButtonCheckBoxUI.class);
- protected static final RecyclableSingleton<ImageIcon> sizingIcon = new RecyclableSingleton<ImageIcon>() {
+ private static final RecyclableSingleton<AquaButtonCheckBoxUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaButtonCheckBoxUI>(AquaButtonCheckBoxUI.class);
+ private static final RecyclableSingleton<ImageIcon> sizingIcon = new RecyclableSingleton<ImageIcon>() {
protected ImageIcon getInstance() {
return new ImageIcon(AquaNativeResources.getRadioButtonSizerImage());
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java Thu Mar 16 09:51:15 2017 -0700
@@ -138,7 +138,7 @@
return typeDefinitions.get().get(name);
}
- protected static final RecyclableSingleton<Map<String, TypeSpecifier>> typeDefinitions = new RecyclableSingleton<Map<String, TypeSpecifier>>() {
+ private static final RecyclableSingleton<Map<String, TypeSpecifier>> typeDefinitions = new RecyclableSingleton<Map<String, TypeSpecifier>>() {
protected Map<String, TypeSpecifier> getInstance() {
return getAllTypes();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonLabeledUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -42,9 +42,9 @@
import com.apple.laf.AquaUtils.RecyclableSingleton;
public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements Sizeable {
- protected static RecyclableSizingIcon regularIcon = new RecyclableSizingIcon(18);
- protected static RecyclableSizingIcon smallIcon = new RecyclableSizingIcon(16);
- protected static RecyclableSizingIcon miniIcon = new RecyclableSizingIcon(14);
+ private static final RecyclableSizingIcon regularIcon = new RecyclableSizingIcon(18);
+ private static final RecyclableSizingIcon smallIcon = new RecyclableSizingIcon(16);
+ private static final RecyclableSizingIcon miniIcon = new RecyclableSizingIcon(14);
protected static class RecyclableSizingIcon extends RecyclableSingleton<Icon> {
final int iconSize;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonRadioUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonRadioUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -34,8 +34,8 @@
import com.apple.laf.AquaUtils.*;
public class AquaButtonRadioUI extends AquaButtonLabeledUI {
- protected static final RecyclableSingleton<AquaButtonRadioUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaButtonRadioUI>(AquaButtonRadioUI.class);
- protected static final RecyclableSingleton<ImageIcon> sizingIcon = new RecyclableSingleton<ImageIcon>() {
+ private static final RecyclableSingleton<AquaButtonRadioUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaButtonRadioUI>(AquaButtonRadioUI.class);
+ private static final RecyclableSingleton<ImageIcon> sizingIcon = new RecyclableSingleton<ImageIcon>() {
protected ImageIcon getInstance() {
return new ImageIcon(AquaNativeResources.getRadioButtonSizerImage());
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonToggleUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonToggleUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -32,7 +32,7 @@
public class AquaButtonToggleUI extends AquaButtonUI {
// Create PLAF
- static final RecyclableSingleton<AquaButtonToggleUI> aquaToggleButtonUI = new RecyclableSingletonFromDefaultConstructor<AquaButtonToggleUI>(AquaButtonToggleUI.class);
+ private static final RecyclableSingleton<AquaButtonToggleUI> aquaToggleButtonUI = new RecyclableSingletonFromDefaultConstructor<AquaButtonToggleUI>(AquaButtonToggleUI.class);
public static ComponentUI createUI(final JComponent b) {
return aquaToggleButtonUI.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -48,7 +48,7 @@
private static final String BUTTON_TYPE = "JButton.buttonType";
private static final String SEGMENTED_BUTTON_POSITION = "JButton.segmentPosition";
- protected static final RecyclableSingleton<AquaButtonUI> buttonUI = new RecyclableSingletonFromDefaultConstructor<AquaButtonUI>(AquaButtonUI.class);
+ private static final RecyclableSingleton<AquaButtonUI> buttonUI = new RecyclableSingletonFromDefaultConstructor<AquaButtonUI>(AquaButtonUI.class);
public static ComponentUI createUI(final JComponent c) {
return buttonUI.get();
}
@@ -462,7 +462,7 @@
return d;
}
- static final RecyclableSingleton<AquaHierarchyButtonListener> fHierListener = new RecyclableSingletonFromDefaultConstructor<AquaHierarchyButtonListener>(AquaHierarchyButtonListener.class);
+ private static final RecyclableSingleton<AquaHierarchyButtonListener> fHierListener = new RecyclableSingletonFromDefaultConstructor<AquaHierarchyButtonListener>(AquaHierarchyButtonListener.class);
static AquaHierarchyButtonListener getAquaHierarchyButtonListener() {
return fHierListener.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Thu Mar 16 09:51:15 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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
@@ -25,18 +25,29 @@
package com.apple.laf;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
import java.awt.Insets;
+import java.awt.Point;
import java.awt.Rectangle;
-import java.awt.event.*;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
-import javax.swing.*;
+import javax.swing.Box;
+import javax.swing.JComboBox;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicComboPopup;
import sun.lwawt.macosx.CPlatformWindow;
@SuppressWarnings("serial") // Superclass is not serializable across versions
-class AquaComboBoxPopup extends BasicComboPopup {
+final class AquaComboBoxPopup extends BasicComboPopup {
static final int FOCUS_RING_PAD_LEFT = 6;
static final int FOCUS_RING_PAD_RIGHT = 6;
static final int FOCUS_RING_PAD_BOTTOM = 5;
@@ -201,9 +212,6 @@
//System.err.println("GetBestScreenBounds p: "+ p.x + ", " + p.y);
final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice[] gs = ge.getScreenDevices();
- //System.err.println(" gs.length = " + gs.length);
- final Rectangle comboBoxBounds = comboBox.getBounds();
-
for (final GraphicsDevice gd : gs) {
final GraphicsConfiguration[] gc = gd.getConfigurations();
for (final GraphicsConfiguration element0 : gc) {
@@ -215,15 +223,14 @@
}
// Hmm. Origin's off screen, but is any part on?
+ final Rectangle comboBoxBounds = comboBox.getBounds();
comboBoxBounds.setLocation(p);
for (final GraphicsDevice gd : gs) {
final GraphicsConfiguration[] gc = gd.getConfigurations();
for (final GraphicsConfiguration element0 : gc) {
final Rectangle gcBounds = element0.getBounds();
if (gcBounds.intersects(comboBoxBounds)) {
- if (gcBounds.contains(p)) {
- return getAvailableScreenArea(gcBounds, element0);
- }
+ return getAvailableScreenArea(gcBounds, element0);
}
}
}
@@ -234,8 +241,15 @@
private Rectangle getAvailableScreenArea(Rectangle bounds,
GraphicsConfiguration gc) {
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
- return new Rectangle(0, insets.top, bounds.width,
- bounds.height - insets.top);
+ return new Rectangle(bounds.x + insets.left, bounds.y + insets.top,
+ bounds.width - insets.left - insets.right,
+ bounds.height - insets.top - insets.bottom);
+ }
+
+ private int getComboBoxEdge(int py, boolean bottom) {
+ int offset = bottom ? 9 : -9;
+ // if py is less than new y we have a clipped combo, so leave it alone.
+ return Math.min((py / 2) + offset, py);
}
@Override
@@ -246,7 +260,7 @@
if (isPopdown && !isTableCellEditor) {
// place the popup just below the button, which is
// near the center of a large combo box
- py = Math.min((py / 2) + 9, py); // if py is less than new y we have a clipped combo, so leave it alone.
+ py = getComboBoxEdge(py, true);
}
// px & py are relative to the combo box
@@ -291,8 +305,12 @@
// Make sure it's all on the screen - shift it by the amount it's off
p.x += px;
p.y += py; // Screen location of px & py
- if (p.x < scrBounds.x) px -= (p.x + scrBounds.x);
- if (p.y < scrBounds.y) py -= (p.y + scrBounds.y);
+ if (p.x < scrBounds.x) {
+ px = px + (scrBounds.x - p.x);
+ }
+ if (p.y < scrBounds.y) {
+ py = py + (scrBounds.y - p.y);
+ }
final Point top = new Point(0, 0);
SwingUtilities.convertPointFromScreen(top, comboBox);
@@ -324,22 +342,27 @@
}
final Rectangle r = new Rectangle(px, py, pw, ph);
- 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);
- }
+ if (r.y + r.height < top.y + scrBounds.y + scrBounds.height) {
+ return r;
+ }
+ // Check whether it goes below the bottom of the screen, if so flip it
+ int newY = getComboBoxEdge(comboBoxBounds.height, false) - ph - comboBoxInsets.top;
+ if (newY > top.y + scrBounds.y) {
+ return new Rectangle(px, newY, r.width, r.height);
+ } else {
+ // There are no place at top, move popup to the center of the screen
+ r.y = top.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
// We want it positioned so the selected item is right above the combo box
- protected Rectangle computePopupBoundsForMenu(final int px, final int py, final int pw, final int ph, final int itemCount, final Rectangle scrBounds) {
+ protected Rectangle computePopupBoundsForMenu(final int px, final int py,
+ final int pw, final int ph,
+ final int itemCount,
+ final Rectangle scrBounds) {
//System.err.println("computePopupBoundsForMenu: " + px + "," + py + " " + pw + "," + ph);
//System.err.println("itemCount: " +itemCount +" src: "+ scrBounds);
int elementSize = 0; //kDefaultItemSize;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -594,7 +594,7 @@
}
@SuppressWarnings("unchecked")
- static final RecyclableSingleton<ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>> APPLICATOR = new
+ private static final RecyclableSingleton<ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>> APPLICATOR = new
RecyclableSingleton<ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>>() {
@Override
protected ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI> getInstance() {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileView.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileView.java Thu Mar 16 09:51:15 2017 -0700
@@ -75,7 +75,7 @@
private static native int getNativeLSInfo(final byte[] pathBytes, final boolean isDirectory);
private static native String getNativePathForResolvedAlias(final byte[] absolutePath, final boolean isDirectory);
- static final RecyclableSingleton<String> machineName = new RecyclableSingleton<String>() {
+ private static final RecyclableSingleton<String> machineName = new RecyclableSingleton<String>() {
@Override
protected String getInstance() {
return getNativeMachineName();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaGroupBorder.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaGroupBorder.java Thu Mar 16 09:51:15 2017 -0700
@@ -35,17 +35,17 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public abstract class AquaGroupBorder extends AquaBorder {
- static final RecyclableSingletonFromDefaultConstructor<? extends Border> tabbedPaneGroupBorder = new RecyclableSingletonFromDefaultConstructor<TabbedPane>(TabbedPane.class);
+ private static final RecyclableSingletonFromDefaultConstructor<? extends Border> tabbedPaneGroupBorder = new RecyclableSingletonFromDefaultConstructor<TabbedPane>(TabbedPane.class);
public static Border getTabbedPaneGroupBorder() {
return tabbedPaneGroupBorder.get();
}
- static final RecyclableSingletonFromDefaultConstructor<? extends Border> titleBorderGroupBorder = new RecyclableSingletonFromDefaultConstructor<Titled>(Titled.class);
+ private static final RecyclableSingletonFromDefaultConstructor<? extends Border> titleBorderGroupBorder = new RecyclableSingletonFromDefaultConstructor<Titled>(Titled.class);
public static Border getBorderForTitledBorder() {
return titleBorderGroupBorder.get();
}
- static final RecyclableSingletonFromDefaultConstructor<? extends Border> titlelessGroupBorder = new RecyclableSingletonFromDefaultConstructor<Titleless>(Titleless.class);
+ private static final RecyclableSingletonFromDefaultConstructor<? extends Border> titlelessGroupBorder = new RecyclableSingletonFromDefaultConstructor<Titleless>(Titleless.class);
public static Border getTitlelessBorder() {
return titlelessGroupBorder.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaHighlighter.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaHighlighter.java Thu Mar 16 09:51:15 2017 -0700
@@ -37,7 +37,7 @@
import com.apple.laf.AquaUtils.RecyclableSingleton;
public class AquaHighlighter extends DefaultHighlighter implements UIResource {
- static final RecyclableSingleton<LayerPainter> instance = new RecyclableSingleton<LayerPainter>() {
+ private static final RecyclableSingleton<LayerPainter> instance = new RecyclableSingleton<LayerPainter>() {
protected LayerPainter getInstance() {
return new AquaHighlightPainter(null);
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java Thu Mar 16 09:51:15 2017 -0700
@@ -240,14 +240,14 @@
}
}
- protected static final NamedImageSingleton northArrow = new NamedImageSingleton("NSMenuScrollUp");
- protected static final IconUIResourceSingleton northArrowIcon = new IconUIResourceSingleton(northArrow);
- protected static final NamedImageSingleton southArrow = new NamedImageSingleton("NSMenuScrollDown");
- protected static final IconUIResourceSingleton southArrowIcon = new IconUIResourceSingleton(southArrow);
- protected static final NamedImageSingleton westArrow = new NamedImageSingleton("NSMenuSubmenuLeft");
- protected static final IconUIResourceSingleton westArrowIcon = new IconUIResourceSingleton(westArrow);
- protected static final NamedImageSingleton eastArrow = new NamedImageSingleton("NSMenuSubmenu");
- protected static final IconUIResourceSingleton eastArrowIcon = new IconUIResourceSingleton(eastArrow);
+ private static final NamedImageSingleton northArrow = new NamedImageSingleton("NSMenuScrollUp");
+ private static final IconUIResourceSingleton northArrowIcon = new IconUIResourceSingleton(northArrow);
+ private static final NamedImageSingleton southArrow = new NamedImageSingleton("NSMenuScrollDown");
+ private static final IconUIResourceSingleton southArrowIcon = new IconUIResourceSingleton(southArrow);
+ private static final NamedImageSingleton westArrow = new NamedImageSingleton("NSMenuSubmenuLeft");
+ private static final IconUIResourceSingleton westArrowIcon = new IconUIResourceSingleton(westArrow);
+ private static final NamedImageSingleton eastArrow = new NamedImageSingleton("NSMenuSubmenu");
+ private static final IconUIResourceSingleton eastArrowIcon = new IconUIResourceSingleton(eastArrow);
static Image getArrowImageForDirection(final int direction) {
switch(direction) {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java Thu Mar 16 09:51:15 2017 -0700
@@ -55,7 +55,7 @@
private static final int kContentTester = 100; // For getting region insets
- static final RecyclableSingleton<AquaInternalFrameBorder> documentWindowFrame = new RecyclableSingleton<AquaInternalFrameBorder>() {
+ private static final RecyclableSingleton<AquaInternalFrameBorder> documentWindowFrame = new RecyclableSingleton<AquaInternalFrameBorder>() {
protected AquaInternalFrameBorder getInstance() {
return new AquaInternalFrameBorder(WindowType.DOCUMENT);
}
@@ -64,7 +64,7 @@
return documentWindowFrame.get();
}
- static final RecyclableSingleton<AquaInternalFrameBorder> utilityWindowFrame = new RecyclableSingleton<AquaInternalFrameBorder>() {
+ private static final RecyclableSingleton<AquaInternalFrameBorder> utilityWindowFrame = new RecyclableSingleton<AquaInternalFrameBorder>() {
protected AquaInternalFrameBorder getInstance() {
return new AquaInternalFrameBorder(WindowType.UTILITY);
}
@@ -73,7 +73,7 @@
return utilityWindowFrame.get();
}
- static final RecyclableSingleton<AquaInternalFrameBorder> dialogWindowFrame = new RecyclableSingleton<AquaInternalFrameBorder>() {
+ private static final RecyclableSingleton<AquaInternalFrameBorder> dialogWindowFrame = new RecyclableSingleton<AquaInternalFrameBorder>() {
protected AquaInternalFrameBorder getInstance() {
return new AquaInternalFrameBorder(WindowType.DOCUMENT);
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -147,7 +147,7 @@
southPane = c;
}
- static final RecyclableSingleton<Icon> closeIcon = new RecyclableSingleton<Icon>() {
+ private static final RecyclableSingleton<Icon> closeIcon = new RecyclableSingleton<Icon>() {
@Override
protected Icon getInstance() {
return new AquaInternalFrameButtonIcon(Widget.TITLE_BAR_CLOSE_BOX);
@@ -157,7 +157,7 @@
return closeIcon.get();
}
- static final RecyclableSingleton<Icon> minimizeIcon = new RecyclableSingleton<Icon>() {
+ private static final RecyclableSingleton<Icon> minimizeIcon = new RecyclableSingleton<Icon>() {
@Override
protected Icon getInstance() {
return new AquaInternalFrameButtonIcon(Widget.TITLE_BAR_COLLAPSE_BOX);
@@ -167,7 +167,7 @@
return minimizeIcon.get();
}
- static final RecyclableSingleton<Icon> zoomIcon = new RecyclableSingleton<Icon>() {
+ private static final RecyclableSingleton<Icon> zoomIcon = new RecyclableSingleton<Icon>() {
@Override
protected Icon getInstance() {
return new AquaInternalFrameButtonIcon(Widget.TITLE_BAR_ZOOM_BOX);
@@ -738,7 +738,7 @@
}
} // end class PaletteListener
- static final InternalFrameShadow documentWindowShadow = new InternalFrameShadow() {
+ private static final InternalFrameShadow documentWindowShadow = new InternalFrameShadow() {
@Override
Border getForegroundShadowBorder() {
return new AquaUtils.SlicedShadowBorder(new Painter() {
@@ -778,7 +778,7 @@
}
};
- static final InternalFrameShadow paletteWindowShadow = new InternalFrameShadow() {
+ private static final InternalFrameShadow paletteWindowShadow = new InternalFrameShadow() {
@Override
Border getForegroundShadowBorder() {
return new AquaUtils.SlicedShadowBorder(new Painter() {
@@ -834,7 +834,7 @@
}
}
- static final RecyclableSingleton<Icon> RESIZE_ICON = new RecyclableSingleton<Icon>() {
+ private static final RecyclableSingleton<Icon> RESIZE_ICON = new RecyclableSingleton<Icon>() {
@Override
protected Icon getInstance() {
return new AquaIcon.ScalingJRSUIIcon(11, 11) {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java Thu Mar 16 09:51:15 2017 -0700
@@ -37,7 +37,7 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public class AquaKeyBindings {
- static final RecyclableSingleton<AquaKeyBindings> instance = new RecyclableSingletonFromDefaultConstructor<AquaKeyBindings>(AquaKeyBindings.class);
+ private static final RecyclableSingleton<AquaKeyBindings> instance = new RecyclableSingletonFromDefaultConstructor<AquaKeyBindings>(AquaKeyBindings.class);
static AquaKeyBindings instance() {
return instance.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaLabelUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaLabelUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -37,7 +37,7 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public class AquaLabelUI extends BasicLabelUI {
- protected static final RecyclableSingleton<AquaLabelUI> aquaLabelUI = new RecyclableSingletonFromDefaultConstructor<AquaLabelUI>(AquaLabelUI.class);
+ private static final RecyclableSingleton<AquaLabelUI> aquaLabelUI = new RecyclableSingletonFromDefaultConstructor<AquaLabelUI>(AquaLabelUI.class);
public static ComponentUI createUI(final JComponent c) {
return aquaLabelUI.get();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java Thu Mar 16 09:51:15 2017 -0700
@@ -125,7 +125,7 @@
return buf.toString();
}
- static final RecyclableSingleton<AquaMenuPainter> sPainter = new RecyclableSingletonFromDefaultConstructor<AquaMenuPainter>(AquaMenuPainter.class);
+ private static final RecyclableSingleton<AquaMenuPainter> sPainter = new RecyclableSingletonFromDefaultConstructor<AquaMenuPainter>(AquaMenuPainter.class);
static AquaMenuPainter instance() {
return sPainter.get();
}
@@ -139,9 +139,9 @@
protected Border getInstance() { return UIManager.getBorder(borderName); }
}
- protected final RecyclableBorder menuBarPainter = new RecyclableBorder("MenuBar.backgroundPainter");
- protected final RecyclableBorder selectedMenuBarItemPainter = new RecyclableBorder("MenuBar.selectedBackgroundPainter");
- protected final RecyclableBorder selectedMenuItemPainter = new RecyclableBorder("MenuItem.selectedBackgroundPainter");
+ private static final RecyclableBorder menuBarPainter = new RecyclableBorder("MenuBar.backgroundPainter");
+ private static final RecyclableBorder selectedMenuBarItemPainter = new RecyclableBorder("MenuBar.selectedBackgroundPainter");
+ private static final RecyclableBorder selectedMenuItemPainter = new RecyclableBorder("MenuItem.selectedBackgroundPainter");
public void paintMenuBarBackground(final Graphics g, final int width, final int height, final JComponent c) {
g.setColor(c == null ? Color.white : c.getBackground());
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaMnemonicHandler.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaMnemonicHandler.java Thu Mar 16 09:51:15 2017 -0700
@@ -34,7 +34,7 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public class AquaMnemonicHandler {
- static final RecyclableSingleton<AltProcessor> altProcessor = new RecyclableSingletonFromDefaultConstructor<AltProcessor>(AltProcessor.class);
+ private static final RecyclableSingleton<AltProcessor> altProcessor = new RecyclableSingletonFromDefaultConstructor<AltProcessor>(AltProcessor.class);
public static KeyEventPostProcessor getInstance() {
return altProcessor.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaNativeResources.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaNativeResources.java Thu Mar 16 09:51:15 2017 -0700
@@ -54,7 +54,7 @@
}
}
- static final RecyclableSingleton<Color> sBackgroundColor = new RecyclableSingleton<Color>() {
+ private static final RecyclableSingleton<Color> sBackgroundColor = new RecyclableSingleton<Color>() {
@Override
protected Color getInstance() {
final long backgroundID = getWindowBackgroundColor();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaPanelUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaPanelUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -35,7 +35,7 @@
import java.awt.Graphics;
public class AquaPanelUI extends BasicPanelUI {
- static RecyclableSingleton<AquaPanelUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPanelUI>(AquaPanelUI.class);
+ private static final RecyclableSingleton<AquaPanelUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPanelUI>(AquaPanelUI.class);
public static ComponentUI createUI(final JComponent c) {
return instance.get();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaPopupMenuSeparatorUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaPopupMenuSeparatorUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -34,7 +34,7 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public class AquaPopupMenuSeparatorUI extends BasicSeparatorUI {
- protected static RecyclableSingletonFromDefaultConstructor<AquaPopupMenuSeparatorUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPopupMenuSeparatorUI>(AquaPopupMenuSeparatorUI.class);
+ private static final RecyclableSingletonFromDefaultConstructor<AquaPopupMenuSeparatorUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPopupMenuSeparatorUI>(AquaPopupMenuSeparatorUI.class);
public static ComponentUI createUI(final JComponent c) {
return instance.get();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -46,7 +46,7 @@
public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener, PropertyChangeListener, AncestorListener, Sizeable {
private static final boolean ADJUSTTIMER = true;
- protected static final RecyclableSingleton<SizeDescriptor> sizeDescriptor = new RecyclableSingleton<SizeDescriptor>() {
+ private static final RecyclableSingleton<SizeDescriptor> sizeDescriptor = new RecyclableSingleton<SizeDescriptor>() {
@Override
protected SizeDescriptor getInstance() {
return new SizeDescriptor(new SizeVariant(146, 20)) {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollBarUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollBarUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -154,7 +154,7 @@
return State.ACTIVE;
}
- static final RecyclableSingleton<Map<Hit, ScrollBarPart>> hitToPressedPartMap = new RecyclableSingleton<Map<Hit,ScrollBarPart>>(){
+ private static final RecyclableSingleton<Map<Hit, ScrollBarPart>> hitToPressedPartMap = new RecyclableSingleton<Map<Hit,ScrollBarPart>>(){
@Override
protected Map<Hit, ScrollBarPart> getInstance() {
final Map<Hit, ScrollBarPart> map = new HashMap<Hit, ScrollBarPart>(7);
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollRegionBorder.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollRegionBorder.java Thu Mar 16 09:51:15 2017 -0700
@@ -40,7 +40,7 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public class AquaScrollRegionBorder extends AquaBorder {
- static final RecyclableSingletonFromDefaultConstructor<AquaScrollRegionBorder> instance = new RecyclableSingletonFromDefaultConstructor<AquaScrollRegionBorder>(AquaScrollRegionBorder.class);
+ private static final RecyclableSingletonFromDefaultConstructor<AquaScrollRegionBorder> instance = new RecyclableSingletonFromDefaultConstructor<AquaScrollRegionBorder>(AquaScrollRegionBorder.class);
public static AquaScrollRegionBorder getScrollRegionBorder() {
return instance.get();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSliderUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSliderUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -45,7 +45,7 @@
// static final Dimension roundThumbSize = new Dimension(21 + 4, 21 + 4); // +2px on both sides for focus fuzz
// static final Dimension pointingThumbSize = new Dimension(19 + 4, 22 + 4);
- protected static final RecyclableSingleton<SizeDescriptor> roundThumbDescriptor = new RecyclableSingleton<SizeDescriptor>() {
+ private static final RecyclableSingleton<SizeDescriptor> roundThumbDescriptor = new RecyclableSingleton<SizeDescriptor>() {
protected SizeDescriptor getInstance() {
return new SizeDescriptor(new SizeVariant(25, 25)) {
public SizeVariant deriveSmall(final SizeVariant v) {
@@ -57,7 +57,7 @@
};
}
};
- protected static final RecyclableSingleton<SizeDescriptor> pointingThumbDescriptor = new RecyclableSingleton<SizeDescriptor>() {
+ private static final RecyclableSingleton<SizeDescriptor> pointingThumbDescriptor = new RecyclableSingleton<SizeDescriptor>() {
protected SizeDescriptor getInstance() {
return new SizeDescriptor(new SizeVariant(23, 26)) {
public SizeVariant deriveSmall(final SizeVariant v) {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderBorder.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderBorder.java Thu Mar 16 09:51:15 2017 -0700
@@ -126,7 +126,7 @@
return State.ACTIVE;
}
- static final RecyclableSingleton<Border> alternateBorder = new RecyclableSingleton<Border>() {
+ private static final RecyclableSingleton<Border> alternateBorder = new RecyclableSingleton<Border>() {
@Override
protected Border getInstance() {
return BorderFactory.createRaisedBevelBorder();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -67,7 +67,7 @@
super.uninstallDefaults();
}
- static final RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>> TABLE_HEADER_APPLICATORS = new RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>>() {
+ private static final RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>> TABLE_HEADER_APPLICATORS = new RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>>() {
@Override
@SuppressWarnings("unchecked")
protected ClientPropertyApplicator<JTableHeader, JTableHeader> getInstance() {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldBorder.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldBorder.java Thu Mar 16 09:51:15 2017 -0700
@@ -36,7 +36,7 @@
import com.apple.laf.AquaUtils.*;
public class AquaTextFieldBorder extends AquaBorder {
- protected static final RecyclableSingleton<AquaTextFieldBorder> instance = new RecyclableSingletonFromDefaultConstructor<AquaTextFieldBorder>(AquaTextFieldBorder.class);
+ private static final RecyclableSingleton<AquaTextFieldBorder> instance = new RecyclableSingletonFromDefaultConstructor<AquaTextFieldBorder>(AquaTextFieldBorder.class);
public static AquaTextFieldBorder getTextFieldBorder() {
return instance.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldSearch.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldSearch.java Thu Mar 16 09:51:15 2017 -0700
@@ -90,7 +90,7 @@
return (c.getClientProperty(FIND_POPUP_KEY) instanceof JPopupMenu);
}
- protected static final RecyclableSingleton<SearchFieldBorder> instance = new RecyclableSingletonFromDefaultConstructor<SearchFieldBorder>(SearchFieldBorder.class);
+ private static final RecyclableSingleton<SearchFieldBorder> instance = new RecyclableSingletonFromDefaultConstructor<SearchFieldBorder>(SearchFieldBorder.class);
public static SearchFieldBorder getSearchTextFieldBorder() {
return instance.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextPasswordFieldUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextPasswordFieldUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -38,7 +38,7 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public class AquaTextPasswordFieldUI extends AquaTextFieldUI {
- static final RecyclableSingleton<CapsLockSymbolPainter> capsLockPainter = new RecyclableSingletonFromDefaultConstructor<CapsLockSymbolPainter>(CapsLockSymbolPainter.class);
+ private static final RecyclableSingleton<CapsLockSymbolPainter> capsLockPainter = new RecyclableSingletonFromDefaultConstructor<CapsLockSymbolPainter>(CapsLockSymbolPainter.class);
static CapsLockSymbolPainter getCapsLockPainter() {
return capsLockPainter.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaToolBarSeparatorUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaToolBarSeparatorUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -34,7 +34,7 @@
import com.apple.laf.AquaUtils.*;
public class AquaToolBarSeparatorUI extends BasicToolBarSeparatorUI {
- protected static RecyclableSingleton<AquaToolBarSeparatorUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaToolBarSeparatorUI>(AquaToolBarSeparatorUI.class);
+ private static final RecyclableSingleton<AquaToolBarSeparatorUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaToolBarSeparatorUI>(AquaToolBarSeparatorUI.class);
public static ComponentUI createUI(final JComponent c) {
return instance.get();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaToolBarUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaToolBarUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -35,7 +35,7 @@
import com.apple.laf.AquaUtils.*;
public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
- private static RecyclableSingleton<ToolBarBorder> toolBarBorder = new RecyclableSingletonFromDefaultConstructor<ToolBarBorder>(ToolBarBorder.class);
+ private static final RecyclableSingleton<ToolBarBorder> toolBarBorder = new RecyclableSingletonFromDefaultConstructor<ToolBarBorder>(ToolBarBorder.class);
public static Border getToolBarBorder() {
return toolBarBorder.get();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaToolTipUI.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaToolTipUI.java Thu Mar 16 09:51:15 2017 -0700
@@ -34,7 +34,7 @@
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
public class AquaToolTipUI extends BasicToolTipUI {
- static final RecyclableSingletonFromDefaultConstructor<AquaToolTipUI> sharedAquaInstance = new RecyclableSingletonFromDefaultConstructor<AquaToolTipUI>(AquaToolTipUI.class);
+ private static final RecyclableSingletonFromDefaultConstructor<AquaToolTipUI> sharedAquaInstance = new RecyclableSingletonFromDefaultConstructor<AquaToolTipUI>(AquaToolTipUI.class);
public static ComponentUI createUI(final JComponent c) {
return sharedAquaInstance.get();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtilControlSize.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtilControlSize.java Thu Mar 16 09:51:15 2017 -0700
@@ -49,7 +49,7 @@
void applySizeFor(final JComponent c, final Size size);
}
- protected static final RecyclableSingleton<PropertySizeListener> sizeListener
+ private static final RecyclableSingleton<PropertySizeListener> sizeListener
= new RecyclableSingletonFromDefaultConstructor<>(PropertySizeListener.class);
protected static PropertySizeListener getSizeListener() {
return sizeListener.get();
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m Thu Mar 16 09:51:15 2017 -0700
@@ -284,28 +284,21 @@
CGFloat components[component_size];
CGGradientRef gradient = NULL;
- for (int i = 0; i < num_locations; i++) {
+ for (i = 0; i < num_locations; i++) {
locations[i] = gradientInfo->fractionsdata[i];
-//fprintf(stderr, "locations[%d] %f\n", i, locations[i]);
}
for (i = 0; i < component_size; i++) {
components[i] = gradientInfo->colordata[i];
-//fprintf(stderr, "components[%d] %f, gradientInfo->colordata[%d] %f\n",
-// i, components[i], i, gradientInfo->colordata[i]);
}
CGContextSaveGState(cgRef);
gradient = CGGradientCreateWithColorComponents(colorspace, components, locations, num_locations);
-//fprintf(stderr, "gradientInfo->start.x %f, gradientInfo->start.y %f\n",
-// gradientInfo->start.x, gradientInfo->start.y);
-//fprintf(stderr, "gradientInfo->end.x %f, gradientInfo->end.y %f\n",
-// gradientInfo->end.x, gradientInfo->end.y);
if (qsdo->isEvenOddFill) {
CGContextEOClip(cgRef);
} else {
CGContextClip(cgRef);
}
CGContextDrawLinearGradient(cgRef, gradient, gradientInfo->start, gradientInfo->end, kCGGradientDrawsAfterEndLocation);
-
+
CGContextRestoreGState(cgRef);
CGColorSpaceRelease(colorspace);
CGGradientRelease(gradient);
@@ -332,27 +325,19 @@
CGFloat startRadius = gradientInfo->radius;
CGFloat endRadius = gradientInfo->radius;
- for (int i = 0; i < num_locations; i++) {
+ for (i = 0; i < num_locations; i++) {
locations[i] = gradientInfo->fractionsdata[i];
-//fprintf(stderr, "locations[%d] %f\n", i, locations[i]);
}
for (i = 0; i < component_size; i++) {
components[i] = gradientInfo->colordata[i];
-//fprintf(stderr, "components[%d] %f, gradientInfo->colordata[%d] %f\n",
-// i, components[i], i, gradientInfo->colordata[i]);
}
CGContextSaveGState(cgRef);
gradient = CGGradientCreateWithColorComponents(colorspace, components, locations, num_locations);
-//fprintf(stderr, "gradientInfo->start.x %f, gradientInfo->start.y %f\n",
-// gradientInfo->start.x, gradientInfo->start.y);
-//fprintf(stderr, "gradientInfo->end.x %f, gradientInfo->end.y %f\n",
-// gradientInfo->end.x, gradientInfo->end.y);
if (qsdo->isEvenOddFill) {
CGContextEOClip(cgRef);
} else {
CGContextClip(cgRef);
}
-//fprintf(stderr, "gradientInfo->startRadius %f, gradientInfo->endRadius %f\n",startRadius,endRadius);
CGContextDrawRadialGradient(cgRef, gradient, gradientInfo->start, 0, gradientInfo->end, endRadius, kCGGradientDrawsAfterEndLocation);
CGContextRestoreGState(cgRef);
@@ -944,54 +929,41 @@
if (colorArray != NULL)
{
jint length = (*env)->GetArrayLength(env, colorArray);
-//fprintf(stderr, "length %d\n", length);
jint* jcolorData = (jint*)(*env)->GetPrimitiveArrayCritical(env, colorArray, NULL);
- CGFloat* colors= (CGFloat*)calloc(0, sizeof(CGFloat)*length);
+ qsdo->gradientInfo->colordata = (CGFloat*)malloc(sizeof(CGFloat)*4*length);
+ memset(qsdo->gradientInfo->colordata, 0, sizeof(CGFloat)*4*length);
if (jcolorData != NULL)
{
- jint i;
+ int i;
for (i=0; i<length; i++)
{
- colors[i] = (CGFloat)jcolorData[i];
+ qsdo->gradientInfo->colordata[i*4] = ((jcolorData[i]>>16)&0xff)*kColorConversionMultiplier;
+
+ qsdo->gradientInfo->colordata[i*4+1] = ((jcolorData[i]>>8)&0xff)*kColorConversionMultiplier;
+
+ qsdo->gradientInfo->colordata[i*4+2] = ((jcolorData[i]>>0)&0xff)*kColorConversionMultiplier;
+
+ qsdo->gradientInfo->colordata[i*4+3] = ((jcolorData[i]>>24)&0xff)*kColorConversionMultiplier;
}
}
(*env)->ReleasePrimitiveArrayCritical(env, colorArray, jcolorData, 0);
- qsdo->gradientInfo->colordata = (CGFloat*)calloc(0, sizeof(CGFloat)*4*length);
- for (int i = 0; i < length; i++)
- {
- jint c1 = colors[i];
-//fprintf(stderr, "c1 %x\n", c1);
- qsdo->gradientInfo->colordata[i*4] = ((c1>>16)&0xff)*kColorConversionMultiplier;
-//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4, qsdo->gradientInfo->colordata[i*4]);
-
- qsdo->gradientInfo->colordata[i*4+1] = ((c1>>8)&0xff)*kColorConversionMultiplier;
-//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4+1, qsdo->gradientInfo->colordata[i*4+1]);
-
- qsdo->gradientInfo->colordata[i*4+2] = ((c1>>0)&0xff)*kColorConversionMultiplier;
-//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4+2, qsdo->gradientInfo->colordata[i*4+2]);
-
- qsdo->gradientInfo->colordata[i*4+3] = ((c1>>24)&0xff)*kColorConversionMultiplier;
-//fprintf(stderr, "qsdo->gradientInfo->colordata[%d] %f\n", i*4+3, qsdo->gradientInfo->colordata[i*4+3]);
- }
- free(colors);
}
jobject fractionsArray = ((*env)->GetObjectArrayElement(env, qsdo->javaGraphicsStatesObjects, sun_java2d_OSXSurfaceData_kFractionsArrayIndex));
if (fractionsArray != NULL)
{
jint length = (*env)->GetArrayLength(env, fractionsArray);
-//fprintf(stderr, "fractions length %d\n", length);
qsdo->gradientInfo->fractionsLength = length;
jfloat* jfractionsData = (jfloat*)(*env)->GetPrimitiveArrayCritical(env, fractionsArray, NULL);
if (jfractionsData != NULL)
{
+ int i;
qsdo->gradientInfo->fractionsdata = (CGFloat *)malloc(sizeof(CGFloat) *length);
- jint i;
+ memset(qsdo->gradientInfo->fractionsdata, 0, sizeof(CGFloat)*length);
for (i=0; i<length; i++)
{
qsdo->gradientInfo->fractionsdata[i] = jfractionsData[i];
-//fprintf(stderr, "jfrationsData[%d] %f, qsdo->gradientInfo->fractionsdata[%d] = %f\n", i, jfractionsData[i], i, qsdo->gradientInfo->fractionsdata[i]);
}
(*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, jfractionsData, 0);
}
--- a/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java Thu Mar 16 09:51:15 2017 -0700
@@ -274,6 +274,10 @@
/**
* Requests user attention to the specified window.
*
+ * Has no effect if a window representation is not displayable in
+ * the task area. Whether it is displayable is dependent on all
+ * of window type, platform, and implementation.
+ *
* @param w window
* @throws SecurityException if a security manager exists and it denies the
* {@code RuntimePermission("canProcessApplicationEvents")} permission.
@@ -375,6 +379,10 @@
* for the specified window.
* It may be disabled by system settings.
*
+ * Has no effect if a window representation is not displayable in
+ * the task area. Whether it is displayable is dependent on all
+ * of window type, platform, and implementation.
+ *
* @param w window to update
* @param badge image to affix to the icon
* @throws SecurityException if a security manager exists and it denies the
@@ -409,6 +417,11 @@
/**
* Displays a determinate progress bar in the task area for the specified
* window.
+ *
+ * Has no effect if a window representation is not displayable in
+ * the task area. Whether it is displayable is dependent on all
+ * of window type, platform, and implementation.
+ *
* <br>
* The visual behavior is platform and {@link State} dependent.
* <br>
@@ -437,6 +450,10 @@
/**
* Sets a progress state for a specified window.
+ *
+ * Has no effect if a window representation is not displayable in
+ * the task area. Whether it is displayable is dependent on all
+ * of window type, platform, and implementation.
* <br>
* Each state displays a progress in a platform-dependent way.
* <br>
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Thu Mar 16 09:51:15 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -36,8 +36,6 @@
import java.beans.PropertyChangeEvent;
import java.awt.IllegalComponentStateException;
-import javax.swing.SwingContainer;
-
/**
* AccessibleContext represents the minimum information all accessible objects
* return. This information includes the accessible name, description, role,
@@ -79,7 +77,6 @@
* @author Lynn Monsanto
*/
@JavaBean(description = "Minimal information that all accessible objects return")
-@SwingContainer(false)
public abstract class AccessibleContext {
/**
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalIconFactory.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalIconFactory.java Thu Mar 16 09:51:15 2017 -0700
@@ -1247,9 +1247,15 @@
protected void drawCheck(Component c, Graphics g, int x, int y) {
int controlSize = getControlSize();
- g.fillRect( x+3, y+5, 2, controlSize-8 );
- g.drawLine( x+(controlSize-4), y+3, x+5, y+(controlSize-6) );
- g.drawLine( x+(controlSize-4), y+4, x+5, y+(controlSize-5) );
+ int csx = controlSize - 3;
+ int csy1 = controlSize - 6;
+ int csy2 = controlSize - 4;
+ int csy3 = controlSize - 3;
+ int[] xPoints = {3, 5, 5, csx, csx, 5, 5, 3};
+ int[] yPoints = {5, 5, csy1, 2, 4, csy2, csy3, csy3};
+ g.translate(x, y);
+ g.fillPolygon(xPoints, yPoints, 8);
+ g.translate(-x, -y);
}
public int getIconWidth() {
@@ -1358,48 +1364,21 @@
// draw Dark Circle (start at top, go clockwise)
g.setColor(darkCircle);
- g.drawLine( 4, 0, 7, 0);
- g.drawLine( 8, 1, 9, 1);
- g.drawLine(10, 2, 10, 3);
- g.drawLine(11, 4, 11, 7);
- g.drawLine(10, 8, 10, 9);
- g.drawLine( 9,10, 8,10);
- g.drawLine( 7,11, 4,11);
- g.drawLine( 3,10, 2,10);
- g.drawLine( 1, 9, 1, 8);
- g.drawLine( 0, 7, 0, 4);
- g.drawLine( 1, 3, 1, 2);
- g.drawLine( 2, 1, 3, 1);
+ g.drawOval(0, 0, 11, 11);
// draw Inner Left (usually) White Arc
// start at lower left corner, go clockwise
g.setColor(whiteInnerLeftArc);
- g.drawLine( 2, 9, 2, 8);
- g.drawLine( 1, 7, 1, 4);
- g.drawLine( 2, 2, 2, 3);
- g.drawLine( 2, 2, 3, 2);
- g.drawLine( 4, 1, 7, 1);
- g.drawLine( 8, 2, 9, 2);
+ g.drawArc(1, 1, 10, 10, 60, 160);
// draw Outer Right White Arc
// start at upper right corner, go clockwise
g.setColor(whiteOuterRightArc);
- g.drawLine(10, 1, 10, 1);
- g.drawLine(11, 2, 11, 3);
- g.drawLine(12, 4, 12, 7);
- g.drawLine(11, 8, 11, 9);
- g.drawLine(10,10, 10,10);
- g.drawLine( 9,11, 8,11);
- g.drawLine( 7,12, 4,12);
- g.drawLine( 3,11, 2,11);
+ g.drawArc(-1, -1, 13, 13, 235, 180);
// selected dot
if ( drawDot ) {
g.setColor(dotColor);
- g.fillRect( 4, 4, 4, 4);
- g.drawLine( 4, 3, 7, 3);
- g.drawLine( 8, 4, 8, 7);
- g.drawLine( 7, 8, 4, 8);
- g.drawLine( 3, 7, 3, 4);
+ g.fillOval(2, 2, 7, 7);
}
g.translate(-x, -y);
@@ -2051,16 +2030,17 @@
g.setColor( b.getForeground() );
}
}
- if( MetalUtils.isLeftToRight(b) ) {
- g.drawLine( 0, 0, 0, 7 );
- g.drawLine( 1, 1, 1, 6 );
- g.drawLine( 2, 2, 2, 5 );
- g.drawLine( 3, 3, 3, 4 );
+ if (MetalUtils.isLeftToRight(b)) {
+ int[] xPoints = {0, 3, 3, 0};
+ int[] yPoints = {0, 3, 4, 7};
+ g.fillPolygon(xPoints, yPoints, 4);
+ g.drawPolygon(xPoints, yPoints, 4);
+
} else {
- g.drawLine( 4, 0, 4, 7 );
- g.drawLine( 3, 1, 3, 6 );
- g.drawLine( 2, 2, 2, 5 );
- g.drawLine( 1, 3, 1, 4 );
+ int[] xPoints = {4, 4, 1, 1};
+ int[] yPoints = {0, 7, 4, 3};
+ g.fillPolygon(xPoints, yPoints, 4);
+ g.drawPolygon(xPoints, yPoints, 4);
}
g.translate( -x, -y );
@@ -2138,10 +2118,7 @@
g.setColor( MetalLookAndFeel.getMenuDisabledForeground());
}
- g.drawLine( 2, 2, 2, 6 );
- g.drawLine( 3, 2, 3, 6 );
- g.drawLine( 4, 4, 8, 0 );
- g.drawLine( 4, 5, 9, 0 );
+ drawCheck(g);
}
g.translate( -x, -y );
}
@@ -2217,15 +2194,18 @@
g.setColor( MetalLookAndFeel.getMenuDisabledForeground() );
}
- g.drawLine( 2, 2, 2, 6 );
- g.drawLine( 3, 2, 3, 6 );
- g.drawLine( 4, 4, 8, 0 );
- g.drawLine( 4, 5, 9, 0 );
+ drawCheck(g);
}
g.translate( -x, -y );
}
+ private void drawCheck(Graphics g) {
+ int[] xPoints = {2, 3, 3, 8, 9, 3, 2};
+ int[] yPoints = {2, 2, 5, 0, 0, 6, 6};
+ g.drawPolygon(xPoints, yPoints, 7);
+ }
+
public int getIconWidth() { return menuCheckIconSize.width; }
public int getIconHeight() { return menuCheckIconSize.height; }
@@ -2252,9 +2232,8 @@
else {
g.setColor(MetalLookAndFeel.getControlHighlight());
}
- g.drawLine( 2, 9, 7, 9 );
- g.drawLine( 9, 2, 9, 7 );
- g.drawLine( 8, 8, 8, 8 );
+
+ g.drawArc(-1, -1, 10, 10, 245, 140);
if (isPressed || isArmed) {
g.setColor(MetalLookAndFeel.getControlInfo());
@@ -2266,14 +2245,8 @@
else {
g.setColor( MetalLookAndFeel.getMenuDisabledForeground() );
}
- g.drawLine( 2, 0, 6, 0 );
- g.drawLine( 2, 8, 6, 8 );
- g.drawLine( 0, 2, 0, 6 );
- g.drawLine( 8, 2, 8, 6 );
- g.drawLine( 1, 1, 1, 1 );
- g.drawLine( 7, 1, 7, 1 );
- g.drawLine( 1, 7, 1, 7 );
- g.drawLine( 7, 7, 7, 7 );
+
+ g.drawOval(0, 0, 8, 8);
if (isSelected) {
if (isEnabled) {
@@ -2288,11 +2261,9 @@
else {
g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
}
- g.drawLine( 3, 2, 5, 2 );
- g.drawLine( 2, 3, 6, 3 );
- g.drawLine( 2, 4, 6, 4 );
- g.drawLine( 2, 5, 6, 5 );
- g.drawLine( 3, 6, 5, 6 );
+
+ g.fillOval(2, 2, 4, 4);
+ g.drawOval(2, 2, 4, 4);
}
g.translate( -x, -y );
@@ -2319,55 +2290,24 @@
if ( isPressed || isArmed )
{
g.setColor( MetalLookAndFeel.getPrimaryControl() );
- g.drawLine( 3, 1, 8, 1 );
- g.drawLine( 2, 9, 7, 9 );
- g.drawLine( 1, 3, 1, 8 );
- g.drawLine( 9, 2, 9, 7 );
- g.drawLine( 2, 2, 2, 2 );
- g.drawLine( 8, 8, 8, 8 );
+ g.drawOval(1, 1, 8, 8);
g.setColor( MetalLookAndFeel.getControlInfo() );
- g.drawLine( 2, 0, 6, 0 );
- g.drawLine( 2, 8, 6, 8 );
- g.drawLine( 0, 2, 0, 6 );
- g.drawLine( 8, 2, 8, 6 );
- g.drawLine( 1, 1, 1, 1 );
- g.drawLine( 7, 1, 7, 1 );
- g.drawLine( 1, 7, 1, 7 );
- g.drawLine( 7, 7, 7, 7 );
+ g.drawOval(0, 0, 8, 8);
}
else
{
g.setColor( MetalLookAndFeel.getControlHighlight() );
- g.drawLine( 3, 1, 8, 1 );
- g.drawLine( 2, 9, 7, 9 );
- g.drawLine( 1, 3, 1, 8 );
- g.drawLine( 9, 2, 9, 7 );
- g.drawLine( 2, 2, 2, 2 );
- g.drawLine( 8, 8, 8, 8 );
+ g.drawOval(1, 1, 8, 8);
g.setColor( MetalLookAndFeel.getControlDarkShadow() );
- g.drawLine( 2, 0, 6, 0 );
- g.drawLine( 2, 8, 6, 8 );
- g.drawLine( 0, 2, 0, 6 );
- g.drawLine( 8, 2, 8, 6 );
- g.drawLine( 1, 1, 1, 1 );
- g.drawLine( 7, 1, 7, 1 );
- g.drawLine( 1, 7, 1, 7 );
- g.drawLine( 7, 7, 7, 7 );
+ g.drawOval(0, 0, 8, 8);
}
}
else
{
g.setColor( MetalLookAndFeel.getMenuDisabledForeground() );
- g.drawLine( 2, 0, 6, 0 );
- g.drawLine( 2, 8, 6, 8 );
- g.drawLine( 0, 2, 0, 6 );
- g.drawLine( 8, 2, 8, 6 );
- g.drawLine( 1, 1, 1, 1 );
- g.drawLine( 7, 1, 7, 1 );
- g.drawLine( 1, 7, 1, 7 );
- g.drawLine( 7, 7, 7, 7 );
+ g.drawOval(0, 0, 8, 8);
}
if ( isSelected )
@@ -2388,11 +2328,8 @@
g.setColor( MetalLookAndFeel.getMenuDisabledForeground() );
}
- g.drawLine( 3, 2, 5, 2 );
- g.drawLine( 2, 3, 6, 3 );
- g.drawLine( 2, 4, 6, 4 );
- g.drawLine( 2, 5, 6, 5 );
- g.drawLine( 3, 6, 5, 6 );
+ g.fillOval(2, 2, 4, 4);
+ g.drawOval(2, 2, 4, 4);
}
g.translate( -x, -y );
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java Thu Mar 16 09:51:15 2017 -0700
@@ -39,6 +39,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
+import java.util.Arrays;
import javax.swing.event.*;
import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CannotRedoException;
@@ -1263,7 +1264,7 @@
int offs, int len) {
attr = a;
this.type = type;
- this.data = txt;
+ this.data = txt == null ? null : Arrays.copyOf(txt, txt.length);
this.offs = offs;
this.len = len;
this.direction = OriginateDirection;
@@ -1323,7 +1324,7 @@
* @return the array
*/
public char[] getArray() {
- return data;
+ return data == null ? null : Arrays.copyOf(data, data.length);
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StyleContext.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StyleContext.java Thu Mar 16 09:51:15 2017 -0700
@@ -794,7 +794,7 @@
* @param attributes the attributes
*/
public SmallAttributeSet(Object[] attributes) {
- this.attributes = attributes;
+ this.attributes = Arrays.copyOf(attributes, attributes.length);
updateResolveParent();
}
--- a/jdk/src/java.desktop/share/classes/sun/awt/CustomCursor.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/CustomCursor.java Thu Mar 16 09:51:15 2017 -0700
@@ -66,7 +66,8 @@
// Scale image to nearest supported size.
Dimension nativeSize = toolkit.getBestCursorSize(width, height);
- if (nativeSize.width != width || nativeSize.height != height) {
+ if ((nativeSize.width != width || nativeSize.height != height) &&
+ (nativeSize.width != 0 && nativeSize.height != 0)) {
cursor = cursor.getScaledInstance(nativeSize.width,
nativeSize.height,
Image.SCALE_DEFAULT);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/print/DialogOnTop.java Thu Mar 16 09:51:15 2017 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.print;
+
+import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintRequestAttribute;
+
+/*
+ * An implementation class used to request the dialog be set always-on-top.
+ * It needs to be read and honoured by the dialog code which will use
+ * java.awt.Window.setAlwaysOnTop(true) in cases where it is supported.
+ */
+public class DialogOnTop implements PrintRequestAttribute {
+
+ private static final long serialVersionUID = -1901909867156076547L;
+
+ long id;
+
+ public DialogOnTop() {
+ }
+
+ public DialogOnTop(long id) {
+ this.id = id;
+ }
+
+ public final Class<? extends Attribute> getCategory() {
+ return DialogOnTop.class;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public final String getName() {
+ return "dialog-on-top";
+ }
+
+ public String toString() {
+ return "dialog-on-top";
+ }
+}
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Thu Mar 16 09:51:15 2017 -0700
@@ -785,7 +785,9 @@
PrintService pservice = getPrintService();
PageFormat pageFrmAttrib = attributeToPageFormat(pservice,
attributes);
+ setParentWindowID(attributes);
PageFormat page = pageDialog(pageFrmAttrib);
+ clearParentWindowID();
// If user cancels the dialog, pageDialog() will return the original
// page object and as per spec, we should return null in that case.
@@ -828,6 +830,9 @@
int x = gcBounds.x+50;
int y = gcBounds.y+50;
ServiceDialog pageDialog;
+ if (onTop != null) {
+ attributes.add(onTop);
+ }
if (w instanceof Frame) {
pageDialog = new ServiceDialog(gc, x, y, service,
DocFlavor.SERVICE_FORMATTED.PAGEABLE,
@@ -837,6 +842,7 @@
DocFlavor.SERVICE_FORMATTED.PAGEABLE,
attributes, (Dialog)w);
}
+
Rectangle dlgBounds = pageDialog.getBounds();
// if portion of dialog is not within the gc boundary
@@ -923,7 +929,9 @@
}
+ setParentWindowID(attributes);
boolean ret = printDialog();
+ clearParentWindowID();
this.attributes = attributes;
return ret;
@@ -2539,4 +2547,26 @@
return new String(out_chars, 0, pos);
}
}
+
+ private DialogOnTop onTop = null;
+
+ private long parentWindowID = 0L;
+
+ /* Called from native code */
+ private long getParentWindowID() {
+ return parentWindowID;
+ }
+
+ private void clearParentWindowID() {
+ parentWindowID = 0L;
+ onTop = null;
+ }
+
+ private void setParentWindowID(PrintRequestAttributeSet attrs) {
+ parentWindowID = 0L;
+ onTop = (DialogOnTop)attrs.get(DialogOnTop.class);
+ if (onTop != null) {
+ parentWindowID = onTop.getID();
+ }
+ }
}
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java Thu Mar 16 09:51:15 2017 -0700
@@ -184,6 +184,9 @@
isAWT = true;
}
+ if (attributes.get(DialogOnTop.class) != null) {
+ setAlwaysOnTop(true);
+ }
Container c = getContentPane();
c.setLayout(new BorderLayout());
@@ -275,6 +278,10 @@
this.asOriginal = attributes;
this.asCurrent = new HashPrintRequestAttributeSet(attributes);
+ if (attributes.get(DialogOnTop.class) != null) {
+ setAlwaysOnTop(true);
+ }
+
Container c = getContentPane();
c.setLayout(new BorderLayout());
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java Thu Mar 16 09:51:15 2017 -0700
@@ -186,7 +186,17 @@
SurfaceData sd = d3dvsm.getPrimarySurfaceData();
if (sd instanceof D3DSurfaceData) {
D3DSurfaceData d3dsd = (D3DSurfaceData)sd;
- D3DSurfaceData.swapBuffers(d3dsd, x1, y1, x2, y2);
+ double scaleX = sd.getDefaultScaleX();
+ double scaleY = sd.getDefaultScaleY();
+ if (scaleX > 1 || scaleY > 1) {
+ int sx1 = (int) Math.floor(x1 * scaleX);
+ int sy1 = (int) Math.floor(y1 * scaleY);
+ int sx2 = (int) Math.ceil(x2 * scaleX);
+ int sy2 = (int) Math.ceil(y2 * scaleY);
+ D3DSurfaceData.swapBuffers(d3dsd, sx1, sy1, sx2, sy2);
+ } else {
+ D3DSurfaceData.swapBuffers(d3dsd, x1, y1, x2, y2);
+ }
} else {
// the surface was likely lost could not have been restored
Graphics g = peer.getGraphics();
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java Thu Mar 16 09:51:15 2017 -0700
@@ -766,7 +766,17 @@
final Component target = (Component)sd.getPeer().getTarget();
SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
public void run() {
- target.repaint(x1, y1, x2, y2);
+ double scaleX = sd.getDefaultScaleX();
+ double scaleY = sd.getDefaultScaleY();
+ if (scaleX > 1 || scaleY > 1) {
+ int sx1 = (int) Math.floor(x1 / scaleX);
+ int sy1 = (int) Math.floor(y1 / scaleY);
+ int sx2 = (int) Math.ceil(x2 / scaleX);
+ int sy2 = (int) Math.ceil(y2 / scaleY);
+ target.repaint(sx1, sy1, sx2 - sx1, sy2 - sy1);
+ } else {
+ target.repaint(x1, y1, x2 - x1, y2 - y1);
+ }
}
});
return;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp Thu Mar 16 09:51:15 2017 -0700
@@ -54,6 +54,7 @@
jmethodID AwtPrintControl::setDevmodeID;
jmethodID AwtPrintControl::getDevnamesID;
jmethodID AwtPrintControl::setDevnamesID;
+jmethodID AwtPrintControl::getParentWindowID;
jfieldID AwtPrintControl::driverDoesMultipleCopiesID;
jfieldID AwtPrintControl::driverDoesCollationID;
jmethodID AwtPrintControl::getWin32MediaID;
@@ -240,6 +241,11 @@
DASSERT(AwtPrintControl::dialogOwnerPeerID != NULL);
CHECK_NULL(AwtPrintControl::dialogOwnerPeerID);
+ AwtPrintControl::getParentWindowID = env->GetMethodID(cls,
+ "getParentWindowID", "()J");
+ DASSERT(AwtPrintControl::getParentWindowID != NULL);
+ CHECK_NULL(AwtPrintControl::getParentWindowID);
+
AwtPrintControl::getPrintDCID = env->GetMethodID(cls, "getPrintDC", "()J");
DASSERT(AwtPrintControl::getPrintDCID != NULL);
CHECK_NULL(AwtPrintControl::getPrintDCID);
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h Thu Mar 16 09:51:15 2017 -0700
@@ -47,6 +47,7 @@
static jmethodID setDevmodeID;
static jmethodID getDevnamesID;
static jmethodID setDevnamesID;
+ static jmethodID getParentWindowID;
static jmethodID getWin32MediaID;
static jmethodID setWin32MediaID;
static jmethodID getWin32MediaTrayID;
@@ -97,6 +98,10 @@
LPTSTR pPrinterName,
LPDEVMODE *pDevMode);
+ inline static HWND getParentID(JNIEnv *env, jobject self) {
+ return (HWND)env->CallLongMethod(self, getParentWindowID);
+ }
+
inline static HDC getPrintDC(JNIEnv *env, jobject self) {
return (HDC)env->CallLongMethod(self, getPrintDCID);
}
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.cpp Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.cpp Thu Mar 16 09:51:15 2017 -0700
@@ -248,6 +248,11 @@
pd.lpfnPrintHook = (LPPRINTHOOKPROC)PrintDialogHookProc;
pd.lpfnSetupHook = (LPSETUPHOOKPROC)PrintDialogHookProc;
pd.Flags |= PD_ENABLESETUPHOOK | PD_ENABLEPRINTHOOK;
+ HWND parent = AwtPrintControl::getParentID(env, control);
+ if (parent != NULL && ::IsWindow(parent)) {
+ // Windows native modality is requested (used by JavaFX).
+ pd.hwndOwner = parent;
+ }
/*
Fix for 6488834.
To disable Win32 native parent modality we have to set
@@ -255,7 +260,7 @@
parentless dialogs we use NULL to show them in the taskbar,
and for all other dialogs AwtToolkit's HWND is used.
*/
- if (awtParent != NULL)
+ else if (awtParent != NULL)
{
pd.hwndOwner = AwtToolkit::GetInstance().GetHWnd();
}
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp Thu Mar 16 09:51:15 2017 -0700
@@ -521,12 +521,18 @@
AwtComponent *awtParent = (parent != NULL) ? (AwtComponent *)JNI_GET_PDATA(parent) : NULL;
HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
+
jboolean doIt = JNI_FALSE; // Assume the user will cancel the dialog.
PAGESETUPDLG setup;
memset(&setup, 0, sizeof(setup));
setup.lStructSize = sizeof(setup);
+ HWND parentID = AwtPrintControl::getParentID(env, self);
+ if (parentID != NULL && ::IsWindow(parentID)) {
+ // windows native modality is requested (used by JavaFX).
+ setup.hwndOwner = parentID;
+ }
/*
Fix for 6488834.
To disable Win32 native parent modality we have to set
@@ -534,7 +540,7 @@
parentless dialogs we use NULL to show them in the taskbar,
and for all other dialogs AwtToolkit's HWND is used.
*/
- if (awtParent != NULL)
+ else if (awtParent != NULL)
{
setup.hwndOwner = AwtToolkit::GetInstance().GetHWnd();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java Thu Mar 16 09:51:15 2017 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2017, 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.Choice;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+
+/**
+ * @test
+ * @bug 8176448
+ * @run main/timeout=300 ChoicePopupLocation
+ */
+public final class ChoicePopupLocation {
+
+ private static final int SIZE = 350;
+
+ public static void main(final String[] args) throws Exception {
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice[] sds = ge.getScreenDevices();
+ Point left = null;
+ for (GraphicsDevice sd : sds) {
+ GraphicsConfiguration gc = sd.getDefaultConfiguration();
+ Rectangle bounds = gc.getBounds();
+ if (left == null || left.x > bounds.x) {
+ left = new Point(bounds.x, bounds.y + bounds.height / 2);
+ }
+
+ Point point = new Point(bounds.x, bounds.y);
+ Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
+ while (point.y < bounds.y + bounds.height - insets.bottom - SIZE ) {
+ while (point.x < bounds.x + bounds.width - insets.right - SIZE) {
+ test(point);
+ point.translate(bounds.width / 5, 0);
+ }
+ point.setLocation(bounds.x, point.y + bounds.height / 5);
+ }
+
+ }
+ if (left != null) {
+ left.translate(-50, 0);
+ test(left);
+ }
+ }
+
+ private static void test(final Point tmp) throws Exception {
+ Choice choice = new Choice();
+ for (int i = 1; i < 7; i++) {
+ choice.add("Long-long-long-long-long text in the item-" + i);
+ }
+ Frame frame = new Frame();
+ try {
+ frame.setAlwaysOnTop(true);
+ frame.setLayout(new FlowLayout());
+ frame.add(choice);
+ frame.pack();
+ frame.setSize(frame.getWidth(), SIZE);
+ frame.setVisible(true);
+ frame.setLocation(tmp.x, tmp.y);
+ openPopup(choice);
+ } finally {
+ frame.dispose();
+ }
+ }
+
+ private static void openPopup(final Choice choice) throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(100);
+ robot.setAutoWaitForIdle(true);
+ robot.waitForIdle();
+ Point pt = choice.getLocationOnScreen();
+ robot.mouseMove(pt.x + choice.getWidth() / 2,
+ pt.y + choice.getHeight() / 2);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ int x = pt.x + choice.getWidth() / 2;
+ int y = pt.y + choice.getHeight() / 2 + 70;
+ robot.mouseMove(x, y);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle();
+ if (choice.getSelectedIndex() == 0) {
+ throw new RuntimeException();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java Thu Mar 16 09:51:15 2017 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2017, 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.Color;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8175301
+ * @summary Java GUI hangs on Windows when Display set to 125%
+ * @run main/othervm -Dsun.java2d.uiScale=2 ScaledFrameBackgroundTest
+ * @run main/othervm -Dsun.java2d.uiScale=2 -Dsun.java2d.d3d=true ScaledFrameBackgroundTest
+ * @run main/othervm -Dsun.java2d.uiScale=2 -Dsun.java2d.opengl=true ScaledFrameBackgroundTest
+ */
+public class ScaledFrameBackgroundTest {
+
+ private static final Color BACKGROUND = Color.RED;
+ private static JFrame frame;
+
+ public static void main(String[] args) throws Exception {
+
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(() -> {
+ frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setSize(400, 300);
+ JPanel panel = new JPanel();
+ panel.setBackground(BACKGROUND);
+ frame.getContentPane().add(panel);
+ frame.setVisible(true);
+ });
+
+ robot.waitForIdle();
+ Thread.sleep(200);
+
+ Rectangle[] rects = new Rectangle[1];
+ SwingUtilities.invokeAndWait(() -> {
+ rects[0] = frame.getBounds();
+ });
+
+ Rectangle bounds = rects[0];
+
+ int x = bounds.x + bounds.width / 4;
+ int y = bounds.y + bounds.height / 4;
+
+ Color color = robot.getPixelColor(x, y);
+
+ if (!BACKGROUND.equals(color)) {
+ throw new RuntimeException("Wrong backgound color!");
+ }
+
+ x = bounds.x + 3 * bounds.width / 4;
+ y = bounds.y + 3 * bounds.height / 4;
+
+ color = robot.getPixelColor(x, y);
+
+ if (!BACKGROUND.equals(color)) {
+ throw new RuntimeException("Wrong backgound color!");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/SwingContainer/SwingContainerIsForContainerOnly/SwingContainerIsForContainerOnly.java Thu Mar 16 09:51:15 2017 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2017, 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.Container;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+
+import javax.swing.SwingContainer;
+
+/**
+ * @test
+ * @bug 8176177
+ */
+public final class SwingContainerIsForContainerOnly {
+
+ public static void main(String[] args) throws IOException {
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ fs.getFileStores();
+ Files.walkFileTree(fs.getPath("/modules/java.desktop"), new SimpleFileVisitor<>() {
+ @Override
+ public FileVisitResult visitFile(Path file,
+ BasicFileAttributes attrs) {
+ file = file.subpath(2, file.getNameCount());
+ String name = file.toString();
+ if (name.endsWith(".class")) {
+ name = name.substring(0, name.indexOf(".")).replace('/', '.');
+
+ final Class<?> type;
+ try {
+ type = Class.forName(name, false, null);
+ } catch (Throwable e) {
+ return FileVisitResult.CONTINUE;
+ }
+ if (type.isAnnotationPresent(SwingContainer.class)) {
+ if (!Container.class.isAssignableFrom(type)) {
+ System.err.println("Wrong annotation for: " + type);
+ throw new RuntimeException();
+ }
+ }
+ }
+ return FileVisitResult.CONTINUE;
+ };
+ });
+ }
+}
--- a/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/test/javax/swing/plaf/basic/BasicComboPopup/7072653/bug7072653.java Thu Mar 16 09:51:15 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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,77 +24,78 @@
/*
* @test
* @key headful
- * @bug 7072653 8144161
+ * @bug 7072653 8144161 8176448
* @summary JComboBox popup mispositioned if its height exceeds the screen height
* @run main bug7072653
*/
+
import java.awt.FlowLayout;
import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
import java.awt.Insets;
+import java.awt.Rectangle;
import java.awt.Robot;
-import javax.swing.event.PopupMenuEvent;
-import javax.swing.event.PopupMenuListener;
import java.awt.Toolkit;
import java.awt.Window;
-import java.util.Arrays;
+
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
public class bug7072653 {
private static JComboBox combobox;
private static JFrame frame;
private static Robot robot;
- private static volatile String errorString = "";
public static void main(String[] args) throws Exception {
robot = new Robot();
- robot.delay(100);
- UIManager.LookAndFeelInfo[] lookAndFeelArray
- = UIManager.getInstalledLookAndFeels();
- for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
- executeCase(lookAndFeelItem.getClassName());
- robot.delay(1000);
- }
- if (!"".equals(errorString)) {
-
- throw new RuntimeException("Error Log:\n" + errorString);
+ GraphicsEnvironment ge =
+ GraphicsEnvironment.getLocalGraphicsEnvironment();
+ UIManager.LookAndFeelInfo[] lookAndFeelArray =
+ UIManager.getInstalledLookAndFeels();
+ for (GraphicsDevice sd : ge.getScreenDevices()) {
+ for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
+ executeCase(lookAndFeelItem.getClassName(), sd);
+ robot.waitForIdle();
+ }
}
}
- private static void executeCase(String lookAndFeelString) throws Exception {
+ private static void executeCase(String lookAndFeelString, GraphicsDevice sd)
+ throws Exception {
if (tryLookAndFeel(lookAndFeelString)) {
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- try {
- setup(lookAndFeelString);
- test();
- } catch (Exception ex) {
- errorString += "\n";
- errorString += Arrays.toString(ex.getStackTrace());
- }
- finally {
- frame.dispose();
- }
+ SwingUtilities.invokeAndWait(() -> {
+ try {
+ setup(lookAndFeelString, sd);
+ test();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ } finally {
+ frame.dispose();
}
});
}
-
}
- private static void setup(String lookAndFeelString)
+ private static void setup(String lookAndFeelString, GraphicsDevice sd)
throws Exception {
+ GraphicsConfiguration gc = sd.getDefaultConfiguration();
+ Rectangle gcBounds = gc.getBounds();
+ frame = new JFrame("JComboBox Test " + lookAndFeelString, gc);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setSize(400, 200);
+ frame.getContentPane().setLayout(new FlowLayout());
+ frame.setLocation(
+ gcBounds.x + gcBounds.width / 2 - frame.getWidth() / 2,
+ gcBounds.y + gcBounds.height / 2 - frame.getHeight() / 2);
- frame = new JFrame("JComboBox Test " + lookAndFeelString);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setSize(320, 200);
- frame.getContentPane().setLayout(new FlowLayout());
- frame.setLocationRelativeTo(null);
combobox = new JComboBox(new DefaultComboBoxModel() {
@Override
public Object getElementAt(int index) {
@@ -108,6 +109,7 @@
});
combobox.setMaximumRowCount(100);
+ combobox.putClientProperty("JComboBox.isPopDown", true);
frame.getContentPane().add(combobox);
frame.setVisible(true);
combobox.addPopupMenuListener(new PopupMenuListener() {
@@ -120,30 +122,24 @@
int height = 0;
for (Window window : JFrame.getWindows()) {
if (Window.Type.POPUP == window.getType()) {
- height = window.getSize().height;
- break;
+ if (window.getOwner().isVisible()) {
+ height = window.getSize().height;
+ break;
+ }
}
}
- GraphicsConfiguration gc
- = combobox.getGraphicsConfiguration();
- Insets screenInsets = Toolkit.getDefaultToolkit()
- .getScreenInsets(gc);
+ GraphicsConfiguration gc = combobox.getGraphicsConfiguration();
+ Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
int gcHeight = gc.getBounds().height;
- if (lookAndFeelString.contains("aqua")) {
- gcHeight = gcHeight - screenInsets.top;
- //For Aqua LAF
- } else {
- gcHeight = gcHeight - screenInsets.top
- - screenInsets.bottom;
- }
+ gcHeight = gcHeight - insets.top - insets.bottom;
if (height == gcHeight) {
return;
}
String exception = "Popup window height "
+ "For LookAndFeel" + lookAndFeelString + " is wrong"
- + "\nShould be " + height + "Actually " + gcHeight;
- errorString += exception;
+ + "\nShould be " + gcHeight + ", Actually " + height;
+ throw new RuntimeException(exception);
}
@Override
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java Thu Mar 16 09:51:15 2017 -0700
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2017, 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 java.awt.FlowLayout;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.UIManager;
+
+/**
+ * @test
+ * @bug 8176448
+ * @run main/timeout=600 JComboBoxPopupLocation
+ */
+public final class JComboBoxPopupLocation {
+
+ private static final int SIZE = 300;
+ public static final String PROPERTY_NAME = "JComboBox.isPopDown";
+ private static volatile Robot robot;
+ private static volatile JComboBox<String> comboBox;
+ private static volatile JFrame frame;
+
+ public static void main(final String[] args) throws Exception {
+ robot = new Robot();
+ robot.setAutoDelay(100);
+ robot.setAutoWaitForIdle(true);
+ GraphicsEnvironment ge =
+ GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice[] sds = ge.getScreenDevices();
+ UIManager.LookAndFeelInfo[] lookAndFeelArray =
+ UIManager.getInstalledLookAndFeels();
+ for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
+ System.setProperty(PROPERTY_NAME, "true");
+ step(sds, lookAndFeelItem);
+ if (lookAndFeelItem.getClassName().contains("Aqua")) {
+ System.setProperty(PROPERTY_NAME, "false");
+ step(sds, lookAndFeelItem);
+ }
+ }
+ }
+
+ private static void step(GraphicsDevice[] sds,
+ UIManager.LookAndFeelInfo lookAndFeelItem)
+ throws Exception {
+ UIManager.setLookAndFeel(lookAndFeelItem.getClassName());
+ Point left = null;
+ for (final GraphicsDevice sd : sds) {
+ GraphicsConfiguration gc = sd.getDefaultConfiguration();
+ Rectangle bounds = gc.getBounds();
+ if (left == null || left.x > bounds.x) {
+ left = new Point(bounds.x, bounds.y + bounds.height / 2);
+ }
+ Point point = new Point(bounds.x, bounds.y);
+ Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
+ while (point.y < bounds.y + bounds.height - insets.bottom - SIZE ) {
+ while (point.x < bounds.x + bounds.width - insets.right - SIZE) {
+ try {
+ EventQueue.invokeAndWait(() -> {
+ setup(point);
+ });
+ robot.waitForIdle();
+ test(comboBox);
+ robot.waitForIdle();
+ validate(comboBox);
+ robot.waitForIdle();
+ point.translate(bounds.width / 5, 0);
+ } finally {
+ dispose();
+ }
+ }
+ point.setLocation(bounds.x, point.y + bounds.height / 5);
+ }
+ }
+ if (left != null) {
+ final Point finalLeft = left;
+ finalLeft.translate(-50, 0);
+ try {
+ EventQueue.invokeAndWait(() -> {
+ setup(finalLeft);
+ });
+ robot.waitForIdle();
+ test(comboBox);
+ robot.waitForIdle();
+ validate(comboBox);
+ } finally {
+ dispose();
+ }
+ }
+ }
+
+ private static void dispose() throws Exception {
+ EventQueue.invokeAndWait(() -> {
+ if (frame != null) {
+ frame.dispose();
+ }
+ });
+ }
+
+ private static void setup(final Point tmp) {
+ comboBox = new JComboBox<>();
+ for (int i = 1; i < 7; i++) {
+ comboBox.addItem("Long-long-long-long-long text in the item-" + i);
+ }
+ String property = System.getProperty(PROPERTY_NAME);
+ comboBox.putClientProperty(PROPERTY_NAME, Boolean.valueOf(property));
+ frame = new JFrame();
+ frame.setAlwaysOnTop(true);
+ frame.setLayout(new FlowLayout());
+ frame.add(comboBox);
+ frame.pack();
+ frame.setSize(frame.getWidth(), SIZE);
+ frame.setVisible(true);
+ frame.setLocation(tmp.x, tmp.y);
+ }
+
+ private static void test(final JComboBox comboBox) throws Exception {
+ Point pt = comboBox.getLocationOnScreen();
+ robot.mouseMove(pt.x + comboBox.getWidth() / 2,
+ pt.y + comboBox.getHeight() / 2);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ int x = pt.x + comboBox.getWidth() / 2;
+ int y = pt.y + comboBox.getHeight() / 2 + 70;
+ robot.mouseMove(x, y);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ }
+
+ private static void validate(final JComboBox comboBox) throws Exception {
+ EventQueue.invokeAndWait(() -> {
+ if (comboBox.getSelectedIndex() == 0) {
+ throw new RuntimeException();
+ }
+ });
+ }
+}
--- a/jdk/test/javax/swing/plaf/metal/MetalIcons/MetalHiDPIIconsTest.java Thu Mar 16 08:58:31 2017 -0700
+++ b/jdk/test/javax/swing/plaf/metal/MetalIcons/MetalHiDPIIconsTest.java Thu Mar 16 09:51:15 2017 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8160986
+ * @bug 8160986 8174845
* @summary Bad rendering of Swing UI controls with Metal L&F on HiDPI display
* @run main/manual MetalHiDPIIconsTest
*/
@@ -56,6 +56,8 @@
+ " - JCheckBox\n"
+ " - JComboBox\n"
+ " - JScrollPane (vertical and horizontal scroll bars)\n"
+ + " - JRadioButtonMenuItem\n"
+ + " - JCheckBoxMenuItem\n"
+ "and others...\n\n"
+ "If so, press PASS, else press FAIL.\n";