Skip to content

Commit f91f863

Browse files
hansonrhansonr
authored andcommitted
If applet takes focus when it is started, it will force the page to
scroll to it. This is not expected behavior.
1 parent e64f1a6 commit f91f863

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

sources/net.sf.j2s.java.core/src/swingjs/JSAppletViewer.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public int run1(int mode) {
458458
}
459459
// BH: This should not be necessary.
460460
// It is causing validation to happen twice,
461-
// But actually that is a good thing, because we don't
461+
// But actually that is a good thing, because we don't
462462
// see the flash of incomplete to complete layout.
463463
applet.getRootPane().addNotify();
464464
// force peer creation now
@@ -472,18 +472,10 @@ public int run1(int mode) {
472472
ok = true;
473473
break;
474474
case APPLET_READY:
475-
applet.getContentPane().setBounds(applet.getBounds()); // added
476-
// 7/13/17;
477-
// applet
478-
// background
479-
// was
480-
// not
481-
// painting
482-
// if
483-
// setContentPane()
484-
// was
485-
// used
486-
applet.setVisible(true);
475+
applet.getContentPane().setBounds(applet.getBounds());
476+
// added 7/13/17; applet background was not painting
477+
// if setContentPane() was used
478+
applet.setVisible(true);
487479
applet.validate(); // one last validation necessary for PolyhedronApplet
488480
showAppletStatus("ready");
489481
JSUtil.readyCallback(appletName, fullName, applet, this);
@@ -492,7 +484,10 @@ public int run1(int mode) {
492484
if (resizer != null)
493485
resizer.show();
494486
}
495-
JSFocusPeer.setFocusLast(applet);
487+
// NO! JSFocusPeer.setFocusLast(applet);
488+
// 2019.10.21 Problem here is that the page will scroll to the
489+
// applet even if it is down on the page.
490+
496491
applet.秘repaint();
497492
break;
498493
case APPLET_STOP:

0 commit comments

Comments
 (0)