Merge
This commit is contained in:
commit
41cd33fc25
@ -217,6 +217,7 @@ CORE_PKGS = \
|
|||||||
javax.swing.plaf.basic \
|
javax.swing.plaf.basic \
|
||||||
javax.swing.plaf.metal \
|
javax.swing.plaf.metal \
|
||||||
javax.swing.plaf.multi \
|
javax.swing.plaf.multi \
|
||||||
|
javax.swing.plaf.nimbus \
|
||||||
javax.swing.plaf.synth \
|
javax.swing.plaf.synth \
|
||||||
javax.tools \
|
javax.tools \
|
||||||
javax.transaction \
|
javax.transaction \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,13 +27,17 @@ package com.sun.java.swing;
|
|||||||
|
|
||||||
import sun.awt.EventQueueDelegate;
|
import sun.awt.EventQueueDelegate;
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.awt.AWTEvent;
|
import java.awt.AWTEvent;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.Container;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.RepaintManager;
|
import javax.swing.RepaintManager;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of utility methods for Swing.
|
* A collection of utility methods for Swing.
|
||||||
@ -69,6 +73,43 @@ public class SwingUtilities3 {
|
|||||||
repaintManager);
|
repaintManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Map<Container, Boolean> vsyncedMap =
|
||||||
|
Collections.synchronizedMap(new WeakHashMap<Container, Boolean>());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets vsyncRequested state for the {@code rootContainer}. If
|
||||||
|
* {@code isRequested} is {@code true} then vsynced
|
||||||
|
* {@code BufferStrategy} is enabled for this {@code rootContainer}.
|
||||||
|
*
|
||||||
|
* Note: requesting vsynced painting does not guarantee one. The outcome
|
||||||
|
* depends on current RepaintManager's RepaintManager.PaintManager
|
||||||
|
* and on the capabilities of the graphics hardware/software and what not.
|
||||||
|
*
|
||||||
|
* @param rootContainer topmost container. Should be either {@code Window}
|
||||||
|
* or {@code Applet}
|
||||||
|
* @param isRequested the value to set vsyncRequested state to
|
||||||
|
*/
|
||||||
|
public static void setVsyncRequested(Container rootContainer,
|
||||||
|
boolean isRequested) {
|
||||||
|
assert SwingUtilities.getRoot(rootContainer) == rootContainer;
|
||||||
|
if (isRequested) {
|
||||||
|
vsyncedMap.put(rootContainer, Boolean.TRUE);
|
||||||
|
} else {
|
||||||
|
vsyncedMap.remove(rootContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if vsync painting is requested for {@code rootContainer}
|
||||||
|
*
|
||||||
|
* @param rootContainer topmost container. Should be either Window or Applet
|
||||||
|
* @return {@code true} if vsync painting is requested for {@code rootContainer}
|
||||||
|
*/
|
||||||
|
public static boolean isVsyncRequested(Container rootContainer) {
|
||||||
|
assert SwingUtilities.getRoot(rootContainer) == rootContainer;
|
||||||
|
return Boolean.TRUE == vsyncedMap.get(rootContainer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns delegate {@code RepaintManager} for {@code component} hierarchy.
|
* Returns delegate {@code RepaintManager} for {@code component} hierarchy.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -139,7 +139,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
|||||||
});
|
});
|
||||||
isSunDesktop = val.booleanValue();
|
isSunDesktop = val.booleanValue();
|
||||||
}
|
}
|
||||||
if (isSunDesktop) {
|
if (isSunDesktop && !sun.java2d.SunGraphicsEnvironment.isOpenSolaris) {
|
||||||
isSunCJK = true;
|
isSunCJK = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class EnumPersistenceDelegate extends PersistenceDelegate {
|
|||||||
|
|
||||||
protected Expression instantiate(Object oldInstance, Encoder out) {
|
protected Expression instantiate(Object oldInstance, Encoder out) {
|
||||||
Enum e = (Enum) oldInstance;
|
Enum e = (Enum) oldInstance;
|
||||||
return new Expression(e, Enum.class, "valueOf", new Object[]{e.getClass(), e.name()});
|
return new Expression(e, Enum.class, "valueOf", new Object[]{e.getDeclaringClass(), e.name()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,9 +1030,9 @@ public class SimpleDateFormat extends DateFormat {
|
|||||||
|
|
||||||
case 1: // 'y' - YEAR
|
case 1: // 'y' - YEAR
|
||||||
if (calendar instanceof GregorianCalendar) {
|
if (calendar instanceof GregorianCalendar) {
|
||||||
if (count >= 4)
|
if (count != 2)
|
||||||
zeroPaddingNumber(value, count, maxIntCount, buffer);
|
zeroPaddingNumber(value, count, maxIntCount, buffer);
|
||||||
else // count < 4
|
else // count == 2
|
||||||
zeroPaddingNumber(value, 2, 2, buffer); // clip 1996 to 96
|
zeroPaddingNumber(value, 2, 2, buffer); // clip 1996 to 96
|
||||||
} else {
|
} else {
|
||||||
if (current == null) {
|
if (current == null) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -33,9 +33,13 @@ import java.lang.ref.WeakReference;
|
|||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
|
||||||
|
import com.sun.java.swing.SwingUtilities3;
|
||||||
|
|
||||||
import sun.awt.SubRegionShowable;
|
import sun.awt.SubRegionShowable;
|
||||||
import sun.java2d.SunGraphics2D;
|
import sun.java2d.SunGraphics2D;
|
||||||
import sun.security.action.GetPropertyAction;
|
import sun.security.action.GetPropertyAction;
|
||||||
|
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,12 +78,6 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
|||||||
private static Method COMPONENT_CREATE_BUFFER_STRATEGY_METHOD;
|
private static Method COMPONENT_CREATE_BUFFER_STRATEGY_METHOD;
|
||||||
private static Method COMPONENT_GET_BUFFER_STRATEGY_METHOD;
|
private static Method COMPONENT_GET_BUFFER_STRATEGY_METHOD;
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether or not we should try and get a flip buffer strategy
|
|
||||||
* first, default is false.
|
|
||||||
*/
|
|
||||||
private static boolean TRY_FLIP;
|
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(
|
private static final Logger LOGGER = Logger.getLogger(
|
||||||
"javax.swing.BufferStrategyPaintManager");
|
"javax.swing.BufferStrategyPaintManager");
|
||||||
|
|
||||||
@ -152,12 +150,6 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
|||||||
*/
|
*/
|
||||||
private boolean disposeBufferOnEnd;
|
private boolean disposeBufferOnEnd;
|
||||||
|
|
||||||
|
|
||||||
static {
|
|
||||||
TRY_FLIP = "true".equals(AccessController.doPrivileged(
|
|
||||||
new GetPropertyAction("swing.useFlipBufferStrategy", "false")));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Method getGetBufferStrategyMethod() {
|
private static Method getGetBufferStrategyMethod() {
|
||||||
if (COMPONENT_GET_BUFFER_STRATEGY_METHOD == null) {
|
if (COMPONENT_GET_BUFFER_STRATEGY_METHOD == null) {
|
||||||
getMethods();
|
getMethods();
|
||||||
@ -258,7 +250,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
|||||||
try {
|
try {
|
||||||
BufferInfo info = getBufferInfo(c);
|
BufferInfo info = getBufferInfo(c);
|
||||||
BufferStrategy bufferStrategy;
|
BufferStrategy bufferStrategy;
|
||||||
if (info != null && !info.usingFlip && info.isInSync() &&
|
if (info != null && info.isInSync() &&
|
||||||
(bufferStrategy = info.getBufferStrategy(false)) != null) {
|
(bufferStrategy = info.getBufferStrategy(false)) != null) {
|
||||||
SubRegionShowable bsSubRegion =
|
SubRegionShowable bsSubRegion =
|
||||||
(SubRegionShowable)bufferStrategy;
|
(SubRegionShowable)bufferStrategy;
|
||||||
@ -687,8 +679,6 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
|||||||
// same reason.
|
// same reason.
|
||||||
private WeakReference<BufferStrategy> weakBS;
|
private WeakReference<BufferStrategy> weakBS;
|
||||||
private WeakReference<Container> root;
|
private WeakReference<Container> root;
|
||||||
// Whether or not we're using flip bs or blit.
|
|
||||||
private boolean usingFlip;
|
|
||||||
// Indicates whether or not the backbuffer and display are in sync.
|
// Indicates whether or not the backbuffer and display are in sync.
|
||||||
// This is set to true when a full repaint on the rootpane is done.
|
// This is set to true when a full repaint on the rootpane is done.
|
||||||
private boolean inSync;
|
private boolean inSync;
|
||||||
@ -765,13 +755,6 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
|||||||
return bs;
|
return bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if using a flip buffer strategy.
|
|
||||||
*/
|
|
||||||
public boolean usingFlip() {
|
|
||||||
return usingFlip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the buffer strategy of the component differs
|
* Returns true if the buffer strategy of the component differs
|
||||||
* from current buffer strategy.
|
* from current buffer strategy.
|
||||||
@ -816,23 +799,19 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
|||||||
* blit.
|
* blit.
|
||||||
*/
|
*/
|
||||||
private BufferStrategy createBufferStrategy() {
|
private BufferStrategy createBufferStrategy() {
|
||||||
BufferCapabilities caps;
|
|
||||||
Container root = getRoot();
|
Container root = getRoot();
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BufferStrategy bs = null;
|
BufferStrategy bs = null;
|
||||||
if (TRY_FLIP) {
|
if (SwingUtilities3.isVsyncRequested(root)) {
|
||||||
bs = createBufferStrategy(root,BufferCapabilities.FlipContents.
|
bs = createBufferStrategy(root, true);
|
||||||
COPIED);
|
|
||||||
usingFlip = true;
|
|
||||||
if (LOGGER.isLoggable(Level.FINER)) {
|
if (LOGGER.isLoggable(Level.FINER)) {
|
||||||
LOGGER.finer("createBufferStrategy: using flip strategy");
|
LOGGER.finer("createBufferStrategy: using vsynced strategy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bs == null) {
|
if (bs == null) {
|
||||||
bs = createBufferStrategy(root, null);
|
bs = createBufferStrategy(root, false);
|
||||||
usingFlip = false;
|
|
||||||
}
|
}
|
||||||
if (!(bs instanceof SubRegionShowable)) {
|
if (!(bs instanceof SubRegionShowable)) {
|
||||||
// We do this for two reasons:
|
// We do this for two reasons:
|
||||||
@ -845,15 +824,22 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
|
|||||||
return bs;
|
return bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates and returns a buffer strategy of the requested type. If
|
// Creates and returns a buffer strategy. If
|
||||||
// there is a problem creating the buffer strategy this will
|
// there is a problem creating the buffer strategy this will
|
||||||
// eat the exception and return null.
|
// eat the exception and return null.
|
||||||
private BufferStrategy createBufferStrategy(Container root,
|
private BufferStrategy createBufferStrategy(Container root,
|
||||||
BufferCapabilities.FlipContents type) {
|
boolean isVsynced) {
|
||||||
BufferCapabilities caps = new BufferCapabilities(
|
BufferCapabilities caps;
|
||||||
new ImageCapabilities(true),
|
if (isVsynced) {
|
||||||
new ImageCapabilities(true),
|
caps = new ExtendedBufferCapabilities(
|
||||||
type);
|
new ImageCapabilities(true), new ImageCapabilities(true),
|
||||||
|
BufferCapabilities.FlipContents.COPIED,
|
||||||
|
ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
|
||||||
|
} else {
|
||||||
|
caps = new BufferCapabilities(
|
||||||
|
new ImageCapabilities(true), new ImageCapabilities(true),
|
||||||
|
null);
|
||||||
|
}
|
||||||
BufferStrategy bs = null;
|
BufferStrategy bs = null;
|
||||||
if (SunToolkit.isInstanceOf(root, "java.applet.Applet")) {
|
if (SunToolkit.isInstanceOf(root, "java.applet.Applet")) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -683,6 +683,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
|
|||||||
}
|
}
|
||||||
getDesktopManager().endResizingFrame(frame);
|
getDesktopManager().endResizingFrame(frame);
|
||||||
resizing = false;
|
resizing = false;
|
||||||
|
updateFrameCursor();
|
||||||
}
|
}
|
||||||
_x = 0;
|
_x = 0;
|
||||||
_y = 0;
|
_y = 0;
|
||||||
|
@ -31,7 +31,6 @@ import javax.swing.*;
|
|||||||
import javax.swing.plaf.UIResource;
|
import javax.swing.plaf.UIResource;
|
||||||
import javax.swing.Painter;
|
import javax.swing.Painter;
|
||||||
import java.awt.print.PrinterGraphics;
|
import java.awt.print.PrinterGraphics;
|
||||||
import static javax.swing.plaf.nimbus.NimbusLookAndFeel.deriveARGB;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenient base class for defining Painter instances for rendering a
|
* Convenient base class for defining Painter instances for rendering a
|
||||||
@ -347,7 +346,7 @@ public abstract class AbstractRegionPainter implements Painter<JComponent> {
|
|||||||
*/
|
*/
|
||||||
protected final Color decodeColor(Color color1, Color color2,
|
protected final Color decodeColor(Color color1, Color color2,
|
||||||
float midPoint) {
|
float midPoint) {
|
||||||
return new Color(deriveARGB(color1, color2, midPoint));
|
return new Color(NimbusLookAndFeel.deriveARGB(color1, color2, midPoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -278,7 +278,7 @@ ${UI_DEFAULT_INIT}
|
|||||||
* offset (if any), and whether it is to be bold, italic, or left in its
|
* offset (if any), and whether it is to be bold, italic, or left in its
|
||||||
* default form.</p>
|
* default form.</p>
|
||||||
*/
|
*/
|
||||||
public static final class DerivedFont implements UIDefaults.ActiveValue {
|
static final class DerivedFont implements UIDefaults.ActiveValue {
|
||||||
private float sizeOffset;
|
private float sizeOffset;
|
||||||
private Boolean bold;
|
private Boolean bold;
|
||||||
private Boolean italic;
|
private Boolean italic;
|
||||||
|
@ -436,15 +436,13 @@ public class NimbusLookAndFeel extends SynthLookAndFeel {
|
|||||||
*/
|
*/
|
||||||
static int deriveARGB(Color color1, Color color2, float midPoint) {
|
static int deriveARGB(Color color1, Color color2, float midPoint) {
|
||||||
int r = color1.getRed() +
|
int r = color1.getRed() +
|
||||||
(int) ((color2.getRed() - color1.getRed()) * midPoint + 0.5f);
|
Math.round((color2.getRed() - color1.getRed()) * midPoint);
|
||||||
int g = color1.getGreen() +
|
int g = color1.getGreen() +
|
||||||
(int) ((color2.getGreen() - color1.getGreen()) * midPoint +
|
Math.round((color2.getGreen() - color1.getGreen()) * midPoint);
|
||||||
0.5f);
|
|
||||||
int b = color1.getBlue() +
|
int b = color1.getBlue() +
|
||||||
(int) ((color2.getBlue() - color1.getBlue()) * midPoint + 0.5f);
|
Math.round((color2.getBlue() - color1.getBlue()) * midPoint);
|
||||||
int a = color1.getAlpha() +
|
int a = color1.getAlpha() +
|
||||||
(int) ((color2.getAlpha() - color1.getAlpha()) * midPoint +
|
Math.round((color2.getAlpha() - color1.getAlpha()) * midPoint);
|
||||||
0.5f);
|
|
||||||
return ((a & 0xFF) << 24) |
|
return ((a & 0xFF) << 24) |
|
||||||
((r & 0xFF) << 16) |
|
((r & 0xFF) << 16) |
|
||||||
((g & 0xFF) << 8) |
|
((g & 0xFF) << 8) |
|
||||||
|
@ -31,7 +31,7 @@ import javax.swing.*;
|
|||||||
import javax.swing.Painter;
|
import javax.swing.Painter;
|
||||||
|
|
||||||
|
|
||||||
public final class ${PAINTER_NAME} extends AbstractRegionPainter {
|
final class ${PAINTER_NAME} extends AbstractRegionPainter {
|
||||||
//package private integers representing the available states that
|
//package private integers representing the available states that
|
||||||
//this painter will paint. These are used when creating a new instance
|
//this painter will paint. These are used when creating a new instance
|
||||||
//of ${PAINTER_NAME} to determine which region/state is being painted
|
//of ${PAINTER_NAME} to determine which region/state is being painted
|
||||||
|
@ -38,7 +38,7 @@ background {@code Painter}, and there may be several painters for different
|
|||||||
component states.
|
component states.
|
||||||
|
|
||||||
<p>Nimbus allows customizing many of its properties, including painters, by
|
<p>Nimbus allows customizing many of its properties, including painters, by
|
||||||
altering the {@link UIDefaults} table. Here's an example:
|
altering the {@link javax.swing.UIDefaults} table. Here's an example:
|
||||||
<code><pre>
|
<code><pre>
|
||||||
UIManager.put("ProgressBar.tileWidth", myTileWidth);
|
UIManager.put("ProgressBar.tileWidth", myTileWidth);
|
||||||
UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
|
UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
|
||||||
|
@ -69,6 +69,7 @@ class SynthColorChooserUI extends BasicColorChooserUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void installDefaults() {
|
protected void installDefaults() {
|
||||||
|
super.installDefaults();
|
||||||
updateStyle(chooser);
|
updateStyle(chooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -118,12 +118,12 @@ public class DefaultTableCellRenderer extends JLabel
|
|||||||
if (System.getSecurityManager() != null) {
|
if (System.getSecurityManager() != null) {
|
||||||
if (border != null) return border;
|
if (border != null) return border;
|
||||||
return SAFE_NO_FOCUS_BORDER;
|
return SAFE_NO_FOCUS_BORDER;
|
||||||
} else {
|
} else if (border != null) {
|
||||||
if (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER) {
|
if (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER) {
|
||||||
return border;
|
return border;
|
||||||
}
|
}
|
||||||
return noFocusBorder;
|
|
||||||
}
|
}
|
||||||
|
return noFocusBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1598,15 +1598,34 @@ public final class NormalizerBase implements Cloneable {
|
|||||||
* @param options the optional features to be enabled.
|
* @param options the optional features to be enabled.
|
||||||
*/
|
*/
|
||||||
public static String normalize(String str, Normalizer.Form form, int options) {
|
public static String normalize(String str, Normalizer.Form form, int options) {
|
||||||
|
int len = str.length();
|
||||||
|
boolean asciiOnly = true;
|
||||||
|
if (len < 80) {
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
if (str.charAt(i) > 127) {
|
||||||
|
asciiOnly = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
char[] a = str.toCharArray();
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
if (a[i] > 127) {
|
||||||
|
asciiOnly = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (form) {
|
switch (form) {
|
||||||
case NFC :
|
case NFC :
|
||||||
return NFC.normalize(str, options);
|
return asciiOnly ? str : NFC.normalize(str, options);
|
||||||
case NFD :
|
case NFD :
|
||||||
return NFD.normalize(str, options);
|
return asciiOnly ? str : NFD.normalize(str, options);
|
||||||
case NFKC :
|
case NFKC :
|
||||||
return NFKC.normalize(str, options);
|
return asciiOnly ? str : NFKC.normalize(str, options);
|
||||||
case NFKD :
|
case NFKD :
|
||||||
return NFKD.normalize(str, options);
|
return asciiOnly ? str : NFKD.normalize(str, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException("Unexpected normalization form: " +
|
throw new IllegalArgumentException("Unexpected normalization form: " +
|
||||||
|
@ -53,7 +53,7 @@ import javax.swing.*;
|
|||||||
public final class RangeMenu extends JComboBox implements ActionListener {
|
public final class RangeMenu extends JComboBox implements ActionListener {
|
||||||
|
|
||||||
/// Painfully extracted from java.lang.Character.UnicodeBlock. Arrrgh!
|
/// Painfully extracted from java.lang.Character.UnicodeBlock. Arrrgh!
|
||||||
/// Unicode 3.0 data.
|
/// Unicode 5.1.0 data.
|
||||||
|
|
||||||
private final int[][] UNICODE_RANGES = {
|
private final int[][] UNICODE_RANGES = {
|
||||||
{ 0x000000, 0x00007f }, /// BASIC_LATIN
|
{ 0x000000, 0x00007f }, /// BASIC_LATIN
|
||||||
@ -63,14 +63,16 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
{ 0x000250, 0x0002af }, /// IPA_EXTENSIONS
|
{ 0x000250, 0x0002af }, /// IPA_EXTENSIONS
|
||||||
{ 0x0002b0, 0x0002ff }, /// SPACING_MODIFIER_LETTERS
|
{ 0x0002b0, 0x0002ff }, /// SPACING_MODIFIER_LETTERS
|
||||||
{ 0x000300, 0x00036f }, /// COMBINING_DIACRITICAL_MARKS
|
{ 0x000300, 0x00036f }, /// COMBINING_DIACRITICAL_MARKS
|
||||||
{ 0x000370, 0x0003ff }, /// GREEK
|
{ 0x000370, 0x0003ff }, /// GREEK_AND_COPTIC
|
||||||
{ 0x000400, 0x0004ff }, /// CYRILLIC
|
{ 0x000400, 0x0004ff }, /// CYRILLIC
|
||||||
{ 0x000500, 0x00052f }, /// CYRILLIC_SUPPLEMENTARY
|
{ 0x000500, 0x00052f }, /// CYRILLIC_SUPPLEMENTARY
|
||||||
{ 0x000530, 0x00058f }, /// ARMENIAN
|
{ 0x000530, 0x00058f }, /// ARMENIAN
|
||||||
{ 0x000590, 0x0005ff }, /// HEBREW
|
{ 0x000590, 0x0005ff }, /// HEBREW
|
||||||
{ 0x000600, 0x0006ff }, /// ARABIC
|
{ 0x000600, 0x0006ff }, /// ARABIC
|
||||||
{ 0x000700, 0x00074f }, /// SYRIAC
|
{ 0x000700, 0x00074f }, /// SYRIAC
|
||||||
|
{ 0x000750, 0x00077f }, /// ARABIC_SUPPLEMENT
|
||||||
{ 0x000780, 0x0007bf }, /// THAANA
|
{ 0x000780, 0x0007bf }, /// THAANA
|
||||||
|
{ 0x0007c0, 0x0007ff }, /// NKO
|
||||||
{ 0x000900, 0x00097f }, /// DEVANAGARI
|
{ 0x000900, 0x00097f }, /// DEVANAGARI
|
||||||
{ 0x000980, 0x0009ff }, /// BENGALI
|
{ 0x000980, 0x0009ff }, /// BENGALI
|
||||||
{ 0x000a00, 0x000a7f }, /// GURMUKHI
|
{ 0x000a00, 0x000a7f }, /// GURMUKHI
|
||||||
@ -88,6 +90,7 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
{ 0x0010a0, 0x0010ff }, /// GEORGIAN
|
{ 0x0010a0, 0x0010ff }, /// GEORGIAN
|
||||||
{ 0x001100, 0x0011ff }, /// HANGUL_JAMO
|
{ 0x001100, 0x0011ff }, /// HANGUL_JAMO
|
||||||
{ 0x001200, 0x00137f }, /// ETHIOPIC
|
{ 0x001200, 0x00137f }, /// ETHIOPIC
|
||||||
|
{ 0x001380, 0x00139f }, /// ETHIOPIC_SUPPLEMENT
|
||||||
{ 0x0013a0, 0x0013ff }, /// CHEROKEE
|
{ 0x0013a0, 0x0013ff }, /// CHEROKEE
|
||||||
{ 0x001400, 0x00167f }, /// UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS
|
{ 0x001400, 0x00167f }, /// UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS
|
||||||
{ 0x001680, 0x00169f }, /// OGHAM
|
{ 0x001680, 0x00169f }, /// OGHAM
|
||||||
@ -100,8 +103,16 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
{ 0x001800, 0x0018af }, /// MONGOLIAN
|
{ 0x001800, 0x0018af }, /// MONGOLIAN
|
||||||
{ 0x001900, 0x00194f }, /// LIMBU
|
{ 0x001900, 0x00194f }, /// LIMBU
|
||||||
{ 0x001950, 0x00197f }, /// TAI_LE
|
{ 0x001950, 0x00197f }, /// TAI_LE
|
||||||
|
{ 0x001980, 0x0019df }, /// NEW_TAI_LE
|
||||||
{ 0x0019e0, 0x0019ff }, /// KHMER_SYMBOLS
|
{ 0x0019e0, 0x0019ff }, /// KHMER_SYMBOLS
|
||||||
|
{ 0x001a00, 0x001a1f }, /// BUGINESE
|
||||||
|
{ 0x001b00, 0x001b7f }, /// BALINESE
|
||||||
|
{ 0x001b80, 0x001bbf }, /// SUNDANESE
|
||||||
|
{ 0x001c00, 0x001c4f }, /// LEPCHA
|
||||||
|
{ 0x001c50, 0x001c7f }, /// OL_CHIKI
|
||||||
{ 0x001d00, 0x001d7f }, /// PHONETIC_EXTENSIONS
|
{ 0x001d00, 0x001d7f }, /// PHONETIC_EXTENSIONS
|
||||||
|
{ 0x001d80, 0x001dbf }, /// PHONEITC EXTENSIONS SUPPLEMENT
|
||||||
|
{ 0x001dc0, 0x001dff }, /// COMBINING_DIACRITICAL_MAKRS_SUPPLEMENT
|
||||||
{ 0x001e00, 0x001eff }, /// LATIN_EXTENDED_ADDITIONAL
|
{ 0x001e00, 0x001eff }, /// LATIN_EXTENDED_ADDITIONAL
|
||||||
{ 0x001f00, 0x001fff }, /// GREEK_EXTENDED
|
{ 0x001f00, 0x001fff }, /// GREEK_EXTENDED
|
||||||
{ 0x002000, 0x00206f }, /// GENERAL_PUNCTUATION
|
{ 0x002000, 0x00206f }, /// GENERAL_PUNCTUATION
|
||||||
@ -128,6 +139,14 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
{ 0x002980, 0x0029ff }, /// MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B
|
{ 0x002980, 0x0029ff }, /// MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B
|
||||||
{ 0x002a00, 0x002aff }, /// SUPPLEMENTAL_MATHEMATICAL_OPERATORS
|
{ 0x002a00, 0x002aff }, /// SUPPLEMENTAL_MATHEMATICAL_OPERATORS
|
||||||
{ 0x002b00, 0x002bff }, /// MISCELLANEOUS_SYMBOLS_AND_ARROWS
|
{ 0x002b00, 0x002bff }, /// MISCELLANEOUS_SYMBOLS_AND_ARROWS
|
||||||
|
{ 0x002c00, 0x002c5f }, /// GLAGOLITIC
|
||||||
|
{ 0x002c60, 0x002c7f }, /// LATIN_EXTENDED-C
|
||||||
|
{ 0x002c80, 0x002cff }, /// COPTIC
|
||||||
|
{ 0x002d00, 0x002d2f }, /// GEORGIAN_SUPPLEMENT
|
||||||
|
{ 0x002d30, 0x002d7f }, /// TIFINAGH
|
||||||
|
{ 0x002d80, 0x002ddf }, /// ETHIOPIC_EXTENDED
|
||||||
|
{ 0x002de0, 0x002dff }, /// CYRILLIC_EXTENDED-A
|
||||||
|
{ 0x002e00, 0x002e7f }, /// SUPPLEMENTAL_PUNCTUATION
|
||||||
{ 0x002e80, 0x002eff }, /// CJK_RADICALS_SUPPLEMENT
|
{ 0x002e80, 0x002eff }, /// CJK_RADICALS_SUPPLEMENT
|
||||||
{ 0x002f00, 0x002fdf }, /// KANGXI_RADICALS
|
{ 0x002f00, 0x002fdf }, /// KANGXI_RADICALS
|
||||||
{ 0x002ff0, 0x002fff }, /// IDEOGRAPHIC_DESCRIPTION_CHARACTERS
|
{ 0x002ff0, 0x002fff }, /// IDEOGRAPHIC_DESCRIPTION_CHARACTERS
|
||||||
@ -138,6 +157,7 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
{ 0x003130, 0x00318f }, /// HANGUL_COMPATIBILITY_JAMO
|
{ 0x003130, 0x00318f }, /// HANGUL_COMPATIBILITY_JAMO
|
||||||
{ 0x003190, 0x00319f }, /// KANBUN
|
{ 0x003190, 0x00319f }, /// KANBUN
|
||||||
{ 0x0031a0, 0x0031bf }, /// BOPOMOFO_EXTENDED
|
{ 0x0031a0, 0x0031bf }, /// BOPOMOFO_EXTENDED
|
||||||
|
{ 0x0031c0, 0x0031ef }, /// CJK_STROKES
|
||||||
{ 0x0031f0, 0x0031ff }, /// KATAKANA_PHONETIC_EXTENSIONS
|
{ 0x0031f0, 0x0031ff }, /// KATAKANA_PHONETIC_EXTENSIONS
|
||||||
{ 0x003200, 0x0032ff }, /// ENCLOSED_CJK_LETTERS_AND_MONTHS
|
{ 0x003200, 0x0032ff }, /// ENCLOSED_CJK_LETTERS_AND_MONTHS
|
||||||
{ 0x003300, 0x0033ff }, /// CJK_COMPATIBILITY
|
{ 0x003300, 0x0033ff }, /// CJK_COMPATIBILITY
|
||||||
@ -146,13 +166,26 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
{ 0x004e00, 0x009fff }, /// CJK_UNIFIED_IDEOGRAPHS
|
{ 0x004e00, 0x009fff }, /// CJK_UNIFIED_IDEOGRAPHS
|
||||||
{ 0x00a000, 0x00a48f }, /// YI_SYLLABLES
|
{ 0x00a000, 0x00a48f }, /// YI_SYLLABLES
|
||||||
{ 0x00a490, 0x00a4cf }, /// YI_RADICALS
|
{ 0x00a490, 0x00a4cf }, /// YI_RADICALS
|
||||||
|
{ 0x00a500, 0x00a63f }, /// YAI
|
||||||
|
{ 0x00a640, 0x00a69f }, /// CYRILLIC_EXTENDED-B
|
||||||
|
{ 0x00a700, 0x00a71f }, /// MODIFIER_TONE_LETTERS
|
||||||
|
{ 0x00a720, 0x00a7ff }, /// LATIN_EXTENDED-D
|
||||||
|
{ 0x00a800, 0x00a82f }, /// SYLOTI_NAGRI
|
||||||
|
{ 0x00a840, 0x00a87f }, /// PHAGS-PA
|
||||||
|
{ 0x00a880, 0x00a8df }, /// SAURASHTRA
|
||||||
|
{ 0x00a900, 0x00a92f }, /// KAYAH_LI
|
||||||
|
{ 0x00a930, 0x00a95f }, /// REJANG
|
||||||
|
{ 0x00aa00, 0x00aa5f }, /// CHAM
|
||||||
{ 0x00ac00, 0x00d7af }, /// HANGUL_SYLLABLES
|
{ 0x00ac00, 0x00d7af }, /// HANGUL_SYLLABLES
|
||||||
{ 0x00d800, 0x00dfff }, /// SURROGATES_AREA
|
{ 0x00d800, 0x00db7f }, /// HIGH_SURROGATES_AREA
|
||||||
|
{ 0x00db80, 0x00dbff }, /// HIGH_PRIVATE_USE_SURROGATES_AREA
|
||||||
|
{ 0x00dc00, 0x00dfff }, /// LOW_SURROGATES_AREA
|
||||||
{ 0x00e000, 0x00f8ff }, /// PRIVATE_USE_AREA
|
{ 0x00e000, 0x00f8ff }, /// PRIVATE_USE_AREA
|
||||||
{ 0x00f900, 0x00faff }, /// CJK_COMPATIBILITY_IDEOGRAPHS
|
{ 0x00f900, 0x00faff }, /// CJK_COMPATIBILITY_IDEOGRAPHS
|
||||||
{ 0x00fb00, 0x00fb4f }, /// ALPHABETIC_PRESENTATION_FORMS
|
{ 0x00fb00, 0x00fb4f }, /// ALPHABETIC_PRESENTATION_FORMS
|
||||||
{ 0x00fb50, 0x00fdff }, /// ARABIC_PRESENTATION_FORMS_A
|
{ 0x00fb50, 0x00fdff }, /// ARABIC_PRESENTATION_FORMS_A
|
||||||
{ 0x00fe00, 0x00fe0f }, /// VARIATION_SELECTORS
|
{ 0x00fe00, 0x00fe0f }, /// VARIATION_SELECTORS
|
||||||
|
{ 0x00fe10, 0x00fe1f }, /// VERTICAL_FORMS
|
||||||
{ 0x00fe20, 0x00fe2f }, /// COMBINING_HALF_MARKS
|
{ 0x00fe20, 0x00fe2f }, /// COMBINING_HALF_MARKS
|
||||||
{ 0x00fe30, 0x00fe4f }, /// CJK_COMPATIBILITY_FORMS
|
{ 0x00fe30, 0x00fe4f }, /// CJK_COMPATIBILITY_FORMS
|
||||||
{ 0x00fe50, 0x00fe6f }, /// SMALL_FORM_VARIANTS
|
{ 0x00fe50, 0x00fe6f }, /// SMALL_FORM_VARIANTS
|
||||||
@ -162,17 +195,32 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
{ 0x010000, 0x01007f }, /// LINEAR_B_SYLLABARY
|
{ 0x010000, 0x01007f }, /// LINEAR_B_SYLLABARY
|
||||||
{ 0x010080, 0x0100ff }, /// LINEAR_B_IDEOGRAMS
|
{ 0x010080, 0x0100ff }, /// LINEAR_B_IDEOGRAMS
|
||||||
{ 0x010100, 0x01013f }, /// AEGEAN_NUMBERS
|
{ 0x010100, 0x01013f }, /// AEGEAN_NUMBERS
|
||||||
|
{ 0x010140, 0x01018f }, /// ANCIENT_GREEK_NUMBERS
|
||||||
|
{ 0x010190, 0x0101cf }, /// ANCIENT_SYMBOLS
|
||||||
|
{ 0x0101d0, 0x0101ff }, /// PHAISTOS_DISC
|
||||||
|
{ 0x010280, 0x01029f }, /// LYCIAN
|
||||||
|
{ 0x0102a0, 0x0102df }, /// CARIAN
|
||||||
{ 0x010300, 0x01032f }, /// OLD_ITALIC
|
{ 0x010300, 0x01032f }, /// OLD_ITALIC
|
||||||
{ 0x010330, 0x01034f }, /// GOTHIC
|
{ 0x010330, 0x01034f }, /// GOTHIC
|
||||||
{ 0x010380, 0x01039f }, /// UGARITIC
|
{ 0x010380, 0x01039f }, /// UGARITIC
|
||||||
|
{ 0x0103a0, 0x0103df }, /// OLD_PERSIAN
|
||||||
{ 0x010400, 0x01044f }, /// DESERET
|
{ 0x010400, 0x01044f }, /// DESERET
|
||||||
{ 0x010450, 0x01047f }, /// SHAVIAN
|
{ 0x010450, 0x01047f }, /// SHAVIAN
|
||||||
{ 0x010480, 0x0104af }, /// OSMANYA
|
{ 0x010480, 0x0104af }, /// OSMANYA
|
||||||
{ 0x010800, 0x01083f }, /// CYPRIOT_SYLLABARY
|
{ 0x010800, 0x01083f }, /// CYPRIOT_SYLLABARY
|
||||||
|
{ 0x010900, 0x01091f }, /// PHOENICIAN
|
||||||
|
{ 0x010920, 0x01093f }, /// LYDIAN
|
||||||
|
{ 0x010a00, 0x010a5f }, /// KHAROSHTHI
|
||||||
|
{ 0x012000, 0x0123ff }, /// CUNEIFORM
|
||||||
|
{ 0x012400, 0x01247f }, /// CUNEIFORM_NUMBERS_AND_PUNCTUATION
|
||||||
{ 0x01d000, 0x01d0ff }, /// BYZANTINE_MUSICAL_SYMBOLS
|
{ 0x01d000, 0x01d0ff }, /// BYZANTINE_MUSICAL_SYMBOLS
|
||||||
{ 0x01d100, 0x01d1ff }, /// MUSICAL_SYMBOLS
|
{ 0x01d100, 0x01d1ff }, /// MUSICAL_SYMBOLS
|
||||||
|
{ 0x01d200, 0x01d24f }, /// ANCIENT_GREEK_MUSICAL_NOTATION
|
||||||
{ 0x01d300, 0x01d35f }, /// TAI_XUAN_JING_SYMBOLS
|
{ 0x01d300, 0x01d35f }, /// TAI_XUAN_JING_SYMBOLS
|
||||||
|
{ 0x01d360, 0x01d37f }, /// COUNTING_ROD_NUMERALS
|
||||||
{ 0x01d400, 0x01d7ff }, /// MATHEMATICAL_ALPHANUMERIC_SYMBOLS
|
{ 0x01d400, 0x01d7ff }, /// MATHEMATICAL_ALPHANUMERIC_SYMBOLS
|
||||||
|
{ 0x01f000, 0x01f02f }, /// MAHJONG_TILES
|
||||||
|
{ 0x01f030, 0x01f09f }, /// DOMINO_TILES
|
||||||
{ 0x020000, 0x02a6df }, /// CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
|
{ 0x020000, 0x02a6df }, /// CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
|
||||||
{ 0x02f800, 0x02fa1f }, /// CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT
|
{ 0x02f800, 0x02fa1f }, /// CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT
|
||||||
{ 0x0e0000, 0x0e007f }, /// TAGS
|
{ 0x0e0000, 0x0e007f }, /// TAGS
|
||||||
@ -190,14 +238,16 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
"IPA Extensions",
|
"IPA Extensions",
|
||||||
"Spacing Modifier Letters",
|
"Spacing Modifier Letters",
|
||||||
"Combining Diacritical Marks",
|
"Combining Diacritical Marks",
|
||||||
"Greek",
|
"Greek and Coptic",
|
||||||
"Cyrillic",
|
"Cyrillic",
|
||||||
"Cyrillic Supplement",
|
"Cyrillic Supplement",
|
||||||
"Armenian",
|
"Armenian",
|
||||||
"Hebrew",
|
"Hebrew",
|
||||||
"Arabic",
|
"Arabic",
|
||||||
"Syriac",
|
"Syriac",
|
||||||
|
"Arabic Supplement",
|
||||||
"Thaana",
|
"Thaana",
|
||||||
|
"NKo",
|
||||||
"Devanagari",
|
"Devanagari",
|
||||||
"Bengali",
|
"Bengali",
|
||||||
"Gurmukhi",
|
"Gurmukhi",
|
||||||
@ -215,6 +265,7 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
"Georgian",
|
"Georgian",
|
||||||
"Hangul Jamo",
|
"Hangul Jamo",
|
||||||
"Ethiopic",
|
"Ethiopic",
|
||||||
|
"Ethiopic Supplement",
|
||||||
"Cherokee",
|
"Cherokee",
|
||||||
"Unified Canadian Aboriginal Syllabics",
|
"Unified Canadian Aboriginal Syllabics",
|
||||||
"Ogham",
|
"Ogham",
|
||||||
@ -227,14 +278,22 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
"Mongolian",
|
"Mongolian",
|
||||||
"Limbu",
|
"Limbu",
|
||||||
"Tai Le",
|
"Tai Le",
|
||||||
|
"New Tai Lue",
|
||||||
"Khmer Symbols",
|
"Khmer Symbols",
|
||||||
|
"Buginese",
|
||||||
|
"Balinese",
|
||||||
|
"Sundanese",
|
||||||
|
"Lepcha",
|
||||||
|
"Ol Chiki",
|
||||||
"Phonetic Extensions",
|
"Phonetic Extensions",
|
||||||
|
"Phonetic Extensions Supplement",
|
||||||
|
"Combining Diacritical Marks Supplement",
|
||||||
"Latin Extended Additional",
|
"Latin Extended Additional",
|
||||||
"Greek Extended",
|
"Greek Extended",
|
||||||
"General Punctuation",
|
"General Punctuation",
|
||||||
"Superscripts and Subscripts",
|
"Superscripts and Subscripts",
|
||||||
"Currency Symbols",
|
"Currency Symbols",
|
||||||
"Combining Marks for Symbols",
|
"Combining Diacritical Marks for Symbols",
|
||||||
"Letterlike Symbols",
|
"Letterlike Symbols",
|
||||||
"Number Forms",
|
"Number Forms",
|
||||||
"Arrows",
|
"Arrows",
|
||||||
@ -255,6 +314,14 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
"Miscellaneous Mathematical Symbols-B",
|
"Miscellaneous Mathematical Symbols-B",
|
||||||
"Supplemental Mathematical Operators",
|
"Supplemental Mathematical Operators",
|
||||||
"Miscellaneous Symbols and Arrows",
|
"Miscellaneous Symbols and Arrows",
|
||||||
|
"Glagolitic",
|
||||||
|
"Latin Extended-C",
|
||||||
|
"Coptic",
|
||||||
|
"Georgian Supplement",
|
||||||
|
"Tifinagh",
|
||||||
|
"Ethiopic Extended",
|
||||||
|
"Cyrillic Extended-A",
|
||||||
|
"Supplemental Punctuation",
|
||||||
"CJK Radicals Supplement",
|
"CJK Radicals Supplement",
|
||||||
"Kangxi Radicals",
|
"Kangxi Radicals",
|
||||||
"Ideographic Description Characters",
|
"Ideographic Description Characters",
|
||||||
@ -265,6 +332,7 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
"Hangul Compatibility Jamo",
|
"Hangul Compatibility Jamo",
|
||||||
"Kanbun",
|
"Kanbun",
|
||||||
"Bopomofo Extended",
|
"Bopomofo Extended",
|
||||||
|
"CJK Strokes",
|
||||||
"Katakana Phonetic Extensions",
|
"Katakana Phonetic Extensions",
|
||||||
"Enclosed CJK Letters and Months",
|
"Enclosed CJK Letters and Months",
|
||||||
"CJK Compatibility",
|
"CJK Compatibility",
|
||||||
@ -273,13 +341,26 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
"CJK Unified Ideographs",
|
"CJK Unified Ideographs",
|
||||||
"Yi Syllables",
|
"Yi Syllables",
|
||||||
"Yi Radicals",
|
"Yi Radicals",
|
||||||
|
"Vai",
|
||||||
|
"Cyrillic Extended-B",
|
||||||
|
"Modifier Tone Letters",
|
||||||
|
"Latin Extended-D",
|
||||||
|
"Syloti Nagri",
|
||||||
|
"Phags-pa",
|
||||||
|
"Saurashtra",
|
||||||
|
"Kayah Li",
|
||||||
|
"Rejang",
|
||||||
|
"Cham",
|
||||||
"Hangul Syllables",
|
"Hangul Syllables",
|
||||||
"Surrogates Area", // High Surrogates, High Private Use Surrogates, Low Surrogates
|
"High Surrogates",
|
||||||
|
"High Private Use Surrogates",
|
||||||
|
"Low Surrogates",
|
||||||
"Private Use Area",
|
"Private Use Area",
|
||||||
"CJK Compatibility Ideographs",
|
"CJK Compatibility Ideographs",
|
||||||
"Alphabetic Presentation Forms",
|
"Alphabetic Presentation Forms",
|
||||||
"Arabic Presentation Forms-A",
|
"Arabic Presentation Forms-A",
|
||||||
"Variation Selectors",
|
"Variation Selectors",
|
||||||
|
"Vertical Forms",
|
||||||
"Combining Half Marks",
|
"Combining Half Marks",
|
||||||
"CJK Compatibility Forms",
|
"CJK Compatibility Forms",
|
||||||
"Small Form Variants",
|
"Small Form Variants",
|
||||||
@ -289,17 +370,32 @@ public final class RangeMenu extends JComboBox implements ActionListener {
|
|||||||
"Linear B Syllabary",
|
"Linear B Syllabary",
|
||||||
"Linear B Ideograms",
|
"Linear B Ideograms",
|
||||||
"Aegean Numbers",
|
"Aegean Numbers",
|
||||||
|
"Ancient Greek Numbers",
|
||||||
|
"Ancient Symbols",
|
||||||
|
"Phaistos Disc",
|
||||||
|
"Lycian",
|
||||||
|
"Carian",
|
||||||
"Old Italic",
|
"Old Italic",
|
||||||
"Gothic",
|
"Gothic",
|
||||||
"Ugaritic",
|
"Ugaritic",
|
||||||
|
"Old Persian",
|
||||||
"Deseret",
|
"Deseret",
|
||||||
"Shavian",
|
"Shavian",
|
||||||
"Osmanya",
|
"Osmanya",
|
||||||
"Cypriot Syllabary",
|
"Cypriot Syllabary",
|
||||||
|
"Phoenician",
|
||||||
|
"Lydian",
|
||||||
|
"Kharoshthi",
|
||||||
|
"Cuneiform",
|
||||||
|
"Cuneiform Numbers and Punctuation",
|
||||||
"Byzantine Musical Symbols",
|
"Byzantine Musical Symbols",
|
||||||
"Musical Symbols",
|
"Musical Symbols",
|
||||||
|
"Ancient Greek Musical Notation",
|
||||||
"Tai Xuan Jing Symbols",
|
"Tai Xuan Jing Symbols",
|
||||||
|
"Counting Rod Numerals",
|
||||||
"Mathematical Alphanumeric Symbols",
|
"Mathematical Alphanumeric Symbols",
|
||||||
|
"Mahjong Tiles",
|
||||||
|
"Domino Tiles",
|
||||||
"CJK Unified Ideographs Extension B",
|
"CJK Unified Ideographs Extension B",
|
||||||
"CJK Compatibility Ideographs Supplement",
|
"CJK Compatibility Ideographs Supplement",
|
||||||
"Tags",
|
"Tags",
|
||||||
|
58
jdk/test/java/beans/XMLEncoder/Test6852574.java
Normal file
58
jdk/test/java/beans/XMLEncoder/Test6852574.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6852574
|
||||||
|
* @summary Tests Enum subclass encoding
|
||||||
|
* @author Sergey Malenkov
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final class Test6852574 extends AbstractTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new Test6852574().test(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Object getObject() {
|
||||||
|
return Data.FIRST;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Object getAnotherObject() {
|
||||||
|
return Data.SECOND;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Data {
|
||||||
|
FIRST {
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SECOND {
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 6850113
|
* @bug 6850113
|
||||||
* @summary Verify the return value of digit() for some digits.
|
* @summary Verify the return value of digit() for some digits.
|
||||||
|
* @compile -XDignore.symbol.file=true Bug6850113.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sun.text.normalizer.UCharacter;
|
import sun.text.normalizer.UCharacter;
|
||||||
|
81
jdk/test/java/text/Format/DateFormat/Bug6609750.java
Normal file
81
jdk/test/java/text/Format/DateFormat/Bug6609750.java
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6609750
|
||||||
|
* @summary Make sure that SimpleDateFormat.format() formats years correctly.
|
||||||
|
*/
|
||||||
|
import java.text.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class Bug6609750 {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
boolean error = false;
|
||||||
|
|
||||||
|
Locale defaultLocale = Locale.getDefault();
|
||||||
|
Locale.setDefault(Locale.US);
|
||||||
|
|
||||||
|
Date[] dates = {
|
||||||
|
new Date(9-1900, Calendar.JUNE, 12),
|
||||||
|
new Date(99-1900, Calendar.JUNE, 12),
|
||||||
|
new Date(999-1900, Calendar.JUNE, 12),
|
||||||
|
new Date(2009-1900, Calendar.JUNE, 12),
|
||||||
|
new Date(30009-1900, Calendar.JUNE, 12),
|
||||||
|
};
|
||||||
|
|
||||||
|
String[] patterns = {
|
||||||
|
"y", "yy", "yyy", "yyyy", "yyyyy", "yyyyyy"
|
||||||
|
};
|
||||||
|
String[][] expectedResults = {
|
||||||
|
{"9", "09", "009", "0009", "00009", "000009"},
|
||||||
|
{"99", "99", "099", "0099", "00099", "000099"},
|
||||||
|
{"999", "99", "999", "0999", "00999", "000999"},
|
||||||
|
{"2009", "09", "2009", "2009", "02009", "002009"},
|
||||||
|
{"30009", "09", "30009", "30009", "30009", "030009"},
|
||||||
|
};
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||||
|
for (int dateNo = 0; dateNo < dates.length; dateNo++) {
|
||||||
|
Date date = dates[dateNo];
|
||||||
|
for (int patternNo = 0; patternNo < patterns.length; patternNo++) {
|
||||||
|
sdf.applyPattern(patterns[patternNo]);
|
||||||
|
String got = sdf.format(date);
|
||||||
|
if (!expectedResults[dateNo][patternNo].equals(got)) {
|
||||||
|
error = true;
|
||||||
|
System.err.println("Failed: Unexpected format result: " +
|
||||||
|
"Expected: \"" + expectedResults[dateNo][patternNo] +
|
||||||
|
"\", Got: \"" + got + "\" for date " + date +
|
||||||
|
" with pattern \"" + patterns[patternNo] + "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Locale.setDefault(defaultLocale);
|
||||||
|
if (error) {
|
||||||
|
throw new RuntimeException("SimpleDateFormat.format() error.");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -35,6 +35,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
|
|
||||||
|
import javax.swing.ActionMap;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@ -51,6 +52,7 @@ import javax.swing.border.LineBorder;
|
|||||||
import javax.swing.border.MatteBorder;
|
import javax.swing.border.MatteBorder;
|
||||||
import javax.swing.border.SoftBevelBorder;
|
import javax.swing.border.SoftBevelBorder;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
|
import javax.swing.plaf.ActionMapUIResource;
|
||||||
import javax.swing.plaf.BorderUIResource;
|
import javax.swing.plaf.BorderUIResource;
|
||||||
import javax.swing.plaf.synth.SynthLookAndFeel;
|
import javax.swing.plaf.synth.SynthLookAndFeel;
|
||||||
import javax.swing.plaf.basic.BasicBorders;
|
import javax.swing.plaf.basic.BasicBorders;
|
||||||
@ -59,7 +61,6 @@ import javax.swing.plaf.metal.MetalBorders;
|
|||||||
import javax.swing.plaf.metal.MetalComboBoxEditor;
|
import javax.swing.plaf.metal.MetalComboBoxEditor;
|
||||||
|
|
||||||
import sun.swing.plaf.synth.SynthFileChooserUI;
|
import sun.swing.plaf.synth.SynthFileChooserUI;
|
||||||
import sun.tools.jconsole.BorderedComponent;
|
|
||||||
|
|
||||||
public class Test4856008 {
|
public class Test4856008 {
|
||||||
private static final JLabel LABEL = new JLabel();
|
private static final JLabel LABEL = new JLabel();
|
||||||
@ -133,11 +134,6 @@ public class Test4856008 {
|
|||||||
|
|
||||||
//+ SynthFileChooserUI.UIBorder:
|
//+ SynthFileChooserUI.UIBorder:
|
||||||
new SynthFileChooser().getUIBorder(),
|
new SynthFileChooser().getUIBorder(),
|
||||||
|
|
||||||
//+ BorderedComponent.FocusBorder:
|
|
||||||
getBorder(false),
|
|
||||||
//+ BorderedComponent.LabeledBorder:
|
|
||||||
getBorder(true),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -182,15 +178,6 @@ public class Test4856008 {
|
|||||||
return LABEL;
|
return LABEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is used to get the border from BorderedComponent
|
|
||||||
private static Border getBorder(boolean labeled) {
|
|
||||||
JComponent component = new BorderedComponent("4856008", null, true);
|
|
||||||
CompoundBorder border = (CompoundBorder) component.getBorder();
|
|
||||||
return labeled
|
|
||||||
? border.getInsideBorder()
|
|
||||||
: border.getOutsideBorder();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This class is used to get the instance of BasicBorders.RolloverMarginBorder
|
// This class is used to get the instance of BasicBorders.RolloverMarginBorder
|
||||||
private static class ToolBar extends BasicToolBarUI {
|
private static class ToolBar extends BasicToolBarUI {
|
||||||
private Border getRolloverMarginBorder() {
|
private Border getRolloverMarginBorder() {
|
||||||
@ -223,6 +210,11 @@ public class Test4856008 {
|
|||||||
return CHOOSER.getBorder();
|
return CHOOSER.getBorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ActionMap createActionMap() {
|
||||||
|
return new ActionMapUIResource();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
|
73
jdk/test/javax/swing/plaf/nimbus/Test6849805.java
Normal file
73
jdk/test/javax/swing/plaf/nimbus/Test6849805.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @test
|
||||||
|
@bug 6849805
|
||||||
|
@summary Tests NimbusLookAndFeel.deriveColor()
|
||||||
|
@author Peter Zhelezniakov
|
||||||
|
@run main Test6849805
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
|
||||||
|
public class Test6849805 {
|
||||||
|
|
||||||
|
static boolean pass = true;
|
||||||
|
|
||||||
|
static class Minimbus extends javax.swing.plaf.nimbus.NimbusLookAndFeel {
|
||||||
|
|
||||||
|
public void test(Color c1, Color c2, float f) {
|
||||||
|
Color r = getDerivedColor(c1, c2, f);
|
||||||
|
Color test = (f > 0 ? c2 : c1);
|
||||||
|
System.out.printf("Got %s, need %s ", r, test);
|
||||||
|
|
||||||
|
if (r.getRGB() == test.getRGB() &&
|
||||||
|
r.getAlpha() == test.getAlpha()) {
|
||||||
|
|
||||||
|
System.out.println("Ok");
|
||||||
|
} else {
|
||||||
|
System.out.println("FAIL");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Minimbus laf = new Minimbus();
|
||||||
|
laf.test(Color.WHITE, Color.BLACK, 0f);
|
||||||
|
laf.test(Color.WHITE, Color.BLACK, 1f);
|
||||||
|
laf.test(Color.BLACK, Color.WHITE, 0f);
|
||||||
|
laf.test(Color.BLACK, Color.WHITE, 1f);
|
||||||
|
laf.test(Color.RED, Color.GREEN, 0f);
|
||||||
|
laf.test(Color.RED, Color.GREEN, 1f);
|
||||||
|
laf.test(new Color(127, 127, 127), new Color(51, 151, 212), 0f);
|
||||||
|
laf.test(new Color(127, 127, 127), new Color(51, 151, 212), 1f);
|
||||||
|
laf.test(new Color(221, 63, 189), new Color(112, 200, 89), 0f);
|
||||||
|
laf.test(new Color(221, 63, 189), new Color(112, 200, 89), 1f);
|
||||||
|
|
||||||
|
if (! pass) {
|
||||||
|
throw new RuntimeException("Some testcases failed, see above");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user