This commit is contained in:
Lana Steuck 2011-02-21 14:31:07 -08:00
commit 12134b9ba9
33 changed files with 516 additions and 179 deletions

View File

@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any # or visit www.oracle.com if you need additional information or have any
# questions. # questions.
# #
tzdata2010o tzdata2011b

View File

@ -106,14 +106,13 @@ Rule AS 1986 only - Oct 19 2:00s 1:00 -
Rule AS 1987 2007 - Oct lastSun 2:00s 1:00 - Rule AS 1987 2007 - Oct lastSun 2:00s 1:00 -
Rule AS 1972 only - Feb 27 2:00s 0 - Rule AS 1972 only - Feb 27 2:00s 0 -
Rule AS 1973 1985 - Mar Sun>=1 2:00s 0 - Rule AS 1973 1985 - Mar Sun>=1 2:00s 0 -
Rule AS 1986 1989 - Mar Sun>=15 2:00s 0 - Rule AS 1986 1990 - Mar Sun>=15 2:00s 0 -
Rule AS 1990 only - Mar Sun>=18 2:00s 0 - Rule AS 1991 only - Mar 3 2:00s 0 -
Rule AS 1991 only - Mar Sun>=1 2:00s 0 - Rule AS 1992 only - Mar 22 2:00s 0 -
Rule AS 1992 only - Mar Sun>=18 2:00s 0 - Rule AS 1993 only - Mar 7 2:00s 0 -
Rule AS 1993 only - Mar Sun>=1 2:00s 0 - Rule AS 1994 only - Mar 20 2:00s 0 -
Rule AS 1994 only - Mar Sun>=18 2:00s 0 -
Rule AS 1995 2005 - Mar lastSun 2:00s 0 - Rule AS 1995 2005 - Mar lastSun 2:00s 0 -
Rule AS 2006 only - Apr Sun>=1 2:00s 0 - Rule AS 2006 only - Apr 2 2:00s 0 -
Rule AS 2007 only - Mar lastSun 2:00s 0 - Rule AS 2007 only - Mar lastSun 2:00s 0 -
Rule AS 2008 max - Apr Sun>=1 2:00s 0 - Rule AS 2008 max - Apr Sun>=1 2:00s 0 -
Rule AS 2008 max - Oct Sun>=1 2:00s 1:00 - Rule AS 2008 max - Oct Sun>=1 2:00s 1:00 -

View File

