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

TalkingAlertJDialog.java

package com.wiverson.macosbook.speech;

public class TalkingAlertJDialog extends com.wiverson.macosbook.speech.TalkingJDialog
{
        
    /** Creates new form TalkingAlertJDialog */
    public TalkingAlertJDialog(String alert)
    {
        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);
    }
    
    private void initComponents()//GEN-BEGIN:initComponents
    {
        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);

    }//GEN-END:initComponents

    private void okButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_okButtonActionPerformed
    {//GEN-HEADEREND:event_okButtonActionPerformed
        setVisible(false);
    }//GEN-LAST:event_okButtonActionPerformed
   
    public static void main(String args[])
    {
        new TalkingAlertJDialog("Help! I've fallen and I can't get up!").show();
    }
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel alertText;
    private javax.swing.JPanel stylePanel;
    private javax.swing.JButton okButton;
    // End of variables declaration//GEN-END:variables
    
}