FileDocCategorySizeDatePackage
TalkingAlertJDialog.javaAPI DocExample2176Wed Jul 17 00:42:38 BST 2002com.wiverson.macosbook.speech

TalkingAlertJDialog

public class TalkingAlertJDialog extends com.wiverson.macosbook.speech.TalkingJDialog

Fields Summary
private JLabel
alertText
private JPanel
stylePanel
private JButton
okButton
Constructors Summary
public TalkingAlertJDialog(String alert)
Creates new form TalkingAlertJDialog

        setNotificationText(alert);
        initComponents();
        this.getRootPane().setDefaultButton(okButton);
        pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setSize(new java.awt.Dimension(374, 128));
        setLocation((screenSize.width-374)/2,(screenSize.height-128)/4);
    
Methods Summary
private voidinitComponents()

        alertText = new javax.swing.JLabel();
        stylePanel = new javax.swing.JPanel();
        okButton = new javax.swing.JButton();

        setTitle("Alert");
        setResizable(false);
        alertText.setText(getNotificationText());
        alertText.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        getContentPane().add(alertText, java.awt.BorderLayout.CENTER);

        okButton.setText("OK");
        okButton.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                okButtonActionPerformed(evt);
            }
        });

        stylePanel.add(okButton);

        getContentPane().add(stylePanel, java.awt.BorderLayout.SOUTH);

    
public static voidmain(java.lang.String[] args)

        new TalkingAlertJDialog("Help! I've fallen and I can't get up!").show();
    
private voidokButtonActionPerformed(java.awt.event.ActionEvent evt)

//GEN-HEADEREND:event_okButtonActionPerformed
        setVisible(false);