@ -368,6 +368,27 @@ Zone America/North_Dakota/New_Salem -6:45:39 - LMT 1883 Nov 18 12:14:21
-7:00 US M%sT 2003 Oct 26 02:00 -7:00 US M%sT 2003 Oct 26 02:00
-6:00 US C%sT -6:00 US C%sT
# From Josh Findley (2011-01-21):
# ...it appears that Mercer County, North Dakota, changed from the
# mountain time zone to the central time zone at the last transition from
# daylight-saving to standard time (on Nov. 7, 2010):
# <a href="http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm">
# http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
# </a>
# <a href="http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html">
# http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html
# </a>
# From Andy Lipscomb (2011-01-24):
# ...according to the Census Bureau, the largest city is Beulah (although
# it's commonly referred to as Beulah-Hazen, with Hazen being the next
# largest city in Mercer County). Google Maps places Beulah's city hall
# at 4715'51" north, 10146'40" west, which yields an offset of 6h47'07".
Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 Nov 18 12:12:53
-7:00 US M%sT 2010 Nov 7 2:00
-6:00 US C%sT
# US mountain time, represented by Denver # US mountain time, represented by Denver
# #
# Colorado, far western Kansas, Montana, western # Colorado, far western Kansas, Montana, western
@ -493,20 +514,50 @@ Zone America/Adak 12:13:21 - LMT 1867 Oct 18
# three votes for and one against." # three votes for and one against."
# Hawaii # Hawaii
# From Arthur David Olson (2010-12-09):
# "Hawaiian Time" by Robert C. Schmitt and Doak C. Cox appears on pages 207-225
# of volume 26 of The Hawaiian Journal of History (1992). As of 2010-12-09,
# the article is available at
# <a href="http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf">
# http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
# </a>
# and indicates that standard time was adopted effective noon, January
# 13, 1896 (page 218), that in "1933, the Legislature decreed daylight
# saving for the period between the last Sunday of each April and the
# last Sunday of each September, but less than a month later repealed the
# act," (page 220), that year-round daylight saving time was in effect
# from 1942-02-09 to 1945-09-30 (page 221, with no time of day given for
# when clocks changed) and that clocks were changed by 30 minutes
# effective the second Sunday of June, 1947 (page 219, with no time of
# day given for when clocks changed). A footnote for the 1933 changes
# cites Session Laws of Hawaii 1933, "Act. 90 (approved 26 Apr. 1933)
# and Act 163 (approved 21 May 1933)."
# From Arthur David Olson (2011-01-19):
# The following is from "Laws of the Territory of Hawaii Passed by the
# Seventeenth Legislature: Regular Session 1933," available (as of
# 2011-01-19) at American University's Pence Law Library. Page 85: "Act
# 90...At 2 o'clock ante meridian of the last Sunday in April of each
# year, the standard time of this Territory shall be advanced one
# hour...This Act shall take effect upon its approval. Approved this 26th
# day of April, A. D. 1933. LAWRENCE M JUDD, Governor of the Territory of
# Hawaii." Page 172: "Act 163...Act 90 of the Session Laws of 1933 is
# hereby repealed...This Act shall take effect upon its approval, upon
# which date the standard time of this Territory shall be restored to
# that existing immediately prior to the taking effect of said Act 90.
# Approved this 21st day of May, A. D. 1933. LAWRENCE M. JUDD, Governor
# of the Territory of Hawaii."
# #
# From Arthur David Olson: # Note that 1933-05-21 was a Sunday.
# And then there's Hawaii. # We're left to guess the time of day when Act 163 was approved; guess noon.
# DST was observed for one day in 1933;
# standard time was changed by half an hour in 1947; Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 #Schmitt&Cox
# it's always standard as of 1986. -10:30 - HST 1933 Apr 30 2:00 #Laws 1933
# -10:30 1:00 HDT 1933 May 21 12:00 #Laws 1933+12
# From Paul Eggert: -10:30 - HST 1942 Feb 09 2:00 #Schmitt&Cox+2
# Shanks says the 1933 experiment lasted for three weeks. Go with Shanks. -10:30 1:00 HDT 1945 Sep 30 2:00 #Schmitt&Fox+2
# -10:30 US H%sT 1947 Jun 8 2:00 #Schmitt&Fox+2
Zone Pacific/Honolulu -10:31:26 - LMT 1900 Jan 1 12:00
-10:30 - HST 1933 Apr 30 2:00
-10:30 1:00 HDT 1933 May 21 2:00
-10:30 US H%sT 1947 Jun 8 2:00
-10:00 - HST -10:00 - HST
# Now we turn to US areas that have diverged from the consensus since 1970. # Now we turn to US areas that have diverged from the consensus since 1970.

View File

@ -233,8 +233,8 @@ HT +1832-07220 America/Port-au-Prince
HU +4730+01905 Europe/Budapest HU +4730+01905 Europe/Budapest
ID -0610+10648 Asia/Jakarta Java & Sumatra ID -0610+10648 Asia/Jakarta Java & Sumatra
ID -0002+10920 Asia/Pontianak west & central Borneo ID -0002+10920 Asia/Pontianak west & central Borneo
ID -0507+11924 Asia/Makassar east & south Borneo, Celebes, Bali, Nusa Tengarra, west Timor ID -0507+11924 Asia/Makassar east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
ID -0232+14042 Asia/Jayapura Irian Jaya & the Moluccas ID -0232+14042 Asia/Jayapura west New Guinea (Irian Jaya) & Malukus (Moluccas)
IE +5320-00615 Europe/Dublin IE +5320-00615 Europe/Dublin
IL +3146+03514 Asia/Jerusalem IL +3146+03514 Asia/Jerusalem
IM +5409-00428 Europe/Isle_of_Man IM +5409-00428 Europe/Isle_of_Man
@ -426,6 +426,7 @@ US +411745-0863730 America/Indiana/Knox Central Time - Indiana - Starke County
US +450628-0873651 America/Menominee Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties US +450628-0873651 America/Menominee Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
US +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County US +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County
US +465042-1012439 America/North_Dakota/New_Salem Central Time - North Dakota - Morton County (except Mandan area) US +465042-1012439 America/North_Dakota/New_Salem Central Time - North Dakota - Morton County (except Mandan area)
US +471551-1014640 America/North_Dakota/Beulah Central Time - North Dakota - Mercer County
US +394421-1045903 America/Denver Mountain Time US +394421-1045903 America/Denver Mountain Time
US +433649-1161209 America/Boise Mountain Time - south Idaho & east Oregon US +433649-1161209 America/Boise Mountain Time - south Idaho & east Oregon
US +364708-1084111 America/Shiprock Mountain Time - Navajo US +364708-1084111 America/Shiprock Mountain Time - Navajo

View File

