8032435: Cleanup of sun.awt.windows package

Reviewed-by: art, pchelko
This commit is contained in:
Sergey Bylokhov 2014-01-29 16:35:42 +04:00
parent 77f3079bed
commit a08bd102f7
51 changed files with 690 additions and 224 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,10 @@
package sun.awt.windows;
import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Point;
/**
@ -36,7 +39,8 @@ import java.awt.*;
*
* @author Leif Samuelsson
*/
public class ThemeReader {
public final class ThemeReader {
public static boolean isThemed() {
return false;
}
@ -84,16 +88,18 @@ public class ThemeReader {
public static Dimension getPartSize(String widget, int part, int state) {
return null;
}
public static long getThemeTransitionDuration(String widget, int part,
int stateFrom, int stateTo, int propId) {
return 0;
}
public static boolean isGetThemeTransitionDurationDefined() {
return false;
}
public static Insets getThemeBackgroundContentMargins(String widget,
int part, int state, int boundingWidth, int boundingHeight) {
return null;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,11 +25,15 @@
package sun.awt.windows;
import java.awt.*;
import java.util.*;
import java.util.concurrent.locks.*;
import java.beans.*;
import javax.swing.SwingUtilities;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Point;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/* !!!! WARNING !!!!
* This class has to be in sync with
@ -45,9 +49,9 @@ import javax.swing.SwingUtilities;
* @author Bino George
* @author Igor Kushnirskiy
*/
public class ThemeReader {
private static final HashMap<String, Long> widgetToTheme =
new HashMap<String, Long>();
public final class ThemeReader {
private static final Map<String, Long> widgetToTheme = new HashMap<>();
// lock for the cache
// reading should be done with readLock
@ -70,7 +74,7 @@ public class ThemeReader {
}
}
public native static boolean isThemed();
public static native boolean isThemed();
// this should be called only with writeLock held
private static Long getThemeImpl(String widget) {
@ -109,8 +113,9 @@ public class ThemeReader {
return theme;
}
public native static void paintBackground(int[] buffer, long theme, int part, int state,
int x, int y, int w, int h, int stride);
private static native void paintBackground(int[] buffer, long theme,
int part, int state, int x,
int y, int w, int h, int stride);
public static void paintBackground(int[] buffer, String widget,
int part, int state, int x, int y, int w, int h, int stride) {
@ -122,8 +127,8 @@ public class ThemeReader {
}
}
public native static Insets getThemeMargins(long theme, int part, int state,
int marginType);
private static native Insets getThemeMargins(long theme, int part,
int state, int marginType);
public static Insets getThemeMargins(String widget, int part, int state, int marginType) {
readLock.lock();
@ -134,7 +139,7 @@ public class ThemeReader {
}
}
private native static boolean isThemePartDefined(long theme, int part, int state);
private static native boolean isThemePartDefined(long theme, int part, int state);
public static boolean isThemePartDefined(String widget, int part, int state) {
readLock.lock();
@ -145,8 +150,8 @@ public class ThemeReader {
}
}
public native static Color getColor(long theme, int part, int state,
int property);
private static native Color getColor(long theme, int part, int state,
int property);
public static Color getColor(String widget, int part, int state, int property) {
readLock.lock();
@ -157,8 +162,8 @@ public class ThemeReader {
}
}
public native static int getInt(long theme, int part, int state,
int property);
private static native int getInt(long theme, int part, int state,
int property);
public static int getInt(String widget, int part, int state, int property) {
readLock.lock();
@ -169,8 +174,8 @@ public class ThemeReader {
}
}
public native static int getEnum(long theme, int part, int state,
int property);
private static native int getEnum(long theme, int part, int state,
int property);
public static int getEnum(String widget, int part, int state, int property) {
readLock.lock();
@ -181,8 +186,8 @@ public class ThemeReader {
}
}
public native static boolean getBoolean(long theme, int part, int state,
int property);
private static native boolean getBoolean(long theme, int part, int state,
int property);
public static boolean getBoolean(String widget, int part, int state,
int property) {
@ -194,7 +199,7 @@ public class ThemeReader {
}
}
public native static boolean getSysBoolean(long theme, int property);
private static native boolean getSysBoolean(long theme, int property);
public static boolean getSysBoolean(String widget, int property) {
readLock.lock();
@ -205,8 +210,8 @@ public class ThemeReader {
}
}
public native static Point getPoint(long theme, int part, int state,
int property);
private static native Point getPoint(long theme, int part, int state,
int property);
public static Point getPoint(String widget, int part, int state, int property) {
readLock.lock();
@ -217,8 +222,8 @@ public class ThemeReader {
}
}
public native static Dimension getPosition(long theme, int part, int state,
int property);
private static native Dimension getPosition(long theme, int part, int state,
int property);
public static Dimension getPosition(String widget, int part, int state,
int property) {
@ -230,7 +235,8 @@ public class ThemeReader {
}
}
public native static Dimension getPartSize(long theme, int part, int state);
private static native Dimension getPartSize(long theme, int part,
int state);
public static Dimension getPartSize(String widget, int part, int state) {
readLock.lock();
@ -241,14 +247,15 @@ public class ThemeReader {
}
}
public native static long openTheme(String widget);
private static native long openTheme(String widget);
public native static void closeTheme(long theme);
private static native void closeTheme(long theme);
public native static void setWindowTheme(String subAppName);
private static native void setWindowTheme(String subAppName);
private native static long getThemeTransitionDuration(long theme, int part,
private static native long getThemeTransitionDuration(long theme, int part,
int stateFrom, int stateTo, int propId);
public static long getThemeTransitionDuration(String widget, int part,
int stateFrom, int stateTo, int propId) {
readLock.lock();
@ -259,10 +266,12 @@ public class ThemeReader {
readLock.unlock();
}
}
public native static boolean isGetThemeTransitionDurationDefined();
private native static Insets getThemeBackgroundContentMargins(long theme,
public static native boolean isGetThemeTransitionDurationDefined();
private static native Insets getThemeBackgroundContentMargins(long theme,
int part, int state, int boundingWidth, int boundingHeight);
public static Insets getThemeBackgroundContentMargins(String widget,
int part, int state, int boundingWidth, int boundingHeight) {
readLock.lock();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,6 @@ import java.awt.Window;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.VolatileImage;
import java.lang.ref.WeakReference;
import java.security.AccessController;
import sun.awt.image.BufImgSurfaceData;
import sun.java2d.DestSurfaceProvider;
@ -46,7 +45,6 @@ import sun.java2d.pipe.hw.AccelSurface;
import sun.security.action.GetPropertyAction;
import static java.awt.image.VolatileImage.*;
import static java.awt.Transparency.*;
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ContextCapabilities.*;
@ -59,7 +57,7 @@ import static sun.java2d.pipe.hw.ContextCapabilities.*;
* Note: this class does not attempt to be thread safe, it is expected to be
* called from a single thread (EDT).
*/
public abstract class TranslucentWindowPainter {
abstract class TranslucentWindowPainter {
protected Window window;
protected WWindowPeer peer;
@ -231,6 +229,7 @@ public abstract class TranslucentWindowPainter {
return (viBB != null ? !viBB.contentsLost() : true);
}
@Override
public void flush() {
if (backBuffer != null) {
backBuffer.flush();
@ -313,6 +312,7 @@ public abstract class TranslucentWindowPainter {
try {
BufferedContext.validateContext(as);
rq.flushAndInvokeNow(new Runnable() {
@Override
public void run() {
long psdops = as.getNativeOps();
arr[0] = updateWindowAccel(psdops, w, h);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,8 +34,9 @@ import java.awt.Component;
* the back buffer associated with a Component. If that
* Component has a BufferStrategy with >1 buffer, then the
* Image subclass associated with that buffer will be returned.
* Note: the class is used by the JAWT3d.
*/
public class WBufferStrategy {
public final class WBufferStrategy {
private static native void initIDs(Class <?> componentClass);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,7 @@ final class WButtonPeer extends WComponentPeer implements ButtonPeer {
// ComponentPeer overrides
@Override
public Dimension getMinimumSize() {
FontMetrics fm = getFontMetrics(((Button)target).getFont());
String label = ((Button)target).getLabel();
@ -46,12 +47,14 @@ final class WButtonPeer extends WComponentPeer implements ButtonPeer {
return new Dimension(fm.stringWidth(label) + 14,
fm.getHeight() + 8);
}
@Override
public boolean isFocusable() {
return true;
}
// ButtonPeer implementation
@Override
public native void setLabel(String label);
// Toolkit & peer internals
@ -60,6 +63,7 @@ final class WButtonPeer extends WComponentPeer implements ButtonPeer {
super(target);
}
@Override
native void create(WComponentPeer peer);
// native callbacks
@ -70,6 +74,7 @@ final class WButtonPeer extends WComponentPeer implements ButtonPeer {
// Fixed 5064013: the InvocationEvent time should be equals
// the time of the ActionEvent
WToolkit.executeOnEventHandlerThread(target, new Runnable() {
@Override
public void run() {
postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
((Button)target).getActionCommand(),
@ -79,6 +84,7 @@ final class WButtonPeer extends WComponentPeer implements ButtonPeer {
}
@Override
public boolean shouldClearRectBeforePaint() {
return false;
}
@ -88,6 +94,7 @@ final class WButtonPeer extends WComponentPeer implements ButtonPeer {
*/
private static native void initIDs();
@Override
public boolean handleJavaKeyEvent(KeyEvent e) {
switch (e.getID()) {
case KeyEvent.KEY_RELEASED:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,12 +24,16 @@
*/
package sun.awt.windows;
import java.awt.*;
import java.awt.peer.*;
import java.lang.ref.WeakReference;
import sun.awt.SunToolkit;
import sun.awt.Win32GraphicsDevice;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.peer.CanvasPeer;
import sun.awt.PaintEventDispatcher;
import sun.awt.SunToolkit;
class WCanvasPeer extends WComponentPeer implements CanvasPeer {
@ -41,8 +45,10 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
super(target);
}
@Override
native void create(WComponentPeer parent);
@Override
void initialize() {
eraseBackground = !SunToolkit.getSunAwtNoerasebackground();
boolean eraseBackgroundOnResize = SunToolkit.getSunAwtErasebackgroundonresize();
@ -60,6 +66,7 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
}
}
@Override
public void paint(Graphics g) {
Dimension d = ((Component)target).getSize();
if (g instanceof Graphics2D ||
@ -75,6 +82,7 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
super.paint(g);
}
@Override
public boolean shouldClearRectBeforePaint() {
return eraseBackground;
}
@ -99,6 +107,7 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
private native void setNativeBackgroundErase(boolean doErase,
boolean doEraseOnResize);
@Override
public GraphicsConfiguration getAppropriateGraphicsConfiguration(
GraphicsConfiguration gc)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,14 +24,16 @@
*/
package sun.awt.windows;
import java.awt.*;
import java.awt.peer.*;
import java.awt.CheckboxMenuItem;
import java.awt.event.ItemEvent;
import java.awt.peer.CheckboxMenuItemPeer;
class WCheckboxMenuItemPeer extends WMenuItemPeer implements CheckboxMenuItemPeer {
final class WCheckboxMenuItemPeer extends WMenuItemPeer
implements CheckboxMenuItemPeer {
// CheckboxMenuItemPeer implementation
@Override
public native void setState(boolean t);
// Toolkit & peer internals
@ -46,6 +48,7 @@ class WCheckboxMenuItemPeer extends WMenuItemPeer implements CheckboxMenuItemPee
public void handleAction(final boolean state) {
final CheckboxMenuItem target = (CheckboxMenuItem)this.target;
WToolkit.executeOnEventHandlerThread(target, new Runnable() {
@Override
public void run() {
target.setState(state);
postEvent(new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,12 +32,16 @@ final class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
// CheckboxPeer implementation
@Override
public native void setState(boolean state);
@Override
public native void setCheckboxGroup(CheckboxGroup g);
@Override
public native void setLabel(String label);
private static native int getCheckMarkSize();
@Override
public Dimension getMinimumSize() {
String lbl = ((Checkbox)target).getLabel();
int marksize = getCheckMarkSize();
@ -54,6 +58,7 @@ final class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
Math.max(fm.getHeight() + 8, marksize));
}
@Override
public boolean isFocusable() {
return true;
}
@ -64,8 +69,10 @@ final class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
super(target);
}
@Override
native void create(WComponentPeer parent);
@Override
void initialize() {
Checkbox t = (Checkbox)target;
setState(t.getState());
@ -79,6 +86,7 @@ final class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
super.initialize();
}
@Override
public boolean shouldClearRectBeforePaint() {
return false;
}
@ -88,6 +96,7 @@ final class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
void handleAction(final boolean state) {
final Checkbox cb = (Checkbox)this.target;
WToolkit.executeOnEventHandlerThread(cb, new Runnable() {
@Override
public void run() {
CheckboxGroup chg = cb.getCheckboxGroup();
if ((chg != null) && (cb == chg.getSelectedCheckbox()) && cb.getState()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
// WComponentPeer overrides
@Override
public Dimension getMinimumSize() {
FontMetrics fm = getFontMetrics(((Choice)target).getFont());
Choice c = (Choice)target;
@ -45,23 +46,29 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
}
return new Dimension(28 + w, Math.max(fm.getHeight() + 6, 15));
}
@Override
public boolean isFocusable() {
return true;
}
// ChoicePeer implementation
@Override
public native void select(int index);
@Override
public void add(String item, int index) {
addItem(item, index);
}
@Override
public boolean shouldClearRectBeforePaint() {
return false;
}
@Override
public native void removeAll();
@Override
public native void remove(int index);
/**
@ -72,6 +79,7 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
}
public native void addItems(String[] items, int index);
@Override
public synchronized native void reshape(int x, int y, int width, int height);
private WindowListener windowListener;
@ -82,8 +90,10 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
super(target);
}
@Override
native void create(WComponentPeer parent);
@Override
@SuppressWarnings("deprecation")
void initialize() {
Choice opt = (Choice)target;
@ -104,9 +114,11 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
if (wpeer != null) {
windowListener = new WindowAdapter() {
@Override
public void windowIconified(WindowEvent e) {
closeList();
}
@Override
public void windowClosing(WindowEvent e) {
closeList();
}
@ -117,6 +129,7 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
super.initialize();
}
@Override
@SuppressWarnings("deprecation")
protected void disposeImpl() {
// TODO: we should somehow reset the listener when the choice
@ -136,6 +149,7 @@ final class WChoicePeer extends WComponentPeer implements ChoicePeer {
void handleAction(final int index) {
final Choice c = (Choice)target;
WToolkit.executeOnEventHandlerThread(c, new Runnable() {
@Override
public void run() {
c.select(index);
postEvent(new ItemEvent(c, ItemEvent.ITEM_STATE_CHANGED,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,14 +28,11 @@ package sun.awt.windows;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import sun.awt.datatransfer.SunClipboard;
import sun.awt.datatransfer.DataTransferer;
import sun.awt.datatransfer.SunClipboard;
/**
@ -50,18 +47,20 @@ import sun.awt.datatransfer.DataTransferer;
*
* @since JDK1.1
*/
public class WClipboard extends SunClipboard {
final class WClipboard extends SunClipboard {
private boolean isClipboardViewerRegistered;
public WClipboard() {
WClipboard() {
super("System");
}
@Override
public long getID() {
return 0;
}
@Override
protected void setContentsNative(Transferable contents) {
// Don't use delayed Clipboard rendering for the Transferable's data.
@ -107,6 +106,7 @@ public class WClipboard extends SunClipboard {
* Currently delayed data rendering is not used for the Windows clipboard,
* so there is no native context to clear.
*/
@Override
protected void clearNativeContext() {}
/**
@ -115,11 +115,13 @@ public class WClipboard extends SunClipboard {
*
* @throws IllegalStateException if the clipboard has not been opened
*/
@Override
public native void openClipboard(SunClipboard newOwner) throws IllegalStateException;
/**
* Call the Win32 CloseClipboard function if we have clipboard ownership,
* does nothing if we have not ownership.
*/
@Override
public native void closeClipboard();
/**
* Call the Win32 SetClipboardData function.
@ -131,9 +133,12 @@ public class WClipboard extends SunClipboard {
init();
}
@Override
protected native long[] getClipboardFormats();
@Override
protected native byte[] getClipboardData(long format) throws IOException;
@Override
protected void registerClipboardViewerChecked() {
if (!isClipboardViewerRegistered) {
registerClipboardViewer();
@ -148,6 +153,7 @@ public class WClipboard extends SunClipboard {
* until the toolkit window disposing since MSDN suggests removing
* the window from the clipboard viewer chain just before it is destroyed.
*/
@Override
protected void unregisterClipboardViewerChecked() {}
/**
@ -175,6 +181,7 @@ public class WClipboard extends SunClipboard {
*
* @since 1.5
*/
@Override
protected Transferable createLocaleTransferable(long[] formats) throws IOException {
boolean found = false;
for (int i = 0; i < formats.length; i++) {
@ -197,12 +204,15 @@ public class WClipboard extends SunClipboard {
final byte[] localeDataFinal = localeData;
return new Transferable() {
@Override
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] { DataTransferer.javaTextEncodingFlavor };
}
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return flavor.equals(DataTransferer.javaTextEncodingFlavor);
}
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
if (isDataFlavorSupported(flavor)) {
return localeDataFinal;
@ -211,5 +221,4 @@ public class WClipboard extends SunClipboard {
}
};
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@ import java.awt.Color;
/*
* This helper class maps Windows system colors to AWT Color objects.
*/
class WColor {
final class WColor {
static final int WINDOW_BKGND = 1; // COLOR_WINDOW
static final int WINDOW_TEXT = 2; // COLOR_WINDOWTEXT

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -93,7 +93,9 @@ public abstract class WComponentPeer extends WObjectPeer
private Color background;
private Font font;
@Override
public native boolean isObscured();
@Override
public boolean canDetermineObscurity() { return true; }
// DropTarget support
@ -101,19 +103,21 @@ public abstract class WComponentPeer extends WObjectPeer
int nDropTargets;
long nativeDropTargetContext; // native pointer
public synchronized native void pShow();
public synchronized native void hide();
public synchronized native void enable();
public synchronized native void disable();
private synchronized native void pShow();
synchronized native void hide();
synchronized native void enable();
synchronized native void disable();
public long getHWnd() {
return hwnd;
}
/* New 1.1 API */
@Override
public native Point getLocationOnScreen();
/* New 1.1 API */
@Override
public void setVisible(boolean b) {
if (b) {
show();
@ -130,6 +134,7 @@ public abstract class WComponentPeer extends WObjectPeer
}
/* New 1.1 API */
@Override
public void setEnabled(boolean b) {
if (b) {
enable();
@ -143,6 +148,7 @@ public abstract class WComponentPeer extends WObjectPeer
private native void reshapeNoCheck(int x, int y, int width, int height);
/* New 1.1 API */
@Override
public void setBounds(int x, int y, int width, int height, int op) {
// Should set paintPending before reahape to prevent
// thread race between paint events
@ -185,6 +191,7 @@ public abstract class WComponentPeer extends WObjectPeer
final Container cont = (Container)target;
WToolkit.executeOnEventHandlerThread(cont, new Runnable() {
@Override
public void run() {
// Discarding old paint events doesn't seem to be necessary.
cont.invalidate();
@ -228,6 +235,7 @@ public abstract class WComponentPeer extends WObjectPeer
native synchronized void updateWindow();
@Override
public void paint(Graphics g) {
((Component)target).paint(g);
}
@ -239,6 +247,7 @@ public abstract class WComponentPeer extends WObjectPeer
private native int[] createPrintedPixels(int srcX, int srcY,
int srcW, int srcH,
int alpha);
@Override
public void print(Graphics g) {
Component comp = (Component)target;
@ -275,6 +284,7 @@ public abstract class WComponentPeer extends WObjectPeer
comp.print(g);
}
@Override
public void coalescePaintEvent(PaintEvent e) {
Rectangle r = e.getUpdateRect();
if (!(e instanceof IgnorePaintEvent)) {
@ -319,6 +329,7 @@ public abstract class WComponentPeer extends WObjectPeer
native void nativeHandleEvent(AWTEvent e);
@Override
@SuppressWarnings("fallthrough")
public void handleEvent(AWTEvent e) {
int id = e.getID();
@ -367,21 +378,25 @@ public abstract class WComponentPeer extends WObjectPeer
native void setFocus(boolean doSetFocus);
@Override
public Dimension getMinimumSize() {
return ((Component)target).getSize();
}
@Override
public Dimension getPreferredSize() {
return getMinimumSize();
}
// Do nothing for heavyweight implementation
@Override
public void layout() {}
public Rectangle getBounds() {
return ((Component)target).getBounds();
}
@Override
public boolean isFocusable() {
return false;
}
@ -390,6 +405,7 @@ public abstract class WComponentPeer extends WObjectPeer
* Return the GraphicsConfiguration associated with this peer, either
* the locally stored winGraphicsConfig, or that of the target Component.
*/
@Override
public GraphicsConfiguration getGraphicsConfiguration() {
if (winGraphicsConfig != null) {
return winGraphicsConfig;
@ -481,6 +497,7 @@ public abstract class WComponentPeer extends WObjectPeer
public void replaceSurfaceDataLater() {
Runnable r = new Runnable() {
@Override
public void run() {
// Shouldn't do anything if object is disposed in meanwhile
// No need for sync as disposeAction in Window is performed
@ -501,6 +518,7 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
@Override
public boolean updateGraphicsData(GraphicsConfiguration gc) {
winGraphicsConfig = (Win32GraphicsConfig)gc;
try {
@ -512,6 +530,7 @@ public abstract class WComponentPeer extends WObjectPeer
}
//This will return null for Components not yet added to a Container
@Override
public ColorModel getColorModel() {
GraphicsConfiguration gc = getGraphicsConfiguration();
if (gc != null) {
@ -549,6 +568,7 @@ public abstract class WComponentPeer extends WObjectPeer
// fallback default font object
final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
@Override
@SuppressWarnings("deprecation")
public Graphics getGraphics() {
if (isDisposed()) {
@ -601,11 +621,13 @@ public abstract class WComponentPeer extends WObjectPeer
}
return null;
}
@Override
public FontMetrics getFontMetrics(Font font) {
return WFontMetrics.getFontMetrics(font);
}
private synchronized native void _dispose();
@Override
protected void disposeImpl() {
SurfaceData oldData = surfaceData;
surfaceData = null;
@ -618,17 +640,20 @@ public abstract class WComponentPeer extends WObjectPeer
public void disposeLater() {
postEvent(new InvocationEvent(target, new Runnable() {
@Override
public void run() {
dispose();
}
}));
}
@Override
public synchronized void setForeground(Color c) {
foreground = c;
_setForeground(c.getRGB());
}
@Override
public synchronized void setBackground(Color c) {
background = c;
_setBackground(c.getRGB());
@ -644,19 +669,22 @@ public abstract class WComponentPeer extends WObjectPeer
return background;
}
public native void _setForeground(int rgb);
public native void _setBackground(int rgb);
private native void _setForeground(int rgb);
private native void _setBackground(int rgb);
@Override
public synchronized void setFont(Font f) {
font = f;
_setFont(f);
}
public synchronized native void _setFont(Font f);
synchronized native void _setFont(Font f);
@Override
public void updateCursorImmediately() {
WGlobalCursorManager.getCursorManager().updateCursorImmediately();
}
// TODO: consider moving it to KeyboardFocusManagerPeerImpl
@Override
@SuppressWarnings("deprecation")
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
@ -720,24 +748,29 @@ public abstract class WComponentPeer extends WObjectPeer
return false;
}
@Override
public Image createImage(ImageProducer producer) {
return new ToolkitImage(producer);
}
@Override
public Image createImage(int width, int height) {
Win32GraphicsConfig gc =
(Win32GraphicsConfig)getGraphicsConfiguration();
return gc.createAcceleratedImage((Component)target, width, height);
}
@Override
public VolatileImage createVolatileImage(int width, int height) {
return new SunVolatileImage((Component)target, width, height);
}
@Override
public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
return Toolkit.getDefaultToolkit().prepareImage(img, w, h, o);
}
@Override
public int checkImage(Image img, int w, int h, ImageObserver o) {
return Toolkit.getDefaultToolkit().checkImage(img, w, h, o);
}
@ -891,6 +924,7 @@ public abstract class WComponentPeer extends WObjectPeer
* register a DropTarget with this native peer
*/
@Override
public synchronized void addDropTarget(DropTarget dt) {
if (nDropTargets == 0) {
nativeDropTargetContext = addNativeDropTarget();
@ -902,6 +936,7 @@ public abstract class WComponentPeer extends WObjectPeer
* unregister a DropTarget with this native peer
*/
@Override
public synchronized void removeDropTarget(DropTarget dt) {
nDropTargets--;
if (nDropTargets == 0) {
@ -924,6 +959,7 @@ public abstract class WComponentPeer extends WObjectPeer
native void removeNativeDropTarget();
native boolean nativeHandlesWheelScrolling();
@Override
public boolean handlesWheelScrolling() {
// should this be cached?
return nativeHandlesWheelScrolling();
@ -1001,6 +1037,7 @@ public abstract class WComponentPeer extends WObjectPeer
/**
* @see java.awt.peer.ComponentPeer#reparent
*/
@Override
public void reparent(ContainerPeer newNativeParent) {
pSetParent(newNativeParent);
}
@ -1008,6 +1045,7 @@ public abstract class WComponentPeer extends WObjectPeer
/**
* @see java.awt.peer.ComponentPeer#isReparentSupported
*/
@Override
public boolean isReparentSupported() {
return true;
}
@ -1081,6 +1119,7 @@ public abstract class WComponentPeer extends WObjectPeer
* Applies the shape to the native component window.
* @since 1.7
*/
@Override
@SuppressWarnings("deprecation")
public void applyShape(Region shape) {
if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
@ -1101,6 +1140,7 @@ public abstract class WComponentPeer extends WObjectPeer
* Lowers this component at the bottom of the above component. If the above parameter
* is null then the method places this component at the top of the Z-order.
*/
@Override
public void setZOrder(ComponentPeer above) {
long aboveHWND = (above != null) ? ((WComponentPeer)above).getHWnd() : 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,13 +38,14 @@ import sun.awt.image.ToolkitImage;
* @see Component#setCursor
* @author ThomasBall
*/
public class WCustomCursor extends CustomCursor {
final class WCustomCursor extends CustomCursor {
public WCustomCursor(Image cursor, Point hotSpot, String name)
WCustomCursor(Image cursor, Point hotSpot, String name)
throws IndexOutOfBoundsException {
super(cursor, hotSpot, name);
}
@Override
protected void createNativeCursor(Image im, int[] pixels, int w, int h,
int xHotSpot, int yHotSpot) {
BufferedImage bimage = new BufferedImage(w, h,

View File

@ -51,7 +51,6 @@ import java.awt.image.WritableRaster;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
@ -85,7 +84,7 @@ import java.io.ByteArrayOutputStream;
*
* @since 1.3.1
*/
public class WDataTransferer extends DataTransferer {
final class WDataTransferer extends DataTransferer {
private static final String[] predefinedClipboardNames = {
"",
"TEXT",
@ -166,6 +165,7 @@ public class WDataTransferer extends DataTransferer {
return transferer;
}
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
DataFlavor[] flavors, FlavorTable map)
{
@ -179,10 +179,12 @@ public class WDataTransferer extends DataTransferer {
return retval;
}
@Override
public String getDefaultUnicodeEncoding() {
return "utf-16le";
}
@Override
public byte[] translateTransferable(Transferable contents,
DataFlavor flavor,
long format) throws IOException
@ -220,6 +222,7 @@ public class WDataTransferer extends DataTransferer {
}
// The stream is closed as a closable object
@Override
public Object translateStream(InputStream str,
DataFlavor flavor, long format,
Transferable localeTransferable)
@ -235,6 +238,7 @@ public class WDataTransferer extends DataTransferer {
}
@Override
public Object translateBytes(byte[] bytes, DataFlavor flavor, long format,
Transferable localeTransferable) throws IOException
{
@ -282,14 +286,17 @@ public class WDataTransferer extends DataTransferer {
}
@Override
public boolean isLocaleDependentTextFormat(long format) {
return format == CF_TEXT || format == CFSTR_INETURL;
}
@Override
public boolean isFileFormat(long format) {
return format == CF_HDROP || format == CF_FILEGROUPDESCRIPTORA || format == CF_FILEGROUPDESCRIPTORW;
}
@Override
protected Long getFormatForNativeAsLong(String str) {
Long format = predefinedClipboardNameMap.get(str);
if (format == null) {
@ -298,6 +305,7 @@ public class WDataTransferer extends DataTransferer {
return format;
}
@Override
protected String getNativeForFormat(long format) {
return (format < predefinedClipboardNames.length)
? predefinedClipboardNames[(int)format]
@ -307,6 +315,7 @@ public class WDataTransferer extends DataTransferer {
private final ToolkitThreadBlockedHandler handler =
new WToolkitThreadBlockedHandler();
@Override
public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
return handler;
}
@ -323,12 +332,14 @@ public class WDataTransferer extends DataTransferer {
*/
private static native String getClipboardFormatName(long format);
@Override
public boolean isImageFormat(long format) {
return format == CF_DIB || format == CF_ENHMETAFILE ||
format == CF_METAFILEPICT || format == CF_PNG ||
format == CF_JFIF;
}
@Override
protected byte[] imageToPlatformBytes(Image image, long format)
throws IOException {
String mimeType = null;
@ -402,6 +413,7 @@ public class WDataTransferer extends DataTransferer {
private static final byte [] UNICODE_NULL_TERMINATOR = new byte [] {0,0};
@Override
protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList)
throws IOException
{
@ -439,6 +451,7 @@ public class WDataTransferer extends DataTransferer {
* Translates either a byte array or an input stream which contain
* platform-specific image data in the given format into an Image.
*/
@Override
protected Image platformImageBytesToImage(byte[] bytes, long format)
throws IOException {
String mimeType = null;
@ -478,12 +491,14 @@ public class WDataTransferer extends DataTransferer {
long format)
throws IOException;
@Override
protected native String[] dragQueryFile(byte[] bytes);
}
final class WToolkitThreadBlockedHandler extends Mutex
implements ToolkitThreadBlockedHandler {
@Override
public void enter() {
if (!isOwned()) {
throw new IllegalMonitorStateException();
@ -493,6 +508,7 @@ final class WToolkitThreadBlockedHandler extends Mutex
lock();
}
@Override
public void exit() {
if (!isOwned()) {
throw new IllegalMonitorStateException();
@ -876,6 +892,7 @@ class HTMLCodec extends InputStream {
descriptionParsed = true;
}
@Override
public synchronized int read() throws IOException {
if( closed ){
throw new IOException("Stream closed");
@ -896,6 +913,7 @@ class HTMLCodec extends InputStream {
return retval;
}
@Override
public synchronized void close() throws IOException {
if( !closed ){
closed = true;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@ package sun.awt.windows;
import java.nio.charset.*;
import sun.awt.AWTCharset;
public class WDefaultFontCharset extends AWTCharset
final class WDefaultFontCharset extends AWTCharset
{
static {
initIDs();
@ -36,22 +36,24 @@ public class WDefaultFontCharset extends AWTCharset
// Name for Windows FontSet.
private String fontName;
public WDefaultFontCharset(String name){
WDefaultFontCharset(String name){
super("WDefaultFontCharset", Charset.forName("windows-1252"));
fontName = name;
}
@Override
public CharsetEncoder newEncoder() {
return new Encoder();
}
private class Encoder extends AWTCharset.Encoder {
@Override
public boolean canEncode(char c){
return canConvert(c);
}
}
public synchronized native boolean canConvert(char ch);
private synchronized native boolean canConvert(char ch);
/**
* Initialize JNI field and method IDs

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,33 +39,39 @@ import java.net.URI;
*
* @see DesktopPeer
*/
public class WDesktopPeer implements DesktopPeer {
final class WDesktopPeer implements DesktopPeer {
/* Contants for the operation verbs */
private static String ACTION_OPEN_VERB = "open";
private static String ACTION_EDIT_VERB = "edit";
private static String ACTION_PRINT_VERB = "print";
@Override
public boolean isSupported(Action action) {
// OPEN, EDIT, PRINT, MAIL, BROWSE all supported on windows.
return true;
}
@Override
public void open(File file) throws IOException {
this.ShellExecute(file, ACTION_OPEN_VERB);
}
@Override
public void edit(File file) throws IOException {
this.ShellExecute(file, ACTION_EDIT_VERB);
}
@Override
public void print(File file) throws IOException {
this.ShellExecute(file, ACTION_PRINT_VERB);
}
@Override
public void mail(URI uri) throws IOException {
this.ShellExecute(uri, ACTION_OPEN_VERB);
}
@Override
public void browse(URI uri) throws IOException {
this.ShellExecute(uri, ACTION_OPEN_VERB);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ import sun.awt.SunToolkit;
* like the Windows Pluggable Look-and-Feel can better adapt
* itself when running on a Windows platform.
*/
class WDesktopProperties {
final class WDesktopProperties {
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WDesktopProperties");
private static final String PREFIX = "win.";
private static final String FILE_PREFIX = "awt.file.";
@ -210,6 +210,7 @@ class WDesktopProperties {
this.winEventName = winEventName;
}
@Override
public void run() {
WDesktopProperties.this.playWindowsSound(winEventName);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,14 +24,13 @@
*/
package sun.awt.windows;
import java.util.*;
import java.awt.*;
import java.awt.peer.*;
import sun.awt.*;
import sun.awt.im.*;
class WDialogPeer extends WWindowPeer implements DialogPeer {
final class WDialogPeer extends WWindowPeer implements DialogPeer {
// Toolkit & peer internals
// Platform default background for dialogs. Gets set on target if
@ -54,6 +53,7 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
}
native void createAwtDialog(WComponentPeer parent);
@Override
void create(WComponentPeer parent) {
preCreate(parent);
createAwtDialog(parent);
@ -62,6 +62,7 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
native void showModal();
native void endModal();
@Override
void initialize() {
Dialog target = (Dialog)this.target;
// Need to set target's background to default _before_ a call
@ -78,6 +79,7 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
setResizable(target.isResizable());
}
@Override
protected void realShow() {
Dialog dlg = (Dialog)target;
if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
@ -87,8 +89,9 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
}
}
@Override
@SuppressWarnings("deprecation")
public void hide() {
void hide() {
Dialog dlg = (Dialog)target;
if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
endModal();
@ -97,6 +100,7 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
}
}
@Override
public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@ -106,6 +110,7 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
}
}
@Override
public Dimension getMinimumSize() {
if (((Dialog)target).isUndecorated()) {
return super.getMinimumSize();
@ -119,6 +124,7 @@ class WDialogPeer extends WWindowPeer implements DialogPeer {
return ((Dialog)target).isUndecorated();
}
@Override
public void reshape(int x, int y, int width, int height) {
if (((Dialog)target).isUndecorated()) {
super.reshape(x, y, width, height);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -79,6 +79,7 @@ final class WDropTargetContextPeer extends SunDropTargetContextPeer {
return new WDropTargetContextPeerIStream(istream);
}
@Override
protected Object getNativeData(long format) {
return getData(getNativeDragContext(), format);
}
@ -87,14 +88,17 @@ final class WDropTargetContextPeer extends SunDropTargetContextPeer {
* signal drop complete
*/
@Override
protected void doDropDone(boolean success, int dropAction,
boolean isLocal) {
dropDone(getNativeDragContext(), success, dropAction);
}
@Override
protected void eventPosted(final SunDropTargetEvent e) {
if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
Runnable runnable = new Runnable() {
@Override
public void run() {
e.getDispatcher().unregisterAllEvents();
}
@ -124,7 +128,7 @@ final class WDropTargetContextPeer extends SunDropTargetContextPeer {
* package private class to handle file transfers
*/
class WDropTargetContextPeerFileStream extends FileInputStream {
final class WDropTargetContextPeerFileStream extends FileInputStream {
/**
* construct file input stream
@ -142,6 +146,7 @@ class WDropTargetContextPeerFileStream extends FileInputStream {
* close
*/
@Override
public void close() throws IOException {
if (stgmedium != 0) {
super.close();
@ -167,7 +172,7 @@ class WDropTargetContextPeerFileStream extends FileInputStream {
* Package private class to access IStream objects
*/
class WDropTargetContextPeerIStream extends InputStream {
final class WDropTargetContextPeerIStream extends InputStream {
/**
* construct a WDropTargetContextPeerIStream wrapper
@ -185,6 +190,7 @@ class WDropTargetContextPeerIStream extends InputStream {
* @return bytes available
*/
@Override
public int available() throws IOException {
if (istream == 0) throw new IOException("No IStream");
return Available(istream);
@ -196,6 +202,7 @@ class WDropTargetContextPeerIStream extends InputStream {
* read
*/
@Override
public int read() throws IOException {
if (istream == 0) throw new IOException("No IStream");
return Read(istream);
@ -207,6 +214,7 @@ class WDropTargetContextPeerIStream extends InputStream {
* read into buffer
*/
@Override
public int read(byte[] b, int off, int len) throws IOException {
if (istream == 0) throw new IOException("No IStream");
return ReadBytes(istream, b, off, len);
@ -218,6 +226,7 @@ class WDropTargetContextPeerIStream extends InputStream {
* close
*/
@Override
public void close() throws IOException {
if (istream != 0) {
super.close();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -203,11 +203,11 @@ public class WEmbeddedFrame extends EmbeddedFrame {
}
protected native boolean isPrinterDC(long hdc);
private native boolean isPrinterDC(long hdc);
protected native void printBand(long hdc, byte[] data, int offset,
int sx, int sy, int swidth, int sheight,
int dx, int dy, int dwidth, int dheight);
private native void printBand(long hdc, byte[] data, int offset, int sx,
int sy, int swidth, int sheight, int dx,
int dy, int dwidth, int dheight);
/**
* Initialize JNI field IDs

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,12 +38,15 @@ public class WEmbeddedFramePeer extends WFramePeer {
super(target);
}
@Override
native void create(WComponentPeer parent);
// suppress printing of an embedded frame.
@Override
public void print(Graphics g) {}
// supress calling native setMinSize()
@Override
public void updateMinimumSize() {}
@Override
@ -59,10 +62,12 @@ public class WEmbeddedFramePeer extends WFramePeer {
((EmbeddedFrame)target).notifyModalBlocked(blocker, false);
}
@Override
public void setBoundsPrivate(int x, int y, int width, int height) {
setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK);
}
@Override
public native Rectangle getBoundsPrivate();
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,11 +34,10 @@ import java.security.PrivilegedAction;
import java.util.ResourceBundle;
import java.util.MissingResourceException;
import java.util.Vector;
import sun.awt.AppContext;
import sun.awt.CausedFocusEvent;
import sun.awt.AWTAccessor;
public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
static {
initIDs();
@ -47,11 +46,12 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
private WComponentPeer parent;
private FilenameFilter fileFilter;
private Vector<WWindowPeer> blockedWindows = new Vector<WWindowPeer>();
private Vector<WWindowPeer> blockedWindows = new Vector<>();
//Needed to fix 4152317
private static native void setFilterString(String allFilter);
@Override
public void setFilenameFilter(FilenameFilter filter) {
this.fileFilter = filter;
}
@ -70,19 +70,23 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
super(target);
}
@Override
void create(WComponentPeer parent) {
this.parent = parent;
}
// don't use checkCreation() from WComponentPeer to avoid hwnd check
@Override
protected void checkCreation() {
}
@Override
void initialize() {
setFilenameFilter(((FileDialog) target).getFilenameFilter());
}
private native void _dispose();
@Override
protected void disposeImpl() {
WToolkit.targetDisposedPeer(target, this);
_dispose();
@ -91,15 +95,18 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
private native void _show();
private native void _hide();
@Override
public void show() {
new Thread(new Runnable() {
@Override
public void run() {
_show();
}
}).start();
}
public void hide() {
@Override
void hide() {
_hide();
}
@ -169,6 +176,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
fileDialogAccessor.setFiles(fileDialog, jFiles);
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
@Override
public void run() {
fileDialog.setVisible(false);
}
@ -185,6 +193,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
AWTAccessor.getFileDialogAccessor().setDirectory(fileDialog, null);
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
@Override
public void run() {
fileDialog.setVisible(false);
}
@ -195,6 +204,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
static {
String filterString = AccessController.doPrivileged(
new PrivilegedAction<String>() {
@Override
public String run() {
try {
ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
@ -224,6 +234,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
}
}
@Override
public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@ -233,31 +244,47 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
}
}
@Override
public native void toFront();
@Override
public native void toBack();
// unused methods. Overridden to disable this functionality as
// it requires HWND which is not available for FileDialog
@Override
public void updateAlwaysOnTopState() {}
@Override
public void setDirectory(String dir) {}
@Override
public void setFile(String file) {}
@Override
public void setTitle(String title) {}
@Override
public void setResizable(boolean resizable) {}
public void enable() {}
public void disable() {}
@Override
void enable() {}
@Override
void disable() {}
@Override
public void reshape(int x, int y, int width, int height) {}
public boolean handleEvent(Event e) { return false; }
@Override
public void setForeground(Color c) {}
@Override
public void setBackground(Color c) {}
@Override
public void setFont(Font f) {}
@Override
public void updateMinimumSize() {}
@Override
public void updateIconImages() {}
public boolean requestFocus(boolean temporary,
boolean focusedWindowChangeAllowed) {
return false;
}
@Override
public boolean requestFocus
(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
@ -265,13 +292,20 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
return false;
}
@Override
void start() {}
@Override
public void beginValidate() {}
@Override
public void endValidate() {}
void invalidate(int x, int y, int width, int height) {}
@Override
public void addDropTarget(DropTarget dt) {}
@Override
public void removeDropTarget(DropTarget dt) {}
@Override
public void updateFocusableWindowState() {}
@Override
public void setZOrder(ComponentPeer above) {}
/**
@ -280,8 +314,11 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
private static native void initIDs();
// The effects are not supported for system dialogs.
@Override
public void applyShape(sun.java2d.pipe.Region shape) {}
@Override
public void setOpacity(float opacity) {}
@Override
public void setOpaque(boolean isOpaque) {}
public void updateWindow(java.awt.image.BufferedImage backBuffer) {}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,12 +29,10 @@ import java.util.HashMap;
import java.util.Hashtable;
import sun.awt.FontDescriptor;
import sun.awt.FontConfiguration;
import sun.font.FontManager;
import sun.font.SunFontManager;
import sun.java2d.SunGraphicsEnvironment;
import java.nio.charset.*;
public class WFontConfiguration extends FontConfiguration {
public final class WFontConfiguration extends FontConfiguration {
// whether compatibility fallbacks for TimesRoman and Co. are used
private boolean useCompatibilityFallbacks;
@ -52,6 +50,7 @@ public class WFontConfiguration extends FontConfiguration {
useCompatibilityFallbacks = "windows-1252".equals(encoding);
}
@Override
protected void initReorderMap() {
if (encoding.equalsIgnoreCase("windows-31j")) {
localeMap = new Hashtable();
@ -81,6 +80,7 @@ public class WFontConfiguration extends FontConfiguration {
// reorderMap.put("windows-1252", "alphabetic");
}
@Override
protected void setOsNameAndVersion(){
super.setOsNameAndVersion();
if (osName.startsWith("Windows")){
@ -103,6 +103,7 @@ public class WFontConfiguration extends FontConfiguration {
}
// overrides FontConfiguration.getFallbackFamilyName
@Override
public String getFallbackFamilyName(String fontName, String defaultFallback) {
// maintain compatibility with old font.properties files, where
// default file had aliases for timesroman & Co, while others didn't.
@ -115,6 +116,7 @@ public class WFontConfiguration extends FontConfiguration {
return defaultFallback;
}
@Override
protected String makeAWTFontName(String platformFontName, String characterSubsetName) {
String windowsCharset = (String) subsetCharsetMap.get(characterSubsetName);
if (windowsCharset == null) {
@ -123,6 +125,7 @@ public class WFontConfiguration extends FontConfiguration {
return platformFontName + "," + windowsCharset;
}
@Override
protected String getEncoding(String awtFontName, String characterSubsetName) {
String encoding = (String) subsetEncodingMap.get(characterSubsetName);
if (encoding == null) {
@ -131,15 +134,18 @@ public class WFontConfiguration extends FontConfiguration {
return encoding;
}
@Override
protected Charset getDefaultFontCharset(String fontName) {
return new WDefaultFontCharset(fontName);
}
@Override
public String getFaceNameFromComponentFontName(String componentFontName) {
// for Windows, the platform name is the face name
return componentFontName;
}
@Override
protected String getFileNameFromComponentFontName(String componentFontName) {
return getFileNameFromPlatformName(componentFontName);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ import java.util.Hashtable;
*
* @author Jim Graham
*/
class WFontMetrics extends FontMetrics {
final class WFontMetrics extends FontMetrics {
static {
initIDs();
@ -117,6 +117,7 @@ class WFontMetrics extends FontMetrics {
/**
* Get leading
*/
@Override
public int getLeading() {
return leading;
}
@ -124,6 +125,7 @@ class WFontMetrics extends FontMetrics {
/**
* Get ascent.
*/
@Override
public int getAscent() {
return ascent;
}
@ -131,6 +133,7 @@ class WFontMetrics extends FontMetrics {
/**
* Get descent
*/
@Override
public int getDescent() {
return descent;
}
@ -138,6 +141,7 @@ class WFontMetrics extends FontMetrics {
/**
* Get height
*/
@Override
public int getHeight() {
return height;
}
@ -145,6 +149,7 @@ class WFontMetrics extends FontMetrics {
/**
* Get maxAscent
*/
@Override
public int getMaxAscent() {
return maxAscent;
}
@ -152,6 +157,7 @@ class WFontMetrics extends FontMetrics {
/**
* Get maxDescent
*/
@Override
public int getMaxDescent() {
return maxDescent;
}
@ -159,6 +165,7 @@ class WFontMetrics extends FontMetrics {
/**
* Get maxAdvance
*/
@Override
public int getMaxAdvance() {
return maxAdvance;
}
@ -166,21 +173,25 @@ class WFontMetrics extends FontMetrics {
/**
* Return the width of the specified string in this Font.
*/
@Override
public native int stringWidth(String str);
/**
* Return the width of the specified char[] in this Font.
*/
@Override
public native int charsWidth(char data[], int off, int len);
/**
* Return the width of the specified byte[] in this Font.
*/
@Override
public native int bytesWidth(byte data[], int off, int len);
/**
* Get the widths of the first 256 characters in the font.
*/
@Override
public int[] getWidths() {
return widths;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@ package sun.awt.windows;
import sun.awt.PlatformFont;
public class WFontPeer extends PlatformFont {
final class WFontPeer extends PlatformFont {
private String textComponentFontName;
@ -38,6 +38,7 @@ public class WFontPeer extends PlatformFont {
}
}
@Override
protected char getMissingGlyphCharacter() {
return '\u2751';
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,7 +41,9 @@ class WFramePeer extends WWindowPeer implements FramePeer {
private static native void initIDs();
// FramePeer implementation
@Override
public native void setState(int state);
@Override
public native int getState();
// sync target and peer
@ -62,6 +64,7 @@ class WFramePeer extends WWindowPeer implements FramePeer {
new GetPropertyAction(
"sun.awt.keepWorkingSetOnMinimize")));
@Override
public void setMaximizedBounds(Rectangle b) {
if (b == null) {
clearMaximizedBounds();
@ -123,6 +126,7 @@ class WFramePeer extends WWindowPeer implements FramePeer {
return ((Frame)target).isUndecorated();
}
@Override
public void reshape(int x, int y, int width, int height) {
if (((Frame)target).isUndecorated()) {
super.reshape(x, y, width, height);
@ -131,6 +135,7 @@ class WFramePeer extends WWindowPeer implements FramePeer {
}
}
@Override
public Dimension getMinimumSize() {
Dimension d = new Dimension();
if (!((Frame)target).isUndecorated()) {
@ -145,6 +150,7 @@ class WFramePeer extends WWindowPeer implements FramePeer {
// Note: Because this method calls resize(), which may be overridden
// by client code, this method must not be executed on the toolkit
// thread.
@Override
public void setMenuBar(MenuBar mb) {
WMenuBarPeer mbPeer = (WMenuBarPeer) WToolkit.targetToPeer(mb);
setMenuBar0(mbPeer);
@ -170,11 +176,13 @@ class WFramePeer extends WWindowPeer implements FramePeer {
}
native void createAwtFrame(WComponentPeer parent);
@Override
void create(WComponentPeer parent) {
preCreate(parent);
createAwtFrame(parent);
}
@Override
void initialize() {
super.initialize();
@ -194,14 +202,17 @@ class WFramePeer extends WWindowPeer implements FramePeer {
InputMethodManager.getInstance().notifyChangeRequest((Component)target);
}
@Override
public void setBoundsPrivate(int x, int y, int width, int height) {
setBounds(x, y, width, height, SET_BOUNDS);
}
@Override
public Rectangle getBoundsPrivate() {
return getBounds();
}
// TODO: implement it in peers. WLightweightFramePeer may implement lw version.
@Override
public void emulateActivation(boolean activate) {
synthesizeWmActivate(activate);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ package sun.awt.windows;
import java.awt.*;
import sun.awt.GlobalCursorManager;
public final class WGlobalCursorManager extends GlobalCursorManager {
final class WGlobalCursorManager extends GlobalCursorManager {
private static WGlobalCursorManager manager;
public static GlobalCursorManager getCursorManager() {
@ -46,12 +46,16 @@ public final class WGlobalCursorManager extends GlobalCursorManager {
WGlobalCursorManager.getCursorManager().updateCursorLater(heavy);
}
@Override
protected native void setCursor(Component comp, Cursor cursor, boolean u);
@Override
protected native void getCursorPos(Point p);
/*
* two native methods to call corresponding methods in Container and
* Component
*/
@Override
protected native Component findHeavyweightUnderCursor(boolean useCache);
@Override
protected native Point getLocationOnScreen(Component com);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,7 +42,7 @@ import java.util.Locale;
import java.util.Map;
import sun.awt.im.InputMethodAdapter;
public class WInputMethod extends InputMethodAdapter
final class WInputMethod extends InputMethodAdapter
{
/**
* The input method context, which is used to dispatch input method
@ -127,6 +127,7 @@ public class WInputMethod extends InputMethodAdapter
}
}
@Override
protected void finalize() throws Throwable
{
// Release the resources used by the native input context.
@ -137,10 +138,12 @@ public class WInputMethod extends InputMethodAdapter
super.finalize();
}
@Override
public synchronized void setInputMethodContext(InputMethodContext context) {
inputContext = context;
}
@Override
public final void dispose() {
// Due to a memory management problem in Windows 98, we should retain
// the native input context until this object is finalized. So do
@ -152,10 +155,12 @@ public class WInputMethod extends InputMethodAdapter
*
* @see java.awt.im.spi.InputMethod#getControlObject
*/
@Override
public Object getControlObject() {
return null;
}
@Override
public boolean setLocale(Locale lang) {
return setLocale(lang, false);
}
@ -178,6 +183,7 @@ public class WInputMethod extends InputMethodAdapter
return false;
}
@Override
public Locale getLocale() {
if (isActive) {
currentLocale = getNativeLocale();
@ -193,6 +199,7 @@ public class WInputMethod extends InputMethodAdapter
*
* @see java.awt.im.spi.InputMethod#setCharacterSubsets
*/
@Override
public void setCharacterSubsets(Subset[] subsets) {
if (subsets == null){
setConversionStatus(context, cmode);
@ -266,6 +273,7 @@ public class WInputMethod extends InputMethodAdapter
}
}
@Override
public void dispatchEvent(AWTEvent e) {
if (e instanceof ComponentEvent) {
Component comp = ((ComponentEvent) e).getComponent();
@ -281,6 +289,7 @@ public class WInputMethod extends InputMethodAdapter
}
}
@Override
public void activate() {
boolean isAc = haveActiveClient();
@ -317,6 +326,7 @@ public class WInputMethod extends InputMethodAdapter
}
@Override
public void deactivate(boolean isTemporary)
{
// Sync currentLocale with the Windows keyboard layout which might be changed
@ -336,6 +346,7 @@ public class WInputMethod extends InputMethodAdapter
* Explicitly disable the native IME. Native IME is not disabled when
* deactivate is called.
*/
@Override
public void disableInputMethod() {
if (lastFocussedComponentPeer != null) {
disableNativeIME(lastFocussedComponentPeer);
@ -348,6 +359,7 @@ public class WInputMethod extends InputMethodAdapter
* Returns a string with information about the windows input method,
* or null.
*/
@Override
public String getNativeInputMethodInfo() {
return getNativeIMMDescription();
}
@ -358,6 +370,7 @@ public class WInputMethod extends InputMethodAdapter
* Calling stopListening to give other input method the keybaord input
* focus.
*/
@Override
protected void stopListening() {
// Since the native input method is not disabled when deactivate is
// called, we need to call disableInputMethod to explicitly turn off the
@ -366,6 +379,7 @@ public class WInputMethod extends InputMethodAdapter
}
// implements sun.awt.im.InputMethodAdapter.setAWTFocussedComponent
@Override
protected void setAWTFocussedComponent(Component component) {
if (component == null) {
return;
@ -386,6 +400,7 @@ public class WInputMethod extends InputMethodAdapter
}
// implements java.awt.im.spi.InputMethod.hideWindows
@Override
public void hideWindows() {
if (awtFocussedComponentPeer != null) {
/* Hide the native status window including the Windows language
@ -401,6 +416,7 @@ public class WInputMethod extends InputMethodAdapter
/**
* @see java.awt.im.spi.InputMethod#removeNotify
*/
@Override
public void removeNotify() {
endCompositionNative(context, DISCARD_INPUT);
awtFocussedComponent = null;
@ -427,10 +443,12 @@ public class WInputMethod extends InputMethodAdapter
}
// see sun.awt.im.InputMethodAdapter.supportsBelowTheSpot
@Override
protected boolean supportsBelowTheSpot() {
return true;
}
@Override
public void endComposition()
{
//right now the native endCompositionNative() just cancel
@ -442,6 +460,7 @@ public class WInputMethod extends InputMethodAdapter
/**
* @see java.awt.im.spi.InputMethod#setCompositionEnabled(boolean)
*/
@Override
public void setCompositionEnabled(boolean enable) {
setOpenStatus(context, enable);
}
@ -449,6 +468,7 @@ public class WInputMethod extends InputMethodAdapter
/**
* @see java.awt.im.spi.InputMethod#isCompositionEnabled
*/
@Override
public boolean isCompositionEnabled() {
return getOpenStatus(context);
}
@ -557,6 +577,7 @@ public class WInputMethod extends InputMethodAdapter
// AWT Event thread. Otherwise, a potential deadlock
// could happen.
Runnable r = new Runnable() {
@Override
public void run() {
int x = 0;
int y = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,11 +40,12 @@ import java.util.Locale;
* @since JDK1.3
*/
class WInputMethodDescriptor implements InputMethodDescriptor {
final class WInputMethodDescriptor implements InputMethodDescriptor {
/**
* @see java.awt.im.spi.InputMethodDescriptor#getAvailableLocales
*/
@Override
public Locale[] getAvailableLocales() {
// returns a copy of internal list for public API
Locale[] locales = getAvailableLocalesInternal();
@ -60,6 +61,7 @@ class WInputMethodDescriptor implements InputMethodDescriptor {
/**
* @see java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList
*/
@Override
public boolean hasDynamicLocaleList() {
return true;
}
@ -67,6 +69,7 @@ class WInputMethodDescriptor implements InputMethodDescriptor {
/**
* @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
*/
@Override
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
// We ignore the input locale.
// When displaying for the default locale, rely on the localized AWT properties;
@ -81,6 +84,7 @@ class WInputMethodDescriptor implements InputMethodDescriptor {
/**
* @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon
*/
@Override
public Image getInputMethodIcon(Locale inputLocale) {
return null;
}
@ -88,6 +92,7 @@ class WInputMethodDescriptor implements InputMethodDescriptor {
/**
* @see java.awt.im.spi.InputMethodDescriptor#createInputMethod
*/
@Override
public InputMethod createInputMethod() throws Exception {
return new WInputMethod();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ import java.awt.peer.ComponentPeer;
import sun.awt.KeyboardFocusManagerPeerImpl;
import sun.awt.CausedFocusEvent;
class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
final class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
static native void setNativeFocusOwner(ComponentPeer peer);
static native Component getNativeFocusOwner();
static native Window getNativeFocusedWindow();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,12 +31,14 @@ import java.awt.event.ItemEvent;
final class WListPeer extends WComponentPeer implements ListPeer {
@Override
public boolean isFocusable() {
return true;
}
// ListPeer implementation
@Override
public int[] getSelectedIndexes() {
List l = (List)target;
int len = l.countItems();
@ -53,26 +55,31 @@ final class WListPeer extends WComponentPeer implements ListPeer {
}
/* New method name for 1.1 */
@Override
public void add(String item, int index) {
addItem(item, index);
}
/* New method name for 1.1 */
@Override
public void removeAll() {
clear();
}
/* New method name for 1.1 */
@Override
public void setMultipleMode (boolean b) {
setMultipleSelections(b);
}
/* New method name for 1.1 */
@Override
public Dimension getPreferredSize(int rows) {
return preferredSize(rows);
}
/* New method name for 1.1 */
@Override
public Dimension getMinimumSize(int rows) {
return minimumSize(rows);
}
@ -83,13 +90,17 @@ final class WListPeer extends WComponentPeer implements ListPeer {
}
native void addItems(String[] items, int index, int width);
@Override
public native void delItems(int start, int end);
public void clear() {
List l = (List)target;
delItems(0, l.countItems());
}
@Override
public native void select(int index);
@Override
public native void deselect(int index);
@Override
public native void makeVisible(int index);
public native void setMultipleSelections(boolean v);
public native int getMaxWidth();
@ -114,8 +125,10 @@ final class WListPeer extends WComponentPeer implements ListPeer {
super(target);
}
@Override
native void create(WComponentPeer parent);
@Override
void initialize() {
List li = (List)target;
@ -169,6 +182,7 @@ final class WListPeer extends WComponentPeer implements ListPeer {
super.initialize();
}
@Override
public boolean shouldClearRectBeforePaint() {
return false;
}
@ -178,7 +192,8 @@ final class WListPeer extends WComponentPeer implements ListPeer {
/*public*/ native boolean isSelected(int index);
// update the fontmetrics when the font changes
public synchronized void _setFont(Font f)
@Override
synchronized void _setFont(Font f)
{
super._setFont( f );
fm = getFontMetrics( ((List)target).getFont() );
@ -190,6 +205,7 @@ final class WListPeer extends WComponentPeer implements ListPeer {
void handleAction(final int index, final long when, final int modifiers) {
final List l = (List)target;
WToolkit.executeOnEventHandlerThread(l, new Runnable() {
@Override
public void run() {
l.select(index);
postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
@ -201,6 +217,7 @@ final class WListPeer extends WComponentPeer implements ListPeer {
void handleListChanged(final int index) {
final List l = (List)target;
WToolkit.executeOnEventHandlerThread(l, new Runnable() {
@Override
public void run() {
postEvent(new ItemEvent(l, ItemEvent.ITEM_STATE_CHANGED,
Integer.valueOf(index),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,13 +27,16 @@ package sun.awt.windows;
import java.awt.*;
import java.awt.peer.*;
class WMenuBarPeer extends WMenuPeer implements MenuBarPeer {
final class WMenuBarPeer extends WMenuPeer implements MenuBarPeer {
// MenuBarPeer implementation
@Override
public native void addMenu(Menu m);
@Override
public native void delMenu(int index);
@Override
public void addHelpMenu(Menu m) {
addMenu(m);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,10 +31,13 @@ class WMenuPeer extends WMenuItemPeer implements MenuPeer {
// MenuPeer implementation
@Override
public native void addSeparator();
@Override
public void addItem(MenuItem item) {
WMenuItemPeer itemPeer = (WMenuItemPeer) WToolkit.targetToPeer(item);
}
@Override
public native void delItem(int index);
// Toolkit & peer internals

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,19 +25,14 @@
package sun.awt.windows;
import java.awt.Toolkit;
import java.awt.Component;
import java.awt.Point;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.MouseDragGestureRecognizer;
import java.awt.dnd.DragGestureListener;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import sun.awt.dnd.SunDragSourceContextPeer;
@ -54,7 +49,7 @@ import sun.awt.dnd.SunDragSourceContextPeer;
* @see java.awt.dnd.DragSource
*/
class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
final class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
private static final long serialVersionUID = -3527844310018033570L;
@ -140,6 +135,7 @@ class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
* Invoked when the mouse has been clicked on a component.
*/
@Override
public void mouseClicked(MouseEvent e) {
// do nothing
}
@ -148,6 +144,7 @@ class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
* Invoked when a mouse button has been pressed on a component.
*/
@Override
public void mousePressed(MouseEvent e) {
events.clear();
@ -165,6 +162,7 @@ class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
* Invoked when a mouse button has been released on a component.
*/
@Override
public void mouseReleased(MouseEvent e) {
events.clear();
}
@ -173,6 +171,7 @@ class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
* Invoked when the mouse enters a component.
*/
@Override
public void mouseEntered(MouseEvent e) {
events.clear();
}
@ -181,6 +180,7 @@ class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
* Invoked when the mouse exits a component.
*/
@Override
public void mouseExited(MouseEvent e) {
if (!events.isEmpty()) { // gesture pending
@ -196,6 +196,7 @@ class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
* Invoked when a mouse button is pressed on a component.
*/
@Override
public void mouseDragged(MouseEvent e) {
if (!events.isEmpty()) { // gesture pending
int dop = mapDragOperationFromModifiers(e);
@ -225,6 +226,7 @@ class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
* (with no buttons no down).
*/
@Override
public void mouseMoved(MouseEvent e) {
// do nothing
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ import java.awt.print.PrinterJob;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
public class WPageDialog extends WPrintDialog {
final class WPageDialog extends WPrintDialog {
static {
initIDs();
}
@ -55,6 +55,7 @@ public class WPageDialog extends WPrintDialog {
this.painter = painter;
}
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
package sun.awt.windows;
public class WPageDialogPeer extends WPrintDialogPeer {
final class WPageDialogPeer extends WPrintDialogPeer {
WPageDialogPeer(WPageDialog target) {
super(target);
@ -37,8 +37,10 @@ public class WPageDialogPeer extends WPrintDialogPeer {
*/
private native boolean _show();
@Override
public void show() {
new Thread(new Runnable() {
@Override
public void run() {
// Call pageSetup even with no printer installed, this
// will display Windows error dialog and return false.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,14 +27,13 @@ package sun.awt.windows;
import java.awt.*;
import java.awt.peer.*;
import java.util.Vector;
import sun.awt.SunGraphicsCallback;
class WPanelPeer extends WCanvasPeer implements PanelPeer {
// ComponentPeer overrides
@Override
public void paint(Graphics g) {
super.paint(g);
SunGraphicsCallback.PaintHeavyweightComponentsCallback.getInstance().
@ -42,6 +41,7 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer {
SunGraphicsCallback.LIGHTWEIGHTS |
SunGraphicsCallback.HEAVYWEIGHTS);
}
@Override
public void print(Graphics g) {
super.print(g);
SunGraphicsCallback.PrintHeavyweightComponentsCallback.getInstance().
@ -52,6 +52,7 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer {
// ContainerPeer (via PanelPeer) implementation
@Override
public Insets getInsets() {
return insets_;
}
@ -73,6 +74,7 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer {
super(target);
}
@Override
void initialize() {
super.initialize();
insets_ = new Insets(0,0,0,0);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ import sun.font.TrueTypeFont;
import sun.print.PathGraphics;
import sun.print.ProxyGraphics2D;
class WPathGraphics extends PathGraphics {
final class WPathGraphics extends PathGraphics {
/**
* For a drawing application the initial user space
@ -896,6 +896,7 @@ class WPathGraphics extends PathGraphics {
* @param handlingTransparency if being recursively called to
* print opaque region of transparent image
*/
@Override
protected boolean drawImageToPlatform(Image image, AffineTransform xform,
Color bgcolor,
int srcX, int srcY,
@ -1335,6 +1336,7 @@ class WPathGraphics extends PathGraphics {
* Have the printing application redraw everything that falls
* within the page bounds defined by <code>region</code>.
*/
@Override
public void redrawRegion(Rectangle2D region, double scaleX, double scaleY,
Shape savedClip, AffineTransform savedTransform)
throws PrinterException {
@ -1434,6 +1436,7 @@ class WPathGraphics extends PathGraphics {
* with the specified color.
* The path is provided in device coordinates.
*/
@Override
protected void deviceFill(PathIterator pathIter, Color color) {
WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
@ -1448,6 +1451,7 @@ class WPathGraphics extends PathGraphics {
* path defined by <code>pathIter</code>
* The path is provided in device coordinates.
*/
@Override
protected void deviceClip(PathIterator pathIter) {
WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
@ -1459,6 +1463,7 @@ class WPathGraphics extends PathGraphics {
/**
* Draw the bounding rectangle using transformed coordinates.
*/
@Override
protected void deviceFrameRect(int x, int y, int width, int height,
Color color) {
@ -1548,6 +1553,7 @@ class WPathGraphics extends PathGraphics {
* GDI fillRect function.
* Boundaries are determined by the given coordinates.
*/
@Override
protected void deviceFillRect(int x, int y, int width, int height,
Color color) {
/*
@ -1584,6 +1590,7 @@ class WPathGraphics extends PathGraphics {
* Draw a line using a pen created using the specified color
* and current stroke properties.
*/
@Override
protected void deviceDrawLine(int xBegin, int yBegin, int xEnd, int yEnd,
Color color) {
Stroke stroke = getStroke();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,12 +29,12 @@ import java.awt.peer.*;
import sun.awt.AWTAccessor;
public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
// We can't use target.getParent() for TrayIcon popup
// because this method should return null for the TrayIcon
// popup regardless of that whether it has parent or not.
public WPopupMenuPeer(PopupMenu target) {
WPopupMenuPeer(PopupMenu target) {
this.target = target;
MenuContainer parent = null;
@ -67,7 +67,7 @@ public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
}
}
native void createMenu(WComponentPeer parent);
private native void createMenu(WComponentPeer parent);
public void show(Event e) {
Component origin = (Component)e.target;
@ -106,5 +106,5 @@ public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
_show(e);
}
public native void _show(Event e);
private native void _show(Event e);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,9 @@ import java.awt.peer.*;
import java.awt.print.PrinterJob;
public class WPrintDialog extends Dialog {
import sun.awt.AWTAccessor;
class WPrintDialog extends Dialog {
static {
initIDs();
}
@ -38,21 +40,23 @@ public class WPrintDialog extends Dialog {
protected PrintJob job;
protected PrinterJob pjob;
public WPrintDialog(Frame parent, PrinterJob control) {
WPrintDialog(Frame parent, PrinterJob control) {
super(parent, true);
this.pjob = control;
setLayout(null);
}
public WPrintDialog(Dialog parent, PrinterJob control) {
WPrintDialog(Dialog parent, PrinterJob control) {
super(parent, "", true);
this.pjob = control;
setLayout(null);
}
// Use native code to circumvent access restrictions on Component.peer
protected native void setPeer(ComponentPeer peer);
final void setPeer(final ComponentPeer p){
AWTAccessor.getComponentAccessor().setPeer(this, p);
}
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
synchronized(getTreeLock()) {
@ -72,11 +76,11 @@ public class WPrintDialog extends Dialog {
private boolean retval = false;
public void setRetVal(boolean ret) {
final void setRetVal(boolean ret) {
retval = ret;
}
public boolean getRetVal() {
final boolean getRetVal() {
return retval;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,11 +30,10 @@ import java.awt.peer.DialogPeer;
import java.awt.peer.ComponentPeer;
import java.awt.dnd.DropTarget;
import java.util.Vector;
import sun.awt.AppContext;
import sun.awt.CausedFocusEvent;
import sun.awt.AWTAccessor;
public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
static {
initIDs();
@ -42,29 +41,34 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
private WComponentPeer parent;
private Vector<WWindowPeer> blockedWindows = new Vector<WWindowPeer>();
private Vector<WWindowPeer> blockedWindows = new Vector<>();
WPrintDialogPeer(WPrintDialog target) {
super(target);
}
@Override
void create(WComponentPeer parent) {
this.parent = parent;
}
// fix for CR 6178323:
// don't use checkCreation() from WComponentPeer to avoid hwnd check
@Override
protected void checkCreation() {
}
@Override
protected void disposeImpl() {
WToolkit.targetDisposedPeer(target, this);
}
private native boolean _show();
@Override
public void show() {
new Thread(new Runnable() {
@Override
public void run() {
try {
((WPrintDialog)target).setRetVal(_show());
@ -102,6 +106,7 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
}
}
@Override
public void blockWindows(java.util.List<Window> toBlock) {
for (Window w : toBlock) {
WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@ -111,28 +116,43 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
}
}
@Override
public native void toFront();
@Override
public native void toBack();
// unused methods. Overridden to disable this functionality as
// it requires HWND which is not available for FileDialog
@Override
void initialize() {}
@Override
public void updateAlwaysOnTopState() {}
@Override
public void setResizable(boolean resizable) {}
public void hide() {}
public void enable() {}
public void disable() {}
@Override
void hide() {}
@Override
void enable() {}
@Override
void disable() {}
@Override
public void reshape(int x, int y, int width, int height) {}
public boolean handleEvent(Event e) { return false; }
@Override
public void setForeground(Color c) {}
@Override
public void setBackground(Color c) {}
@Override
public void setFont(Font f) {}
@Override
public void updateMinimumSize() {}
@Override
public void updateIconImages() {}
public boolean requestFocus(boolean temporary, boolean focusedWindowChangeAllowed) {
return false;
}
@Override
public boolean requestFocus
(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
@ -141,13 +161,20 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
return false;
}
@Override
public void updateFocusableWindowState() {}
@Override
void start() {}
@Override
public void beginValidate() {}
@Override
public void endValidate() {}
void invalidate(int x, int y, int width, int height) {}
@Override
public void addDropTarget(DropTarget dt) {}
@Override
public void removeDropTarget(DropTarget dt) {}
@Override
public void setZOrder(ComponentPeer above) {}
/**
@ -156,8 +183,11 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
private static native void initIDs();
// The effects are not supported for system dialogs.
@Override
public void applyShape(sun.java2d.pipe.Region shape) {}
@Override
public void setOpacity(float opacity) {}
@Override
public void setOpaque(boolean isOpaque) {}
public void updateWindow(java.awt.image.BufferedImage backBuffer) {}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -57,26 +57,19 @@ import java.awt.print.PrinterJob;
import java.awt.print.PrinterException;
import javax.print.PrintService;
import java.io.IOException;
import java.io.File;
import java.util.Hashtable;
import java.util.Properties;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import sun.awt.Win32GraphicsEnvironment;
import sun.print.PeekGraphics;
import sun.print.PeekMetrics;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import javax.print.PrintServiceLookup;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.HashPrintServiceAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.Attribute;
import javax.print.attribute.standard.Sides;
@ -84,7 +77,6 @@ import javax.print.attribute.standard.Chromaticity;
import javax.print.attribute.standard.PrintQuality;
import javax.print.attribute.standard.PrinterResolution;
import javax.print.attribute.standard.SheetCollate;
import javax.print.attribute.IntegerSyntax;
import javax.print.attribute.standard.Copies;
import javax.print.attribute.standard.Destination;
import javax.print.attribute.standard.OrientationRequested;
@ -92,17 +84,13 @@ import javax.print.attribute.standard.Media;
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.MediaSize;
import javax.print.attribute.standard.MediaTray;
import javax.print.attribute.standard.PrinterName;
import javax.print.attribute.standard.JobMediaSheetsSupported;
import javax.print.attribute.standard.PageRanges;
import javax.print.attribute.Size2DSyntax;
import sun.awt.Win32FontManager;
import sun.print.RasterPrinterJob;
import sun.print.SunAlternateMedia;
import sun.print.SunPageSelection;
import sun.print.SunMinMaxPage;
import sun.print.Win32MediaTray;
import sun.print.Win32PrintService;
import sun.print.Win32PrintServiceLookup;
@ -121,7 +109,8 @@ import sun.java2d.DisposerTarget;
*
* @author Richard Blanchard
*/
public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
public final class WPrinterJob extends RasterPrinterJob
implements DisposerTarget {
/* Class Constants */
@ -290,6 +279,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
private long mPrintHDevMode;
private long mPrintHDevNames;
@Override
public void dispose() {
WPrinterJob.deleteDC(mPrintDC, mPrintHDevMode, mPrintHDevNames);
}
@ -402,6 +392,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
*/
private Object disposerReferent = new Object();
@Override
public Object getDisposerReferent() {
return disposerReferent;
}
@ -430,6 +421,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* @see java.awt.GraphicsEnvironment#isHeadless
* @since JDK1.2
*/
@Override
public PageFormat pageDialog(PageFormat page) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
@ -570,6 +562,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
*/
@Override
public boolean printDialog() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
@ -603,6 +596,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* @throws PrinterException if the specified service does not support
* 2D printing.
*/
@Override
public void setPrintService(PrintService service)
throws PrinterException {
super.setPrintService(service);
@ -628,6 +622,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
}
}
@Override
public PrintService getPrintService() {
if (myService == null) {
String printerName = getNativePrintService();
@ -681,6 +676,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* In the event that the user changes the printer using the
dialog, then it is up to GDI to report back all changed values.
*/
@Override
protected void setAttributes(PrintRequestAttributeSet attributes)
throws PrinterException {
@ -750,6 +746,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* Note: PageFormat.getPaper() returns a clone and getDefaultPage()
* gets that clone so it won't overwrite the original paper.
*/
@Override
public PageFormat defaultPage(PageFormat page) {
PageFormat newPage = (PageFormat)page.clone();
getDefaultPage(newPage);
@ -759,6 +756,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/**
* validate the paper size against the current printer.
*/
@Override
protected native void validatePaper(Paper origPaper, Paper newPaper );
/**
@ -774,6 +772,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* causes the print job to be rasterized.
*/
@Override
protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
PrinterJob printerJob,
Printable painter,
@ -810,6 +809,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
}
@Override
protected double getXRes() {
if (mAttXRes != 0) {
return mAttXRes;
@ -818,6 +818,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
}
}
@Override
protected double getYRes() {
if (mAttYRes != 0) {
return mAttYRes;
@ -826,26 +827,32 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
}
}
@Override
protected double getPhysicalPrintableX(Paper p) {
return mPrintPhysX;
}
@Override
protected double getPhysicalPrintableY(Paper p) {
return mPrintPhysY;
}
@Override
protected double getPhysicalPrintableWidth(Paper p) {
return mPrintWidth;
}
@Override
protected double getPhysicalPrintableHeight(Paper p) {
return mPrintHeight;
}
@Override
protected double getPhysicalPageWidth(Paper p) {
return mPageWidth;
}
@Override
protected double getPhysicalPageHeight(Paper p) {
return mPageHeight;
}
@ -857,6 +864,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* collation requests - which can only originate from the print dialog.
* REMIND: check if this can be deleted already.
*/
@Override
protected boolean isCollated() {
return userRequestedCollation;
}
@ -869,6 +877,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* book need only be printed once and the copies
* will be collated and made in the printer.
*/
@Override
protected int getCollatedCopies() {
debug_println("driverDoesMultipleCopies="+driverDoesMultipleCopies
+" driverDoesCollation="+driverDoesCollation);
@ -891,6 +900,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* iterate over the number of copies, this method always returns
* 1.
*/
@Override
protected int getNoncollatedCopies() {
if (driverDoesMultipleCopies || super.isCollated()) {
return 1;
@ -1128,6 +1138,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/**
* Remove control characters.
*/
@Override
protected String removeControlChars(String str) {
return super.removeControlChars(str);
}
@ -1267,6 +1278,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/**
* Begin a new page.
*/
@Override
protected void startPage(PageFormat format, Printable painter,
int index, boolean paperChanged) {
@ -1283,6 +1295,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/**
* End a page.
*/
@Override
protected void endPage(PageFormat format, Printable painter,
int index) {
@ -1302,6 +1315,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/**
* Set the number of copies to be printed.
*/
@Override
public void setCopies(int copies) {
super.setCopies(copies);
defaultCopies = false;
@ -1315,7 +1329,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/**
* Set copies in device.
*/
public native void setNativeCopies(int copies);
private native void setNativeCopies(int copies);
/**
* Displays the print dialog and records the user's settings
@ -1328,6 +1342,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
/* Make sure printer DC is intialised and that info about the printer
* is reflected back up to Java code
*/
@Override
protected native void initPrinter();
/**
@ -1343,6 +1358,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
*/
private native boolean _startDoc(String dest, String jobName)
throws PrinterException;
@Override
protected void startDoc() throws PrinterException {
if (!_startDoc(mDestination, getJobName())) {
cancel();
@ -1353,12 +1369,14 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* Call Window's EndDoc routine to end a
* print job.
*/
@Override
protected native void endDoc();
/**
* Call Window's AbortDoc routine to abort a
* print job.
*/
@Override
protected native void abortDoc();
/**
@ -1386,6 +1404,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
* page. The width and height of the band is
* specified by the caller.
*/
@Override
protected native void printBand(byte[] data, int x, int y,
int width, int height);
@ -2204,6 +2223,7 @@ class PrintToFileErrorDialog extends Dialog implements ActionListener{
}
}
@Override
public void actionPerformed(ActionEvent event) {
setVisible(false);
dispose();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ package sun.awt.windows;
import java.awt.*;
import java.awt.peer.RobotPeer;
class WRobotPeer extends WObjectPeer implements RobotPeer
final class WRobotPeer extends WObjectPeer implements RobotPeer
{
WRobotPeer() {
create();
@ -39,27 +39,36 @@ class WRobotPeer extends WObjectPeer implements RobotPeer
private synchronized native void _dispose();
@Override
protected void disposeImpl() {
_dispose();
}
public native void create();
public native void mouseMoveImpl(int x, int y);
@Override
public void mouseMove(int x, int y) {
mouseMoveImpl(x, y);
}
@Override
public native void mousePress(int buttons);
@Override
public native void mouseRelease(int buttons);
@Override
public native void mouseWheel(int wheelAmt);
@Override
public native void keyPress( int keycode );
@Override
public native void keyRelease( int keycode );
@Override
public int getRGBPixel(int x, int y) {
// See 7002846: that's ineffective, but works correctly with non-opaque windows
return getRGBPixels(new Rectangle(x, y, 1, 1))[0];
}
@Override
public int [] getRGBPixels(Rectangle bounds) {
int pixelArray[] = new int[bounds.width*bounds.height];
getRGBPixels(bounds.x, bounds.y, bounds.width, bounds.height, pixelArray);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ import sun.awt.PeerEvent;
import sun.util.logging.PlatformLogger;
class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WScrollPanePeer");
@ -47,6 +47,7 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
}
static native void initIDs();
@Override
native void create(WComponentPeer parent);
native int getOffset(int orient);
@ -56,6 +57,7 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
scrollbarHeight = _getHScrollbarHeight();
}
@Override
void initialize() {
super.initialize();
setInsets();
@ -63,22 +65,27 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
setScrollPosition(-i.left,-i.top);
}
@Override
public void setUnitIncrement(Adjustable adj, int p) {
// The unitIncrement is grabbed from the target as needed.
}
@Override
public Insets insets() {
return getInsets();
}
private native void setInsets();
@Override
public native synchronized void setScrollPosition(int x, int y);
@Override
public int getHScrollbarHeight() {
return scrollbarHeight;
}
private native int _getHScrollbarHeight();
@Override
public int getVScrollbarWidth() {
return scrollbarWidth;
}
@ -96,6 +103,7 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
* the actual windows may not have changed yet, so the size
* information from the java-level is passed down and used.
*/
@Override
public void childResized(int width, int height) {
ScrollPane sp = (ScrollPane)target;
Dimension vs = sp.getSize();
@ -112,6 +120,7 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
* of adjustables, whether it was modified externally or from the
* native scrollbars themselves.
*/
@Override
public void setValue(Adjustable adj, int v) {
Component c = getScrollChild();
if (c == null) {
@ -160,6 +169,7 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
super(source, runnable, 0L);
}
@Override
public PeerEvent coalesceEvents(PeerEvent newEvent) {
if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("ScrollEvent coalesced: " + newEvent);
@ -187,6 +197,7 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
this.isAdjusting = isAdjusting;
}
@Override
public void run() {
if (getScrollChild() == null) {
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,11 +30,12 @@ import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.peer.SystemTrayPeer;
public class WSystemTrayPeer extends WObjectPeer implements SystemTrayPeer {
final class WSystemTrayPeer extends WObjectPeer implements SystemTrayPeer {
WSystemTrayPeer(SystemTray target) {
this.target = target;
}
@Override
public Dimension getTrayIconSize() {
return new Dimension(WTrayIconPeer.TRAY_ICON_WIDTH, WTrayIconPeer.TRAY_ICON_HEIGHT);
}
@ -43,6 +44,7 @@ public class WSystemTrayPeer extends WObjectPeer implements SystemTrayPeer {
return ((WToolkit)Toolkit.getDefaultToolkit()).isTraySupported();
}
@Override
protected void disposeImpl() {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,6 +53,7 @@ final class WTextAreaPeer extends WTextComponentPeer implements TextAreaPeer {
public Dimension getPreferredSize(int rows, int cols) {
return getMinimumSize(rows, cols);
}
@Override
public Dimension getMinimumSize(int rows, int cols) {
FontMetrics fm = getFontMetrics(((TextArea)target).getFont());

View File

@ -67,7 +67,7 @@ import sun.misc.PerformanceLogger;
import sun.util.logging.PlatformLogger;
import sun.security.util.SecurityConstants;
public class WToolkit extends SunToolkit implements Runnable {
public final class WToolkit extends SunToolkit implements Runnable {
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
@ -98,6 +98,7 @@ public class WToolkit extends SunToolkit implements Runnable {
if (!loaded) {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
@Override
public Void run() {
System.loadLibrary("awt");
return null;
@ -121,6 +122,7 @@ public class WToolkit extends SunToolkit implements Runnable {
AccessController.doPrivileged(
new PrivilegedAction <Void> ()
{
@Override
public Void run() {
String browserProp = System.getProperty("browser");
if (browserProp != null && browserProp.equals("sun.plugin")) {
@ -212,6 +214,7 @@ public class WToolkit extends SunToolkit implements Runnable {
public native void embeddedEventLoopIdleProcessing();
static class ToolkitDisposer implements sun.java2d.DisposerRecord {
@Override
public void dispose() {
WToolkit.postDispose();
}
@ -266,6 +269,7 @@ public class WToolkit extends SunToolkit implements Runnable {
private final void registerShutdownHook() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
ThreadGroup currentTG =
Thread.currentThread().getThreadGroup();
@ -275,6 +279,7 @@ public class WToolkit extends SunToolkit implements Runnable {
parentTG = currentTG.getParent();
}
Thread shutdown = new Thread(currentTG, new Runnable() {
@Override
public void run() {
shutdown();
}
@ -286,6 +291,7 @@ public class WToolkit extends SunToolkit implements Runnable {
});
}
@Override
public void run() {
Thread.currentThread().setPriority(Thread.NORM_PRIORITY+1);
boolean startPump = init();
@ -330,85 +336,98 @@ public class WToolkit extends SunToolkit implements Runnable {
* WARNING: startSecondaryEventLoop must only be called from the "AWT-
* Windows" thread.
*/
public static native void startSecondaryEventLoop();
public static native void quitSecondaryEventLoop();
static native void startSecondaryEventLoop();
static native void quitSecondaryEventLoop();
/*
* Create peer objects.
*/
@Override
public ButtonPeer createButton(Button target) {
ButtonPeer peer = new WButtonPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public TextFieldPeer createTextField(TextField target) {
TextFieldPeer peer = new WTextFieldPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public LabelPeer createLabel(Label target) {
LabelPeer peer = new WLabelPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public ListPeer createList(List target) {
ListPeer peer = new WListPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public CheckboxPeer createCheckbox(Checkbox target) {
CheckboxPeer peer = new WCheckboxPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public ScrollbarPeer createScrollbar(Scrollbar target) {
ScrollbarPeer peer = new WScrollbarPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public ScrollPanePeer createScrollPane(ScrollPane target) {
ScrollPanePeer peer = new WScrollPanePeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public TextAreaPeer createTextArea(TextArea target) {
TextAreaPeer peer = new WTextAreaPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public ChoicePeer createChoice(Choice target) {
ChoicePeer peer = new WChoicePeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public FramePeer createFrame(Frame target) {
FramePeer peer = new WFramePeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public FramePeer createLightweightFrame(LightweightFrame target) {
FramePeer peer = new WLightweightFramePeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public CanvasPeer createCanvas(Canvas target) {
CanvasPeer peer = new WCanvasPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
@SuppressWarnings("deprecation")
public void disableBackgroundErase(Canvas canvas) {
WCanvasPeer peer = (WCanvasPeer)canvas.getPeer();
@ -418,60 +437,70 @@ public class WToolkit extends SunToolkit implements Runnable {
peer.disableBackgroundErase();
}
@Override
public PanelPeer createPanel(Panel target) {
PanelPeer peer = new WPanelPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public WindowPeer createWindow(Window target) {
WindowPeer peer = new WWindowPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public DialogPeer createDialog(Dialog target) {
DialogPeer peer = new WDialogPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public FileDialogPeer createFileDialog(FileDialog target) {
FileDialogPeer peer = new WFileDialogPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public MenuBarPeer createMenuBar(MenuBar target) {
MenuBarPeer peer = new WMenuBarPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public MenuPeer createMenu(Menu target) {
MenuPeer peer = new WMenuPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public PopupMenuPeer createPopupMenu(PopupMenu target) {
PopupMenuPeer peer = new WPopupMenuPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public MenuItemPeer createMenuItem(MenuItem target) {
MenuItemPeer peer = new WMenuItemPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
CheckboxMenuItemPeer peer = new WCheckboxMenuItemPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
// (target is unused for now)
// Robot's don't need to go in the peer map since
@ -497,16 +526,19 @@ public class WToolkit extends SunToolkit implements Runnable {
return peer;
}
@Override
public TrayIconPeer createTrayIcon(TrayIcon target) {
WTrayIconPeer peer = new WTrayIconPeer(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public SystemTrayPeer createSystemTray(SystemTray target) {
return new WSystemTrayPeer(target);
}
@Override
public boolean isTraySupported() {
return true;
}
@ -516,14 +548,16 @@ public class WToolkit extends SunToolkit implements Runnable {
return WDataTransferer.getInstanceImpl();
}
@Override
public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer()
throws HeadlessException
{
return WKeyboardFocusManagerPeer.getInstance();
}
protected native void setDynamicLayoutNative(boolean b);
private native void setDynamicLayoutNative(boolean b);
@Override
public void setDynamicLayout(boolean b) {
if (b == dynamicLayoutSetting) {
return;
@ -533,6 +567,7 @@ public class WToolkit extends SunToolkit implements Runnable {
setDynamicLayoutNative(b);
}
@Override
protected boolean isDynamicLayoutSet() {
return dynamicLayoutSetting;
}
@ -541,8 +576,9 @@ public class WToolkit extends SunToolkit implements Runnable {
* Called from lazilyLoadDynamicLayoutSupportedProperty because
* Windows doesn't always send WM_SETTINGCHANGE when it should.
*/
protected native boolean isDynamicLayoutSupportedNative();
private native boolean isDynamicLayoutSupportedNative();
@Override
public boolean isDynamicLayoutActive() {
return (isDynamicLayoutSet() && isDynamicLayoutSupported());
}
@ -550,6 +586,7 @@ public class WToolkit extends SunToolkit implements Runnable {
/**
* Returns <code>true</code> if this frame state is supported.
*/
@Override
public boolean isFrameStateSupported(int state) {
switch (state) {
case Frame.NORMAL:
@ -574,25 +611,31 @@ public class WToolkit extends SunToolkit implements Runnable {
return config.getColorModel();
}
@Override
public ColorModel getColorModel() {
return getStaticColorModel();
}
@Override
public Insets getScreenInsets(GraphicsConfiguration gc)
{
return getScreenInsets(((Win32GraphicsDevice) gc.getDevice()).getScreen());
}
@Override
public int getScreenResolution() {
Win32GraphicsEnvironment ge = (Win32GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment();
return ge.getXResolution();
}
@Override
protected native int getScreenWidth();
@Override
protected native int getScreenHeight();
protected native Insets getScreenInsets(int screen);
private native Insets getScreenInsets(int screen);
@Override
public FontMetrics getFontMetrics(Font font) {
// This is an unsupported hack, but left in for a customer.
// Do not remove.
@ -604,6 +647,7 @@ public class WToolkit extends SunToolkit implements Runnable {
return super.getFontMetrics(font);
}
@Override
public FontPeer getFontPeer(String name, int style) {
FontPeer retval = null;
String lcName = name.toLowerCase();
@ -627,6 +671,7 @@ public class WToolkit extends SunToolkit implements Runnable {
private native void nativeSync();
@Override
public void sync() {
// flush the GDI/DD buffers
nativeSync();
@ -636,11 +681,13 @@ public class WToolkit extends SunToolkit implements Runnable {
D3DRenderQueue.sync();
}
@Override
public PrintJob getPrintJob(Frame frame, String doctitle,
Properties props) {
return getPrintJob(frame, doctitle, null, null);
}
@Override
public PrintJob getPrintJob(Frame frame, String doctitle,
JobAttributes jobAttributes,
PageAttributes pageAttributes)
@ -659,8 +706,10 @@ public class WToolkit extends SunToolkit implements Runnable {
return printJob;
}
@Override
public native void beep();
@Override
public boolean getLockingKeyState(int key) {
if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
@ -669,8 +718,9 @@ public class WToolkit extends SunToolkit implements Runnable {
return getLockingKeyStateNative(key);
}
public native boolean getLockingKeyStateNative(int key);
private native boolean getLockingKeyStateNative(int key);
@Override
public void setLockingKeyState(int key, boolean on) {
if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
@ -679,8 +729,9 @@ public class WToolkit extends SunToolkit implements Runnable {
setLockingKeyStateNative(key, on);
}
public native void setLockingKeyStateNative(int key, boolean on);
private native void setLockingKeyStateNative(int key, boolean on);
@Override
public Clipboard getSystemClipboard() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
@ -694,6 +745,7 @@ public class WToolkit extends SunToolkit implements Runnable {
return clipboard;
}
@Override
protected native void loadSystemColors(int[] systemColors);
public static final Object targetToPeer(Object target) {
@ -707,6 +759,7 @@ public class WToolkit extends SunToolkit implements Runnable {
/**
* Returns a new input method adapter descriptor for native input methods.
*/
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
return new WInputMethodDescriptor();
}
@ -714,6 +767,7 @@ public class WToolkit extends SunToolkit implements Runnable {
/**
* Returns a style map for the input method highlight.
*/
@Override
public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
InputMethodHighlight highlight)
{
@ -724,6 +778,7 @@ public class WToolkit extends SunToolkit implements Runnable {
* Returns whether enableInputMethods should be set to true for peered
* TextComponent instances on this platform.
*/
@Override
public boolean enableInputMethodsForTextComponent() {
return true;
}
@ -731,6 +786,7 @@ public class WToolkit extends SunToolkit implements Runnable {
/**
* Returns the default keyboard locale of the underlying operating system
*/
@Override
public Locale getDefaultKeyboardLocale() {
Locale locale = WInputMethod.getNativeLocale();
@ -744,6 +800,7 @@ public class WToolkit extends SunToolkit implements Runnable {
/**
* Returns a new custom cursor.
*/
@Override
public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
throws IndexOutOfBoundsException {
return new WCustomCursor(cursor, hotSpot, name);
@ -752,11 +809,13 @@ public class WToolkit extends SunToolkit implements Runnable {
/**
* Returns the supported cursor size (Win32 only has one).
*/
@Override
public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) {
return new Dimension(WCustomCursor.getCursorWidth(),
WCustomCursor.getCursorHeight());
}
@Override
public native int getMaximumCursorColors();
static void paletteChanged() {
@ -772,6 +831,7 @@ public class WToolkit extends SunToolkit implements Runnable {
*/
static public void displayChanged() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
((Win32GraphicsEnvironment)GraphicsEnvironment
.getLocalGraphicsEnvironment())
@ -784,10 +844,12 @@ public class WToolkit extends SunToolkit implements Runnable {
* create the peer for a DragSourceContext
*/
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
@Override
public <T extends DragGestureRecognizer> T
createDragGestureRecognizer(Class<T> abstractRecognizerClass,
DragSource ds, Component c, int srcActions,
@ -808,6 +870,7 @@ public class WToolkit extends SunToolkit implements Runnable {
private static final String awtPrefix = "awt.";
private static final String dndPrefix = "DnD.";
@Override
protected Object lazilyLoadDesktopProperty(String name) {
if (name.startsWith(prefix)) {
String cursorName = name.substring(prefix.length(), name.length()) + postfix;
@ -874,6 +937,7 @@ public class WToolkit extends SunToolkit implements Runnable {
*/
private void windowsSettingChange() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
updateProperties();
}
@ -896,6 +960,7 @@ public class WToolkit extends SunToolkit implements Runnable {
}
}
@Override
public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
if (name == null) {
// See JavaDoc for the Toolkit.addPropertyChangeListener() method
@ -916,6 +981,7 @@ public class WToolkit extends SunToolkit implements Runnable {
* initialize only static props here and do not try to initialize props which depends on wprops,
* this should be done in lazilyLoadDesktopProperty() only.
*/
@Override
protected synchronized void initializeDesktopProperties() {
desktopProperties.put("DnD.Autoscroll.initialDelay",
Integer.valueOf(50));
@ -931,6 +997,7 @@ public class WToolkit extends SunToolkit implements Runnable {
* This returns the value for the desktop property "awt.font.desktophints"
* This requires that the Windows properties have already been gathered.
*/
@Override
protected synchronized RenderingHints getDesktopAAHints() {
if (wprops == null) {
return null;
@ -939,6 +1006,7 @@ public class WToolkit extends SunToolkit implements Runnable {
}
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
return (modalityType == null) ||
(modalityType == Dialog.ModalityType.MODELESS) ||
@ -947,6 +1015,7 @@ public class WToolkit extends SunToolkit implements Runnable {
(modalityType == Dialog.ModalityType.TOOLKIT_MODAL);
}
@Override
public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
return (exclusionType == null) ||
(exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE) ||
@ -986,6 +1055,7 @@ public class WToolkit extends SunToolkit implements Runnable {
return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
}
@Override
@SuppressWarnings("deprecation")
public void grab(Window w) {
if (w.getPeer() != null) {
@ -993,6 +1063,7 @@ public class WToolkit extends SunToolkit implements Runnable {
}
}
@Override
@SuppressWarnings("deprecation")
public void ungrab(Window w) {
if (w.getPeer() != null) {
@ -1000,17 +1071,21 @@ public class WToolkit extends SunToolkit implements Runnable {
}
}
@Override
public native boolean syncNativeQueue(final long timeout);
@Override
public boolean isDesktopSupported() {
return true;
}
@Override
public DesktopPeer createDesktopPeer(Desktop target) {
return new WDesktopPeer();
}
public static native void setExtraMouseButtonsEnabledNative(boolean enable);
private static native void setExtraMouseButtonsEnabledNative(boolean enable);
@Override
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
return areExtraMouseButtonsEnabled;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,9 +36,8 @@ import java.awt.peer.TrayIconPeer;
import java.awt.image.*;
import sun.awt.SunToolkit;
import sun.awt.image.IntegerComponentRaster;
import sun.awt.windows.WPopupMenuPeer;
public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
final static int TRAY_ICON_WIDTH = 16;
final static int TRAY_ICON_HEIGHT = 16;
final static int TRAY_ICON_MASK_SIZE = (TRAY_ICON_WIDTH * TRAY_ICON_HEIGHT) / 8;
@ -48,6 +47,7 @@ public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
Frame popupParent = new Frame("PopupMessageWindow");
PopupMenu popup;
@Override
protected void disposeImpl() {
if (popupParent != null) {
popupParent.dispose();
@ -64,6 +64,7 @@ public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
updateImage();
}
@Override
public void updateImage() {
Image image = ((TrayIcon)target).getImage();
if (image != null) {
@ -71,13 +72,16 @@ public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
}
}
@Override
public native void setToolTip(String tooltip);
@Override
public synchronized void showPopupMenu(final int x, final int y) {
if (isDisposed())
return;
SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
@Override
public void run() {
PopupMenu newPopup = ((TrayIcon)target).getPopupMenu();
if (popup != newPopup) {
@ -96,6 +100,7 @@ public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
});
}
@Override
public void displayMessage(String caption, String text, String messageType) {
// The situation when both caption and text are null is processed in the shared code.
if (caption == null) {
@ -185,6 +190,7 @@ public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
native void _displayMessage(String caption, String text, String messageType);
class IconObserver implements ImageObserver {
@Override
public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
if (image != ((TrayIcon)target).getImage() || // if the image has been changed
isDisposed())

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -90,6 +90,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
// WComponentPeer overrides
@Override
@SuppressWarnings("unchecked")
protected void disposeImpl() {
AppContext appContext = SunToolkit.targetToAppContext(target);
@ -118,24 +119,30 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
// WindowPeer implementation
@Override
public void toFront() {
updateFocusableWindowState();
_toFront();
}
native void _toFront();
private native void _toFront();
@Override
public native void toBack();
public native void setAlwaysOnTopNative(boolean value);
private native void setAlwaysOnTopNative(boolean value);
public void setAlwaysOnTop(boolean value) {
if ((value && ((Window)target).isVisible()) || !value) {
setAlwaysOnTopNative(value);
}
}
@Override
public void updateAlwaysOnTopState() {
setAlwaysOnTop(((Window)target).isAlwaysOnTop());
}
@Override
public void updateFocusableWindowState() {
setFocusableWindow(((Window)target).isFocusableWindow());
}
@ -150,12 +157,13 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
_setTitle(title);
}
native void _setTitle(String title);
private native void _setTitle(String title);
public void setResizable(boolean resizable) {
_setResizable(resizable);
}
public native void _setResizable(boolean resizable);
private native void _setResizable(boolean resizable);
// Toolkit & peer internals
@ -163,6 +171,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
super(target);
}
@Override
void initialize() {
super.initialize();
@ -210,6 +219,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
windowType = ((Window)target).getType();
}
@Override
void create(WComponentPeer parent) {
preCreate(parent);
createAwtWindow(parent);
@ -226,6 +236,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
super.show();
}
@Override
public void show() {
updateFocusableWindowState();
@ -289,7 +300,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
return requestWindowFocus(cause == CausedFocusEvent.Cause.MOUSE_EVENT);
}
public native boolean requestWindowFocus(boolean isMouseEventCause);
private native boolean requestWindowFocus(boolean isMouseEventCause);
public boolean focusAllowedFor() {
Window window = (Window)this.target;
@ -305,7 +316,8 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
return true;
}
public void hide() {
@Override
void hide() {
WindowListener listener = windowListener;
if (listener != null) {
// We're not getting WINDOW_CLOSING from the native code when hiding
@ -316,6 +328,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
// WARNING: it's called on the Toolkit thread!
@Override
void preprocessPostEvent(AWTEvent event) {
if (event instanceof WindowEvent) {
WindowListener listener = windowListener;
@ -340,6 +353,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
windowListener = AWTEventMulticaster.remove(windowListener, l);
}
@Override
public void updateMinimumSize() {
Dimension minimumSize = null;
if (((Component)target).isMinimumSizeSet()) {
@ -356,6 +370,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
}
@Override
public void updateIconImages() {
java.util.List<Image> imageList = ((Window)target).getIconImages();
if (imageList == null || imageList.size() == 0) {
@ -393,6 +408,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
return modalBlocker != null;
}
@Override
@SuppressWarnings("deprecation")
public void setModalBlocked(Dialog dialog, boolean blocked) {
synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
@ -459,6 +475,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
void draggedToNewScreen() {
SunToolkit.executeOnEventHandlerThread((Component)target,new Runnable()
{
@Override
public void run() {
displayChanged();
}
@ -519,6 +536,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* reflects the current display depth information, which has
* just changed).
*/
@Override
public void displayChanged() {
updateGC();
}
@ -527,6 +545,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* Part of the DisplayChangedListener interface: components
* do not need to react to this event
*/
@Override
public void paletteChanged() {
}
@ -565,6 +584,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
private volatile int sysW = 0;
private volatile int sysH = 0;
@Override
public native void repositionSecurityWarning();
@Override
@ -620,6 +640,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
private native void setOpacity(int iOpacity);
private float opacity = 1.0f;
@Override
public void setOpacity(float opacity) {
if (!((SunToolkit)((Window)target).getToolkit()).
isWindowOpacitySupported())
@ -663,6 +684,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
private native void setOpaqueImpl(boolean isOpaque);
@Override
public void setOpaque(boolean isOpaque) {
synchronized (getStateLock()) {
if (this.isOpaque == isOpaque) {
@ -720,8 +742,9 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
}
}
public native void updateWindowImpl(int[] data, int width, int height);
native void updateWindowImpl(int[] data, int width, int height);
@Override
public void updateWindow() {
updateWindow(false);
}
@ -770,6 +793,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
* unregisters ActiveWindowListener listener.
*/
private static class GuiDisposedListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent e) {
boolean isDisposed = (Boolean)e.getNewValue();
if (isDisposed != true) {
@ -795,6 +819,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
*/
@SuppressWarnings( value = {"deprecation", "unchecked"})
private static class ActiveWindowListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent e) {
Window w = (Window)e.getNewValue();
if (w == null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,11 +29,12 @@ import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.*;
public class WingDings extends Charset {
final class WingDings extends Charset {
public WingDings () {
super("WingDings", null);
}
@Override
public CharsetEncoder newEncoder() {
return new Encoder(this);
}
@ -41,10 +42,12 @@ public class WingDings extends Charset {
/* Seems like supporting a decoder is required, but we aren't going
* to be publically exposing this class, so no need to waste work
*/
@Override
public CharsetDecoder newDecoder() {
throw new Error("Decoder isn't implemented for WingDings Charset");
}
@Override
public boolean contains(Charset cs) {
return cs instanceof WingDings;
}
@ -54,6 +57,7 @@ public class WingDings extends Charset {
super(cs, 1.0f, 1.0f);
}
@Override
public boolean canEncode(char c) {
if(c >= 0x2701 && c <= 0x27be){
if (table[c - 0x2700] != 0x00)
@ -64,6 +68,7 @@ public class WingDings extends Charset {
return false;
}
@Override
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
char[] sa = src.array();
int sp = src.arrayOffset() + src.position();
@ -156,6 +161,7 @@ public class WingDings extends Charset {
};
/* The default implementation creates a decoder and we don't have one */
@Override
public boolean isLegalReplacement(byte[] repl) {
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -165,17 +165,6 @@ Java_sun_awt_windows_WPrintDialog_initIDs(JNIEnv *env, jclass cls)
CATCH_BAD_ALLOC;
}
JNIEXPORT void JNICALL
Java_sun_awt_windows_WPrintDialog_setPeer(JNIEnv *env, jobject target,
jobject peer)
{
TRY;
env->SetObjectField(target, AwtComponent::peerID, peer);
CATCH_BAD_ALLOC;
}
JNIEXPORT void JNICALL
Java_sun_awt_windows_WPrintDialogPeer_initIDs(JNIEnv *env, jclass cls)
{