Skip to content

Commit e0b67c6

Browse files
authored
Merge pull request #86 from BobHanson/hanson1
better menu look and feel; dynamic menu item adding;
2 parents aab27b3 + 0dc5aea commit e0b67c6

40 files changed

+2025
-1672
lines changed
5.67 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181114074826
1+
20181117145755
5.67 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20181114074826
1+
20181117145755
5.67 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/Container.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,9 +1450,11 @@ public void doLayout() {
14501450
@Deprecated
14511451
public void layout() {
14521452
// called by Component and Container
1453-
if (this.layoutMgr != null && this.width > 0 && this.height > 0) {
1454-
this.layoutMgr.layoutContainer(this);
1455-
}
1453+
// The reason we don't care about w&h is that
1454+
// we can be working just with preferences here.
1455+
// This is when getPreferredSize() is copied to getSize()
1456+
if (layoutMgr != null)//BH out 11/16/18 && this.width > 0 && this.height > 0) {
1457+
layoutMgr.layoutContainer(this);
14561458
}
14571459

14581460
/**

sources/net.sf.j2s.java.core/src/java/awt/JSDialog.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ public class JSDialog extends Window {
229229
public JSDialog(JSFrame owner) {
230230
this(owner, "", false);
231231
}
232+
public JSDialog(Frame owner) {
233+
this(owner, "", false);
234+
}
232235

233236
/**
234237
* Constructs an initially invisible <code>Dialog</code> with the specified
@@ -256,6 +259,10 @@ public JSDialog(JSFrame owner, boolean modal) {
256259
this(owner, "", modal);
257260
}
258261

262+
public JSDialog(Frame owner, boolean modal) {
263+
this(owner, "", modal);
264+
}
265+
259266
/**
260267
* Constructs an initially invisible, modeless <code>Dialog</code> with
261268
* the specified owner <code>Frame</code> and title.
@@ -277,6 +284,10 @@ public JSDialog(JSFrame owner, String title) {
277284
this(owner, title, false);
278285
}
279286

287+
public JSDialog(Frame owner, String title) {
288+
this(owner, title, false);
289+
}
290+
280291
/**
281292
* Constructs an initially invisible <code>Dialog</code> with the
282293
* specified owner <code>Frame</code>, title and modality.
@@ -307,6 +318,10 @@ public JSDialog(JSFrame owner, String title, boolean modal) {
307318
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS);
308319
}
309320

321+
public JSDialog(Frame owner, String title, boolean modal) {
322+
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS);
323+
}
324+
310325
/**
311326
* Constructs an initially invisible <code>Dialog</code> with the specified owner
312327
* <code>Frame</code>, title, modality, and <code>GraphicsConfiguration</code>.
@@ -341,6 +356,11 @@ public JSDialog(JSFrame owner, String title, boolean modal,
341356
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS, gc);
342357
}
343358

359+
public JSDialog(Frame owner, String title, boolean modal,
360+
GraphicsConfiguration gc) {
361+
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS, gc);
362+
}
363+
344364
/**
345365
* Constructs an initially invisible, modeless <code>Dialog</code> with
346366
* the specified owner <code>Dialog</code> and an empty title.
@@ -358,6 +378,10 @@ public JSDialog(JSDialog owner) {
358378
this(owner, "", false);
359379
}
360380

381+
public JSDialog(Dialog owner) {
382+
this(owner, "", false);
383+
}
384+
361385
/**
362386
* Constructs an initially invisible, modeless <code>Dialog</code>
363387
* with the specified owner <code>Dialog</code> and title.
@@ -378,6 +402,10 @@ public JSDialog(JSDialog owner, String title) {
378402
this(owner, title, false);
379403
}
380404

405+
public JSDialog(Dialog owner, String title) {
406+
this(owner, title, false);
407+
}
408+
381409
/**
382410
* Constructs an initially invisible <code>Dialog</code> with the
383411
* specified owner <code>Dialog</code>, title, and modality.
@@ -408,6 +436,10 @@ public JSDialog(JSDialog owner, String title, boolean modal) {
408436
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS);
409437
}
410438

439+
public JSDialog(Dialog owner, String title, boolean modal) {
440+
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS);
441+
}
442+
411443
/**
412444
* Constructs an initially invisible <code>Dialog</code> with the
413445
* specified owner <code>Dialog</code>, title, modality and
@@ -445,6 +477,10 @@ public JSDialog(JSDialog owner, String title, boolean modal,
445477
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS, gc);
446478
}
447479

480+
public JSDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc) {
481+
this(owner, title, modal ? Dialog.DEFAULT_MODALITY_TYPE : Dialog.ModalityType.MODELESS, gc);
482+
}
483+
448484
/**
449485
* Constructs an initially invisible, modeless <code>Dialog</code> with the
450486
* specified owner <code>Window</code> and an empty title.

sources/net.sf.j2s.java.core/src/java/awt/Toolkit.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ public abstract class Toolkit {
289289
* @see java.awt.peer.FramePeer
290290
*/
291291
protected abstract FramePeer createFrame(JSFrame target);
292+
protected abstract FramePeer createFrame(Frame target);
292293
//
293294
// /**
294295
// * Creates this toolkit's implementation of <code>Canvas</code> using
@@ -1177,6 +1178,9 @@ public abstract Image createImage(byte[] imagedata,
11771178
public abstract PrintJob getPrintJob(JSFrame frame, String jobtitle,
11781179
Properties props);
11791180

1181+
public abstract PrintJob getPrintJob(Frame frame, String jobtitle,
1182+
Properties props);
1183+
11801184
/**
11811185
* Gets a <code>PrintJob</code> object which is the result of initiating
11821186
* a print operation on the toolkit's platform.
@@ -1240,6 +1244,18 @@ public PrintJob getPrintJob(JSFrame frame, String jobtitle,
12401244
}
12411245
}
12421246

1247+
public PrintJob getPrintJob(Frame frame, String jobtitle,
1248+
JobAttributes jobAttributes,
1249+
PageAttributes pageAttributes) {
1250+
if (this != Toolkit.getDefaultToolkit()) {
1251+
return Toolkit.getDefaultToolkit().getPrintJob(frame, jobtitle,
1252+
jobAttributes,
1253+
pageAttributes);
1254+
} else {
1255+
return getPrintJob(frame, jobtitle, null);
1256+
}
1257+
}
1258+
12431259
//
12441260
// /**
12451261
// * Emits an audio beep.

sources/net.sf.j2s.java.core/src/java/awt/Window.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,13 +1364,13 @@ boolean isModalBlocked() {
13641364
}
13651365

13661366
void setModalBlocked(JSDialog blocker, boolean blocked, boolean peerCall) {
1367-
// this.modalBlocker = blocked ? blocker : null;
1368-
// if (peerCall) {
1369-
// WindowPeer peer = (WindowPeer)this.peer;
1370-
// if (peer != null) {
1371-
// peer.setModalBlocked(blocker, blocked);
1372-
// }
1373-
// }
1367+
this.modalBlocker = blocked ? blocker : null;
1368+
if (peerCall) {
1369+
WindowPeer peer = (WindowPeer)this.peer;
1370+
if (peer != null) {
1371+
peer.setModalBlocked(blocker, blocked);
1372+
}
1373+
}
13741374
}
13751375

13761376
void setModalBlocked(Dialog blocker, boolean blocked, boolean peerCall) {

sources/net.sf.j2s.java.core/src/java/awt/peer/WindowPeer.java

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -35,52 +35,60 @@
3535
import java.awt.image.BufferedImage;
3636

3737
/**
38-
* The peer interfaces are intended only for use in porting
39-
* the AWT. They are not intended for use by application
40-
* developers, and developers should not implement peers
41-
* nor invoke any of the peer methods directly on the peer
38+
* The peer interfaces are intended only for use in porting the AWT. They are
39+
* not intended for use by application developers, and developers should not
40+
* implement peers nor invoke any of the peer methods directly on the peer
4241
* instances.
4342
*
4443
* Not a LightWeightPeer
4544
*
4645
*/
4746
public interface WindowPeer extends ContainerPeer {
48-
void toFront();
49-
void toBack();
50-
void updateAlwaysOnTopState();
51-
void updateFocusableWindowState();
52-
boolean requestWindowFocus();
53-
void setModalBlocked(Dialog blocker, boolean blocked);
54-
void updateMinimumSize();
55-
void updateIconImages();
56-
57-
/**
58-
* Sets the level of opacity for the window.
59-
*
60-
* @see Window#setOpacity(float)
61-
*/
62-
void setOpacity(float opacity);
63-
64-
/**
65-
* Enables the per-pixel alpha support for the window.
66-
*
67-
* @see Window#setBackground(Color)
68-
*/
69-
void setOpaque(boolean isOpaque);
70-
71-
/**
72-
* Updates the native part of non-opaque window using
73-
* the given image with color+alpha values for each pixel.
74-
*
75-
* @see Window#setBackground(Color)
76-
*/
77-
void updateWindow(BufferedImage backBuffer);
78-
79-
/**
80-
* Instructs the peer to update the position of the security warning.
81-
*/
82-
void repositionSecurityWarning();
83-
84-
WindowPeer setFrame(Window target, boolean b);
85-
47+
void toFront();
48+
49+
void toBack();
50+
51+
void updateAlwaysOnTopState();
52+
53+
void updateFocusableWindowState();
54+
55+
boolean requestWindowFocus();
56+
57+
void setModalBlocked(Dialog blocker, boolean blocked);
58+
59+
void setModalBlocked(JSDialog blocker, boolean blocked);
60+
61+
void updateMinimumSize();
62+
63+
void updateIconImages();
64+
65+
/**
66+
* Sets the level of opacity for the window.
67+
*
68+
* @see Window#setOpacity(float)
69+
*/
70+
void setOpacity(float opacity);
71+
72+
/**
73+
* Enables the per-pixel alpha support for the window.
74+
*
75+
* @see Window#setBackground(Color)
76+
*/
77+
void setOpaque(boolean isOpaque);
78+
79+
/**
80+
* Updates the native part of non-opaque window using the given image with
81+
* color+alpha values for each pixel.
82+
*
83+
* @see Window#setBackground(Color)
84+
*/
85+
void updateWindow(BufferedImage backBuffer);
86+
87+
/**
88+
* Instructs the peer to update the position of the security warning.
89+
*/
90+
void repositionSecurityWarning();
91+
92+
WindowPeer setFrame(Window target, boolean b);
93+
8694
}

0 commit comments

Comments
 (0)