Skip to content

Commit c264522

Browse files
authored
Merge pull request #243 from BobHanson/hanson1
Toolkit.getBestCursorSize() missing
2 parents 85b5d40 + 2d3c1db commit c264522

File tree

26 files changed

+299
-220
lines changed

26 files changed

+299
-220
lines changed
-71.4 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20220915081800
1+
20230124211103
-71.4 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20220915081800
1+
20230124211103
31.2 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/Component.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4730,9 +4730,9 @@ public synchronized void addMouseListener(MouseListener l) {
47304730

47314731
// // if this is a lightweight component, enable mouse events
47324732
// // in the native container.
4733-
// if (peer instanceof LightweightPeer) {
4734-
// parent.proxyEnableEvents(AWTEvent.MOUSE_EVENT_MASK);
4735-
// }
4733+
if (peer instanceof LightweightPeer && parent != null) {
4734+
parent.proxyEnableEvents(AWTEvent.MOUSE_EVENT_MASK);
4735+
}
47364736
}
47374737

47384738
/**

sources/net.sf.j2s.java.core/src/java/awt/Toolkit.java

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,66 +1493,66 @@ public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
14931493
// }
14941494
}
14951495

1496-
// /**
1497-
// * Returns the supported cursor dimension which is closest to the desired
1498-
// * sizes. Systems which only support a single cursor size will return that
1499-
// * size regardless of the desired sizes. Systems which don't support custom
1500-
// * cursors will return a dimension of 0, 0. <p>
1501-
// * Note: if an image is used whose dimensions don't match a supported size
1502-
// * (as returned by this method), the Toolkit implementation will attempt to
1503-
// * resize the image to a supported size.
1504-
// * Since converting low-resolution images is difficult,
1505-
// * no guarantees are made as to the quality of a cursor image which isn't a
1506-
// * supported size. It is therefore recommended that this method
1507-
// * be called and an appropriate image used so no image conversion is made.
1508-
// *
1509-
// * @param preferredWidth the preferred cursor width the component would like
1510-
// * to use.
1511-
// * @param preferredHeight the preferred cursor height the component would like
1512-
// * to use.
1513-
// * @return the closest matching supported cursor size, or a dimension of 0,0 if
1514-
// * the Toolkit implementation doesn't support custom cursors.
1515-
// * @exception HeadlessException if GraphicsEnvironment.isHeadless()
1516-
// * returns true
1517-
// * @see java.awt.GraphicsEnvironment#isHeadless
1518-
// * @since 1.2
1519-
// */
1520-
// public Dimension getBestCursorSize(int preferredWidth,
1521-
// int preferredHeight) {
1496+
/**
1497+
* Returns the supported cursor dimension which is closest to the desired
1498+
* sizes. Systems which only support a single cursor size will return that
1499+
* size regardless of the desired sizes. Systems which don't support custom
1500+
* cursors will return a dimension of 0, 0. <p>
1501+
* Note: if an image is used whose dimensions don't match a supported size
1502+
* (as returned by this method), the Toolkit implementation will attempt to
1503+
* resize the image to a supported size.
1504+
* Since converting low-resolution images is difficult,
1505+
* no guarantees are made as to the quality of a cursor image which isn't a
1506+
* supported size. It is therefore recommended that this method
1507+
* be called and an appropriate image used so no image conversion is made.
1508+
*
1509+
* @param preferredWidth the preferred cursor width the component would like
1510+
* to use.
1511+
* @param preferredHeight the preferred cursor height the component would like
1512+
* to use.
1513+
* @return the closest matching supported cursor size, or a dimension of 0,0 if
1514+
* the Toolkit implementation doesn't support custom cursors.
1515+
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
1516+
* returns true
1517+
* @see java.awt.GraphicsEnvironment#isHeadless
1518+
* @since 1.2
1519+
*/
1520+
public Dimension getBestCursorSize(int preferredWidth,
1521+
int preferredHeight) {
15221522
// // Override to implement custom cursor support.
15231523
// if (this != Toolkit.getDefaultToolkit()) {
15241524
// return Toolkit.getDefaultToolkit().
15251525
// getBestCursorSize(preferredWidth, preferredHeight);
15261526
// } else {
1527-
// return new Dimension(0, 0);
1527+
return new Dimension(0, 0);
15281528
// }
1529-
// }
1529+
}
15301530

