46 |
import java.awt.Graphics; |
import java.awt.Graphics; |
47 |
import java.awt.LayoutManager; |
import java.awt.LayoutManager; |
48 |
import java.awt.event.KeyEvent; |
import java.awt.event.KeyEvent; |
|
import java.awt.event.WindowEvent; |
|
49 |
|
|
50 |
import javax.accessibility.AccessibleContext; |
import javax.accessibility.AccessibleContext; |
51 |
|
|
54 |
{ |
{ |
55 |
private static final long serialVersionUID = 7269359214497372587L; |
private static final long serialVersionUID = 7269359214497372587L; |
56 |
|
|
|
public static final int HIDE_ON_CLOSE = 0; |
|
|
public static final int EXIT_ON_CLOSE = 1; |
|
|
public static final int DISPOSE_ON_CLOSE = 2; |
|
|
public static final int DO_NOTHING_ON_CLOSE = 3; |
|
|
|
|
|
private int close_action = EXIT_ON_CLOSE; |
|
|
|
|
57 |
protected JRootPane rootPane; |
protected JRootPane rootPane; |
58 |
protected boolean rootPaneCheckingEnabled; |
protected boolean rootPaneCheckingEnabled; |
59 |
|
|
75 |
|
|
76 |
public Dimension getPreferredSize() |
public Dimension getPreferredSize() |
77 |
{ |
{ |
78 |
Dimension d = super.getPreferredSize(); |
return super.getPreferredSize(); |
|
System.out.println("JFrame.getPrefSize(): " + d + " , comp=" |
|
|
+ getComponentCount() + ", layout=" + getLayout()); |
|
|
return d; |
|
79 |
} |
} |
80 |
|
|
81 |
public void setLayout(LayoutManager manager) |
public void setLayout(LayoutManager manager) |
144 |
return null; |
return null; |
145 |
} |
} |
146 |
|
|
|
int getDefaultCloseOperation() |
|
|
{ |
|
|
return close_action; |
|
|
} |
|
|
|
|
147 |
public JMenuBar getJMenuBar() |
public JMenuBar getJMenuBar() |
148 |
{ |
{ |
149 |
return getRootPane().getJMenuBar(); |
return getRootPane().getJMenuBar(); |
163 |
{ |
{ |
164 |
super.processKeyEvent(e); |
super.processKeyEvent(e); |
165 |
} |
} |
166 |
|
|
|
protected void processWindowEvent(WindowEvent e) |
|
|
{ |
|
|
// System.out.println("PROCESS_WIN_EV-1: " + e); |
|
|
// super.processWindowEvent(e); |
|
|
// System.out.println("PROCESS_WIN_EV-2: " + e); |
|
|
switch (e.getID()) |
|
|
{ |
|
|
case WindowEvent.WINDOW_CLOSING: |
|
|
{ |
|
|
switch (close_action) |
|
|
{ |
|
|
case EXIT_ON_CLOSE: |
|
|
{ |
|
|
System.out.println("user requested exit on close"); |
|
|
System.exit(1); |
|
|
break; |
|
|
} |
|
|
case DISPOSE_ON_CLOSE: |
|
|
{ |
|
|
System.out.println("user requested dispose on close"); |
|
|
//dispose(); |
|
|
break; |
|
|
} |
|
|
case HIDE_ON_CLOSE: |
|
|
case DO_NOTHING_ON_CLOSE: |
|
|
break; |
|
|
} |
|
|
break; |
|
|
} |
|
|
case WindowEvent.WINDOW_CLOSED: |
|
|
case WindowEvent.WINDOW_OPENED: |
|
|
case WindowEvent.WINDOW_ICONIFIED: |
|
|
case WindowEvent.WINDOW_DEICONIFIED: |
|
|
case WindowEvent.WINDOW_ACTIVATED: |
|
|
case WindowEvent.WINDOW_DEACTIVATED: |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
167 |
public void remove(Component comp) |
public void remove(Component comp) |
168 |
{ |
{ |
169 |
getContentPane().remove(comp); |
getContentPane().remove(comp); |
170 |
} |
} |
171 |
|
|
|
void setDefaultCloseOperation(int operation) |
|
|
{ |
|
|
close_action = operation; |
|
|
} |
|
|
|
|
172 |
protected boolean isRootPaneCheckingEnabled() |
protected boolean isRootPaneCheckingEnabled() |
173 |
{ |
{ |
174 |
return rootPaneCheckingEnabled; |
return rootPaneCheckingEnabled; |