|
| |
"Multiplatform Frames"
Vol. 9, Issue 1, p. 44
Listing 1
1 class SDIFrame
2 extends JFrame
3 implements IMultiEnvironFrame
4 {
5 // interface methods do not need
6 // to be specified--JFrame
7 // provides these.
8 }
1 class MDIFrame
2 extends JInternalFrame
3 implements IMultiEnvironFrame
4 {
5 // Interface methods specific to
6 // JFrame are defined using
7 // JInternalFrame method mappings.
8
9 public void setIconImage(
Image p_icon )
10 {
11 setFrameIcon(
new ImageIcon( p_icon ) );
13 }
14
15 // ...
16 }
Listing 2
1 class ApplicationMenuGroup extends
AbstractMenuGroup
2 {
3 // ...
4
5 // Very simple implementation.
6 public Object clone()
7 {
8 ApplicationMenuGroup newClone =
new ApplicationMenuGroup();
// Could also use copy
constructor.
9 newClone.initMenus();
10 return newClone;
11 }
12
13 protected void initMenus()
14 {
15 JMenu fileMenu =
new JMenu("File");
17 addMenu( fileMenu );
18 // ...
19 }
20 }
|
|
All Rights Reserved
Copyright © 2004 SYS-CON Media, Inc.
E-mail: info@sys-con.com
Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.
|