17 package com.generalrobotix.ui.util;
20 import java.awt.event.*;
36 public AlertBox(Frame owner, String title,
int messageType,
int buttonType) {
38 _init(title, messageType, buttonType);
40 public AlertBox(Dialog owner, String title,
int messageType,
int buttonType) {
42 _init(title, messageType, buttonType);
45 private void _init(String title,
int messageType,
int buttonType) {
47 messageType_ = messageType;
49 caption_ =
new JLabel(
"");
53 message_ =
new JTextArea();
54 message_.setOpaque(
false);
55 message_.setEditable(
false);
56 message_.setForeground(caption_.getForeground());
63 gbc_ =
new GridBagConstraints();
66 public void actionPerformed(ActionEvent evt) {
70 SwingUtilities.invokeLater(
86 options_ =
new Object[] { okButton };
95 options_ =
new Object[] {
101 options_ =
new Object[] {
112 mainPanel_.add(message_, BorderLayout.CENTER);
117 JOptionPane optionPane =
new JOptionPane(
120 JOptionPane.DEFAULT_OPTION,
126 dialog_ = optionPane.createDialog(
owner_, title_);
127 dialog_.setVisible(
true);
134 caption_.setText(caption);
140 message_.setText(message);
static final int YES_BUTTON
static final int CANCEL_BUTTON
void setMessage(String message)
#define null
our own NULL pointer
static final int OK_CANCEL_TYPE
void setCaption(String caption)
static final int NONE_TYPE
static final int YES_NO_CANCEL_TYPE
AlertBox(Dialog owner, String title, int messageType, int buttonType)
AlertBox(Frame owner, String title, int messageType, int buttonType)
static final int OK_BUTTON
static final int YES_NO_TYPE
void setTitle(String title)
static final int NO_BUTTON
void _init(String title, int messageType, int buttonType)