mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
Merge
This commit is contained in:
commit
a43f699f88
32 changed files with 708 additions and 120 deletions
|
@ -125,6 +125,26 @@ ifeq ($(PLATFORM), windows)
|
||||||
OTHER_LDLIBS += jli.lib
|
OTHER_LDLIBS += jli.lib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
# Applications expect to be able to link against libjawt without invoking
|
||||||
|
# System.loadLibrary("jawt") first. This was the behaviour described in the
|
||||||
|
# devloper documentation of JAWT and what worked with OpenJDK6.
|
||||||
|
#
|
||||||
|
ifeq ($(PLATFORM), solaris)
|
||||||
|
ifeq ($(ARCH_DATA_MODEL), 32)
|
||||||
|
LDFLAGS += -R \$$ORIGIN/../lib/$(LIBARCH)
|
||||||
|
LDFLAGS += -R \$$ORIGIN/../jre/lib/$(LIBARCH)
|
||||||
|
else # ! ARCH_DATA_MODEL 64-bit
|
||||||
|
LDFLAGS += -R \$$ORIGIN/../../lib/$(LIBARCH)
|
||||||
|
LDFLAGS += -R \$$ORIGIN/../../jre/lib/$(LIBARCH)
|
||||||
|
endif # ARCH_DATA_MODEL
|
||||||
|
endif # PLATFORM SOLARIS
|
||||||
|
ifeq ($(PLATFORM), linux)
|
||||||
|
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)
|
||||||
|
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)
|
||||||
|
endif # PLATFORM LINUX
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Launcher specific files.
|
# Launcher specific files.
|
||||||
#
|
#
|
||||||
|
|
|
@ -30,6 +30,13 @@ PRODUCT = sun
|
||||||
|
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
|
#
|
||||||
|
# libjawt links to other programs, but nothing links to it directly. An RPATH
|
||||||
|
# entry has been added to the launcher so third-party programs linked against
|
||||||
|
# it will be able to find it no matter where the JDK or the third-party program
|
||||||
|
# is located.
|
||||||
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# Files
|
# Files
|
||||||
#
|
#
|
||||||
|
|
|
@ -34,7 +34,7 @@ import javax.swing.plaf.ComponentUI;
|
||||||
|
|
||||||
import sun.lwawt.macosx.CMenuItem;
|
import sun.lwawt.macosx.CMenuItem;
|
||||||
|
|
||||||
class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
|
final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
|
||||||
ScreenMenuPropertyListener fListener;
|
ScreenMenuPropertyListener fListener;
|
||||||
JMenuItem fMenuItem;
|
JMenuItem fMenuItem;
|
||||||
|
|
||||||
|
@ -96,21 +96,31 @@ class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListen
|
||||||
fMenuItem.removeComponentListener(this);
|
fMenuItem.removeComponentListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccelerator(final KeyStroke ks) {
|
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
|
||||||
if (ks == null) {
|
final MenuComponentPeer peer = menuItem.getPeer();
|
||||||
setShortcut(null);
|
if (!(peer instanceof CMenuItem)) {
|
||||||
|
//Is it possible?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final CMenuItem cmi = (CMenuItem) peer;
|
||||||
final MenuComponentPeer peer = getPeer();
|
if (ks == null) {
|
||||||
if (peer instanceof CMenuItem) {
|
cmi.setLabel(label);
|
||||||
final CMenuItem ourPeer = (CMenuItem)peer;
|
|
||||||
ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers());
|
|
||||||
} else {
|
} else {
|
||||||
setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0));
|
cmi.setLabel(label, ks.getKeyChar(), ks.getKeyCode(),
|
||||||
|
ks.getModifiers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void setLabel(final String label) {
|
||||||
|
syncLabelAndKS(this, label, fMenuItem.getAccelerator());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAccelerator(final KeyStroke ks) {
|
||||||
|
syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||||
|
}
|
||||||
|
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
fMenuItem.doClick(0); // This takes care of all the different events
|
fMenuItem.doClick(0); // This takes care of all the different events
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
|
||||||
|
|
||||||
import sun.lwawt.macosx.*;
|
import sun.lwawt.macosx.*;
|
||||||
|
|
||||||
class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
|
final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
|
||||||
JMenuItem fMenuItem;
|
JMenuItem fMenuItem;
|
||||||
MenuContainer fParent;
|
MenuContainer fParent;
|
||||||
|
|
||||||
|
@ -110,19 +110,14 @@ class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener,
|
||||||
super.removeNotify();
|
super.removeNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccelerator(final KeyStroke ks) {
|
@Override
|
||||||
if (ks == null) {
|
public synchronized void setLabel(final String label) {
|
||||||
setShortcut(null);
|
ScreenMenuItem.syncLabelAndKS(this, label, fMenuItem.getAccelerator());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final MenuComponentPeer peer = getPeer();
|
@Override
|
||||||
if (peer instanceof CMenuItem) {
|
public void setAccelerator(final KeyStroke ks) {
|
||||||
final CMenuItem ourPeer = (CMenuItem)peer;
|
ScreenMenuItem.syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||||
ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers());
|
|
||||||
} else {
|
|
||||||
setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
|
|
|
@ -31,8 +31,12 @@ import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.GraphicsConfiguration;
|
||||||
|
import java.awt.GraphicsDevice;
|
||||||
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.ImageCapabilities;
|
import java.awt.ImageCapabilities;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.Transparency;
|
import java.awt.Transparency;
|
||||||
import java.awt.color.ColorSpace;
|
import java.awt.color.ColorSpace;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
@ -44,6 +48,7 @@ import java.awt.image.WritableRaster;
|
||||||
|
|
||||||
import sun.awt.CGraphicsConfig;
|
import sun.awt.CGraphicsConfig;
|
||||||
import sun.awt.CGraphicsDevice;
|
import sun.awt.CGraphicsDevice;
|
||||||
|
import sun.awt.TextureSizeConstraining;
|
||||||
import sun.awt.image.OffScreenImage;
|
import sun.awt.image.OffScreenImage;
|
||||||
import sun.awt.image.SunVolatileImage;
|
import sun.awt.image.SunVolatileImage;
|
||||||
import sun.awt.image.SurfaceManager;
|
import sun.awt.image.SurfaceManager;
|
||||||
|
@ -65,7 +70,7 @@ import sun.java2d.pipe.hw.AccelDeviceEventNotifier;
|
||||||
import sun.lwawt.macosx.CPlatformView;
|
import sun.lwawt.macosx.CPlatformView;
|
||||||
|
|
||||||
public class CGLGraphicsConfig extends CGraphicsConfig
|
public class CGLGraphicsConfig extends CGraphicsConfig
|
||||||
implements OGLGraphicsConfig
|
implements OGLGraphicsConfig, TextureSizeConstraining
|
||||||
{
|
{
|
||||||
//private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
|
//private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
|
||||||
private static final int kOpenGLSwapInterval = 0; // TODO
|
private static final int kOpenGLSwapInterval = 0; // TODO
|
||||||
|
@ -242,6 +247,8 @@ public class CGLGraphicsConfig extends CGraphicsConfig
|
||||||
} finally {
|
} finally {
|
||||||
rq.unlock();
|
rq.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateTotalDisplayBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -478,4 +485,50 @@ public class CGLGraphicsConfig extends CGraphicsConfig
|
||||||
public void removeDeviceEventListener(AccelDeviceEventListener l) {
|
public void removeDeviceEventListener(AccelDeviceEventListener l) {
|
||||||
AccelDeviceEventNotifier.removeListener(l);
|
AccelDeviceEventNotifier.removeListener(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Rectangle totalDisplayBounds = new Rectangle();
|
||||||
|
|
||||||
|
private static void updateTotalDisplayBounds() {
|
||||||
|
synchronized (totalDisplayBounds) {
|
||||||
|
Rectangle virtualBounds = new Rectangle();
|
||||||
|
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
|
||||||
|
for (GraphicsConfiguration gc : gd.getConfigurations()) {
|
||||||
|
virtualBounds = virtualBounds.union(gc.getBounds());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
totalDisplayBounds.setBounds(virtualBounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7160609: GL still fails to create a square texture of this size,
|
||||||
|
// so we use this value to cap the total display bounds.
|
||||||
|
native private static int getMaxTextureSize();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxTextureWidth() {
|
||||||
|
int width;
|
||||||
|
|
||||||
|
synchronized (totalDisplayBounds) {
|
||||||
|
if (totalDisplayBounds.width == 0) {
|
||||||
|
updateTotalDisplayBounds();
|
||||||
|
}
|
||||||
|
width = totalDisplayBounds.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.min(width, getMaxTextureSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxTextureHeight() {
|
||||||
|
int height;
|
||||||
|
|
||||||
|
synchronized (totalDisplayBounds) {
|
||||||
|
if (totalDisplayBounds.height == 0) {
|
||||||
|
updateTotalDisplayBounds();
|
||||||
|
}
|
||||||
|
height = totalDisplayBounds.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.min(height, getMaxTextureSize());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||||
* Note that we call setVisible() at the end of initialization.
|
* Note that we call setVisible() at the end of initialization.
|
||||||
*/
|
*/
|
||||||
public final void initialize() {
|
public final void initialize() {
|
||||||
platformComponent.initialize(target, this, getPlatformWindow());
|
platformComponent.initialize(getPlatformWindow());
|
||||||
initializeImpl();
|
initializeImpl();
|
||||||
setVisible(target.isVisible());
|
setVisible(target.isVisible());
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,6 +338,18 @@ public class LWWindowPeer
|
||||||
h = MINIMUM_HEIGHT;
|
h = MINIMUM_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (graphicsConfig instanceof TextureSizeConstraining) {
|
||||||
|
final int maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth();
|
||||||
|
final int maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight();
|
||||||
|
|
||||||
|
if (w > maxW) {
|
||||||
|
w = maxW;
|
||||||
|
}
|
||||||
|
if (h > maxH) {
|
||||||
|
h = maxH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Don't post ComponentMoved/Resized and Paint events
|
// Don't post ComponentMoved/Resized and Paint events
|
||||||
// until we've got a notification from the delegate
|
// until we've got a notification from the delegate
|
||||||
setBounds(x, y, w, h, op, false, false);
|
setBounds(x, y, w, h, op, false, false);
|
||||||
|
@ -405,14 +417,33 @@ public class LWWindowPeer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateMinimumSize() {
|
public void updateMinimumSize() {
|
||||||
Dimension d = null;
|
final Dimension min;
|
||||||
if (getTarget().isMinimumSizeSet()) {
|
if (getTarget().isMinimumSizeSet()) {
|
||||||
d = getTarget().getMinimumSize();
|
min = getTarget().getMinimumSize();
|
||||||
|
min.width = Math.max(min.width, MINIMUM_WIDTH);
|
||||||
|
min.height = Math.max(min.height, MINIMUM_HEIGHT);
|
||||||
|
} else {
|
||||||
|
min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
|
||||||
}
|
}
|
||||||
if (d == null) {
|
|
||||||
d = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
|
final int maxW, maxH;
|
||||||
|
if (graphicsConfig instanceof TextureSizeConstraining) {
|
||||||
|
maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth();
|
||||||
|
maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight();
|
||||||
|
} else {
|
||||||
|
maxW = maxH = Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
platformWindow.setMinimumSize(d.width, d.height);
|
|
||||||
|
final Dimension max;
|
||||||
|
if (getTarget().isMaximumSizeSet()) {
|
||||||
|
max = getTarget().getMaximumSize();
|
||||||
|
max.width = Math.min(max.width, maxW);
|
||||||
|
max.height = Math.min(max.height, maxH);
|
||||||
|
} else {
|
||||||
|
max = new Dimension(maxW, maxH);
|
||||||
|
}
|
||||||
|
|
||||||
|
platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,15 +23,38 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package sun.lwawt;
|
package sun.lwawt;
|
||||||
|
|
||||||
import java.awt.Component;
|
/**
|
||||||
|
* Can be used to store information about native resource related to the
|
||||||
|
* lightweight component.
|
||||||
|
*/
|
||||||
public interface PlatformComponent {
|
public interface PlatformComponent {
|
||||||
|
|
||||||
public void initialize(Component target, LWComponentPeer peer, PlatformWindow platformWindow);
|
/**
|
||||||
|
* Initializes platform component.
|
||||||
|
*
|
||||||
|
* @param platformWindow already initialized {@code PlatformWindow}.
|
||||||
|
*/
|
||||||
|
void initialize(PlatformWindow platformWindow);
|
||||||
|
|
||||||
public void setBounds(int x, int y, int w, int h);
|
/**
|
||||||
|
* Moves and resizes this component. The new location of the top-left corner
|
||||||
|
* is specified by {@code x} and {@code y}, and the new size is specified by
|
||||||
|
* {@code w} and {@code h}. The location is specified relative to the {@code
|
||||||
|
* platformWindow}.
|
||||||
|
*
|
||||||
|
* @param x the X location of the component
|
||||||
|
* @param y the Y location of the component
|
||||||
|
* @param w the width of the component
|
||||||
|
* @param h the height of the component
|
||||||
|
*/
|
||||||
|
void setBounds(int x, int y, int w, int h);
|
||||||
|
|
||||||
public void dispose();
|
/**
|
||||||
|
* Releases all of the native resources used by this {@code
|
||||||
|
* PlatformComponent}.
|
||||||
|
*/
|
||||||
|
void dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,10 @@ public interface PlatformWindow {
|
||||||
|
|
||||||
public void setResizable(boolean resizable);
|
public void setResizable(boolean resizable);
|
||||||
|
|
||||||
public void setMinimumSize(int width, int height);
|
/**
|
||||||
|
* Applies the minimum and maximum size to the platform window.
|
||||||
|
*/
|
||||||
|
public void setSizeConstraints(int minW, int minH, int maxW, int maxH);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms the given Graphics object according to the native
|
* Transforms the given Graphics object according to the native
|
||||||
|
|
|
@ -33,8 +33,8 @@ package sun.lwawt.macosx;
|
||||||
public class CFRetainedResource {
|
public class CFRetainedResource {
|
||||||
private static native void nativeCFRelease(final long ptr, final boolean disposeOnAppKitThread);
|
private static native void nativeCFRelease(final long ptr, final boolean disposeOnAppKitThread);
|
||||||
|
|
||||||
final boolean disposeOnAppKitThread;
|
private final boolean disposeOnAppKitThread;
|
||||||
protected long ptr;
|
protected volatile long ptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ptr CFRetained native object pointer
|
* @param ptr CFRetained native object pointer
|
||||||
|
|
|
@ -30,12 +30,14 @@ import java.awt.peer.*;
|
||||||
import java.awt.BufferCapabilities.FlipContents;
|
import java.awt.BufferCapabilities.FlipContents;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
|
import java.security.AccessController;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import sun.awt.CausedFocusEvent.Cause;
|
import sun.awt.CausedFocusEvent.Cause;
|
||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
import sun.java2d.pipe.Region;
|
import sun.java2d.pipe.Region;
|
||||||
|
import sun.security.action.GetBooleanAction;
|
||||||
|
|
||||||
class CFileDialog implements FileDialogPeer {
|
class CFileDialog implements FileDialogPeer {
|
||||||
|
|
||||||
|
@ -53,11 +55,14 @@ class CFileDialog implements FileDialogPeer {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
title = " ";
|
title = " ";
|
||||||
}
|
}
|
||||||
|
Boolean chooseDirectories = AccessController.doPrivileged(
|
||||||
|
new GetBooleanAction("apple.awt.fileDialogForDirectories"));
|
||||||
|
|
||||||
String[] userFileNames = nativeRunFileDialog(title,
|
String[] userFileNames = nativeRunFileDialog(title,
|
||||||
dialogMode,
|
dialogMode,
|
||||||
target.isMultipleMode(),
|
target.isMultipleMode(),
|
||||||
navigateApps,
|
navigateApps,
|
||||||
|
chooseDirectories,
|
||||||
target.getFilenameFilter() != null,
|
target.getFilenameFilter() != null,
|
||||||
target.getDirectory(),
|
target.getDirectory(),
|
||||||
target.getFile());
|
target.getFile());
|
||||||
|
@ -142,7 +147,8 @@ class CFileDialog implements FileDialogPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private native String[] nativeRunFileDialog(String title, int mode,
|
private native String[] nativeRunFileDialog(String title, int mode,
|
||||||
boolean multipleMode, boolean shouldNavigateApps, boolean hasFilenameFilter,
|
boolean multipleMode, boolean shouldNavigateApps,
|
||||||
|
boolean canChooseDirectories, boolean hasFilenameFilter,
|
||||||
String directory, String file);
|
String directory, String file);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,27 +23,24 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package sun.lwawt.macosx;
|
package sun.lwawt.macosx;
|
||||||
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
|
|
||||||
import sun.lwawt.PlatformComponent;
|
import sun.lwawt.PlatformComponent;
|
||||||
import sun.lwawt.PlatformWindow;
|
import sun.lwawt.PlatformWindow;
|
||||||
import sun.lwawt.LWComponentPeer;
|
|
||||||
|
|
||||||
import sun.lwawt.macosx.CFRetainedResource;
|
/**
|
||||||
|
* On OSX {@code CPlatformComponent} stores pointer to the native CAlayer which
|
||||||
|
* can be used from JAWT.
|
||||||
|
*/
|
||||||
|
final class CPlatformComponent extends CFRetainedResource
|
||||||
|
implements PlatformComponent {
|
||||||
|
|
||||||
public class CPlatformComponent extends CFRetainedResource implements PlatformComponent {
|
private volatile PlatformWindow platformWindow;
|
||||||
|
|
||||||
Component target;
|
CPlatformComponent() {
|
||||||
LWComponentPeer peer;
|
|
||||||
PlatformWindow platformWindow;
|
|
||||||
|
|
||||||
private native long nativeCreateComponent(long windowLayer);
|
|
||||||
private native long nativeSetBounds(long ptr, int x, int y, int width, int height);
|
|
||||||
|
|
||||||
public CPlatformComponent() {
|
|
||||||
super(0, true);
|
super(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,27 +48,28 @@ public class CPlatformComponent extends CFRetainedResource implements PlatformCo
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(Component target, LWComponentPeer peer, PlatformWindow platformWindow) {
|
@Override
|
||||||
this.target = target;
|
public void initialize(final PlatformWindow platformWindow) {
|
||||||
this.peer = peer;
|
|
||||||
this.platformWindow = platformWindow;
|
this.platformWindow = platformWindow;
|
||||||
|
setPtr(nativeCreateComponent(platformWindow.getLayerPtr()));
|
||||||
long windowLayerPtr = platformWindow.getLayerPtr();
|
|
||||||
setPtr(nativeCreateComponent(windowLayerPtr));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: visibility, z-order
|
// TODO: visibility, z-order
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBounds(int x, int y, int width, int height) {
|
public void setBounds(final int x, final int y, final int w, final int h) {
|
||||||
// translates values from the coordinate system of the top-level window
|
// translates values from the coordinate system of the top-level window
|
||||||
// to the coordinate system of the content view
|
// to the coordinate system of the content view
|
||||||
Insets insets = platformWindow.getPeer().getInsets();
|
final Insets insets = platformWindow.getPeer().getInsets();
|
||||||
nativeSetBounds(getPointer(), x - insets.left, y - insets.top, width, height);
|
nativeSetBounds(getPointer(), x - insets.left, y - insets.top, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native long nativeCreateComponent(long windowLayer);
|
||||||
|
|
||||||
|
private native void nativeSetBounds(long ptr, int x, int y, int w, int h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
|
||||||
public void setResizable(boolean resizable) {}
|
public void setResizable(boolean resizable) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMinimumSize(int width, int height) {}
|
public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Graphics transformGraphics(Graphics g) {
|
public Graphics transformGraphics(Graphics g) {
|
||||||
|
|
|
@ -672,20 +672,15 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||||
|
|
||||||
// Re-apply the size constraints and the size to ensure the space
|
// Re-apply the size constraints and the size to ensure the space
|
||||||
// occupied by the grow box is counted properly
|
// occupied by the grow box is counted properly
|
||||||
setMinimumSize(1, 1); // the method ignores its arguments
|
peer.updateMinimumSize();
|
||||||
|
|
||||||
Rectangle bounds = peer.getBounds();
|
Rectangle bounds = peer.getBounds();
|
||||||
setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
|
setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMinimumSize(int width, int height) {
|
public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
|
||||||
//TODO width, height should be used
|
nativeSetNSWindowMinMax(getNSWindowPtr(), minW, minH, maxW, maxH);
|
||||||
//NOTE: setResizable() calls setMinimumSize(1,1) relaying on the logic below
|
|
||||||
final long nsWindowPtr = getNSWindowPtr();
|
|
||||||
final Dimension min = target.getMinimumSize();
|
|
||||||
final Dimension max = target.getMaximumSize();
|
|
||||||
nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -78,11 +78,10 @@
|
||||||
|
|
||||||
// translates values to the coordinate system of the "root" layer
|
// translates values to the coordinate system of the "root" layer
|
||||||
CGFloat newY = windowLayer.bounds.size.height - rect.origin.y - rect.size.height;
|
CGFloat newY = windowLayer.bounds.size.height - rect.origin.y - rect.size.height;
|
||||||
|
CGRect newRect = CGRectMake(rect.origin.x, newY, rect.size.width, rect.size.height);
|
||||||
|
|
||||||
// REMIND: why do we need to inverse position?
|
layer.frame = newRect;
|
||||||
CGRect newRect = CGRectMake(-rect.origin.x, -newY, rect.size.width, rect.size.height);
|
|
||||||
|
|
||||||
layer.bounds = newRect;
|
|
||||||
[AWTSurfaceLayers repaintLayersRecursively:layer];
|
[AWTSurfaceLayers repaintLayersRecursively:layer];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,9 @@
|
||||||
// Should we navigate into apps?
|
// Should we navigate into apps?
|
||||||
BOOL fNavigateApps;
|
BOOL fNavigateApps;
|
||||||
|
|
||||||
|
// Can the dialog choose directories ?
|
||||||
|
BOOL fChooseDirectories;
|
||||||
|
|
||||||
// Contains the absolute paths of the selected files as URLs
|
// Contains the absolute paths of the selected files as URLs
|
||||||
NSArray *fURLs;
|
NSArray *fURLs;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +68,7 @@
|
||||||
mode:(jint)inMode
|
mode:(jint)inMode
|
||||||
multipleMode:(BOOL)inMultipleMode
|
multipleMode:(BOOL)inMultipleMode
|
||||||
shouldNavigate:(BOOL)inNavigateApps
|
shouldNavigate:(BOOL)inNavigateApps
|
||||||
|
canChooseDirectories:(BOOL)inChooseDirectories
|
||||||
withEnv:(JNIEnv*)env;
|
withEnv:(JNIEnv*)env;
|
||||||
|
|
||||||
// Invoked from the main thread
|
// Invoked from the main thread
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
mode:(jint)inMode
|
mode:(jint)inMode
|
||||||
multipleMode:(BOOL)inMultipleMode
|
multipleMode:(BOOL)inMultipleMode
|
||||||
shouldNavigate:(BOOL)inNavigateApps
|
shouldNavigate:(BOOL)inNavigateApps
|
||||||
|
canChooseDirectories:(BOOL)inChooseDirectories
|
||||||
withEnv:(JNIEnv*)env;
|
withEnv:(JNIEnv*)env;
|
||||||
{
|
{
|
||||||
if (self == [super init]) {
|
if (self == [super init]) {
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
fMode = inMode;
|
fMode = inMode;
|
||||||
fMultipleMode = inMultipleMode;
|
fMultipleMode = inMultipleMode;
|
||||||
fNavigateApps = inNavigateApps;
|
fNavigateApps = inNavigateApps;
|
||||||
|
fChooseDirectories = inChooseDirectories;
|
||||||
fPanelResult = NSCancelButton;
|
fPanelResult = NSCancelButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +111,7 @@
|
||||||
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
|
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
|
||||||
[openPanel setAllowsMultipleSelection:fMultipleMode];
|
[openPanel setAllowsMultipleSelection:fMultipleMode];
|
||||||
[openPanel setCanChooseFiles:YES];
|
[openPanel setCanChooseFiles:YES];
|
||||||
[openPanel setCanChooseDirectories:NO];
|
[openPanel setCanChooseDirectories:fChooseDirectories];
|
||||||
[openPanel setCanCreateDirectories:YES];
|
[openPanel setCanCreateDirectories:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +184,8 @@
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL
|
||||||
Java_sun_lwawt_macosx_CFileDialog_nativeRunFileDialog
|
Java_sun_lwawt_macosx_CFileDialog_nativeRunFileDialog
|
||||||
(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean multipleMode,
|
(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean multipleMode,
|
||||||
jboolean navigateApps, jboolean hasFilter, jstring directory, jstring file)
|
jboolean navigateApps, jboolean chooseDirectories, jboolean hasFilter,
|
||||||
|
jstring directory, jstring file)
|
||||||
{
|
{
|
||||||
jobjectArray returnValue = NULL;
|
jobjectArray returnValue = NULL;
|
||||||
|
|
||||||
|
@ -200,6 +203,7 @@ JNF_COCOA_ENTER(env);
|
||||||
mode:mode
|
mode:mode
|
||||||
multipleMode:multipleMode
|
multipleMode:multipleMode
|
||||||
shouldNavigate:navigateApps
|
shouldNavigate:navigateApps
|
||||||
|
canChooseDirectories:chooseDirectories
|
||||||
withEnv:env];
|
withEnv:env];
|
||||||
|
|
||||||
[JNFRunLoop performOnMainThread:@selector(safeSaveOrLoad)
|
[JNFRunLoop performOnMainThread:@selector(safeSaveOrLoad)
|
||||||
|
|
|
@ -447,3 +447,20 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getOGLCapabilities
|
||||||
return cglinfo->context->caps;
|
return cglinfo->context->caps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_sun_java2d_opengl_CGLGraphicsConfig_getMaxTextureSize
|
||||||
|
(JNIEnv *env, jclass cglgc)
|
||||||
|
{
|
||||||
|
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getMaxTextureSize");
|
||||||
|
|
||||||
|
__block int max = 0;
|
||||||
|
|
||||||
|
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
|
||||||
|
[sharedContext makeCurrentContext];
|
||||||
|
j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
|
||||||
|
}];
|
||||||
|
|
||||||
|
return (jint)max;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
@interface NSApplicationAWT : NSApplication {
|
@interface NSApplicationAWT : NSApplication {
|
||||||
NSString *fApplicationName;
|
NSString *fApplicationName;
|
||||||
BOOL fUseDefaultIcon;
|
|
||||||
NSWindow *eventTransparentWindow;
|
NSWindow *eventTransparentWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ BOOL postEventDuringEventSynthesis = NO;
|
||||||
|
|
||||||
AWT_ASSERT_APPKIT_THREAD;
|
AWT_ASSERT_APPKIT_THREAD;
|
||||||
fApplicationName = nil;
|
fApplicationName = nil;
|
||||||
fUseDefaultIcon = NO;
|
|
||||||
|
|
||||||
// NSApplication will call _RegisterApplication with the application's bundle, but there may not be one.
|
// NSApplication will call _RegisterApplication with the application's bundle, but there may not be one.
|
||||||
// So, we need to call it ourselves to ensure the app is set up properly.
|
// So, we need to call it ourselves to ensure the app is set up properly.
|
||||||
|
@ -147,10 +146,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||||
if (appName != NULL) {
|
if (appName != NULL) {
|
||||||
fApplicationName = [NSString stringWithUTF8String:appName];
|
fApplicationName = [NSString stringWithUTF8String:appName];
|
||||||
unsetenv(envVar);
|
unsetenv(envVar);
|
||||||
|
|
||||||
// If this environment variable was set we were launched from the command line, so we
|
|
||||||
// should use a generic app icon if one wasn't set.
|
|
||||||
fUseDefaultIcon = YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it wasn't specified as an argument, see if it was specified as a system property.
|
// If it wasn't specified as an argument, see if it was specified as a system property.
|
||||||
|
@ -171,9 +166,6 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||||
if (lastPeriod.location != NSNotFound) {
|
if (lastPeriod.location != NSNotFound) {
|
||||||
fApplicationName = [fApplicationName substringFromIndex:lastPeriod.location + 1];
|
fApplicationName = [fApplicationName substringFromIndex:lastPeriod.location + 1];
|
||||||
}
|
}
|
||||||
// If this environment variable was set we were launched from the command line, so we
|
|
||||||
// should use a generic app icon if one wasn't set.
|
|
||||||
fUseDefaultIcon = YES;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,9 +258,12 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||||
// If the icon file wasn't specified as an argument and we need to get an icon
|
// If the icon file wasn't specified as an argument and we need to get an icon
|
||||||
// we'll use the generic java app icon.
|
// we'll use the generic java app icon.
|
||||||
NSString *defaultIconPath = [NSString stringWithFormat:@"%@%@", SHARED_FRAMEWORK_BUNDLE, @"/Resources/GenericApp.icns"];
|
NSString *defaultIconPath = [NSString stringWithFormat:@"%@%@", SHARED_FRAMEWORK_BUNDLE, @"/Resources/GenericApp.icns"];
|
||||||
if (fUseDefaultIcon && (theIconPath == nil)) {
|
if (theIconPath == nil) {
|
||||||
|
NSString* bundleIcon = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIconFile"];
|
||||||
|
if (bundleIcon == nil) {
|
||||||
theIconPath = defaultIconPath;
|
theIconPath = defaultIconPath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set up the dock icon if we have an icon name.
|
// Set up the dock icon if we have an icon name.
|
||||||
if (theIconPath != nil) {
|
if (theIconPath != nil) {
|
||||||
|
|
|
@ -150,7 +150,7 @@ import sun.util.logging.PlatformLogger;
|
||||||
* import java.awt.event.*;
|
* import java.awt.event.*;
|
||||||
* import java.io.Serializable;
|
* import java.io.Serializable;
|
||||||
*
|
*
|
||||||
* class MyApp java.io.Serializable
|
* class MyApp implements java.io.Serializable
|
||||||
* {
|
* {
|
||||||
* BigObjectThatShouldNotBeSerializedWithAButton bigOne;
|
* BigObjectThatShouldNotBeSerializedWithAButton bigOne;
|
||||||
* Button aButton = new Button();
|
* Button aButton = new Button();
|
||||||
|
|
|
@ -36,6 +36,8 @@ import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
|
|
||||||
import java.util.EmptyStackException;
|
import java.util.EmptyStackException;
|
||||||
|
|
||||||
|
import sun.awt.dnd.SunDropTargetEvent;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
|
@ -464,7 +466,9 @@ public class EventQueue {
|
||||||
case MouseEvent.MOUSE_MOVED:
|
case MouseEvent.MOUSE_MOVED:
|
||||||
return MOVE;
|
return MOVE;
|
||||||
case MouseEvent.MOUSE_DRAGGED:
|
case MouseEvent.MOUSE_DRAGGED:
|
||||||
return DRAG;
|
// Return -1 for SunDropTargetEvent since they are usually synchronous
|
||||||
|
// and we don't want to skip them by coalescing with MouseEvent or other drag events
|
||||||
|
return e instanceof SunDropTargetEvent ? -1 : DRAG;
|
||||||
default:
|
default:
|
||||||
return e instanceof PeerEvent ? PEER : -1;
|
return e instanceof PeerEvent ? PEER : -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -657,7 +657,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
|
||||||
throw new IntrospectionException("bad write method arg count: "
|
throw new IntrospectionException("bad write method arg count: "
|
||||||
+ writeMethod);
|
+ writeMethod);
|
||||||
}
|
}
|
||||||
if (propertyType != null && propertyType != params[0]) {
|
if (propertyType != null && !params[0].isAssignableFrom(propertyType)) {
|
||||||
throw new IntrospectionException("type mismatch between read and write methods");
|
throw new IntrospectionException("type mismatch between read and write methods");
|
||||||
}
|
}
|
||||||
propertyType = params[0];
|
propertyType = params[0];
|
||||||
|
|
|
@ -8590,7 +8590,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
||||||
* <code>null</code> if this object is not on the screen
|
* <code>null</code> if this object is not on the screen
|
||||||
*/
|
*/
|
||||||
public Point getLocationOnScreen() {
|
public Point getLocationOnScreen() {
|
||||||
if (parent != null) {
|
if (parent != null && parent.isShowing()) {
|
||||||
Point parentLocation = parent.getLocationOnScreen();
|
Point parentLocation = parent.getLocationOnScreen();
|
||||||
Point componentLocation = getLocation();
|
Point componentLocation = getLocation();
|
||||||
componentLocation.translate(parentLocation.x, parentLocation.y);
|
componentLocation.translate(parentLocation.x, parentLocation.y);
|
||||||
|
@ -9391,7 +9391,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
||||||
* <code>null</code> if this object is not on the screen
|
* <code>null</code> if this object is not on the screen
|
||||||
*/
|
*/
|
||||||
public Point getLocationOnScreen() {
|
public Point getLocationOnScreen() {
|
||||||
if (parent != null) {
|
if (parent != null && parent.isShowing()) {
|
||||||
Point parentLocation = parent.getLocationOnScreen();
|
Point parentLocation = parent.getLocationOnScreen();
|
||||||
Point componentLocation = getLocation();
|
Point componentLocation = getLocation();
|
||||||
componentLocation.translate(parentLocation.x, parentLocation.y);
|
componentLocation.translate(parentLocation.x, parentLocation.y);
|
||||||
|
|
45
jdk/src/share/classes/sun/awt/TextureSizeConstraining.java
Normal file
45
jdk/src/share/classes/sun/awt/TextureSizeConstraining.java
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012, 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.awt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A GraphicsConfiguration implements the TextureSizeConstraining
|
||||||
|
* interface to indicate that it imposes certain limitations on the
|
||||||
|
* maximum size of supported textures.
|
||||||
|
*/
|
||||||
|
public interface TextureSizeConstraining {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the maximum width of any texture image.
|
||||||
|
*/
|
||||||
|
public int getMaxTextureWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the maximum height of any texture image.
|
||||||
|
*/
|
||||||
|
public int getMaxTextureHeight();
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -22,19 +22,28 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
@test
|
||||||
* @bug 4380468
|
@bug 7160609
|
||||||
* @summary JColorChooser's HSB panel should display all RGB digits
|
@summary A window with huge dimensions shouldn't crash JVM
|
||||||
* @author Andrey Pikalev
|
@author anthony.petrov@oracle.com: area=awt.toplevel
|
||||||
* @run applet/manual=yesno Test4380468.html
|
@run main HugeFrame
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.*;
|
||||||
import javax.swing.JApplet;
|
|
||||||
import javax.swing.JColorChooser;
|
|
||||||
|
|
||||||
public class Test4380468 extends JApplet {
|
public class HugeFrame {
|
||||||
public void init() {
|
public static void main(String[] args) throws Exception {
|
||||||
add(new JColorChooser(Color.GREEN));
|
Frame f = new Frame("Huge");
|
||||||
|
|
||||||
|
// 8193+ should already produce a crash, but let's go extreme...
|
||||||
|
f.setBounds(10, 10, 30000, 500000);
|
||||||
|
f.setVisible(true);
|
||||||
|
|
||||||
|
// We would crash by now if the bug wasn't fixed
|
||||||
|
Thread.sleep(1000);
|
||||||
|
System.err.println(f.getBounds());
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
f.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
64
jdk/test/java/beans/Introspector/Test7189112.java
Normal file
64
jdk/test/java/beans/Introspector/Test7189112.java
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012, 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 7189112
|
||||||
|
* @summary Tests overridden getter
|
||||||
|
* @author Sergey Malenkov
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.beans.IntrospectionException;
|
||||||
|
import java.beans.Introspector;
|
||||||
|
import java.beans.PropertyDescriptor;
|
||||||
|
|
||||||
|
public class Test7189112 {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IntrospectionException {
|
||||||
|
for (PropertyDescriptor pd : Introspector.getBeanInfo(MyBean.class).getPropertyDescriptors()) {
|
||||||
|
if (pd.getName().equals("value") && (null == pd.getWriteMethod())) {
|
||||||
|
throw new Error("The property setter is not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BaseBean {
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MyBean extends BaseBean {
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return (String) super.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
1. Click the HSB tab at the ColorChooser.
|
|
||||||
2. Click in the lower left corner of the gradient palette
|
|
||||||
in order to select a color such that all three RGB values
|
|
||||||
are single digit colors (such as 0, 0, 0 or 5, 3, 1).
|
|
||||||
3. Click another tab, then click back to the HSB tab.
|
|
||||||
4. Now click the lighter colors that should have
|
|
||||||
2 and 3 digit RGB values (in the upper right corner).
|
|
||||||
|
|
||||||
If all digits of each RGB value are shown then test passes.
|
|
||||||
If only the last digit of their values are shown then test fails.
|
|
||||||
|
|
||||||
<applet width="500" height="400" code="Test4380468.class">
|
|
||||||
</applet>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
47
jdk/test/javax/swing/JSplitPane/4201995/bug4201995.java
Normal file
47
jdk/test/javax/swing/JSplitPane/4201995/bug4201995.java
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012, 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 4201995
|
||||||
|
* @summary Tests that JSplitPane is opaque
|
||||||
|
* @author Scott Violet
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
public class bug4201995 {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
boolean expectedOpaqueValue = !"Nimbus".equals(UIManager.getLookAndFeel().getName());
|
||||||
|
JSplitPane sp = new JSplitPane();
|
||||||
|
|
||||||
|
if (sp.isOpaque() != expectedOpaqueValue) {
|
||||||
|
throw new RuntimeException("JSplitPane has incorrect default opaque value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
87
jdk/test/javax/swing/JTable/4235420/bug4235420.java
Normal file
87
jdk/test/javax/swing/JTable/4235420/bug4235420.java
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012 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 4235420
|
||||||
|
@summary Tests that JTable delays creating Renderers and Editors
|
||||||
|
@author Peter Zhelezniakov
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.table.TableCellEditor;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class bug4235420 {
|
||||||
|
|
||||||
|
public static void main(String[] argv) throws Exception {
|
||||||
|
if ("Nimbus".equals(UIManager.getLookAndFeel().getName())) {
|
||||||
|
System.out.println("The test is skipped for Nimbus");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Table table = new Table();
|
||||||
|
|
||||||
|
table.test();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Table extends JTable {
|
||||||
|
public void test() {
|
||||||
|
// Renderers
|
||||||
|
Class[] rendererClasses = {Object.class, Number.class, Date.class, ImageIcon.class, Boolean.class};
|
||||||
|
|
||||||
|
Map copy = new HashMap(defaultRenderersByColumnClass);
|
||||||
|
|
||||||
|
for (Class rendererClass : rendererClasses) {
|
||||||
|
Object obj = copy.get(rendererClass);
|
||||||
|
|
||||||
|
if (obj instanceof TableCellRenderer) {
|
||||||
|
throw new Error("Failed: TableCellRenderer created for " +
|
||||||
|
rendererClass.getClass().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Editors
|
||||||
|
Class[] editorClasses = {Object.class, Number.class, Boolean.class};
|
||||||
|
|
||||||
|
copy = new HashMap(defaultEditorsByColumnClass);
|
||||||
|
|
||||||
|
for (Class editorClass : editorClasses) {
|
||||||
|
Object obj = copy.get(editorClass);
|
||||||
|
|
||||||
|
if (obj instanceof TableCellEditor) {
|
||||||
|
throw new Error("Failed: TableCellEditor created for " +
|
||||||
|
editorClass.getClass().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Portions Copyright (c) 2012 IBM Corporation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @test
|
||||||
|
* @bug 7188612
|
||||||
|
* @summary AccessibleTableHeader and AccessibleJTableCell should stick to
|
||||||
|
* AccessibleComponent.getLocationOnScreen api.
|
||||||
|
* @author Frank Ding
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.accessibility.AccessibleComponent;
|
||||||
|
import javax.accessibility.AccessibleTable;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
public class JTableAccessibleGetLocationOnScreen {
|
||||||
|
private static JFrame frame;
|
||||||
|
private static JTable table;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
constructInEDT();
|
||||||
|
try {
|
||||||
|
assertGetLocation();
|
||||||
|
} finally {
|
||||||
|
frame.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void constructInEDT() {
|
||||||
|
String[] columnNames = { "col1", "col2", };
|
||||||
|
Object[][] data = { { "row1, col1", "row1, col2" },
|
||||||
|
{ "row2, col1", "row2, col2" }, };
|
||||||
|
|
||||||
|
frame = new JFrame(
|
||||||
|
"JTable AccessibleTableHeader and AccessibleJTableCell test");
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
table = new JTable(data, columnNames);
|
||||||
|
frame.add(table);
|
||||||
|
frame.pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void assertGetLocation() {
|
||||||
|
// the frame is now invisible
|
||||||
|
// test getLocationOnScreen() of
|
||||||
|
// JTable$AccessibleJTable$AccessibleJTableHeaderCell
|
||||||
|
// and JTable$AccessibleJTable$AccessibleJTableCell
|
||||||
|
AccessibleTable accessibleTable = (AccessibleTable) table
|
||||||
|
.getAccessibleContext();
|
||||||
|
AccessibleTable header = accessibleTable.getAccessibleColumnHeader();
|
||||||
|
AccessibleComponent accessibleComp1 = (AccessibleComponent) header
|
||||||
|
.getAccessibleAt(0, 0);
|
||||||
|
// getLocation() must be null according to its javadoc and no exception
|
||||||
|
// is thrown
|
||||||
|
if (null != accessibleComp1.getLocationOnScreen()) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"JTable$AccessibleJTable$AccessibleJTableHeaderCell."
|
||||||
|
+ "getLocation() must be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
JComponent.AccessibleJComponent accessibleJComponent =
|
||||||
|
(JComponent.AccessibleJComponent) table.getAccessibleContext();
|
||||||
|
AccessibleComponent accessibleComp2 = (AccessibleComponent)
|
||||||
|
accessibleJComponent.getAccessibleChild(3);
|
||||||
|
// getLocation() must be null according to its javadoc and no exception
|
||||||
|
// is thrown
|
||||||
|
if (null != accessibleComp2.getLocationOnScreen()) {
|
||||||
|
throw new RuntimeException("JTable$AccessibleJTable$"
|
||||||
|
+ "AccessibleJTableCell.getLocation() must be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
84
jdk/test/tools/launcher/RunpathTest.java
Normal file
84
jdk/test/tools/launcher/RunpathTest.java
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012, 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 7190813
|
||||||
|
* @summary Check for extended RPATHs on *nixes
|
||||||
|
* @compile -XDignore.symbol.file RunpathTest.java
|
||||||
|
* @run main RunpathTest
|
||||||
|
* @author ksrini
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class RunpathTest extends TestHelper {
|
||||||
|
|
||||||
|
final String elfreaderCmd;
|
||||||
|
RunpathTest() {
|
||||||
|
elfreaderCmd = findElfReader();
|
||||||
|
}
|
||||||
|
|
||||||
|
final String findElfReader() {
|
||||||
|
String[] paths = {"/bin", "/sbin", "/usr/bin", "/usr/sbin", "/usr/ccs/bin"};
|
||||||
|
final String cmd = isSolaris ? "elfdump" : "readelf";
|
||||||
|
for (String x : paths) {
|
||||||
|
File p = new File(x);
|
||||||
|
File e = new File(p, cmd);
|
||||||
|
if (e.canExecute()) {
|
||||||
|
return e.getAbsolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.err.println("Warning: no suitable elf reader!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void elfCheck(String javacmd, String expectedRpath) {
|
||||||
|
final TestResult tr = doExec(elfreaderCmd, "-d", javacmd);
|
||||||
|
if (!tr.matches(expectedRpath)) {
|
||||||
|
System.out.println(tr);
|
||||||
|
throw new RuntimeException("FAILED: RPATH strings " +
|
||||||
|
expectedRpath + " not found in " + javaCmd);
|
||||||
|
}
|
||||||
|
System.out.println(javacmd + " contains expected RPATHS");
|
||||||
|
}
|
||||||
|
|
||||||
|
void testRpath() {
|
||||||
|
if (isDualMode && is64Bit) {
|
||||||
|
String expectedRpath = ".*RPATH.*\\$ORIGIN/../../lib/" + getJreArch()
|
||||||
|
+ ":\\$ORIGIN/../../jre/lib/" + getJreArch() + ".*";
|
||||||
|
elfCheck(java64Cmd, expectedRpath);
|
||||||
|
} else {
|
||||||
|
String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch()
|
||||||
|
+ ":\\$ORIGIN/../jre/lib/" + getJreArch() + ".*";
|
||||||
|
elfCheck(javaCmd, expectedRpath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String... args) throws Exception {
|
||||||
|
if (isSolaris || isLinux) {
|
||||||
|
RunpathTest rp = new RunpathTest();
|
||||||
|
rp.testRpath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue