1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| public class OpalysFrame extends JXFrame {
private JDesktopPane desktop;
public OpalysFrame() {
super(tr("opalys.frame.title"), false);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent) {
Actions.QUIT.actionPerformed(new ActionEvent(OpalysFrame.this, windowEvent.getID(), Actions.QUIT.getCommand()));
}
public void windowClosed(WindowEvent windowEvent) {
Actions.QUIT.actionPerformed(new ActionEvent(OpalysFrame.this, windowEvent.getID(), Actions.QUIT.getCommand()));
}
});
desktop = new JDesktopPane();
desktop.setDesktopManager(new OpalysDesktopManager(desktop));
this.getContentPane().add(desktop, BorderLayout.CENTER);
this.setBounds(Config.instance().getMainFrameBounds());
this.setJMenuBar(new OpalysMenuBar(desktop));
this.setToolBar(new OpalysToolBar());
this.setStatusBar(new OpalysStatusBar());
}
public JDesktopPane getDesktop() {
return desktop;
}
public void addFrameToDesktop(JInternalFrame frame, boolean center) {
desktop.add(frame);
if (center) {
frame.setLocation((desktop.getSize().width - frame.getSize().width) / 2,
(desktop.getSize().height - frame.getSize().height) / 2);
}
desktop.getDesktopManager().dragFrame(frame, frame.getLocation().x, frame.getLocation().y);
}
public void addProgressBarToDesktop(JProgressBar dialog, boolean center) {
desktop.add(dialog);
if (center) {
dialog.setLocation((desktop.getSize().width - dialog.getSize().width) / 2,
(desktop.getSize().height - dialog.getSize().height) / 2);
}
desktop.getDesktopManager().dragFrame(dialog, dialog.getLocation().x, dialog.getLocation().y);
}
} |
Partager