3.8.2 - Message Dialogue - JdlMessageDialog

John W. Campbell

3.8.2.1 Introduction

This class provides a number of standard dialogue boxes with one or two return buttons. These are Message dialogues, Warning dialogues, Information dialogues, Error dialogues and Query dialogues. On returning from the dialogue, the jdl_dialog_returns method, from an object implementing the JdlDialogReturns interface may be invoked.

Class, fields, constructor and methods:

Class Details
Accessible Fields
Constructor
Operational Methods
Resource Methods
Overriden Superclass Methods

3.8.2.2 Class Details

Package:
Jdl.JdlView;
Class name:
JdlMessageDialog
Class definition:
public class JdlMessageDialog
Extends:
JDialog
Implements:
JdlDrawPanelDrawer
ActionListener
Actions:
none

3.8.2.3 Accessible Fields

The following accessible fields have been defined:

static final long serialVersionUID

3.8.2.4 Constructor

3.8.2.4.1 Introduction

There are five different constructors available with various common combinations of buttons and messages.

Constructor:

Constructor 1
Constructor 2
Constructor 3
Constructor 4
Constructor 5

3.8.2.4.2 Constructor 1

Constructs a Message Dialogue with a full list of parameters specified.

Constructor Definition:
public JdlMessageDialog (Frame fr, JdlDialogReturns dret, int id, int type, int buttons, String msg, String msg2, String button1, String button2)
Parameters List:
fr
The parent frame (must be given).
dret
The object supporting the JdlDialogReturns interface (may be null).
id
An identifier to be passed to the jdl_dialog_restuns routine to distinguish the requested dialogue if needed.
type
The dialogue type:
= 0, message
= 1, warning
= 2, information
= 3, error
= 4, query
buttons
Buttons type flag:
= 0, default ('OK' or 'OK' and 'CANCEL' for type=4)
= 1, 'OK'
= 2, 'CONTINUE'
= 3, 'OK' and 'CANCEL'
= 4, 'YES' and 'NO'
= 5, use specified button labels
= 6, 'REDO' and 'CANCEL'
msg
First message string.
msg2
An optional second message string.
button1
User specfied string for button 1.
button2
Optional user specfied string for button 2.

3.8.2.4.3 Constructor 2

Constructs a Message Dialogue with a single message and default buttons.

Constructor Definition:
public JdlMessageDialog (Frame fr, JdlDialogReturns dret, int id, int type, String msg)
Parameters List:
fr
The parent frame (must be given).
dret
The object supporting the JdlDialogReturns interface (may be null).
id
An identifier to be passed to the jdl_dialog_returns routine to distinguish the requested dialogue if needed.
type
The dialogue type:
= 0, message
= 1, warning
= 2, information
= 3, error
= 4, query
msg
First message string.

3.8.2.4.4 Constructor 3

Constructs a Message Dialogue with two messages and default buttons.

Constructor Definition:
public JdlMessageDialog (Frame fr, JdlDialogReturns dret, int id, int type, String msg, String msg2)
Parameters List:
fr
The parent frame (must be given).
dret
The object supporting the JdlDialogReturns interface (may be null).
id
An identifier to be passed to the jdl_dialog_restuns routine to distinguish the requested dialogue if needed.
type
The dialogue type:
= 0, message
= 1, warning
= 2, information
= 3, error
= 4, query
msg
First message string.
msg2
Second message string.

3.8.2.4.5 Constructor 4

Constructs a Message Dialogue with a single message and selected standard buttons.

Constructor Definition:
public JdlMessageDialog (Frame fr, JdlDialogReturns dret, int id, int type, int buttons, String msg)
Parameters List:
fr
The parent frame (must be given).
dret
The object supporting the JdlDialogReturns interface (may be null).
id
An identifier to be passed to the jdl_dialog_restuns routine to distinguish the requested dialogue if needed.
type
The dialogue type:
= 0, message
= 1, warning
= 2, information
= 3, error
= 4, query
buttons
Buttons type flag:
= 0, default ('OK' or 'OK' and 'CANCEL' for type=4)
= 1, 'OK'
= 2, 'CONTINUE'
= 3, 'OK' and 'CANCEL'
= 4, 'YES' and 'NO'
msg
First message string.

3.8.2.4.6 Constructor 5

Constructs a Message Dialogue with a two messages and selected standard buttons.

Constructor Definition:
public JdlMessageDialog (Frame fr, JdlDialogReturns dret, int id, int type, int buttons, String msg, String msg2)
Parameters List:
fr
The parent frame (must be given).
dret
The object supporting the JdlDialogReturns interface (may be null).
id
An identifier to be passed to the jdl_dialog_restuns routine to distinguish the requested dialogue if needed.
type
The dialogue type:
= 0, message
= 1, warning
= 2, information
= 3, error
= 4, query
buttons
Buttons type flag:
= 0, default ('OK' or 'OK' and 'CANCEL' for type=4)
= 1, 'OK'
= 2, 'CONTINUE'
= 3, 'OK' and 'CANCEL'
= 4, 'YES' and 'NO'
msg
First message string.
msg2
Second message string.

3.8.2.5 Operational Methods

3.8.2.5.1 Introduction

This section contains the main methods used with normal operation of the object.

Methods:

Get selected button - getSelectedButton

3.8.2.5.2 Get selected button - getSelectedButton

This method returns the number of the last button selected.

Method Definition:
public int getSelectedButton()
Parameters List:
none
Method Return:
The button number 1 or 2 (0 if not yet set)

3.8.2.6 Resource Methods

3.8.2.6.1 Introduction

This section has methods to set/get the resources associated with the object determining its appearance and mode of action.

Methods:

Set font - setLabelFont

3.8.2.6.2 Set font - setLabelFont

This method sets the label & button font resource.

Method Definition:
public void setLabelFont (Font font)
Parameters List:
font
The font for a label

3.8.2.7 Overriden Superclass Methods

3.8.2.7.1 Introduction

This section contains methods which override the corresponding superclass methods. These are basically standard for JdlView objects and comprise methods to set background and foreground colours. (The paintComponent method is also over-ridden but is not normally called by the user).

Methods:

Set background - setBackground
Set background colours - setBackground
Set foreground - setForeground

3.8.2.7.2 Set background - setBackground

This method sets the background colour resource.

Method Definition:
public void setBackground (Color c)
Parameters List:
c
The color to become this object's background color.

3.8.2.7.3 Set background colours - setBackground

This method sets the background colour resource and brighter and darker shades of that colour (e.g. for 3-D frames).

Method Definition:
public void setBackground (Color c, Color brighter, Color darker)
Parameters List:
c
The background colour.
brighter
A brighter shade of the background colour.
darker
A darker shade of the background colour.

3.8.2.7.4 Set foreground - setForeground

This method sets the foreground colour resource.

Method Definition:
public void setForeground (Color c)
Parameters List:
c
The color to become this object's foreground color.

⇑ Up 3   ⇑ Up 2   ⇑ Up 1   ⇑ Top of this