/*
 * Version.java
 *
 * Created on 13 april 2009, 13:48
 */

package net.i2p.desktopgui.gui;

import javax.swing.JFrame;
import net.i2p.desktopgui.router.RouterHelper;

/**
 *
 * @author  mathias
 */
public class Version extends javax.swing.JDialog {

    public Version() {
        this(new JFrame(), true);
    }
    
    
    private Version(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        String i2pVersion = RouterHelper.getVersion();
        String guiVersion = net.i2p.desktopgui.desktopgui.GUIVersion.VERSION;
        this.I2PVersion.setText("<html><h1>" + i2pVersion + "</h1></html>");
        this.GUIVersion.setText("<html><h1>" + guiVersion + "</h1></html>");
        this.setVisible(true);
    }

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

        okButton = new javax.swing.JButton();
        I2Plabel = new javax.swing.JLabel();
        GUILabel = new javax.swing.JLabel();
        I2PVersion = new javax.swing.JLabel();
        GUIVersion = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.i2p.desktopgui.desktopgui.Main.class).getContext().getResourceMap(Version.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        okButton.setText(resourceMap.getString("okButton.text")); // NOI18N
        okButton.setName("okButton"); // NOI18N
        okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                okButtonActionPerformed(evt);
            }
        });

        I2Plabel.setText(resourceMap.getString("I2Plabel.text")); // NOI18N
        I2Plabel.setName("I2Plabel"); // NOI18N

        GUILabel.setText(resourceMap.getString("GUILabel.text")); // NOI18N
        GUILabel.setName("GUILabel"); // NOI18N

        I2PVersion.setText(resourceMap.getString("I2PVersion.text")); // NOI18N
        I2PVersion.setName("I2PVersion"); // NOI18N

        GUIVersion.setText(resourceMap.getString("GUIVersion.text")); // NOI18N
        GUIVersion.setName("GUIVersion"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(I2Plabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(GUILabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(I2PVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
                            .addComponent(GUIVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)))
                    .addComponent(okButton, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(I2Plabel)
                    .addComponent(I2PVersion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(GUILabel)
                    .addComponent(GUIVersion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(okButton)
                .addContainerGap())
        );

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

private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
    this.dispose();
}//GEN-LAST:event_okButtonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel GUILabel;
    private javax.swing.JLabel GUIVersion;
    private javax.swing.JLabel I2PVersion;
    private javax.swing.JLabel I2Plabel;
    private javax.swing.JButton okButton;
    // End of variables declaration//GEN-END:variables

}
