}
this.controlBar = new ControlBar(appsEP);
final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit();
final JNodeAwtContext ctx = tk.getAwtContext();
final JDesktopPane desktop = ctx.getDesktop();
final Container awtRoot = ctx.getAwtRoot();
controlBar.getApplicationBar().addApp("Halt", new ActionListener() {
public void actionPerformed(ActionEvent e) {
JNodeToolkit.stopGui();
}
});
controlBar.getApplicationBar().addApp("Reboot", new ActionListener() {
public void actionPerformed(ActionEvent e) {
JNodeToolkit.stopGui();
VmSystem.halt(true);
}
});
awtRoot.removeAll();
awtRoot.setLayout(null);
awtRoot.add(desktop);
final int h = awtRoot.getHeight();
final int controlBarHeight = h / 8;
final int w = awtRoot.getWidth();
desktop.setBounds(0, 0, w, h - controlBarHeight);
awtRoot.add(controlBar);
controlBar.setBounds(0, h - controlBarHeight, w, controlBarHeight);
awtRoot.invalidate();
awtRoot.repaint();
System.out.println("controlBar.bounds=" + controlBar.getBounds());
System.out.println("desktop.bounds=" + desktop.getBounds());
// Update desktopmanager
desktop.setDesktopManager(new DesktopManagerImpl());
desktop.addContainerListener(new DesktopContainerListener());
// Set background info
final int dx = 30;
final int dy = dx;
final JLabel welcomeLbl = new JLabel("Welcome to JNode");
welcomeLbl.setForeground(Color.WHITE);
welcomeLbl.setLocation(dx, dy);
welcomeLbl.setFont(welcomeLbl.getFont().deriveFont(20.0f));
welcomeLbl.setSize(welcomeLbl.getPreferredSize());
desktop.add(welcomeLbl, (Integer) (JLayeredPane.DEFAULT_LAYER - 1));
final JLabel versionLbl = new JLabel("version " + VmUtils.getVm().getVersion());
versionLbl.setForeground(Color.WHITE);
versionLbl.setFont(versionLbl.getFont().deriveFont(14.0f));
versionLbl.setSize(versionLbl.getPreferredSize());
versionLbl.setLocation(desktop.getWidth() - versionLbl.getWidth() - dy,
desktop.getHeight() - versionLbl.getHeight() - dy);
desktop.add(versionLbl, (Integer) (JLayeredPane.DEFAULT_LAYER - 1));
// Update
desktop.doLayout();
desktop.repaint();
}