/*
 * ErrorDialog.java
 *
 * Created on November 15, 2008, 12:58 AM
 */

package gui;

import javax.swing.ImageIcon;

/**
 *
 * @author  joe
 */
public class ErrorDialog extends javax.swing.JDialog {

    /** Creates new form ErrorDialog */
    public ErrorDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        
        java.net.URL imgURL = MainMenu.class.getResource("/gui/images/icon.png");
        ImageIcon icon = new ImageIcon(imgURL);
        this.setIconImage(icon.getImage());
        
        this.setLocation(400, 400);
    }
    
    public ErrorDialog(java.awt.Frame parent, boolean modal, String errorMgs){
        this(parent, modal);
        this.errorjLabel.setText(errorMgs);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        okjButton = new javax.swing.JButton();
        titlejLabel = new javax.swing.JLabel();
        errorjLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setIconImage(null);

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

        titlejLabel.setFont(new java.awt.Font("Albany AMT", 1, 18)); // NOI18N
        titlejLabel.setForeground(new java.awt.Color(233, 2, 2));
        titlejLabel.setText("HIBA!");

        errorjLabel.setText("Hiba");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(errorjLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(175, 175, 175)
                        .addComponent(titlejLabel))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(355, Short.MAX_VALUE)
                        .addComponent(okjButton)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(titlejLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(errorjLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(okjButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void okjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okjButtonActionPerformed
// TODO add your handling code here:
    this.dispose();
}//GEN-LAST:event_okjButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel errorjLabel;
    private javax.swing.JButton okjButton;
    private javax.swing.JLabel titlejLabel;
    // End of variables declaration//GEN-END:variables

}
