[ Foro de Java ]

asignacion necesito ayuda

09-Mar-2020 02:24
Invitado (Marcos)
0 Respuestas

Necesito ayuda con esta asigancion
Tiene que contener un Toolbar.

paquete com.java8talleres;

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

clase pública LottoMadness16 extiende JFrame {

LottoEvent16 lotto = new LottoEvent16 (esto);

// configurar la fila 1
JPanel fila1 = nuevo JPanel ();
Opción de grupo de botones = nuevo grupo de botones ();
JCheckBox quickpick = new JCheckBox ("Selección rápida", falso);
JCheckBox personal = nuevo JCheckBox ("Personal", verdadero);
// configurar la fila 2
JPanel row2 = new JPanel ();
JLabel numbersLabel = new JLabel ("Sus selecciones:", JLabel.RIGHT);
JTextField [] números = nuevo JTextField [5];
JLabel winnersLabel = new JLabel ("Ganadores:", JLabel.RIGHT);
JTextField [] ganadores = nuevo JTextField [5];
// configurar la fila 3
JPanel row3 = new JPanel ();
JButton stop = nuevo JButton ("Stop");
JButton play = nuevo JButton ("Play");
JButton reset = nuevo JButton ("Reset");
// configurar la fila 4
JPanel row4 = new JPanel ();
JLabel got3Label = new JLabel ("3 de 6:", JLabel.RIGHT);
JTextField got3 = new JTextField ("0");
JLabel got4Label = new JLabel ("4 de 6:", JLabel.RIGHT);
JTextField got4 = new JTextField ("0");
JLabel got5Label = new JLabel ("5 de 6:", JLabel.RIGHT);
JTextField got5 = new JTextField ("0");
JLabel drawingsLabel = new JLabel ("Dibujos:", JLabel.RIGHT);
Dibujos JTextField = nuevo JTextField ("0");
JLabel yearsLabel = new JLabel ("Años:", JLabel.RIGHT);
// configurar la fila 5
JPanel row5 = new JPanel ();
JTextField años = nuevo JTextField ("0", 10);
JLabel pauseLabel = new JLabel ("Tasa de pausa:", JLabel.RIGHT);
Pausa JTextField = nuevo JTextField ("100", 10);

public LottoMadness16 () {
super ("Lotto Madness");
setSize (550, 320);
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
Diseño GridLayout = nuevo GridLayout (5, 1, 10, 10);
setLayout (diseño);

// Añadir oyentes
quickpick.addItemListener (lotto);
personal.addItemListener (lotto);
stop.addActionListener (lotto);
play.addActionListener (lotto);
reset.addActionListener (lotto);

FlowLayout layout1 = new FlowLayout (FlowLayout.CENTER,
10, 10);
option.add (selección rápida);
option.add (personal);
row1.setLayout (layout1);
row1.add (selección rápida);
row1.add (personal);
agregar (fila1);

GridLayout layout2 = new GridLayout (2, 7, 10, 10);
row2.setLayout (layout2);
row2.setLayout (layout2);
row2.add (numbersLabel);
para (int i = 0; i <5; i ++) {
números [i] = nuevo JTextField ();
row2.add (números [i]);
}
row2.add (winnersLabel);
para (int i = 0; i <5; i ++) {
ganadores [i] = new JTextField ();
ganadores [i] .setEditable (falso);
row2.add (ganadores [i]);
}
agregar (fila2);

FlowLayout layout3 = new FlowLayout (FlowLayout.CENTER,
10, 10);
row3.setLayout (layout3);
stop.setEnabled (falso);
fila3.add (detener);
row3.add (reproducir);
row3.add (restablecer);
agregar (fila3);

GridLayout layout4 = new GridLayout (2, 4, 20, 10);
row4.setLayout (layout4);
row4.add (got3Label);
got3.setEditable (falso);
row4.add (got3);
row4.add (got4Label);
got4.setEditable (falso);
row4.add (got4);
row4.add (got5Label);
got5.setEditable (falso);
row4.add (got5);
row4.add (drawingsLabel);
dibujos.setEditable (falso);
row4.add (dibujos);
agregar (fila4);

FlowLayout layout5 = new FlowLayout (FlowLayout.CENTER,
10, 10);
row5.add (yearsLabel);
years.setEditable (false);
row5.add (años);
row5.setLayout (layout5);
row5.add (pauseLabel);
row5.add (pausa);
agregar (fila5);

setVisible (verdadero);
}

public static void main (String [] argumentos) {
LottoMadness16 frame = new LottoMadness16 ();
}
}




(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)