Enquanto (For) SWING
Enquanto (For) SWING
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this
template
*/
package Exerciciosfor;
import javax.swing.DefaultListModel;
/**
*
* @author computador
*/
public class PainelEnquanto extends javax.swing.JFrame {
/**
* Creates new form PainelEnquanto
*/
public PainelEnquanto() {
initComponents();
}
/**
* 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">
jLabel4.setText("jLabel4");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("inicio");
jLabel2.setText("fim");
jLabel3.setText("passo");
Sinicio.setMaximum(5);
Sinicio.setValue(0);
Sinicio.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
SinicioStateChanged(evt);
}
});
Sfim.setMaximum(20);
Sfim.setMinimum(6);
Sfim.setValue(6);
Sfim.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
SfimStateChanged(evt);
}
});
Spasso.setMaximum(4);
Spasso.setMinimum(1);
Spasso.setValue(1);
Spasso.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
SpassoStateChanged(evt);
}
});
Jinicio.setText("0");
Jfim.setText("0");
Jpasso.setText("0");
Bcalc.setText("calcular");
Bcalc.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BcalcActionPerformed(evt);
}
});
jScrollPane1.setViewportView(Listcont);
pack();
}// </editor-fold>
Jfim.setText(Integer.toString(Sfim.getValue()));
// criando a lista
lista.addElement(c);
Listcont.setModel(lista);
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the
default look and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PainelEnquanto.class.getName()).log(java.util.lo
gging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PainelEnquanto.class.getName()).log(java.util.lo
gging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PainelEnquanto.class.getName()).log(java.util.lo
gging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PainelEnquanto.class.getName()).log(java.util.lo
gging.Level.SEVERE, null, ex);
}
//</editor-fold>