Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7d67de4
// BH 9/18/2018 fixes data.getBytes() not qualified, J2S.saveFile
Sep 19, 2018
6670d59
// moved to local
Sep 19, 2018
4ce594f
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.gi…
Sep 22, 2018
a15ca75
fixes for JScrollBar
Sep 23, 2018
75ba926
fix for a2s.Applet subclasses not having super.paint(g) methods
Sep 23, 2018
c8e7ab2
3.2.2.07 adds support for direct AWT java.applet.Applet translation
Sep 23, 2018
f2523c0
a2s support for AWT non-Swing Applets
Sep 23, 2018
3882259
new AWT constructor-only classes that subclass a2s.*
Sep 23, 2018
1f3509b
Core plugin 3.2.2.07 adds HTML for java.applet.Applet
Sep 23, 2018
9e373b1
new classes for AWT
Sep 23, 2018
180f0d9
printwriter fix -- no need for reflection
Sep 23, 2018
45138ce
AWT/swing support for JSFrame, JSDialog, JSPanel
Sep 23, 2018
4102acb
swingjs/plaf support for new AWT JSxxxx classes
Sep 23, 2018
f0cb0ee
adds JSObject support for JSApplet/Applet
Sep 23, 2018
ed6ebd5
test files for AWT applets
Sep 23, 2018
46142c1
distribution files for direct AWT support
Sep 23, 2018
6f9103d
3.2.3.00 full coverage of java.awt non-Swing components. 2/2
Sep 26, 2018
1ed4235
3.2.3.00 full coverage of java.awt non-Swing components. 2/2
Sep 26, 2018
9547f55
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.git
Sep 26, 2018
141c976
Merge pull request #63 from BobHanson/hanson1
BobHanson Sep 26, 2018
b839cad
repairs 0-length SwingJS-site.zip
Sep 26, 2018
41ea62b
Merge pull request #64 from BobHanson/hanson1
BobHanson Sep 26, 2018
a27599b
BigInteger, BigDecimal -- preliminary only
Oct 1, 2018
110753a
fixes for Integer, Long, and System.properties
Oct 1, 2018
4e3eba1
preliminary info for JAXB -- will be changing
Oct 1, 2018
574730c
resource bundle default set to check Properties files first
Oct 1, 2018
10192c4
JAXB with examples and org.apache.xml.bind support
Oct 1, 2018
dd8a505
3.2.4.01(Runtime) BH 2018.10.01
Oct 1, 2018
c00cdc0
Merge pull request #65 from BobHanson/hanson1
BobHanson Oct 1, 2018
4536495
doc/Differences.txt update; moving older doc/*.txt to unused/
Oct 2, 2018
40ae205
BigInteger working; tested for div
Oct 3, 2018
990e745
adds test.math; fixes BigInteger;working
Oct 4, 2018
3e97e0e
fixing A2SEvent
Oct 9, 2018
c246a91
antialiasing fixes
Oct 9, 2018
2a083b7
antialias testing
Oct 9, 2018
879b025
GPL ConcurrentMap.java
Oct 9, 2018
de1797f
open source QName from JBoss
Oct 9, 2018
d0368b8
SwingJS-site.zip; preliminary javax.xml work
Oct 9, 2018
2207f32
Merge pull request #66 from BobHanson/hanson1
BobHanson Oct 10, 2018
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
Prev Previous commit
Next Next commit
AWT/swing support for JSFrame, JSDialog, JSPanel
  • Loading branch information
hansonr hansonr
hansonr authored and hansonr committed Sep 23, 2018
commit 45138ce931bfd9d4278f5cde2f2fea645d0a25ea
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public interface AppletContext {
* @return the applet with the given name, or <code>null</code> if
* not found.
*/
Applet getApplet(String name);
JSApplet getApplet(String name);

/**
* Finds all the applets in the document represented by this applet
Expand All @@ -87,7 +87,7 @@ public interface AppletContext {
* @return an enumeration of all applets in the document represented by
* this applet context.
*/
Enumeration<Applet> getApplets();
Enumeration<JSApplet> getApplets();

/**
* Requests that the browser or applet viewer show the Web page
Expand Down
5 changes: 2 additions & 3 deletions sources/net.sf.j2s.java.core/src/java/awt/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/
package java.awt;

import java.applet.Applet;
import java.awt.dnd.DropTarget;
import java.awt.event.ActionEvent;
import java.awt.event.AdjustmentEvent;
Expand Down Expand Up @@ -4156,8 +4155,8 @@ boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {

boolean checkWindowClosingException() {
if (windowClosingException != null) {
if (this instanceof Dialog) {
((Dialog) this).interruptBlocking();
if (this instanceof JSDialog) {
((JSDialog) this).interruptBlocking();
} else {
windowClosingException.fillInStackTrace();
windowClosingException.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public String toString() {
}

private Window getOwningFrameDialog(Window window) {
while (window != null && !(window instanceof Frame ||
window instanceof Dialog)) {
while (window != null && !(window instanceof JSFrame ||
window instanceof JSDialog)) {
window = (Window)window.getParent();
}
return window;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
* } </pre>
*
* @see Window
* @see Frame
* @see JSFrame
* @see GraphicsEnvironment
* @see GraphicsDevice
* @see swingjs.JSGraphicsConfiguration
Expand Down
12 changes: 6 additions & 6 deletions sources/net.sf.j2s.java.core/src/java/awt/JSPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @see java.awt.FlowLayout
* @since JDK1.0
*/
public class Panel extends Container {
public class JSPanel extends Container {
private static final String base = "panel";
private static int nameCounter = 0;

Expand All @@ -56,7 +56,7 @@ public class Panel extends Container {
* <code>FlowLayout</code> class.
*
*/
public Panel() {
public JSPanel() {
this(new FlowLayout());
}

Expand All @@ -72,7 +72,7 @@ protected boolean canPaint() {
* @param layout the layout manager for this panel.
* @since JDK1.1
*/
public Panel(LayoutManager layout) {
public JSPanel(LayoutManager layout) {
setAppContext();
setLayout(layout);
}
Expand All @@ -83,9 +83,9 @@ public Panel(LayoutManager layout) {
*/
@Override
String constructComponentName() {
synchronized (Panel.class) {
// synchronized (JSPanel.class) {
return base + nameCounter++;
}
// }
}

/**
Expand All @@ -103,7 +103,7 @@ public void addNotify() {

@Override
protected ComponentPeer getOrCreatePeer() {
return (ui == null ? null : peer == null ? (peer = getToolkit().createPanel(this)) : peer);
return (ui == null ? null : peer == null ? (peer = getToolkit().createPanel((Panel) (Object) this)) : peer);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
* @author David Mendenhall
*
* @see Window
* @see Frame
* @see Dialog
* @see JSFrame
* @see JSDialog
* @see java.awt.event.FocusEvent
* @see java.awt.event.WindowEvent
* @see java.awt.event.KeyEvent
Expand Down Expand Up @@ -2555,8 +2555,8 @@ static Window markClearGlobalFocusOwner() {
? SunToolkit.getContainingWindow(hwFocusRequest.heavyweight)
: nativeFocusedWindow);
while (activeWindow != null &&
!((activeWindow instanceof Frame) ||
(activeWindow instanceof Dialog)))
!((activeWindow instanceof JSFrame) ||
(activeWindow instanceof JSDialog)))
{
activeWindow = activeWindow.getParent_NoClientCode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int compareTo(ModalEventFilter another) {
c = c.getParent_NoClientCode();
}
// check if one dialog blocks (directly or indirectly) another
Dialog blocker = modalDialog.getModalBlocker();
Dialog blocker = ((a2s.Dialog) modalDialog).getModalBlocker();
while (blocker != null) {
if (blocker == anotherDialog) {
return -1;
Expand Down
20 changes: 10 additions & 10 deletions sources/net.sf.j2s.java.core/src/java/awt/Toolkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ public abstract class Toolkit {
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Frame
* @see java.awt.JSFrame
* @see java.awt.peer.FramePeer
*/
protected abstract FramePeer createFrame(Frame target);
protected abstract FramePeer createFrame(JSFrame target);
//
// /**
// * Creates this toolkit's implementation of <code>Canvas</code> using
Expand All @@ -305,7 +305,7 @@ public abstract class Toolkit {
* the specified peer interface.
* @param target the panel to be implemented.
* @return this toolkit's implementation of <code>Panel</code>.
* @see java.awt.Panel
* @see java.awt.JSPanel
* @see java.awt.peer.PanelPeer
*/
protected abstract PanelPeer createPanel(Panel target);
Expand All @@ -331,7 +331,7 @@ public abstract class Toolkit {
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.Dialog
* @see java.awt.JSDialog
* @see java.awt.peer.DialogPeer
*/
protected abstract java.awt.peer.DialogPeer createDialog(Dialog target)
Expand Down Expand Up @@ -1174,7 +1174,7 @@ public abstract Image createImage(byte[] imagedata,
* @see java.lang.RuntimePermission
* @since JDK1.1
*/
public abstract PrintJob getPrintJob(Frame frame, String jobtitle,
public abstract PrintJob getPrintJob(JSFrame frame, String jobtitle,
Properties props);

/**
Expand Down Expand Up @@ -1226,7 +1226,7 @@ public abstract PrintJob getPrintJob(Frame frame, String jobtitle,
* @see java.awt.PageAttributes
* @since 1.3
*/
public PrintJob getPrintJob(Frame frame, String jobtitle,
public PrintJob getPrintJob(JSFrame frame, String jobtitle,
JobAttributes jobAttributes,
PageAttributes pageAttributes) {
// Override to add printing support with new job/page control classes
Expand Down Expand Up @@ -1553,13 +1553,13 @@ public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
* @exception HeadlessException
* if <code>GraphicsEnvironment.isHeadless()</code>
* returns <code>true</code>.
* @see java.awt.Frame#setExtendedState
* @see java.awt.JSFrame#setExtendedState
* @since 1.4
*/
public boolean isFrameStateSupported(int state)

{
return (state == Frame.NORMAL); // others are not guaranteed
return (state == JSFrame.NORMAL); // others are not guaranteed
}

/**
Expand Down Expand Up @@ -1825,8 +1825,8 @@ public boolean isAlwaysOnTopSupported() {
* type, <code>false</code> otherwise
*
* @see java.awt.Dialog.ModalityType
* @see java.awt.Dialog#getModalityType
* @see java.awt.Dialog#setModalityType
* @see java.awt.JSDialog#getModalityType
* @see java.awt.JSDialog#setModalityType
*
* @since 1.6
*/
Expand Down
50 changes: 24 additions & 26 deletions sources/net.sf.j2s.java.core/src/java/awt/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,7 @@
*/
package java.awt;

//import java.lang.ref.WeakReference;
//import java.lang.reflect.InvocationTargetException;
//import java.awt.AWTPermission;
//import java.awt.HeadlessException;
import java.awt.KeyboardFocusManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EventListener;
import java.util.Set;
import java.util.Vector;

import java.applet.Applet;
import java.applet.JSApplet;
import java.awt.event.ComponentEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseWheelEvent;
Expand All @@ -49,8 +38,14 @@
import java.awt.peer.ComponentPeer;
import java.awt.peer.WindowPeer;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EventListener;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.Vector;

import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JRootPane;
Expand All @@ -62,7 +57,6 @@
//import java.util.concurrent.atomic.AtomicBoolean;
//import java.util.logging.Logger;
import swingjs.JSUtil;
import swingjs.plaf.JSComponentUI;

/**
*
Expand Down Expand Up @@ -232,7 +226,7 @@ public class Window extends JComponent {
*
* @since 1.6
*/
transient Dialog modalBlocker;
transient JSDialog modalBlocker;

/**
* @serial
Expand Down Expand Up @@ -924,7 +918,7 @@ public void show() {
// // should be raised to front
// modalBlocker.toFront_NoClientCode();
// }
if (this instanceof Frame || this instanceof Dialog) {
if (this instanceof JSFrame || this instanceof JSDialog) {
updateChildFocusableWindowState(this);
}
}
Expand Down Expand Up @@ -1369,7 +1363,7 @@ boolean isModalBlocked() {
return modalBlocker != null;
}

void setModalBlocked(Dialog blocker, boolean blocked, boolean peerCall) {
void setModalBlocked(JSDialog blocker, boolean blocked, boolean peerCall) {
// this.modalBlocker = blocked ? blocker : null;
// if (peerCall) {
// WindowPeer peer = (WindowPeer)this.peer;
Expand All @@ -1379,8 +1373,12 @@ void setModalBlocked(Dialog blocker, boolean blocked, boolean peerCall) {
// }
}

Dialog getModalBlocker() {
return modalBlocker;
void setModalBlocked(Dialog blocker, boolean blocked, boolean peerCall) {
setModalBlocked((JSDialog) blocker, blocked, peerCall);
}

public Dialog getModalBlocker() {
return (Dialog)(Object) modalBlocker;
}

/*
Expand Down Expand Up @@ -1451,7 +1449,7 @@ private static Window[] getWindows(AppContext appContext) {
* dialogs such as component positions, <code>LayoutManager</code>s
* or serialization.
*
* @see Frame#getFrames
* @see JSFrame#getFrames
* @see Window#getOwnerlessWindows
*
* @since 1.6
Expand All @@ -1473,7 +1471,7 @@ public static Window[] getWindows() {
* dialogs such as component positions, <code>LayoutManager</code>s
* or serialization.
*
* @see Frame#getFrames
* @see JSFrame#getFrames
* @see Window#getWindows()
*
* @since 1.6
Expand All @@ -1499,7 +1497,7 @@ public static Window[] getOwnerlessWindows() {
return ownerless;
}

Window getDocumentRoot() {
public Window getDocumentRoot() {
synchronized (getTreeLock()) {
Window w = this;
while (w.getOwner() != null) {
Expand All @@ -1521,7 +1519,7 @@ Window getDocumentRoot() {
* effect until it is hidden and then shown again.
*
* @param exclusionType the modal exclusion type for this window; a <code>null</code>
* value is equivivalent to {@link Dialog.ModalExclusionType#NO_EXCLUDE
* value is equivivalent to {@link JSDialog.ModalExclusionType#NO_EXCLUDE
* NO_EXCLUDE}
* @throws SecurityException if the calling thread does not have permission
* to set the modal exclusion property to the window with the given
Expand Down Expand Up @@ -2344,7 +2342,7 @@ public final boolean isFocusableWindow() {
}

// All other tests apply only to Windows.
if (this instanceof Frame || this instanceof Dialog) {
if (this instanceof JSFrame || this instanceof JSDialog) {
return true;
}

Expand All @@ -2359,7 +2357,7 @@ public final boolean isFocusableWindow() {
for (Window owner = getOwner(); owner != null;
owner = owner.getOwner())
{
if (owner instanceof Frame || owner instanceof Dialog) {
if (owner instanceof JSFrame || owner instanceof JSDialog) {
return owner.isShowing();
}
}
Expand Down Expand Up @@ -2979,12 +2977,12 @@ public void setLocationRelativeTo(Component c) {
Container root=null;

if (c != null) {
if (c instanceof Window || c instanceof Applet) {
if (c instanceof Window || c instanceof JSApplet) {
root = (Container)c;
} else {
Container parent;
for(parent = c.getParent() ; parent != null ; parent = parent.getParent()) {
if (parent instanceof Window || parent instanceof Applet) {
if (parent instanceof Window || parent instanceof JSApplet) {
root = parent;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class WindowEvent extends ComponentEvent {
* the window has been changed from a normal to a minimized state.
* For many platforms, a minimized window is displayed as
* the icon specified in the window's iconImage property.
* @see java.awt.Frame#setIconImage
* @see java.awt.JSFrame#setIconImage
*/
public static final int WINDOW_ICONIFIED = 3 + WINDOW_FIRST; //Event.WINDOW_ICONIFY

Expand Down Expand Up @@ -325,7 +325,7 @@ public Window getOppositeWindow() {
* </ul>
*
* @return a bitwise mask of the previous window state
* @see java.awt.Frame#getExtendedState()
* @see java.awt.JSFrame#getExtendedState()
* @since 1.4
*/
public int getOldState() {
Expand All @@ -348,7 +348,7 @@ public int getOldState() {
* </ul>
*
* @return a bitwise mask of the new window state
* @see java.awt.Frame#getExtendedState()
* @see java.awt.JSFrame#getExtendedState()
* @since 1.4
*/
public int getNewState() {
Expand Down
Loading