LogFactor5Dialogpublic abstract class LogFactor5Dialog extends JDialog
Fields Summary |
---|
protected static final Font | DISPLAY_FONT |
Constructors Summary |
---|
protected LogFactor5Dialog(JFrame jframe, String message, boolean modal)
//--------------------------------------------------------------------------
// Protected Variables:
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Private Variables:
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Constructors:
//--------------------------------------------------------------------------
super(jframe, message, modal);
|
Methods Summary |
---|
protected void | centerWindow(java.awt.Window win)
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
// If larger than screen, reduce window width or height
if (screenDim.width < win.getSize().width) {
win.setSize(screenDim.width, win.getSize().height);
}
if (screenDim.height < win.getSize().height) {
win.setSize(win.getSize().width, screenDim.height);
}
// Center Frame, Dialogue or Window on screen
int x = (screenDim.width - win.getSize().width) / 2;
int y = (screenDim.height - win.getSize().height) / 2;
win.setLocation(x, y);
| protected java.awt.GridBagConstraints | getDefaultConstraints()
GridBagConstraints constraints = new GridBagConstraints();
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.gridheight = 1; // One row high
// Insets() args are top, left, bottom, right
constraints.insets = new Insets(4, 4, 4, 4);
// fill of NONE means do not change size
constraints.fill = GridBagConstraints.NONE;
// WEST means align left
constraints.anchor = GridBagConstraints.WEST;
return constraints;
| protected void | minimumSizeDialog(java.awt.Component component, int minWidth, int minHeight)
// set the min width
if (component.getSize().width < minWidth)
component.setSize(minWidth, component.getSize().height);
// set the min height
if (component.getSize().height < minHeight)
component.setSize(component.getSize().width, minHeight);
| public void | show()
pack();
minimumSizeDialog(this, 200, 100);
centerWindow(this);
super.show();
| protected void | wrapStringOnPanel(java.lang.String message, java.awt.Container container)
GridBagConstraints c = getDefaultConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;
// Insets() args are top, left, bottom, right
c.insets = new Insets(0, 0, 0, 0);
GridBagLayout gbLayout = (GridBagLayout) container.getLayout();
while (message.length() > 0) {
int newLineIndex = message.indexOf('\n");
String line;
if (newLineIndex >= 0) {
line = message.substring(0, newLineIndex);
message = message.substring(newLineIndex + 1);
} else {
line = message;
message = "";
}
Label label = new Label(line);
label.setFont(DISPLAY_FONT);
gbLayout.setConstraints(label, c);
container.add(label);
}
|
|