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.
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 @@
20200117045002
20200119225004
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.7/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.7/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20200117045002
20200119225004
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,7 @@ private boolean addClassOrInterface(ASTNode node, ITypeBinding binding, List<?>
case "java.awt.Component":
case "javax.swing.JComponent":
if (!class_fullName.startsWith("java.") && !class_fullName.startsWith("javax.")) {
// Component and Label are not opaque, Panel is, so we choose Label here
String s = superclassName.replace("Component", "Label");
log(">>class " + class_fullName + " extended " + superclassName + " now extends " + s);
superclassName = s;
Expand Down
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/src/java/awt/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -1867,17 +1867,21 @@ public Point getLocationOnScreen() {
*/
final Point getLocationOnScreen_NoTreeLock() {
if (isShowing()) {
if (isLightweight()) {// peer instanceof LightweightPeer) { // SwingJS will return FALSE
if (isLightweight()) {
// lightweight component location needs to be translated
// relative to a native component.
Container host = getNativeContainer();
if (host.peer == null)
return null;
Point pt = host.peer.getLocationOnScreen();
for (Component c = this; c != host; c = c.getParent()) {
pt.x += c.x;
pt.y += c.y;
}
return pt;
} else {
if (peer == null)
return null;
Point pt = peer.getLocationOnScreen();
return pt;
}
Expand Down
27 changes: 24 additions & 3 deletions sources/net.sf.j2s.java.core/src/java/awt/JSComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
import java.util.Arrays;

import javax.swing.Action;
import javax.swing.JApplet;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRootPane;
import javax.swing.RootPaneContainer;
Expand Down Expand Up @@ -103,8 +105,8 @@ public interface A2SWrappedComponent {
*/
public Action 秘keyAction;

protected boolean 秘isAppletFrame;
public boolean 秘isFramedApplet;
// protected boolean 秘isAppletFrame;
// public boolean 秘isFramedApplet;

public String 秘htmlName;

Expand All @@ -116,7 +118,7 @@ public interface A2SWrappedComponent {
public boolean 秘isRootPane, 秘isContentPane;
// initially, we go with the current thread, but later we will pick up the actual JSAppletViewer
public JSAppletViewer 秘appletViewer = Thread.currentThread().getThreadGroup().秘appletViewer;
private JSFrameViewer 秘frameViewer, 秘topFrameViewer;
public JSFrameViewer 秘frameViewer, 秘topFrameViewer;
public HTML5Canvas 秘canvas;
public ComponentUI ui; // from JComponent

Expand Down Expand Up @@ -284,6 +286,7 @@ public JSFrameViewer setFrameViewer(JSFrameViewer viewer) {
return 秘frameViewer = (viewer == null ? viewer = new JSFrameViewer().setForWindow((RootPaneContainer) this) : viewer);
}


public JSFrameViewer getFrameViewer() {
JSComponent parent = null;
return (秘topFrameViewer != null ? 秘topFrameViewer
Expand Down Expand Up @@ -735,4 +738,22 @@ protected boolean canPaint() {
rootPane.addNotify(); // builds a peer for the root pane
}

public JComponent 秘transferFrameTo(JComponent jc) {
if (jc.秘frameViewer == 秘frameViewer)
return jc;
if (jc.getUIClassID() == "AppletUI") {
System.out.println("JSComponent setContentPane to applet; using content.contentPane instead");
// applet or frame or window of some sort
// take just the content pane
jc = (JComponent) jc.getRootPane().getContentPane();
jc.秘isContentPane = false;
jc.getRootPane().setContentPane(new JPanel());
}
jc.秘frameViewer = 秘frameViewer;
jc.秘topFrameViewer = 秘topFrameViewer;
return jc;
}



}
8 changes: 5 additions & 3 deletions sources/net.sf.j2s.java.core/src/java/awt/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -3081,14 +3081,16 @@ public void setLocationRelativeTo(Component c) {
}
}

if ((c != null && !c.isShowing()) || root == null || !root.isShowing()) {
Point invokerScreenLocation;
if (c != null && !c.isShowing()
|| root == null
|| !root.isShowing()
|| (invokerScreenLocation = c.getLocationOnScreen()) == null) {
Dimension paneSize = getSize();
Point centerPoint = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
setLocation(centerPoint.x - paneSize.width / 2, centerPoint.y - paneSize.height / 2);
} else {
Dimension invokerSize = c.getSize();
Point invokerScreenLocation = c.getLocationOnScreen();

Rectangle windowBounds = getBounds();
int dx = invokerScreenLocation.x + ((invokerSize.width - windowBounds.width) >> 1);
int dy = invokerScreenLocation.y + ((invokerSize.height - windowBounds.height) >> 1);
Expand Down
7 changes: 4 additions & 3 deletions sources/net.sf.j2s.java.core/src/java/io/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -701,11 +701,12 @@ private static String slashify(String path, boolean isDirectory) {
// */
public URI toURI() {
try {
File f = getAbsoluteFile();
String sp = slashify(f.getPath(), f.isDirectory());
String sp = slashify(getAbsoluteFile().getPath(), false);
if (sp.startsWith("//"))
sp = "//" + sp;
return new URI("file", null, sp, null);
URI uri = new URI("file", null, sp, null);
uri.秘bytes = 秘bytes;
return uri;
} catch (URISyntaxException x) {
throw new Error(x); // Can't happen
}
Expand Down
50 changes: 50 additions & 0 deletions sources/net.sf.j2s.java.core/src/java/io/FileFilter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 1998, 2013, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/

package java.io;


/**
* A filter for abstract pathnames.
*
* <p> Instances of this interface may be passed to the <code>{@link
* File#listFiles(java.io.FileFilter) listFiles(FileFilter)}</code> method
* of the <code>{@link java.io.File}</code> class.
*
* @since 1.2
*/
@FunctionalInterface
public interface FileFilter {

/**
* Tests whether or not the specified abstract pathname should be
* included in a pathname list.
*
* @param pathname The abstract pathname to be tested
* @return <code>true</code> if and only if <code>pathname</code>
* should be included
*/
boolean accept(File pathname);
}
Loading