File tree Expand file tree Collapse file tree 4 files changed +35
-6
lines changed
sources/net.sf.j2s.java.core/src/swingjs/a2s Expand file tree Collapse file tree 4 files changed +35
-6
lines changed Original file line number Diff line number Diff line change 22
33import java .awt .Color ;
44import java .awt .FlowLayout ;
5+ import java .awt .Font ;
56import java .awt .HeadlessException ;
67import java .net .MalformedURLException ;
78import java .net .URL ;
@@ -30,6 +31,13 @@ public Applet() throws HeadlessException {
3031 ((JComponent ) getContentPane ()).setOpaque (false );
3132 }
3233
34+ @ Override
35+ public Font getFont () {
36+ if (font == null && parent == null )
37+ font = new Font (Font .DIALOG , Font .PLAIN , 12 );
38+ return super .getFont ();
39+ }
40+
3341 @ Override
3442 public void setBackground (Color c ) {
3543 super .setBackground (c );
Original file line number Diff line number Diff line change 11package swingjs .a2s ;
22
3+ import java .awt .Font ;
34import java .awt .GraphicsConfiguration ;
45import java .awt .Window ;
56
@@ -19,9 +20,15 @@ private void setListener() {
1920 Util .setAWTWindowDefaults (this );
2021 }
2122
23+ @ Override
24+ public Font getFont () {
25+ if (font == null && parent == null )
26+ font = new Font (Font .DIALOG , Font .PLAIN , 12 );
27+ return super .getFont ();
28+ }
29+
2230 public Dialog (Frame owner ) {
23- super (owner );
24- setListener ();
31+ this (owner , false );
2532 }
2633
2734 public Dialog (java .awt .Frame owner , boolean modal ) {
Original file line number Diff line number Diff line change 11package swingjs .a2s ;
22
33import java .awt .Component ;
4+ import java .awt .Font ;
45import java .awt .GraphicsConfiguration ;
56import java .awt .MenuBar ;
67import java .awt .MenuComponent ;
@@ -48,10 +49,14 @@ public void windowOpened(WindowEvent e) {
4849
4950 });
5051 }
51-
52-
53-
5452
53+ @ Override
54+ public Font getFont () {
55+ if (font == null && parent == null )
56+ font = new Font (Font .DIALOG , Font .PLAIN , 12 );
57+ return super .getFont ();
58+ }
59+
5560 @ Override
5661 public void remove (int i ) {
5762 super .remove (i );
Original file line number Diff line number Diff line change 2020public class PopupMenu extends JPopupMenu implements AWTPopupMenu {
2121
2222 public PopupMenu () {
23- super ( );
23+ this ( null );
2424 }
2525
2626 public PopupMenu (String string ) {
2727 super (string );
2828 }
2929
30+ @ Override
31+ public Font getFont () {
32+ // AWT default fonts are set by the peer (native OS)
33+ Font f = super .getFont ();
34+ if (f == null ) {
35+ setFont (f = new Font (Font .DIALOG , Font .PLAIN , 12 ));
36+ }
37+ return f ;
38+ }
3039 @ Override
3140 public int countItems () {
3241 return getComponentCount ();
You can’t perform that action at this time.
0 commit comments