@ -1,5 +1,5 @@
# Providers for FormatConversion # Providers for FormatConversion
com.sun.media.sound.AudioFloatFormatConverter
com.sun.media.sound.UlawCodec com.sun.media.sound.UlawCodec
com.sun.media.sound.AlawCodec com.sun.media.sound.AlawCodec
com.sun.media.sound.PCMtoPCMCodec com.sun.media.sound.PCMtoPCMCodec
com.sun.media.sound.AudioFloatFormatConverter

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -825,10 +825,7 @@ public class SimpleTimeZone extends TimeZone {
* @since 1.2 * @since 1.2
*/ */
public int getDSTSavings() { public int getDSTSavings() {
if (useDaylight) { return useDaylight ? dstSavings : 0;
return dstSavings;
}
return 0;
} }
/** /**
@ -841,6 +838,20 @@ public class SimpleTimeZone extends TimeZone {
return useDaylight; return useDaylight;
} }
/**
* Returns {@code true} if this {@code SimpleTimeZone} observes
* Daylight Saving Time. This method is equivalent to {@link
* #useDaylightTime()}.
*
* @return {@code true} if this {@code SimpleTimeZone} observes
* Daylight Saving Time; {@code false} otherwise.
* @since 1.7
*/
@Override
public boolean observesDaylightTime() {
return useDaylightTime();
}
/** /**
* Queries if the given date is in daylight saving time. * Queries if the given date is in daylight saving time.
* @return true if daylight saving time is in effective at the * @return true if daylight saving time is in effective at the

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -455,17 +455,28 @@ abstract public class TimeZone implements Serializable, Cloneable {
/** /**
* Returns the amount of time to be added to local standard time * Returns the amount of time to be added to local standard time
* to get local wall clock time. * to get local wall clock time.
* <p> *
* The default implementation always returns 3600000 milliseconds * <p>The default implementation returns 3600000 milliseconds
* (i.e., one hour) if this time zone observes Daylight Saving * (i.e., one hour) if a call to {@link #useDaylightTime()}
* Time. Otherwise, 0 (zero) is returned. * returns {@code true}. Otherwise, 0 (zero) is returned.
* <p> *
* If an underlying TimeZone implementation subclass supports * <p>If an underlying {@code TimeZone} implementation subclass
* historical Daylight Saving Time changes, this method returns * supports historical and future Daylight Saving Time schedule
* the known latest daylight saving value. * changes, this method returns the amount of saving time of the
* last known Daylight Saving Time rule that can be a future
* prediction.
*
* <p>If the amount of saving time at any given time stamp is
* required, construct a {@link Calendar} with this {@code
* TimeZone} and the time stamp, and call {@link Calendar#get(int)
* Calendar.get}{@code (}{@link Calendar#DST_OFFSET}{@code )}.
* *
* @return the amount of saving time in milliseconds * @return the amount of saving time in milliseconds
* @since 1.4 * @since 1.4
* @see #inDaylightTime(Date)
* @see #getOffset(long)
* @see #getOffset(int,int,int,int,int,int)
* @see Calendar#ZONE_OFFSET
*/ */
public int getDSTSavings() { public int getDSTSavings() {
if (useDaylightTime()) { if (useDaylightTime()) {
@ -475,24 +486,51 @@ abstract public class TimeZone implements Serializable, Cloneable {
} }
/** /**
* Queries if this time zone uses daylight savings time. * Queries if this {@code TimeZone} uses Daylight Saving Time.
* <p>
* If an underlying <code>TimeZone</code> implementation subclass
* supports historical Daylight Saving Time schedule changes, the
* method refers to the latest Daylight Saving Time schedule
* information.
* *
* @return true if this time zone uses daylight savings time, * <p>If an underlying {@code TimeZone} implementation subclass
* false, otherwise. * supports historical and future Daylight Saving Time schedule
* changes, this method refers to the last known Daylight Saving Time
* rule that can be a future prediction and may not be the same as
* the current rule. Consider calling {@link #observesDaylightTime()}
* if the current rule should also be taken into account.
*
* @return {@code true} if this {@code TimeZone} uses Daylight Saving Time,
* {@code false}, otherwise.
* @see #inDaylightTime(Date)
* @see Calendar#DST_OFFSET
*/ */
public abstract boolean useDaylightTime(); public abstract boolean useDaylightTime();
/** /**
* Queries if the given date is in daylight savings time in * Returns {@code true} if this {@code TimeZone} is currently in
* this time zone. * Daylight Saving Time, or if a transition from Standard Time to
* @param date the given Date. * Daylight Saving Time occurs at any future time.
* @return true if the given date is in daylight savings time, *
* false, otherwise. * <p>The default implementation returns {@code true} if
* {@code useDaylightTime()} or {@code inDaylightTime(new Date())}
* returns {@code true}.
*
* @return {@code true} if this {@code TimeZone} is currently in
* Daylight Saving Time, or if a transition from Standard Time to
* Daylight Saving Time occurs at any future time; {@code false}
* otherwise.
* @since 1.7
* @see #useDaylightTime()
* @see #inDaylightTime(Date)
* @see Calendar#DST_OFFSET
*/
public boolean observesDaylightTime() {
return useDaylightTime() || inDaylightTime(new Date());
}
/**
* Queries if the given {@code date} is in Daylight Saving Time in
* this {@code TimeZone}.
*
* @param date the given {@code Date}.
* @return {@code true} if the given {@code date} is in Daylight Saving Time,
* {@code false}, otherwise.
*/ */
abstract public boolean inDaylightTime(Date date); abstract public boolean inDaylightTime(Date date);

View File

@ -670,6 +670,12 @@ public class AudioSystem {
* <p>The returned <code>TargetDataLine</code>'s default * <p>The returned <code>TargetDataLine</code>'s default
* audio format will be initialized with <code>format</code>. * audio format will be initialized with <code>format</code>.
* *
* <p>If the system property
* {@code javax.sound.sampled.TargetDataLine}
* is defined or it is defined in the file &quot;sound.properties&quot;,
* it is used to retrieve the default target data line.
* For details, refer to the {@link AudioSystem class description}.
*
* @param format an <code>AudioFormat</code> object specifying * @param format an <code>AudioFormat</code> object specifying
* the supported audio format of the returned line, * the supported audio format of the returned line,
* or <code>null</code> for any audio format * or <code>null</code> for any audio format
@ -712,12 +718,6 @@ public class AudioSystem {
* <p>The returned <code>TargetDataLine</code>'s default * <p>The returned <code>TargetDataLine</code>'s default
* audio format will be initialized with <code>format</code>. * audio format will be initialized with <code>format</code>.
* *
* <p>If the system property
* <code>javax.sound.sampled.TargetDataLine</code>
* is defined or it is defined in the file &quot;sound.properties&quot;,
* it is used to retrieve the default target data line.
* For details, refer to the {@link AudioSystem class description}.
*
* @param format an <code>AudioFormat</code> object specifying * @param format an <code>AudioFormat</code> object specifying
* the supported audio format of the returned line, * the supported audio format of the returned line,
* or <code>null</code> for any audio format * or <code>null</code> for any audio format

View File

@ -4910,14 +4910,17 @@ public abstract class JComponent extends Container implements Serializable,
* Returns {@code true} if a paint triggered on a child component should cause * Returns {@code true} if a paint triggered on a child component should cause
* painting to originate from this Component, or one of its ancestors. * painting to originate from this Component, or one of its ancestors.
* <p/> * <p/>
* Calling {@link JComponent#repaint} on a Swing component will be delegated to * Calling {@link #repaint} or {@link #paintImmediately(int, int, int, int)}
* the first ancestor which {@code isPaintingOrigin()} returns {@code true}, * on a Swing component will result in calling
* if there are any. * the {@link JComponent#paintImmediately(int, int, int, int)} method of
* the first ancestor which {@code isPaintingOrigin()} returns {@code true}, if there are any.
* <p/> * <p/>
* {@code JComponent} subclasses that need to be repainted when any of their * {@code JComponent} subclasses that need to be painted when any of their
* children are repainted should override this method to return {@code true}. * children are repainted should override this method to return {@code true}.
* *
* @return always returns {@code false} * @return always returns {@code false}
*
* @see #paintImmediately(int, int, int, int)
*/ */
protected boolean isPaintingOrigin() { protected boolean isPaintingOrigin() {
return false; return false;
@ -4932,12 +4935,16 @@ public abstract class JComponent extends Container implements Serializable,
* and can collapse redundant requests into a single paint call. * and can collapse redundant requests into a single paint call.
* This method is useful if one needs to update the display while * This method is useful if one needs to update the display while
* the current event is being dispatched. * the current event is being dispatched.
* <p>
* This method is to be overridden when the dirty region needs to be changed
* for components that are painting origins.
* *
* @param x the x value of the region to be painted * @param x the x value of the region to be painted
* @param y the y value of the region to be painted * @param y the y value of the region to be painted
* @param w the width of the region to be painted * @param w the width of the region to be painted
* @param h the height of the region to be painted * @param h the height of the region to be painted
* @see #repaint * @see #repaint
* @see #isPaintingOrigin()
*/ */
public void paintImmediately(int x,int y,int w, int h) { public void paintImmediately(int x,int y,int w, int h) {
Component c = this; Component c = this;
@ -4946,6 +4953,15 @@ public abstract class JComponent extends Container implements Serializable,
if(!isShowing()) { if(!isShowing()) {
return; return;
} }
JComponent paintingOigin = SwingUtilities.getPaintingOrigin(this);
if (paintingOigin != null) {
Rectangle rectangle = SwingUtilities.convertRectangle(
c, new Rectangle(x, y, w, h), paintingOigin);
paintingOigin.paintImmediately(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
return;
}
while(!c.isOpaque()) { while(!c.isOpaque()) {
parent = c.getParent(); parent = c.getParent();
if(parent != null) { if(parent != null) {

View File

@ -156,8 +156,9 @@ public final class JLayer<V extends Component>
// when layerUI is serializable // when layerUI is serializable
private LayerUI<? super V> layerUI; private LayerUI<? super V> layerUI;
private JPanel glassPane; private JPanel glassPane;
private boolean isPainting;
private long eventMask; private long eventMask;
private transient boolean isPainting;
private transient boolean isPaintingImmediately;
private static final LayerEventController eventController = private static final LayerEventController eventController =
new LayerEventController(); new LayerEventController();
@ -393,17 +394,25 @@ public final class JLayer<V extends Component>
} }
/** /**
* Delegates repainting to {@link javax.swing.plaf.LayerUI#repaint} method. * Delegates its functionality to the
* {@link javax.swing.plaf.LayerUI#paintImmediately(int, int, int, int, JLayer)} method,
* if {@code LayerUI} is set.
* *
* @param tm this parameter is not used * @param x the x value of the region to be painted
* @param x the x value of the dirty region * @param y the y value of the region to be painted
* @param y the y value of the dirty region * @param w the width of the region to be painted
* @param width the width of the dirty region * @param h the height of the region to be painted
* @param height the height of the dirty region
*/ */
public void repaint(long tm, int x, int y, int width, int height) { public void paintImmediately(int x, int y, int w, int h) {
if (getUI() != null) { if (!isPaintingImmediately && getUI() != null) {
getUI().repaint(tm, x, y, width, height, this); isPaintingImmediately = true;
try {
getUI().paintImmediately(x, y, w, h, this);
} finally {
isPaintingImmediately = false;
}
} else {
super.paintImmediately(x, y, w, h);
} }
} }
@ -415,8 +424,11 @@ public final class JLayer<V extends Component>
public void paint(Graphics g) { public void paint(Graphics g) {
if (!isPainting) { if (!isPainting) {
isPainting = true; isPainting = true;
super.paintComponent(g); try {
isPainting = false; super.paintComponent(g);
} finally {
isPainting = false;
}
} else { } else {
super.paint(g); super.paint(g);
} }

View File

@ -332,12 +332,13 @@ public abstract class LookAndFeel
{ {
JTextComponent.KeyBinding[] rv = new JTextComponent.KeyBinding[keyBindingList.length / 2]; JTextComponent.KeyBinding[] rv = new JTextComponent.KeyBinding[keyBindingList.length / 2];
for(int i = 0; i < keyBindingList.length; i += 2) { for(int i = 0; i < rv.length; i ++) {
KeyStroke keystroke = (keyBindingList[i] instanceof KeyStroke) Object o = keyBindingList[2 * i];
? (KeyStroke)keyBindingList[i] KeyStroke keystroke = (o instanceof KeyStroke)
: KeyStroke.getKeyStroke((String)keyBindingList[i]); ? (KeyStroke) o
String action = (String)keyBindingList[i+1]; : KeyStroke.getKeyStroke((String) o);
rv[i / 2] = new JTextComponent.KeyBinding(keystroke, action); String action = (String) keyBindingList[2 * i + 1];
rv[i] = new JTextComponent.KeyBinding(keystroke, action);
} }
return rv; return rv;

View File

@ -438,7 +438,6 @@ public class RepaintManager
* @param y Y coordinate of the region to repaint * @param y Y coordinate of the region to repaint
* @param w Width of the region to repaint * @param w Width of the region to repaint
* @param h Height of the region to repaint * @param h Height of the region to repaint
* @see JComponent#isPaintingOrigin()
* @see JComponent#repaint * @see JComponent#repaint
*/ */
public void addDirtyRegion(JComponent c, int x, int y, int w, int h) public void addDirtyRegion(JComponent c, int x, int y, int w, int h)
@ -448,16 +447,6 @@ public class RepaintManager
delegate.addDirtyRegion(c, x, y, w, h); delegate.addDirtyRegion(c, x, y, w, h);
return; return;
} }
Container p = c;
while ((p = p.getParent()) instanceof JComponent) {
JComponent jp = (JComponent) p;
if (jp.isPaintingOrigin()) {
Rectangle rectangle = SwingUtilities.convertRectangle(
c, new Rectangle(x, y, w, h), jp);
jp.repaint(0, rectangle.x, rectangle.y, rectangle.width, rectangle.height);
return;
}
}
addDirtyRegion0(c, x, y, w, h); addDirtyRegion0(c, x, y, w, h);
} }

View File

@ -1532,6 +1532,17 @@ public class SwingUtilities implements SwingConstants
return applet; return applet;
} }
static JComponent getPaintingOrigin(JComponent c) {
Container p = c;
while ((p = p.getParent()) instanceof JComponent) {
JComponent jp = (JComponent) p;
if (jp.isPaintingOrigin()) {
return jp;
}
}
return null;
}
/** /**
* Process the key bindings for the <code>Component</code> associated with * Process the key bindings for the <code>Component</code> associated with
* <code>event</code>. This method is only useful if * <code>event</code>. This method is only useful if

View File

@ -703,21 +703,19 @@ public class LayerUI<V extends Component>
} }
/** /**
* Adds the specified region to the dirty region list if the component * Paints the specified region in the {@code JLayer} this {@code LayerUI} is set to, immediately.
* is showing. The component will be repainted after all of the
* currently pending events have been dispatched.
* <p/> * <p/>
* This method is to be overridden when the dirty region needs to be changed. * This method is to be overridden when the dirty region needs to be changed.
* The default implementation delegates its functionality to {@link JComponent#paintImmediately(int, int, int, int)}.
* *
* @param tm this parameter is not used * @param x the x value of the region to be painted
* @param x the x value of the dirty region * @param y the y value of the region to be painted
* @param y the y value of the dirty region * @param w the width of the region to be painted
* @param width the width of the dirty region * @param h the height of the region to be painted
* @param height the height of the dirty region *
* @see java.awt.Component#isShowing * @see JComponent#paintImmediately(int, int, int, int)
* @see RepaintManager#addDirtyRegion
*/ */
public void repaint(long tm, int x, int y, int width, int height, JLayer<? extends V> l) { public void paintImmediately(int x, int y, int width, int height, JLayer<? extends V> l) {
RepaintManager.currentManager(l).addDirtyRegion(l, x, y, width, height); l.paintImmediately(x, y, width, height);
} }
} }

View File

@ -1965,18 +1965,18 @@ public class BasicTreeUI extends TreeUI
} }
/** Returns the preferred size to properly display the tree, /** Returns the preferred size to properly display the tree,
* this is a cover method for getPreferredSize(c, false). * this is a cover method for getPreferredSize(c, true).
*/ */
public Dimension getPreferredSize(JComponent c) { public Dimension getPreferredSize(JComponent c) {
return getPreferredSize(c, true); return getPreferredSize(c, true);
} }
/** Returns the preferred size to represent the tree in /** Returns the preferred size to represent the tree in
* <I>c</I>. If <I>checkConsistancy</I> is true * <I>c</I>. If <I>checkConsistency</I> is true
* <b>checkConsistancy</b> is messaged first. * <b>checkConsistency</b> is messaged first.
*/ */
public Dimension getPreferredSize(JComponent c, public Dimension getPreferredSize(JComponent c,
boolean checkConsistancy) { boolean checkConsistency) {
Dimension pSize = this.getPreferredMinSize(); Dimension pSize = this.getPreferredMinSize();
if(!validCachedPreferredSize) if(!validCachedPreferredSize)

View File

@ -510,7 +510,6 @@ public class SynthGraphicsUtils {
Font holdf = g.getFont(); Font holdf = g.getFont();
Color holdc = g.getColor(); Color holdc = g.getColor();
paintBackground(g, lh);
paintCheckIcon(g, lh, lr); paintCheckIcon(g, lh, lr);
paintIcon(g, lh, lr); paintIcon(g, lh, lr);
paintText(g, lh, lr); paintText(g, lh, lr);

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Panama", EST}, {"America/Panama", EST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -405,6 +405,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
{"America/Nipigon", EST}, {"America/Nipigon", EST},
{"America/Nome", AKST}, {"America/Nome", AKST},
{"America/Noronha", NORONHA}, {"America/Noronha", NORONHA},
{"America/North_Dakota/Beulah", CST},
{"America/North_Dakota/Center", CST}, {"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST}, {"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST}, {"America/Ojinaga", MST},

View File

@ -0,0 +1,103 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6936350
* @summary Test case for TimeZone.observesDaylightTime()
*/
import java.util.*;
import static java.util.GregorianCalendar.*;
public class DaylightTimeTest {
private static final int ONE_HOUR = 60 * 60 * 1000; // one hour
private static final int INTERVAL = 24 * ONE_HOUR; // one day
private static final String[] ZONES = TimeZone.getAvailableIDs();
private static int errors = 0;
public static void main(String[] args) {
// Test default TimeZone
for (String id : ZONES) {
TimeZone tz = TimeZone.getTimeZone(id);
long now = System.currentTimeMillis();
boolean observes = tz.observesDaylightTime();
boolean found = findDSTTransition(tz, now);
if (observes != found) {
// There's a critical section. If DST ends after the
// System.currentTimeMills() call, there should be
// inconsistency in the determination. Try the same
// thing again to see the inconsistency was due to the
// critical section.
now = System.currentTimeMillis();
observes = tz.observesDaylightTime();
found = findDSTTransition(tz, now);
if (observes != found) {
System.err.printf("%s: observesDaylightTime() should return %s at %d%n",
tz.getID(), found, now);
errors++;
}
}
}
// Test SimpleTimeZone in which observesDaylightTime() is
// equivalent to useDaylightTime().
testSimpleTimeZone(new SimpleTimeZone(-8*ONE_HOUR, "X",
APRIL, 1, -SUNDAY, 2*ONE_HOUR,
OCTOBER, -1, SUNDAY, 2*ONE_HOUR,
1*ONE_HOUR));
testSimpleTimeZone(new SimpleTimeZone(-8*ONE_HOUR, "Y"));
if (errors > 0) {
throw new RuntimeException("DaylightTimeTest: failed");
}
}
/**
* Returns true if it's `now' in DST or there's any
* standard-to-daylight transition within 50 years after `now'.
*/
private static boolean findDSTTransition(TimeZone tz, long now) {
GregorianCalendar cal = new GregorianCalendar(tz, Locale.US);
cal.setTimeInMillis(now);
cal.add(YEAR, 50);
long end = cal.getTimeInMillis();
for (long t = now; t < end; t += INTERVAL) {
cal.setTimeInMillis(t);
if (cal.get(DST_OFFSET) > 0) {
return true;
}
}
return false;
}
private static void testSimpleTimeZone(SimpleTimeZone stz) {
if (stz.useDaylightTime() != stz.observesDaylightTime()) {
System.err.printf("Failed: useDaylightTime=%b, observesDaylightTime()=%b%n\t%s%n",
stz.useDaylightTime(),stz.observesDaylightTime(), stz);
errors++;
}
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,76 +28,107 @@
@run main bug6989617 @run main bug6989617
*/ */
import sun.awt.SunToolkit;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
public class bug6989617 { public class bug6989617 {
private static MyPanel panel;
private boolean isPaintingOrigin; private static JButton button;
private boolean innerPanelRepainted, outerPanelRepainted;
public bug6989617() {
final JButton button = new JButton("button");
JPanel innerPanel = new JPanel() {
protected boolean isPaintingOrigin() {
return isPaintingOrigin;
}
public void repaint(long tm, int x, int y, int width, int height) {
if (button.getParent() != null) {
innerPanelRepainted = true;
if (!button.getSize().equals(new Dimension(width, height))) {
throw new RuntimeException("Wrong size of the dirty area");
}
if (!button.getLocation().equals(new Point(x, y))) {
throw new RuntimeException("Wrong location of the dirty area");
}
}
super.repaint(tm, x, y, width, height);
}
};
JPanel outerPanel = new JPanel() {
protected boolean isPaintingOrigin() {
return isPaintingOrigin;
}
public void repaint(long tm, int x, int y, int width, int height) {
if (button.getParent() != null) {
outerPanelRepainted = true;
if (!button.getSize().equals(new Dimension(width, height))) {
throw new RuntimeException("Wrong size of the dirty area");
}
}
super.repaint(tm, x, y, width, height);
}
};
outerPanel.add(innerPanel);
innerPanel.add(button);
outerPanel.setSize(100, 100);
innerPanel.setBounds(10, 10, 50, 50);
button.setBounds(10, 10, 20, 20);
if (innerPanelRepainted || outerPanelRepainted) {
throw new RuntimeException("Repainted flag is unexpectedly on");
}
button.repaint();
if (innerPanelRepainted || outerPanelRepainted) {
throw new RuntimeException("Repainted flag is unexpectedly on");
}
isPaintingOrigin = true;
button.repaint();
if (!innerPanelRepainted || !outerPanelRepainted) {
throw new RuntimeException("Repainted flag is unexpectedly off");
}
}
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
new bug6989617(); SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame();
frame. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel = new MyPanel();
button = new JButton("Hello");
panel.add(button);
frame.add(panel);
frame.setSize(200, 300);
frame.setVisible(true);
}
});
// Testing the panel as a painting origin,
// the panel.paintImmediately() must be triggered
// when button.repaint() is called
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (panel.getPaintRectangle() != null) {
throw new RuntimeException("paint rectangle is not null");
}
button.repaint();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Rectangle pr = panel.getPaintRectangle();
if (!pr.getSize().equals(button.getSize())) {
throw new RuntimeException("wrong size of the dirty area");
}
if (!pr.getLocation().equals(button.getLocation())) {
throw new RuntimeException("wrong location of the dirty area");
}
}
});
// Testing the panel as NOT a painting origin
// the panel.paintImmediately() must NOT be triggered
// when button.repaint() is called
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
panel.resetPaintRectangle();
panel.setPaintingOrigin(false);
if (panel.getPaintRectangle() != null) {
throw new RuntimeException("paint rectangle is not null");
}
button.repaint();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if(panel.getPaintRectangle() != null) {
throw new RuntimeException("paint rectangle is not null");
}
System.out.println("Test passed...");
}
});
}
static class MyPanel extends JPanel {
private boolean isPaintingOrigin = true;
private Rectangle paintRectangle;
{
setLayout(new GridBagLayout());
}
public boolean isPaintingOrigin() {
return isPaintingOrigin;
}
public void setPaintingOrigin(boolean paintingOrigin) {
isPaintingOrigin = paintingOrigin;
}
public void paintImmediately(int x, int y, int w, int h) {
super.paintImmediately(x, y, w, h);
paintRectangle = new Rectangle(x, y, w, h);
}
public Rectangle getPaintRectangle() {
return paintRectangle == null? null: new Rectangle(paintRectangle);
}
public void resetPaintRectangle() {
this.paintRectangle = null;
}
} }
} }

View File

@ -1,6 +1,8 @@
<html> <html>
<body> <body>
<applet code="bug6798062.class" width=400 height=300></applet> <applet code="bug6798062.class" width=400 height=300></applet>
The test is suitable only for Windows
1. Create a link 1. Create a link
2. Copy path to the link into TextField 2. Copy path to the link into TextField
3. Run the Windows Task Manager. Select the Processes tab and find the java process 3. Run the Windows Task Manager. Select the Processes tab and find the java process

View File

@ -28,6 +28,7 @@
@run applet/manual=done bug6798062.html @run applet/manual=done bug6798062.html
*/ */
import sun.awt.OSInfo;
import sun.awt.shell.ShellFolder; import sun.awt.shell.ShellFolder;
import javax.swing.*; import javax.swing.*;
@ -68,13 +69,23 @@ public class bug6798062 extends JApplet {
add(initialize()); add(initialize());
} }
private JPanel initialize() { private JComponent initialize() {
File file = new File("c:/"); if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
return new JLabel("The test is suitable only for Windows");
}
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir.length() == 0) { // 'java.io.tmpdir' isn't guaranteed to be defined
tempDir = System.getProperty("user.home");
}
System.out.println("Temp directory: " + tempDir);
try { try {
folder = ShellFolder.getShellFolder(file); folder = ShellFolder.getShellFolder(new File(tempDir));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
fail("Directory " + file.getPath() + " not found"); fail("Directory " + tempDir + " not found");
} }
slider.setMajorTickSpacing(10); slider.setMajorTickSpacing(10);

View File

@ -69,8 +69,6 @@ public class bug6542335 {
frame.setSize(200, 100); frame.setSize(200, 100);
frame.setVisible(true); frame.setVisible(true);
thumbBounds[0] = new Rectangle(ui.getThumbBounds());
} }
}); });
@ -78,6 +76,8 @@ public class bug6542335 {
SwingUtilities.invokeAndWait(new Runnable() { SwingUtilities.invokeAndWait(new Runnable() {
public void run() { public void run() {
thumbBounds[0] = new Rectangle(ui.getThumbBounds());
Point l = sb.getLocationOnScreen(); Point l = sb.getLocationOnScreen();
robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight() / 2); robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight() / 2);

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 6474153
* @summary LookAndFeel.makeKeyBindings(...) doesn't ignore last element in keyBindingList with odd size
* @author Alexander Potochkin
*/
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.JTextComponent;
public class bug6474153 {
public static void main(String... args) throws Exception {
checkArray(LookAndFeel.makeKeyBindings(new Object[] {"UP", DefaultEditorKit.upAction} ));
checkArray(LookAndFeel.makeKeyBindings(new Object[] {"UP", DefaultEditorKit.upAction, "PAGE_UP"} ));
}
private static void checkArray(JTextComponent.KeyBinding[] keyActionArray) {
if (keyActionArray.length != 1) {
throw new RuntimeException("Wrong array lenght!");
}
if (!DefaultEditorKit.upAction.equals(keyActionArray[0].actionName)) {
throw new RuntimeException("Wrong action name!");
}
if (!KeyStroke.getKeyStroke("UP").equals(keyActionArray[0].key)) {
throw new RuntimeException("Wrong keystroke!");
}
}
}