/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package feuille.xtrn;
import feuille.xtrn.XtrnLib.EffectType;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
/**
*
* @author Yves
*/
public class XKCStep0 extends javax.swing.JPanel {
DefaultComboBoxModel comboModel = new DefaultComboBoxModel();
/**
* Creates new form XtrnKaraokePanel
*/
public XKCStep0() {
initComponents();
init();
}
private void init(){
try {
javax.swing.UIManager.setLookAndFeel(new NimbusLookAndFeel());
javax.swing.SwingUtilities.updateComponentTreeUI(this);
} catch (UnsupportedLookAndFeelException exc) {
System.out.println("Nimbus LookAndFeel not loaded : "+exc);
}
cbEffect.setModel(comboModel);
for(EffectType ef : EffectType.values()){
comboModel.addElement(ef);
}
cbEffect.setSelectedIndex(0); // Force le rendu de lblSummary
}
public JButton getNextButton(){
return btnNext;
}
public EffectType getSelectedEffectType(){
return (EffectType)cbEffect.getSelectedItem();
}
/**
* 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() {
jLabel2 = new javax.swing.JLabel();
cbEffect = new javax.swing.JComboBox();
btnNext = new javax.swing.JButton();
lblSummary = new javax.swing.JLabel();
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("<html><h1>Choose a type of effect :");
cbEffect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
cbEffect.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
cbEffectItemStateChanged(evt);
}
});
btnNext.setText("Next >>");
lblSummary.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblSummary.setText("Summary");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 473, Short.MAX_VALUE)
.addComponent(cbEffect, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(btnNext, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(lblSummary, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblSummary, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbEffect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnNext)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void cbEffectItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbEffectItemStateChanged
EffectType ef = (EffectType)cbEffect.getSelectedItem();
switch(ef){
case Normal:
lblSummary.setText("<html><p align=\"center\">Normal : one or more effects by syllable.</p>");
break;
case Periodic:
lblSummary.setText("<html><p align=\"center\">Periodic : each syllable have periodic effect(s) "
+ "depending of layers from the start syllable.</p>");
break;
case Random:
lblSummary.setText("<html><p align=\"center\">Random : each syllable have random effect(s).</p>");
break;
case Symmetric:
lblSummary.setText("<html><p align=\"center\">Symmetric : the effects are symmetric compared "
+ "to sentence syllable center.</p>");
break;
}
}//GEN-LAST:event_cbEffectItemStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnNext;
private javax.swing.JComboBox cbEffect;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel lblSummary;
// End of variables declaration//GEN-END:variables
}