KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > wingset > DesktopPaneExample


1 package wingset;
2
3 import org.wings.SComponent;
4 import org.wings.SDesktopPane;
5 import org.wings.SDimension;
6 import org.wings.SIcon;
7 import org.wings.SInternalFrame;
8 import org.wings.SLabel;
9 import org.wings.STextField;
10 import org.wings.session.SessionManager;
11
12 public class DesktopPaneExample extends WingSetPane {
13     
14     private static SIcon windowIcon = (SIcon)SessionManager.getSession().getCGManager()
15                                             .getObject("TableCG.editIcon", SIcon.class);
16
17     private static final int FRAME_COUNT = 8;
18
19     protected SComponent createExample() {
20         SDesktopPane desktopPane = new SDesktopPane();
21         for (int i = 0; i < FRAME_COUNT; i++) {
22             SInternalFrame iFrame = new SInternalFrame();
23             iFrame.setTitle("A Long Title of Frame " + (i+1));
24             desktopPane.add(iFrame);
25             fillFrame(iFrame);
26             // set some special contents & icons
27
if ((i % 2) == 0) {
28                 iFrame.setIcon(windowIcon);
29                 StringBuffer JavaDoc labelText = new StringBuffer JavaDoc("some extra label...");
30                 for (int j = 0; j <= i; j++) {
31                     labelText.append("extra-");
32                     iFrame.getContentPane().add(new SLabel(labelText.toString()));
33                 }
34                 labelText.append("long.");
35                 iFrame.getContentPane().add(new SLabel(labelText.toString()));
36             }
37         }
38         return desktopPane;
39     }
40
41     private void fillFrame(SInternalFrame frame) {
42         frame.getContentPane().add(new STextField());
43         frame.getContentPane().add(new SLabel("This is a label"));
44     }
45
46 }
47
Popular Tags