/*
 * XApplicationWindow.java
 *
 * Created on 4. duben 2009, 16:58
 */
package base;

import base.*;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 *
 * @author  illi
 */
public class XApplicationMessageFrame extends javax.swing.JDialog {

    /** Creates new form XApplicationWindow */
    public XApplicationMessageFrame() {
        initComponents();
        ApplicationMessageFrameButtonOK.registerKeyboardAction(
                new DefaultAction((AbstractButton) ApplicationMessageFrameButtonOK),
                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
                JComponent.WHEN_IN_FOCUSED_WINDOW);
    }

    /** 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() {

        ApplicationMessageFrameHeader = new javax.swing.JLabel();
        ApplicationMessageFrameButtonOK = new javax.swing.JButton();
        ApplicationMessageWindowScrollPane = new javax.swing.JScrollPane();
        ApplicationMessageFrameText = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Application Message!");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setLocationByPlatform(true);
        setMinimumSize(new java.awt.Dimension(220, 160));
        setResizable(false);

        ApplicationMessageFrameHeader.setFont(new java.awt.Font("Lucida Console", 1, 14));
        ApplicationMessageFrameHeader.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        ApplicationMessageFrameHeader.setText("Warning!");
        ApplicationMessageFrameHeader.setName("ApplicationMessageFrameHeader"); // NOI18N

        ApplicationMessageFrameButtonOK.setText("OK");
        ApplicationMessageFrameButtonOK.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        ApplicationMessageFrameButtonOK.setName("ApplicationMessageFrameButtonOK"); // NOI18N
        ApplicationMessageFrameButtonOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ApplicationMessageFrameButtonOKActionPerformed(evt);
            }
        });

        ApplicationMessageWindowScrollPane.setBorder(null);
        ApplicationMessageWindowScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        ApplicationMessageWindowScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        ApplicationMessageWindowScrollPane.setHorizontalScrollBar(null);
        ApplicationMessageWindowScrollPane.setName("ApplicationMessageWindowScrollPane"); // NOI18N
        ApplicationMessageWindowScrollPane.setWheelScrollingEnabled(false);

        ApplicationMessageFrameText.setBackground(new java.awt.Color(240, 240, 240));
        ApplicationMessageFrameText.setColumns(20);
        ApplicationMessageFrameText.setEditable(false);
        ApplicationMessageFrameText.setLineWrap(true);
        ApplicationMessageFrameText.setRows(5);
        ApplicationMessageFrameText.setWrapStyleWord(true);
        ApplicationMessageFrameText.setAutoscrolls(false);
        ApplicationMessageFrameText.setBorder(null);
        ApplicationMessageFrameText.setName("ApplicationMessageFrameText"); // NOI18N
        ApplicationMessageWindowScrollPane.setViewportView(ApplicationMessageFrameText);
        ApplicationMessageFrameText.getAccessibleContext().setAccessibleParent(this);

        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(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(ApplicationMessageWindowScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(83, 83, 83)
                        .addComponent(ApplicationMessageFrameButtonOK))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(ApplicationMessageFrameHeader, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ApplicationMessageFrameHeader, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ApplicationMessageWindowScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ApplicationMessageFrameButtonOK)
                .addContainerGap(20, Short.MAX_VALUE))
        );

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

private void ApplicationMessageFrameButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ApplicationMessageFrameButtonOKActionPerformed
    this.setVisible(false);
}//GEN-LAST:event_ApplicationMessageFrameButtonOKActionPerformed

/**
 * Nastavi spravu vo frame
 *
 * @param header hlavicka(nadpis)
 * @param text text
 */
    public void SetMessage(String header, String text) {
        ApplicationMessageFrameHeader.setText(header);
        ApplicationMessageFrameText.setText(text);
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private static javax.swing.JButton ApplicationMessageFrameButtonOK;
    private static javax.swing.JLabel ApplicationMessageFrameHeader;
    private static javax.swing.JTextArea ApplicationMessageFrameText;
    private static javax.swing.JScrollPane ApplicationMessageWindowScrollPane;
    // End of variables declaration//GEN-END:variables
}