1531-
// /**
1532-
// * Returns the maximum number of colors the Toolkit supports in a custom cursor
1533-
// * palette.<p>
1534-
// * Note: if an image is used which has more colors in its palette than
1535-
// * the supported maximum, the Toolkit implementation will attempt to flatten the
1536-
// * palette to the maximum. Since converting low-resolution images is difficult,
1537-
// * no guarantees are made as to the quality of a cursor image which has more
1538-
// * colors than the system supports. It is therefore recommended that this method
1539-
// * be called and an appropriate image used so no image conversion is made.
1540-
// *
1541-
// * @return the maximum number of colors, or zero if custom cursors are not
1542-
// * supported by this Toolkit implementation.
1543-
// * @exception HeadlessException if GraphicsEnvironment.isHeadless()
1544-
// * returns true
1545-
// * @see java.awt.GraphicsEnvironment#isHeadless
1546-
// * @since 1.2
1547-
// */
1548-
// public int getMaximumCursorColors() {
1549-
// // Override to implement custom cursor support.
1531+
/**
1532+
* Returns the maximum number of colors the Toolkit supports in a custom cursor
1533+
* palette.<p>
1534+
* Note: if an image is used which has more colors in its palette than
1535+
* the supported maximum, the Toolkit implementation will attempt to flatten the
1536+
* palette to the maximum. Since converting low-resolution images is difficult,
1537+
* no guarantees are made as to the quality of a cursor image which has more
1538+
* colors than the system supports. It is therefore recommended that this method
1539+
* be called and an appropriate image used so no image conversion is made.
1540+
*
1541+
* @return the maximum number of colors, or zero if custom cursors are not
1542+
* supported by this Toolkit implementation.
1543+
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
1544+
* returns true
1545+
* @see java.awt.GraphicsEnvironment#isHeadless
1546+
* @since 1.2
1547+
*/
1548+
public int getMaximumCursorColors() {
1549+
// Override to implement custom cursor support.
15501550
// if (this != Toolkit.getDefaultToolkit()) {
15511551
// return Toolkit.getDefaultToolkit().getMaximumCursorColors();
15521552
// } else {
1553-
// return 0;
1553+
return 0;
15541554
// }
1555-
// }
1555+
}
15561556

15571557
/**
15581558
* Returns whether Toolkit supports this state for

sources/net.sf.j2s.java.core/src/java/io/File.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ else if ((p = uri.getPath()).equals(""))
391391
this.path = //fs.normalize
392392
(p);
393393
this.prefixLength = fs.prefixLength(this.path);
394+
秘bytes = uri.秘bytes;
394395
return;
395396
}
396397
throw new IllegalArgumentException(err);

sources/net.sf.j2s.java.core/src/javajs/img/GifEncoder.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@
6767

6868
package javajs.img;
6969

70+
import java.io.IOException;
71+
import java.util.Hashtable;
72+
import java.util.Map;
73+
7074
import javajs.util.CU;
7175
import javajs.util.Lst;
7276
import javajs.util.M3;
7377
import javajs.util.P3;
7478

75-
import java.util.Hashtable;
76-
import java.util.Map;
77-
import java.io.IOException;
78-
7979
/**
8080
*
8181
* GifEncoder extensively adapted for Jmol by Bob Hanson
@@ -152,11 +152,9 @@ protected void setParams(Map<String, Object> params) {
152152
return;
153153
interlaced = false;
154154
capturing = true;
155-
try {
156-
byteCount = ((Integer) params.get("captureByteCount")).intValue();
157-
} catch (Exception e) {
158-
// ignore
159-
}
155+
Integer c = (Integer) params.get("captureByteCount");
156+
if (c != null)
157+
byteCount = c.intValue();
160158
switch ("maec"
161159
.indexOf(((String) params.get("captureMode")).substring(0, 1))) {
162160
case 0: //"movie"
@@ -214,6 +212,7 @@ protected void close() {
214212
* a color point in normalized L*a*b space with a flag indicating whether it
215213
* is the background color
216214
*/
215+
@SuppressWarnings("serial")
217216
private class ColorItem extends P3 {
218217
/**
219218
*
@@ -608,7 +607,7 @@ else if (errp.x == Float.MAX_VALUE) // reuse
608607
// these could be static, but that just makes for more JavaScript code
609608

610609
protected P3 toLABnorm(int rgb) {
611-
P3 lab = CU.colorPtFromInt(rgb, null);
610+
P3 lab = P3.new3((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF);
612611
rgbToXyz(lab, lab);
613612
xyzToLab(lab, lab);
614613
// normalize to 0-100

sources/net.sf.j2s.java.core/src/javajs/util/AU.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,16 @@ public static Object doubleLength(Object array) {
8282
return arrayCopyObject(array, (array == null ? 16 : 2 * getLength(array)));
8383
}
8484

85+
86+
8587
public static String[] doubleLengthS(String[] array) {
8688
return arrayCopyS(array, (array == null ? 16 : 2 * array.length));
8789
}
8890

91+
public static double[] doubleLengthD(double[] array) {
92+
return arrayCopyD(array, (array == null ? 16 : 2 * array.length));
93+
}
94+
8995
public static float[] doubleLengthF(float[] array) {
9096
return arrayCopyF(array, (array == null ? 16 : 2 * array.length));
9197
}

0 commit comments

Comments
 (0)