1 52 53 54 package swingwtx.swing; 55 56 import swingwt.awt.Component; 57 import swingwt.awt.Container; 58 import swingwt.awt.Frame; 59 import swingwt.awt.GraphicsConfiguration; 60 61 public class JDialog extends swingwt.awt.Dialog implements WindowConstants, RootPaneContainer { 62 63 protected int closeOperation = WindowConstants.DISPOSE_ON_CLOSE; 64 65 public JDialog() {super(); } 66 public JDialog(swingwt.awt.Dialog owner) { super(owner); } 67 public JDialog(swingwt.awt.Dialog owner, boolean modal) { super(owner, modal); } 68 public JDialog(swingwt.awt.Dialog owner, String title) { super(owner, title); } 69 public JDialog(swingwt.awt.Dialog owner, String title, boolean modal) { super(owner, title, modal); } 70 public JDialog(swingwt.awt.Dialog owner, String title, boolean modal, GraphicsConfiguration gc) { super(owner, title, modal, gc); } 71 public JDialog(Frame owner) { super(owner); } 72 public JDialog(Frame owner, boolean modal) { super(owner, modal); } 73 public JDialog(Frame owner, String title) { super(owner, title); } 74 public JDialog(Frame owner, String title, boolean modal) { super(owner, title, modal); } 75 public JDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) { super(owner, title, modal, gc); } 76 77 public int getDefaultCloseOperation() { 78 return closeOperation; 79 } 80 81 public void setDefaultCloseOperation(int operation) { 82 closeOperation = operation; 83 } 84 85 public Container getContentPane() { 86 return rootPane.getContentPane(); 87 } 88 89 public Component getGlassPane() { 90 return rootPane.getGlassPane(); 91 } 92 93 public JLayeredPane getLayeredPane() { 94 return rootPane.getLayeredPane(); 95 } 96 97 public JRootPane getRootPane() { 98 return rootPane; 99 } 100 101 public void setContentPane(Container contentPane) { 102 rootPane.setContentPane(contentPane); 103 } 104 105 public void setGlassPane(Component glassPane) { 106 rootPane.setGlassPane(glassPane); 107 } 108 109 public void setLayeredPane(JLayeredPane layeredPane) { 110 rootPane.setLayeredPane(layeredPane); 111 } 112 113 public void registerWindowEvents() { 114 115 117 peer.addShellListener(new org.eclipse.swt.events.ShellListener() { 118 public void shellActivated(org.eclipse.swt.events.ShellEvent e) { 119 processWindowEvent(swingwt.awt.event.WindowEvent.WINDOW_ACTIVATED); 120 } 121 public void shellClosed(org.eclipse.swt.events.ShellEvent e) { 122 isClosed = true; 123 processWindowEvent(swingwt.awt.event.WindowEvent.WINDOW_CLOSING); 124 processWindowEvent(swingwt.awt.event.WindowEvent.WINDOW_CLOSED); 125 switch (closeOperation) { 127 case WindowConstants.DISPOSE_ON_CLOSE: e.doit = true; SwingWTUtils.decrementWindowReferences(); break; 128 case WindowConstants.DO_NOTHING_ON_CLOSE: e.doit = false; break; 129 case WindowConstants.EXIT_ON_CLOSE: e.doit = true; SwingWTUtils.decrementWindowReferences(); System.exit(0); break; 130 case WindowConstants.HIDE_ON_CLOSE: e.doit = false; peer.setVisible(false); break; 131 } 132 } 133 public void shellDeactivated(org.eclipse.swt.events.ShellEvent e) { 134 processWindowEvent(swingwt.awt.event.WindowEvent.WINDOW_DEACTIVATED); 135 } 136 public void shellDeiconified(org.eclipse.swt.events.ShellEvent e) { 137 processWindowEvent(swingwt.awt.event.WindowEvent.WINDOW_DEICONIFIED); 138 } 139 public void shellIconified(org.eclipse.swt.events.ShellEvent e) { 140 processWindowEvent(swingwt.awt.event.WindowEvent.WINDOW_ICONIFIED); 141 } 142 }); 143 } 144 145 } 146 | Popular Tags |