1
1
package Principal ;
2
2
3
+ import java .awt .Color ;
4
+ import java .awt .Font ;
5
+ import java .awt .Panel ;
6
+ import java .awt .SystemColor ;
7
+ import java .awt .event .ActionEvent ;
8
+ import java .awt .event .ActionListener ;
9
+ import java .util .Hashtable ;
10
+
11
+ import javax .swing .ImageIcon ;
12
+ import javax .swing .JButton ;
13
+ import javax .swing .JCheckBox ;
14
+ import javax .swing .JComboBox ;
3
15
import javax .swing .JFrame ;
4
- import javax .swing .JPanel ;
5
16
import javax .swing .JLabel ;
6
17
import javax .swing .JOptionPane ;
7
-
8
- import java . awt . Font ;
9
-
18
+ import javax . swing . JPanel ;
19
+ import javax . swing . JSlider ;
20
+ import javax . swing . SwingConstants ;
10
21
import javax .swing .border .LineBorder ;
22
+ import javax .swing .event .ChangeEvent ;
23
+ import javax .swing .event .ChangeListener ;
11
24
12
25
import Adicionales .*;
13
- import Sorts .* ;
26
+ import Sorts .Sorts ;
14
27
import Sorts .Algoritmos .*;
15
28
16
- import java .awt .Color ;
17
-
18
- import javax .swing .SwingConstants ;
19
- import javax .swing .JComboBox ;
20
- import javax .swing .JButton ;
21
- import java .awt .event .ActionListener ;
22
- import java .util .Hashtable ;
23
- import java .awt .event .ActionEvent ;
24
- import javax .swing .JSlider ;
25
- import javax .swing .event .ChangeListener ;
26
-
27
- import javax .swing .event .ChangeEvent ;
28
- import java .awt .Panel ;
29
- import java .awt .SystemColor ;
30
- import javax .swing .ImageIcon ;
31
-
32
29
public class Main extends Sorts {
33
30
// Nombre de cada algoritmo Sort
34
31
private final String [] nombreAlgoritmos = { "Bubble" , "Cocktail" , "Cycle" , "Gnome" , "Heap" , "Insertion" , "Merge" ,
@@ -45,6 +42,8 @@ public class Main extends Sorts {
45
42
// COMBOBOX
46
43
private final JComboBox <String > comboBoxTipoSort = new JComboBox <String >(nombreAlgoritmos );
47
44
private static final JComboBox <Object > comboBoxTiposGraficos = new JComboBox <Object >(nombreGrafico );
45
+ // private final JComboBox<String> comboBoxTipoSort = new JComboBox<String>();
46
+ // private static final JComboBox<Object> comboBoxTiposGraficos = new JComboBox<Object>();
48
47
// JLABEL
49
48
private final JLabel lblTitleAlgoritmo = new JLabel ("Seleccionar algoritmo de ordenacion" );
50
49
private final JLabel lblTitle = new JLabel ("Panel de control" );
@@ -65,6 +64,8 @@ public class Main extends Sorts {
65
64
private final JButton btnInformacion = new JButton ("Informacion" );
66
65
private final JButton btnGithub = new JButton ();
67
66
private final JButton btnCodepen = new JButton ();
67
+ // JCHECKBOX
68
+ private final JCheckBox chckbxContornoBarras = new JCheckBox ("Marcar el contorno de las barras" );
68
69
// JSLIDER
69
70
private final JSlider sliderTamBarras = new JSlider ();
70
71
private final JSlider sliderRetardo = new JSlider ();
@@ -199,16 +200,16 @@ public void actionPerformed(ActionEvent e) {
199
200
}
200
201
});
201
202
panelOpcionesMenu .add (btnDesordenar );
202
- lblCambios .setForeground (Color .WHITE );
203
203
204
204
// Label para el recuento de cambios realizados en el array.
205
+ lblCambios .setForeground (Color .WHITE );
205
206
lblCambios .setFont (new Font ("Arial" , Font .BOLD , 13 ));
206
207
lblCambios .setBounds (10 , 215 , 250 , 30 );
207
208
panelOpcionesMenu .add (lblCambios );
208
- lblAccesos .setForeground (Color .WHITE );
209
209
210
210
// Label para el recuento de accesos realizados en el array.
211
211
lblAccesos .setFont (new Font ("Arial" , Font .BOLD , 13 ));
212
+ lblAccesos .setForeground (Color .WHITE );
212
213
lblAccesos .setBounds (10 , 256 , 237 , 30 );
213
214
panelOpcionesMenu .add (lblAccesos );
214
215
lblNumeroBarras .setHorizontalAlignment (SwingConstants .RIGHT );
@@ -312,13 +313,14 @@ public void stateChanged(ChangeEvent e) {
312
313
// Boton para saltar o salir de la animacion
313
314
btnSaltarSort .setBackground (Color .BLACK );
314
315
btnSaltarSort .setForeground (Color .WHITE );
316
+ btnSaltarSort .setFont (new Font ("Arial" , Font .BOLD , 13 ));
317
+ btnSaltarSort .setBounds (160 , 129 , 110 , 30 );
315
318
btnSaltarSort .addActionListener (new ActionListener () {
316
319
public void actionPerformed (ActionEvent e ) {
317
- Delay .n = 1 / 2 ;
320
+ Delay .n = 0 ;
318
321
}
319
322
});
320
- btnSaltarSort .setFont (new Font ("Arial" , Font .BOLD , 13 ));
321
- btnSaltarSort .setBounds (160 , 129 , 110 , 30 );
323
+
322
324
panelOpcionesMenu .add (btnSaltarSort );
323
325
324
326
// Boton para ver informacion sobre la aplicacion
@@ -370,6 +372,22 @@ public void actionPerformed(ActionEvent e) {
370
372
lblTituloGraficos .setBounds (10 , 88 , 120 , 30 );
371
373
panelOpcionesMenu .add (lblTituloGraficos );
372
374
375
+ // Radio button para poner o quitar separacion entre barras.
376
+ chckbxContornoBarras .setForeground (Color .WHITE );
377
+ chckbxContornoBarras .setBackground (Color .BLACK );
378
+ chckbxContornoBarras .setFont (new Font ("Arial" , Font .BOLD , 13 ));
379
+ chckbxContornoBarras .setBounds (10 , 185 , 260 , 23 );
380
+ chckbxContornoBarras .addActionListener (new ActionListener () {
381
+ public void actionPerformed (ActionEvent e ) {
382
+ if (chckbxContornoBarras .isSelected ())
383
+ barras .setMarcarSepacaion (true );
384
+ else if (!chckbxContornoBarras .isSelected ())
385
+ barras .setMarcarSepacaion (false );
386
+ panelBarras .repaint ();
387
+ }
388
+ });
389
+ panelOpcionesMenu .add (chckbxContornoBarras );
390
+
373
391
// Label para el titulo de los controles.
374
392
lblTitle .setBounds (10 , 11 , 280 , 24 );
375
393
lblTitle .setForeground (Color .WHITE );
@@ -648,8 +666,4 @@ public void setPanelBarras(JPanel panelBarras) {
648
666
public static JComboBox <Object > getComboboxtiposgraficos () {
649
667
return comboBoxTiposGraficos ;
650
668
}
651
-
652
- // public static JComboBox<Object> getComboboxtiposgraficos() {
653
- // return comboBoxTiposGraficos;
654
- // }
655
669
}
0 commit comments