/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * StarterKit.java
 *jButtonNext
 * Created on 08.04.2010, 17:50:20
 */

package csa.gui.panels;

import csa.Global;
import csa.config.Configuration;
import csa.config.theme.Theme;
import csa.gui.Windowable;
import csa.gui.components.CSAInternalFrame;
import csa.gui.components.CSAView;
import csa.tiletools.TipOfTheDay;
import java.awt.Color;
/**
 *
 * @author Malban
 */
public class TipOfDayGUI extends javax.swing.JPanel implements Windowable{

    /** Creates new form StarterKit */

    private CSAView mParent = null;
    private javax.swing.JMenuItem mParentMenuItem = null;
    private int mClassSetting=0;

    Color backfade = new Color(50,50,50,200);


    private int index = 0;

    @Override
    public void closing(){}
    @Override
    public void setParentWindow(CSAView jpv)
    {
        mParent = jpv;
    }
    @Override
    public void setMenuItem(javax.swing.JMenuItem item)
    {
        mParentMenuItem = item;
        mParentMenuItem.setText("Tip of Day!");
    }
    @Override
    public javax.swing.JMenuItem getMenuItem()
    {
        return mParentMenuItem;
    }
    @Override
    public javax.swing.JPanel getPanel()
    {
        return this;
    }

    public TipOfDayGUI() {
        initComponents();
        Theme t = Configuration.getConfiguration().getCurrentTheme();
        jLabel3.setIcon(new javax.swing.ImageIcon(t.getImage("TitleSmall.png")));
        jButtonNext.setIcon(new javax.swing.ImageIcon(t.getImage("AllIconSmall.png")));

        String text = TipOfTheDay.tipsOfDay[Global.getRand().nextInt(TipOfTheDay.tipsOfDay.length)];

        jLabelText.setText("<html>"+text+"</html>");

        setOpaque(false);
        setDoubleBuffered(false);
        setForeground(Color.white);
        setBackground(backfade);
        setComponentZOrder(jPanelmana, 0);
    }
    @Override
    public void paintComponent(java.awt.Graphics g)
    {
        g.setColor(backfade);
        g.fillRect(0, 0, getWidth(), getHeight());
        super.paintComponent(g);
    }


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

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jPanel1 = new javax.swing.JPanel();
        jLabelText = new javax.swing.JLabel();
        jLabelTitel = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jPanelmana = new javax.swing.JPanel();
        jButtonNext = new javax.swing.JButton();
        jLabelGoOn = new javax.swing.JLabel();

        setBackground(new java.awt.Color(102, 102, 102));
        setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        setLayout(null);

        jLayeredPane1.setName("jLayeredPane1"); // NOI18N

        jPanel1.setBackground(new java.awt.Color(102, 102, 102));
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setOpaque(false);

        jLabelText.setFont(jLabelText.getFont().deriveFont(jLabelText.getFont().getStyle() | java.awt.Font.BOLD, 16));
        jLabelText.setForeground(new java.awt.Color(255, 255, 204));
        jLabelText.setText("<html>\nLast thing to do - is start the game!<BR><BR>\nFor further information, regarding e.g. the game controls, please read the Help.\n<BR><BR>Thanks and have fun....\n</html>"); // NOI18N
        jLabelText.setName("jLabelText"); // NOI18N

        jLabelTitel.setBackground(new java.awt.Color(51, 51, 51));
        jLabelTitel.setFont(jLabelTitel.getFont().deriveFont(jLabelTitel.getFont().getStyle() | java.awt.Font.BOLD, 20));
        jLabelTitel.setForeground(new java.awt.Color(255, 255, 204));
        jLabelTitel.setText("Tip of the day!"); // NOI18N
        jLabelTitel.setName("jLabelTitel"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelTitel)
                    .addComponent(jLabelText, javax.swing.GroupLayout.PREFERRED_SIZE, 484, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(26, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelTitel)
                .addGap(18, 18, 18)
                .addComponent(jLabelText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(116, Short.MAX_VALUE))
        );

        jPanel1.setBounds(0, 10, 520, 290);
        jLayeredPane1.add(jPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        add(jLayeredPane1);
        jLayeredPane1.setBounds(0, 100, 523, 260);

        jLabel3.setName("jLabel3"); // NOI18N
        add(jLabel3);
        jLabel3.setBounds(110, 20, 0, 0);

        jPanelmana.setMinimumSize(new java.awt.Dimension(120, 120));
        jPanelmana.setName("jPanelmana"); // NOI18N
        jPanelmana.setPreferredSize(new java.awt.Dimension(120, 120));

        javax.swing.GroupLayout jPanelmanaLayout = new javax.swing.GroupLayout(jPanelmana);
        jPanelmana.setLayout(jPanelmanaLayout);
        jPanelmanaLayout.setHorizontalGroup(
            jPanelmanaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 120, Short.MAX_VALUE)
        );
        jPanelmanaLayout.setVerticalGroup(
            jPanelmanaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 120, Short.MAX_VALUE)
        );

        add(jPanelmana);
        jPanelmana.setBounds(390, 10, 120, 120);

        jButtonNext.setName("jButtonNext"); // NOI18N
        jButtonNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNextActionPerformed(evt);
            }
        });
        add(jButtonNext);
        jButtonNext.setBounds(450, 360, 40, 20);

        jLabelGoOn.setBackground(new java.awt.Color(51, 51, 51));
        jLabelGoOn.setFont(jLabelGoOn.getFont().deriveFont((float)14));
        jLabelGoOn.setForeground(new java.awt.Color(255, 255, 204));
        jLabelGoOn.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabelGoOn.setText("Done");
        jLabelGoOn.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jLabelGoOn.setName("jLabelGoOn"); // NOI18N
        add(jLabelGoOn);
        jLabelGoOn.setBounds(378, 360, 60, 20);
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonNextActionPerformed
    {//GEN-HEADEREND:event_jButtonNextActionPerformed
        mParent.removeTOD(this);

    }//GEN-LAST:event_jButtonNextActionPerformed

    CSAInternalFrame startGame= null;
    CSAInternalFrame importer= null;

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonNext;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabelGoOn;
    private javax.swing.JLabel jLabelText;
    private javax.swing.JLabel jLabelTitel;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelmana;
    // End of variables declaration//GEN-END:variables

    public void deinit()
    {
        jPanelmana = null;
        jLabel3 = null;
    }
}
