You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.7 KiB
106 lines
2.7 KiB
package de.memtext.dlg; |
|
|
|
import java.awt.BorderLayout; |
|
import java.awt.Dialog; |
|
import java.awt.Frame; |
|
import java.awt.GraphicsConfiguration; |
|
import java.awt.HeadlessException; |
|
import java.awt.event.WindowAdapter; |
|
import java.awt.event.WindowEvent; |
|
|
|
import javax.swing.JComponent; |
|
import javax.swing.JDialog; |
|
|
|
public class DialogWithExit extends JDialog { |
|
|
|
public DialogWithExit() throws HeadlessException { |
|
super(); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Frame owner) throws HeadlessException { |
|
super(owner); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Frame owner, boolean arg1) throws HeadlessException { |
|
super(owner, arg1); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Frame owner, String arg1) throws HeadlessException { |
|
super(owner, arg1); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Frame owner, String arg1, boolean arg2) throws HeadlessException { |
|
super(owner, arg1, arg2); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Frame owner, String arg1, boolean arg2, GraphicsConfiguration arg3) { |
|
super(owner, arg1, arg2, arg3); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Dialog owner) throws HeadlessException { |
|
super(owner); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Dialog owner, boolean arg1) throws HeadlessException { |
|
super(owner, arg1); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Dialog owner, String arg1) throws HeadlessException { |
|
super(owner, arg1); |
|
initMe(); |
|
} |
|
|
|
public DialogWithExit(Dialog owner, String arg1, boolean arg2) throws HeadlessException { |
|
super(owner, arg1, arg2); |
|
} |
|
|
|
public DialogWithExit(Dialog owner, String arg1, boolean arg2, GraphicsConfiguration arg3) throws HeadlessException { |
|
super(owner, arg1, arg2, arg3); |
|
initMe(); |
|
} |
|
|
|
private void initMe() { |
|
addWindowListener(new WindowAdapter() { |
|
@Override |
|
public void windowClosing(WindowEvent we) { |
|
exit(); |
|
} |
|
}); |
|
} |
|
|
|
/** |
|
* called if window is closed, does nothing by default, |
|
* subclasses can override |
|
* |
|
*/ |
|
protected void exit() { |
|
} |
|
|
|
//man könnte noch abfragen ob auch wirklich Borderlayout benutzt |
|
//wird |
|
/** |
|
* installs a component in the center of the dialog |
|
* @param comp |
|
*/ |
|
public void setCenter(JComponent comp) { |
|
this.getContentPane().add(comp, BorderLayout.CENTER); |
|
} |
|
|
|
/** |
|
* installs a component in the notrh of the dialog |
|
* @param comp |
|
*/ |
|
public void setNorth(JComponent comp) { |
|
this.getContentPane().add(comp, BorderLayout.NORTH); |
|
} |
|
} |
|
|
|
//Created on 21.11.2003
|