Methods Summary |
---|
public java.awt.Component | getComponent() return pane;
|
public static void | main(java.lang.String[] args)
Diagnostic diag = new Diagnostic();
JFrame f = new JFrame();
f.addWindowListener(new BasicWindowMonitor());
f.getContentPane().add(diag.getComponent());
f.setSize(300,200);
f.setVisible(true);
// Display a few messages...
diag.showInfo("System normal");
diag.showWarning("Disk space low");
diag.showError("Out of memory");
diag.showError("Program performed an illegal operation");
diag.showInfo("System normal");
|
public void | showError(java.lang.String msg)
SimpleAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setForeground(attrs, Color.red);
StyleConstants.setItalic(attrs, true);
StyleConstants.setBold(attrs, true);
showMsg(msg, attrs);
|
public void | showInfo(java.lang.String msg)
SimpleAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setForeground(attrs, Color.green);
showMsg(msg, attrs);
|
protected void | showMsg(java.lang.String msg, javax.swing.text.AttributeSet attrs)
Document doc = pane.getDocument();
msg += "\n";
try {
doc.insertString(doc.getLength(), msg, attrs);
} catch (BadLocationException ex) { ex.printStackTrace(); }
|
public void | showWarning(java.lang.String msg)
SimpleAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setForeground(attrs, Color.yellow);
StyleConstants.setItalic(attrs, true);
showMsg(msg, attrs);
|