|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.visuals.FontDialog
public class FontDialog
FontDialog is a subclass of Dialog which displays components for font creation and a set of buttons to allow a user response. The dialog can be modal or non-modal. When a button is selected by the user, a MessageBoxEvent is sent to all registered MessageBoxListeners. Listening for this event is necessary to use the FontDialog non-modally. When the FontDialog is modal, the selection of a button causes the SelectedButton property to be set on the FontDialog. After the call to show() on a modal FontDialog, SelectedButton indicates which button was pressed.
On Windows NT (at least), there is a button in the upper right hand corner of the FontDialog with an "x". When this button is pressed, it is as if the user pressed "Cancel". So, users of the FontDialog should properly handle the "Cancel" button even if there is not one in the FontDialog.
WARNING: At least until JDK version 1.1.2 there are bugs in AWT modal dialog handling. An application using a modal dialog may hang, partially hang, or improperly display the modal dialog.
A sample use of the FontDialog (non-modally) might look like :
FontDialog FontDialog = new FontDialog( frame); FontDialog.initialize(); FontDialog.addMessageBoxListener(this); FontDialog.setVisible(true);
The user of the FontDialog would then need to listen for MessageBoxEvents. The MessageBoxEvent contains an integer indicating which button was selected.
A sample use of the FontDialog (modally) might look like :
FontDialog FontDialog = new FontDialog( frame,true); FontDialog.initialize(); FontDialog.setVisible(true); switch (FontDialog.getSelectedButton() ) { case FontDialog.BUTTON_OK: break; case FontDialog.BUTTON_CANCEL: break; } // switch
The font created by selections in the comboBoxes can be accessed through the getSelectedFont method. A font can be set through the setSelectedFont(Font ft) method.
MessageBoxEvent
,
MessageBoxListener
,
MessageBoxSource
,
MessageBoxListenerList
,
Serialized FormField Summary | |
---|---|
static int |
BUTTON_CANCEL
|
static int |
BUTTON_OK
|
protected Button |
buttonCancel
|
protected Button |
buttonOK
|
static int |
BUTTONS_OK_CANCEL
|
protected FontPanel |
fp
|
protected Button |
lastButtonWithFocus
|
protected MessageBoxListenerList |
messageBoxListenerList
|
static java.lang.String |
RB_KEY
|
protected int |
selectedButton
|
Fields inherited from class com.sas.awt.Dialog |
---|
_cantUseSASModal, _inApplet, _modal, autoDispose, READY, setVisibleCalled, t |
Constructor Summary | |
---|---|
FontDialog(java.awt.Frame frame)
Construct a FontDialog owned by a given Frame. |
|
FontDialog(java.awt.Frame frame,
boolean modal)
Construct a FontDialog owned by a given Frame. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed handles ActionEvents from the buttons in the FontDialog. |
void |
addMessageBoxListener(MessageBoxListener listener)
This is part of the MessageBoxSource interface implementation. |
protected void |
commonInit()
commonInit performs all the common functionality between the constructors of the FontDialog. |
void |
fireMessageBoxEvent(int button)
Sends a MessageBoxEvent to all of the registered listeners. |
void |
focusGained(java.awt.event.FocusEvent event)
|
void |
focusLost(java.awt.event.FocusEvent event)
|
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
|
int |
getSelectedButton()
getSelectedButton can be called on the FontDialog to return the button selected. |
java.awt.Font |
getSelectedFont()
Returns the font created |
protected java.lang.String |
paramString()
paramString returns information about the FontDialog in String format. |
void |
removeMessageBoxListener(MessageBoxListener listener)
This is part of the MessageBox interface implementation. |
void |
setSelectedFont(java.awt.Font nf)
Set the font |
void |
setVisible(boolean visible)
setVisible sets the selectedButton property to zero to indicate that no button has been selected. |
void |
windowActivated(java.awt.event.WindowEvent e)
Part of the implementation of the WindowListener interface. |
void |
windowClosed(java.awt.event.WindowEvent e)
Part of the implementation of the WindowListener interface. |
void |
windowClosing(java.awt.event.WindowEvent e)
Part of the implementation of the WindowListener interface. |
void |
windowDeactivated(java.awt.event.WindowEvent e)
Part of the implementation of the WindowListener interface. |
void |
windowDeiconified(java.awt.event.WindowEvent e)
Part of the implementation of the WindowListener interface. |
void |
windowIconified(java.awt.event.WindowEvent e)
Part of the implementation of the WindowListener interface. |
void |
windowOpened(java.awt.event.WindowEvent e)
Part of the implementation of the WindowListener interface. |
Methods inherited from class com.sas.awt.Dialog |
---|
center, centerOver, centerOverWindow, dispose, fireReadySignal, getAutoDispose, getDefaultHeight, getDefaultWidth, getText, hide, isSASModalEnabled, newDispatchThread, processWindowEvent, setAutoDispose, setDefaultHeight, setDefaultWidth, setModal, setResizable, setSASModalEnabled, setText, setTitle, setVisible, show, stopDispatchThread, waitForReadySignal, waitTilReady |
Methods inherited from interface com.sas.awt.ContainerInterface |
---|
getComponents, getLayout, invalidate, setLayout, validate |
Field Detail |
---|
public static final java.lang.String RB_KEY
public static final int BUTTON_OK
public static final int BUTTON_CANCEL
public static final int BUTTONS_OK_CANCEL
protected Button lastButtonWithFocus
protected int selectedButton
protected FontPanel fp
protected Button buttonOK
protected Button buttonCancel
protected MessageBoxListenerList messageBoxListenerList
Constructor Detail |
---|
public FontDialog(java.awt.Frame frame)
frame
- The frame to own the FontDialog.public FontDialog(java.awt.Frame frame, boolean modal)
frame
- The frame to own the FontDialog.modal
- Whether the FontDialog is modal.Method Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
protected void commonInit()
public void setVisible(boolean visible)
setVisible
in interface VisualInterface
setVisible
in class Dialog
visible
- Whether the component should be visible.VisualInterface.setVisible(boolean)
protected java.lang.String paramString()
paramString
in class java.awt.Dialog
public java.awt.Font getSelectedFont()
public void setSelectedFont(java.awt.Font nf)
nf
- the selected fontpublic int getSelectedButton()
public void windowOpened(java.awt.event.WindowEvent e)
windowOpened
in interface java.awt.event.WindowListener
windowOpened
in class Dialog
e
- windowEventpublic void windowClosing(java.awt.event.WindowEvent e)
When the window close button is clicked, a MessageEvent is sent with the button field as CANCEL and the window is hidden using dipose().
windowClosing
in interface java.awt.event.WindowListener
windowClosing
in class Dialog
e
- windowEventpublic void windowClosed(java.awt.event.WindowEvent e)
windowClosed
in interface java.awt.event.WindowListener
windowClosed
in class Dialog
e
- windowEventpublic void windowIconified(java.awt.event.WindowEvent e)
windowIconified
in interface java.awt.event.WindowListener
windowIconified
in class Dialog
e
- windowEventpublic void windowDeiconified(java.awt.event.WindowEvent e)
windowDeiconified
in interface java.awt.event.WindowListener
windowDeiconified
in class Dialog
e
- windowEventpublic void windowActivated(java.awt.event.WindowEvent e)
windowActivated
in interface java.awt.event.WindowListener
windowActivated
in class Dialog
e
- windowEventpublic void windowDeactivated(java.awt.event.WindowEvent e)
windowDeactivated
in interface java.awt.event.WindowListener
windowDeactivated
in class Dialog
e
- windowEventpublic void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
public void focusGained(java.awt.event.FocusEvent event)
focusGained
in interface java.awt.event.FocusListener
public void focusLost(java.awt.event.FocusEvent event)
focusLost
in interface java.awt.event.FocusListener
public void addMessageBoxListener(MessageBoxListener listener)
addMessageBoxListener
in interface MessageBoxSource
listener
- an object which handles MessageBoxEvent events
the listener is not added a second time if it already exists
in the list of listeners for this event.removeMessageBoxListener(com.sas.visuals.MessageBoxListener)
,
fireMessageBoxEvent(int)
public void removeMessageBoxListener(MessageBoxListener listener)
removeMessageBoxListener
in interface MessageBoxSource
listener
- an object which handles MessageBoxEvent eventsaddMessageBoxListener(com.sas.visuals.MessageBoxListener)
,
fireMessageBoxEvent(int)
public void fireMessageBoxEvent(int button)
addMessageBoxListener(com.sas.visuals.MessageBoxListener)
,
removeMessageBoxListener(com.sas.visuals.MessageBoxListener)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |