Java Reference
In-Depth Information
// check that the File Edit View menu appears atop the desktop not the window
System
.
setProperty
(
"apple.laf.useScreenMenuBar"
,
"true"
);
// OS X Tester: check that this string appears in the Application Menu.
System
.
setProperty
(
"com.apple.mrj.application.apple.menu.about.name"
,
"MacOsUiHints"
);
final
final
MacOsUiHints gui
=
new
new
MacOsUiHints
( );
SwingUtilities
.
invokeAndWait
(
new
new
Runnable
() {
@Override
public
public
void
void
run
() {
gui
.
getFrame
().
setVisible
(
true
true
);
}
});
}
JFrame jf
;
protected
protected
JFrame
getFrame
() {
return
return
jf
;
}
public
public
MacOsUiHints
( ) {
jf
=
new
new
JFrame
(
"MacOsUiHints"
);
JButton button
=
new
new
JButton
(
"Exit"
);
button
.
addActionListener
(
new
new
ActionListener
( ) {
public
public
void
void
actionPerformed
(
ActionEvent arg0
) {
System
.
exit
(
0
);
}
});
jf
.
getContentPane
( ).
add
(
button
);
JMenuBar mb
=
new
new
JMenuBar
();
jf
.
setJMenuBar
(
mb
);
JMenu fileMenu
=
new
new
JMenu
(
"File"
);
mb
.
add
(
fileMenu
);
fileMenu
.
add
(
new
new
JMenuItem
(
"Quit"
));
mb
.
add
(
new
new
JMenu
(
"Edit"
));
// Tester: see that Application->About produces our popup
// Ditto for Preferences and Shutdown.
// MacOSAppAdapter adapter =
// new MacOSAppAdapter(jf, abouter, prefser, printer, shutter);
//adapter.register( );
jf
.
setSize
(
300
,
200
);