Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
6 changes: 5 additions & 1 deletion sources/net.sf.j2s.core/dist/swingjs/differences.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 5/4/2025 -- clarity about not supporting UI subclassing
updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
Expand Down Expand Up @@ -359,6 +360,9 @@ Java or JavaScript equivalents.
Swing GUI Peers and UIClasses
-----------------------------

SwingJS does not support custom UI classes that subclass UI classes in javax/swing/plaf
or com/sun/javax/swing/plaf.

One of the biggest adaptations introduced in SwingJS is in the area of the graphical
user interface. Basically, what we have is a Java Swing "LookAndFeel" customized for HTML.

Expand All @@ -369,7 +373,7 @@ component "uiClass" (one per component, such as BasicButtonUI or BasicTextFieldU
Peers are native objects of the operating system. These are the virtual buttons and text areas
that the user is interacting with at a very base level. They are chunks of low-level code that
paint the screen to give the illusion that you really are pressing a button or typing text
ot the screen. Their events are being passed on to Java or the browser by the operating system.
to the screen. Their events are being passed on to Java or the browser by the operating system.

UI classes provide a consistent "look and feel" for these native objects, rendering them onto
the native window canvas and handling all user-generated events. They paint the borders,
Expand Down
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20250419180504
20251109202645
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/SwingJS-site.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 5/4/2025 -- clarity about not supporting UI subclassing
updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
Expand Down Expand Up @@ -359,6 +360,9 @@ Java or JavaScript equivalents.
Swing GUI Peers and UIClasses
-----------------------------

SwingJS does not support custom UI classes that subclass UI classes in javax/swing/plaf
or com/sun/javax/swing/plaf.

One of the biggest adaptations introduced in SwingJS is in the area of the graphical
user interface. Basically, what we have is a Java Swing "LookAndFeel" customized for HTML.

Expand All @@ -369,7 +373,7 @@ component "uiClass" (one per component, such as BasicButtonUI or BasicTextFieldU
Peers are native objects of the operating system. These are the virtual buttons and text areas
that the user is interacting with at a very base level. They are chunks of low-level code that
paint the screen to give the illusion that you really are pressing a button or typing text
ot the screen. Their events are being passed on to Java or the browser by the operating system.
to the screen. Their events are being passed on to Java or the browser by the operating system.

UI classes provide a consistent "look and feel" for these native objects, rendering them onto
the native window canvas and handling all user-generated events. They paint the borders,
Expand Down
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20250419180504
20251109202645
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
6 changes: 5 additions & 1 deletion sources/net.sf.j2s.java.core/dist/differences.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 5/4/2025 -- clarity about not supporting UI subclassing
updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
Expand Down Expand Up @@ -359,6 +360,9 @@ Java or JavaScript equivalents.
Swing GUI Peers and UIClasses
-----------------------------

SwingJS does not support custom UI classes that subclass UI classes in javax/swing/plaf
or com/sun/javax/swing/plaf.

One of the biggest adaptations introduced in SwingJS is in the area of the graphical
user interface. Basically, what we have is a Java Swing "LookAndFeel" customized for HTML.

Expand All @@ -369,7 +373,7 @@ component "uiClass" (one per component, such as BasicButtonUI or BasicTextFieldU
Peers are native objects of the operating system. These are the virtual buttons and text areas
that the user is interacting with at a very base level. They are chunks of low-level code that
paint the screen to give the illusion that you really are pressing a button or typing text
ot the screen. Their events are being passed on to Java or the browser by the operating system.
to the screen. Their events are being passed on to Java or the browser by the operating system.

UI classes provide a consistent "look and feel" for these native objects, rendering them onto
the native window canvas and handling all user-generated events. They paint the borders,
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist_to_jsmol/Jmol-j2s-site.zip
Binary file not shown.
6 changes: 5 additions & 1 deletion sources/net.sf.j2s.java.core/doc/Differences.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
java2script/SwingJS Notes
=========================

updated 5/4/2025 -- clarity about not supporting UI subclassing
updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
updated 12/31/2020 -- full support for 64-bit long
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
Expand Down Expand Up @@ -359,6 +360,9 @@ Java or JavaScript equivalents.
Swing GUI Peers and UIClasses
-----------------------------

SwingJS does not support custom UI classes that subclass UI classes in javax/swing/plaf
or com/sun/javax/swing/plaf.

One of the biggest adaptations introduced in SwingJS is in the area of the graphical
user interface. Basically, what we have is a Java Swing "LookAndFeel" customized for HTML.

Expand All @@ -369,7 +373,7 @@ component "uiClass" (one per component, such as BasicButtonUI or BasicTextFieldU
Peers are native objects of the operating system. These are the virtual buttons and text areas
that the user is interacting with at a very base level. They are chunks of low-level code that
paint the screen to give the illusion that you really are pressing a button or typing text
ot the screen. Their events are being passed on to Java or the browser by the operating system.
to the screen. Their events are being passed on to Java or the browser by the operating system.

UI classes provide a consistent "look and feel" for these native objects, rendering them onto
the native window canvas and handling all user-generated events. They paint the borders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// (local scope) Clazz_xxx, allowing them to be further compressed using
// Google Closure Compiler in that same ANT task.

// BH 2025.11.10 removing override of String.prototype.concat
// BH 2023.07.08 NaN.0 fix
// BH 10/16/2017 6:51:20 AM fixing range error for MSIE in prepareCallback setting arguments.length < 0
// BH 10/13/2017 7:03:28 AM fix for String.initialize(bytes) applying bytes as arguments
Expand Down Expand Up @@ -1392,13 +1393,13 @@ for(var i=0;i<srcEnd-srcBegin;i++){
dst[dstBegin+i]=this.charAt(srcBegin+i);
}
};
sp.$concat=sp.concat;
sp.concat=function(s){
if(s==null){
throw new NullPointerException();
}
return this.$concat(s);
};
//sp.$concat=sp.concat;
//sp.concat=function(s){
//if(s==null){
//throw new NullPointerException();
//}
//return this.$concat(s);
//};

sp.$lastIndexOf=sp.lastIndexOf;
sp.lastIndexOf=function(s,last){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
public interface GenericCifDataParser {

static final int NONE = -1;

String fullTrim(String str);
static final int EMPTY = -2;

Map<String, Object> getAllCifData();

Map<String, Object> getAllCifDataType(String[] types);

boolean getData() throws Exception;

String getColumnName(int i);
Expand Down
5 changes: 5 additions & 0 deletions sources/net.sf.j2s.java.core/src/javajs/img/ImageEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public abstract class ImageEncoder implements GenericImageEncoder {
protected int width = -1;
protected int height = -1;
protected int quality = -1;
protected int dpi = -1;

protected String date;
protected boolean logging;
protected boolean doClose = true;
Expand All @@ -103,6 +105,9 @@ public boolean createImage(String type, OC out, Map<String, Object> params)
setParams(params);
generate();
close(); // GIF will override this and not close
params.put("qualityActual", Integer.valueOf(quality));
if (dpi > 0)
params.put("DPI", Integer.valueOf(dpi));
return doClose;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Jpg64Encoder extends JpgEncoder {

@Override
protected void setParams(Map<String, Object> params) {
defaultQuality = 75;
defaultQuality = 75; // assuming this is for the web; only 30% of the size relative to 100
outTemp = (OC) params.remove("outputChannelTemp");
super.setParams(params);
}
Expand Down
75 changes: 59 additions & 16 deletions sources/net.sf.j2s.java.core/src/javajs/img/JpgEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.io.IOException;
import java.util.Map;

import javajs.img.ImageEncoder;
import javajs.util.AU;
import javajs.util.OC;

Expand Down Expand Up @@ -65,7 +64,7 @@ public class JpgEncoder extends ImageEncoder {
private JpegObj jpegObj;
private Huffman huf;
private DCT dct;
protected int defaultQuality = 100;
protected int defaultQuality = 100; // set to 75 for Base64
private String applicationTag;

public JpgEncoder() {
Expand All @@ -74,11 +73,19 @@ public JpgEncoder() {

@Override
protected void setParams(Map<String, Object> params) {
if (quality <= 0)
quality = (params.containsKey("qualityJPG") ? ((Integer) params.get("qualityJPG")).intValue() : defaultQuality);
jpegObj = new JpegObj();
jpegObj.comment = (String) params.get("comment");
applicationTag = (String) params.get("jpgAppTag");
dpi = 300;
if (quality <= 0)
quality = (params.containsKey("qualityJPG") ? ((Integer) params.get("qualityJPG")).intValue() : -1);
if (quality >= 90) {
// 96, 100, 200, 300, 600, etc.
dpi = quality;
quality = -1;
}
if (quality < 0)
quality = defaultQuality;
}

@Override
Expand Down Expand Up @@ -186,24 +193,33 @@ private void writeCompressedData(JpegObj jpegObj, DCT dct, Huffman huf) {
private static byte[] eoi = { (byte) 0xFF, (byte) 0xD9 };

private static byte[] jfif = new byte[] {
/* JFIF[0] =*/(byte) 0xff,
/* JFIF[1] =*/(byte) 0xe0,
/* JFIF[2] =*/0,
/* JFIF[3] =*/16,
/* JFIF[4] =*/(byte) 0x4a, //'J'
// application use marker
/* JFIF[0] =*/(byte) 0xff,
/* JFIF[1] =*/(byte) 0xe0,
// APP0 field size; starting at [2]
/* JFIF[2] =*/0,
/* JFIF[3] =*/16,

/* JFIF[4] =*/(byte) 0x4a, //'J'
/* JFIF[5] =*/(byte) 0x46, //'F'
/* JFIF[6] =*/(byte) 0x49, //'I'
/* JFIF[7] =*/(byte) 0x46, //'F'
/* JFIF[8] =*/0,

/* JFIF[9] =*/1,
/* JFIF[10] =*/0,
/* JFIF[11] =*/0,
/* JFIF[12] =*/0,
/* JFIF[13] =*/1,
/* JFIF[14] =*/0,
/* JFIF[15] =*/1,
/* JFIF[16] =*/0,
/* JFIF[17] =*/0 };

// quality (5 bytes) and thumbnail (2 bytes) follow; not included here
};


// BYTE Identifier[5]; /* 06h "JFIF" (zero terminated) Id String */
// BYTE Version[2]; /* 07h JFIF Format Revision */
// BYTE Units; /* 09h Units used for Resolution */
// BYTE Xdensity[2]; /* 0Ah Horizontal Resolution */
// BYTE Ydensity[2]; /* 0Ch Vertical Resolution */
// BYTE XThumbnail; /* 0Eh Horizontal Pixel Count */
// BYTE YThumbnail; /* 0Fh Vertical Pixel Count */

private static byte[] soi = { (byte) 0xFF, (byte) 0xD8 };

Expand All @@ -217,6 +233,9 @@ private String writeHeaders(JpegObj jpegObj, DCT dct) {
// The order of the following headers is quite inconsequential.
// the JFIF header
writeArray(jfif);

writeDensities();
writeThumbNailSize();

// Comment Header
String comment = null;
Expand Down Expand Up @@ -287,6 +306,30 @@ private String writeHeaders(JpegObj jpegObj, DCT dct) {
return comment;
}

private void writeDensities() {
// Units, Xdensity, and Ydensity identify the unit of measurement
// used to describe the image resolution.
// Units may be 01h for dots per inch,
// 02h for dots per centimeter,
// or 00h for none (use measurement as pixel aspect ratio).
// Xdensity and Ydensity are the horizontal and vertical resolution
// of the image data, respectively.
// If the Units field value is 00h, the Xdensity and Ydensity fields
// will contain the pixel aspect ratio (Xdensity : Ydensity)
// rather than the image resolution.
// Because non-square pixels are discouraged for portability
// reasons, the Xdensity and Ydensity values normally
// equal 1 when the Units value is 0.

out.writeByteAsInt(1);
out.writeShort((short) dpi);
out.writeShort((short) dpi);
}

private void writeThumbNailSize() {
writeArray(new byte[2]);
}

private void writeString(String s, byte id) {
int len = s.length();
int i0 = 0;
Expand Down
Loading