Java - Como enviar datos a un método que tiene parámetros de tipo Interfaz en java

 
Vista:

Como enviar datos a un método que tiene parámetros de tipo Interfaz en java

Publicado por jhon fredis muñoz (2 intervenciones) el 30/10/2019 16:15:55
Como puedo enviar datos a un método que tiene parámetros de tipo Interfaz en java por ejemplo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Interfaz java
public interface State {
 
     // prototipo de metodos
}
 
// clase que implementa la interfaz
class JavImp implements State {
 
      // metodos de la Interfaz
 
}
 
// clase Problem
class Problem {
 
     State stadoInicial;
 
      Problem(State stadoInicial){
 
              this.stadoInicial = stadoInicia ;
 
     }
 
// clase con metodo Main
 
class puzzle {
       byte [] [] matrizInic;
 
       puzzle(){
             matrizInic = new byte[3][3];
       }
 
// Creamos el Objeto Problem y es cuando tengo problemas ya que el parámetro es de tipo interfaz "State" y no se como puedo enviar la matriz con ese tipo dato "State", la matriz ya esta llena de datos byte cuando deseo enviarla.
 
      evento click boton (){
            Problem prob = new Problem ( matrizInic );
       }
}


les agradezco me puedan Colaborar con información, si no fui claro ya les subo contenido del código. Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Rodrigo
Val: 2.041
Plata
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

Como enviar datos a un método que tiene parámetros de tipo Interfaz en java

Publicado por Rodrigo (623 intervenciones) el 31/10/2019 01:46:40
Haz que la clase puzzle implemente la interfaz y haces

new Problem(this);

donde ahora tienes El error.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Como enviar datos a un método que tiene parámetros de tipo Interfaz en java

Publicado por jhon fredis (2 intervenciones) el 31/10/2019 03:06:07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
package basic;
 
import java.util.List;
import search.Search;
import puzzle.SubProblem;
 
 
public abstract class Problem {
 
	State initialState;
 
	List actions;
 
	GoalTest goaltest;
 
 
	public Problem(){
	};
 
	public void Set(State initialS, List actionslist, GoalTest gtest)
	{
	    initialState = initialS;
	    goaltest = gtest;
	    actions = actionslist;
    };
 
    public Solution solve(Search buscador) {
        Node root = new Node(getInitialState());
        return buscador.findSolution(root,getActions(),getGoaltest());
    }
 
	/**
	 * @return Returns the initialState.
	 */
	public State getInitialState() {
		return initialState;
	}
 
	/**
	 * @return Returns the actions.
	 * 
	 */
	public List getActions() {
		return actions;
	}
 
	/**
	 * @return Returns the goaltest.
	 */
	public GoalTest getGoaltest() {
		return goaltest;
	}
 
}
 
// interfaz State
package basic;
 
 
public interface State {
    public boolean possible(Accion action);
    public State successor(Accion action);
    public State copy();
    public int compareTo(State state);
}
 
// interfaz Goaltest
package basic;
 
import java.util.List;
 
 
public interface GoalTest {
    public boolean isGoalState(State state);
    public State hasGoalState(List states);
 
}
 
// JFrame principal
 
/*
 * 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 puzzle;
 
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
 
 
/**
 *
 * @author Asus
 */
public class Puzzle_JF  extends javax.swing.JFrame {
 
    // Parametros
    int n;
    byte matrizPuzzleInicial[][], matrizPuzzleFinal[][];
    List listaAcciones;
 
    /**
     * Creates new form Puzzle_JF
     */
    public Puzzle_JF() {
        initComponents();
        this.setLocationRelativeTo(null);
 
        n=3;
        matrizPuzzleInicial = new byte[n][n];
        matrizPuzzleFinal = new byte[n][n];
 
        listaAcciones = new ArrayList<String>();
        listaAcciones.add("DER");
        listaAcciones.add("IZQ");
        listaAcciones.add("ARRIB");
        listaAcciones.add("ABAJ");
 
//        problem = new Problem();
//        problem.Set(createBoard(n), listaAcciones, createBoard(n));
//        
    }
 
    /**
     * 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">                          
    private void initComponents() {
 
        pnlContainer = new java.awt.Panel();
        pnlTitle = new java.awt.Panel();
        lblTitle = new java.awt.Label();
        btnSalir = new org.edisoncor.gui.button.ButtonTextDown();
        lblMetodoSolucion = new java.awt.Label();
        lblSolucion = new java.awt.Label();
        cbxMetodoSolucion = new javax.swing.JComboBox<>();
        lblPuzzleFinal = new java.awt.Label();
        pnlPuzzleFinal = new org.edisoncor.gui.panel.PanelNice();
        btnPF23 = new javax.swing.JButton();
        btnPF12 = new javax.swing.JButton();
        btnPF11 = new javax.swing.JButton();
        btnPF13 = new javax.swing.JButton();
        btnPF32 = new javax.swing.JButton();
        btnPF31 = new javax.swing.JButton();
        btnPF22 = new javax.swing.JButton();
        btnPF21 = new javax.swing.JButton();
        btnPF33 = new javax.swing.JButton();
        pnlPuzzleInicial = new org.edisoncor.gui.panel.PanelNice();
        btnPI23 = new javax.swing.JButton();
        btnPI12 = new javax.swing.JButton();
        btnPI11 = new javax.swing.JButton();
        btnPI13 = new javax.swing.JButton();
        btnPI32 = new javax.swing.JButton();
        btnPI31 = new javax.swing.JButton();
        btnPI22 = new javax.swing.JButton();
        btnPI21 = new javax.swing.JButton();
        btnPI33 = new javax.swing.JButton();
        lblPuzzleInicial = new java.awt.Label();
        lblInformacion = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txaInformacion = new javax.swing.JTextArea();
        jScrollPane1 = new javax.swing.JScrollPane();
        txaSolucion = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox<>();
        btnCargaPuzzle = new org.edisoncor.gui.button.ButtonTextDown();
        btnLimpiar = new org.edisoncor.gui.button.ButtonTextDown();
        BtnResolver = new org.edisoncor.gui.button.ButtonTextDown();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setUndecorated(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
 
        pnlContainer.setBackground(new java.awt.Color(215, 228, 233));
        pnlContainer.setName("pnlFondo"); // NOI18N
 
        pnlTitle.setBackground(new java.awt.Color(57, 83, 108));
 
        lblTitle.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        lblTitle.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 18)); // NOI18N
        lblTitle.setForeground(new java.awt.Color(222, 230, 234));
        lblTitle.setText("Puzzle IA");
 
        btnSalir.setBackground(new java.awt.Color(57, 36, 68));
        btnSalir.setForeground(new java.awt.Color(222, 230, 234));
        btnSalir.setText("Salir");
        btnSalir.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 14)); // NOI18N
        btnSalir.setName("btnSalir"); // NOI18N
        btnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirActionPerformed(evt);
            }
        });
 
        javax.swing.GroupLayout pnlTitleLayout = new javax.swing.GroupLayout(pnlTitle);
        pnlTitle.setLayout(pnlTitleLayout);
        pnlTitleLayout.setHorizontalGroup(
            pnlTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlTitleLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(lblTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        pnlTitleLayout.setVerticalGroup(
            pnlTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlTitleLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(pnlTitleLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
 
        lblMetodoSolucion.setFont(new java.awt.Font("Yu Gothic UI Semilight", 0, 14)); // NOI18N
        lblMetodoSolucion.setForeground(new java.awt.Color(93, 69, 66));
        lblMetodoSolucion.setName("lblMetodoSolucion"); // NOI18N
        lblMetodoSolucion.setText("Metodo de Solución");
 
        lblSolucion.setFont(new java.awt.Font("Yu Gothic UI Semilight", 0, 14)); // NOI18N
        lblSolucion.setForeground(new java.awt.Color(93, 69, 66));
        lblSolucion.setName("lblSolucion"); // NOI18N
        lblSolucion.setText("Solución");
 
        cbxMetodoSolucion.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 12)); // NOI18N
        cbxMetodoSolucion.setForeground(new java.awt.Color(20, 32, 39));
        cbxMetodoSolucion.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccionar...", "Amplitud", "Profundidad", "Profundidad Limitada", "Profundidad Iterativa", "Voraz", "A*" }));
        cbxMetodoSolucion.setName("cbxMetodoSolucion"); // NOI18N
 
        lblPuzzleFinal.setFont(new java.awt.Font("Yu Gothic UI Semilight", 0, 14)); // NOI18N
        lblPuzzleFinal.setForeground(new java.awt.Color(93, 69, 66));
        lblPuzzleFinal.setName("lblPuzzleFinal:"); // NOI18N
        lblPuzzleFinal.setText("Puzzle Final");
 
        pnlPuzzleFinal.setForeground(new java.awt.Color(255, 255, 255));
        pnlPuzzleFinal.setName("pnlPuzzleFinal"); // NOI18N
 
        btnPF23.setText("?");
        btnPF23.setName("btnpf6"); // NOI18N
        btnPF23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF23ActionPerformed(evt);
            }
        });
 
        btnPF12.setText("?");
        btnPF12.setName("btnpf2"); // NOI18N
        btnPF12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF12ActionPerformed(evt);
            }
        });
 
        btnPF11.setText("?");
        btnPF11.setName("btnpf1"); // NOI18N
        btnPF11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF11ActionPerformed(evt);
            }
        });
 
        btnPF13.setText("?");
        btnPF13.setName("btnpf3"); // NOI18N
        btnPF13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF13ActionPerformed(evt);
            }
        });
 
        btnPF32.setText("?");
        btnPF32.setName("btnpf8"); // NOI18N
        btnPF32.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF32ActionPerformed(evt);
            }
        });
 
        btnPF31.setText("?");
        btnPF31.setName("btnpf7"); // NOI18N
        btnPF31.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF31ActionPerformed(evt);
            }
        });
 
        btnPF22.setText("?");
        btnPF22.setName("btnpf5"); // NOI18N
        btnPF22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF22ActionPerformed(evt);
            }
        });
 
        btnPF21.setText("?");
        btnPF21.setName("btnpf4"); // NOI18N
        btnPF21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF21ActionPerformed(evt);
            }
        });
 
        btnPF33.setText("?");
        btnPF33.setName("btnpf9"); // NOI18N
        btnPF33.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPF33ActionPerformed(evt);
            }
        });
 
        javax.swing.GroupLayout pnlPuzzleFinalLayout = new javax.swing.GroupLayout(pnlPuzzleFinal);
        pnlPuzzleFinal.setLayout(pnlPuzzleFinalLayout);
        pnlPuzzleFinalLayout.setHorizontalGroup(
            pnlPuzzleFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPuzzleFinalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPuzzleFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlPuzzleFinalLayout.createSequentialGroup()
                        .addComponent(btnPF11, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPF12, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPF13, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlPuzzleFinalLayout.createSequentialGroup()
                        .addComponent(btnPF21, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPF22, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPF23, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlPuzzleFinalLayout.createSequentialGroup()
                        .addComponent(btnPF31, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPF32, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPF33, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlPuzzleFinalLayout.setVerticalGroup(
            pnlPuzzleFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPuzzleFinalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPuzzleFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPF11)
                    .addComponent(btnPF13)
                    .addComponent(btnPF12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlPuzzleFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPF21)
                    .addComponent(btnPF22)
                    .addComponent(btnPF23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlPuzzleFinalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPF31)
                    .addComponent(btnPF32)
                    .addComponent(btnPF33))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
 
        btnPF11.getAccessibleContext().setAccessibleName("btnpi1");
 
        pnlPuzzleInicial.setForeground(new java.awt.Color(255, 255, 255));
        pnlPuzzleInicial.setName("pnlPuzzleInicial"); // NOI18N
 
        btnPI23.setText("?");
        btnPI23.setName("btnpi6"); // NOI18N
        btnPI23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI23ActionPerformed(evt);
            }
        });
 
        btnPI12.setText("?");
        btnPI12.setName("btnpi2"); // NOI18N
        btnPI12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI12ActionPerformed(evt);
            }
        });
 
        btnPI11.setText("?");
        btnPI11.setName("btnpi1"); // NOI18N
        btnPI11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI11ActionPerformed(evt);
            }
        });
 
        btnPI13.setText("?");
        btnPI13.setName("btnpi3"); // NOI18N
        btnPI13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI13ActionPerformed(evt);
            }
        });
 
        btnPI32.setText("?");
        btnPI32.setName("btnpi8"); // NOI18N
        btnPI32.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI32ActionPerformed(evt);
            }
        });
 
        btnPI31.setText("?");
        btnPI31.setName("btnpi7"); // NOI18N
        btnPI31.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI31ActionPerformed(evt);
            }
        });
 
        btnPI22.setText("?");
        btnPI22.setName("btnpi5"); // NOI18N
        btnPI22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI22ActionPerformed(evt);
            }
        });
 
        btnPI21.setText("?");
        btnPI21.setName("btnpi4"); // NOI18N
        btnPI21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI21ActionPerformed(evt);
            }
        });
 
        btnPI33.setText("?");
        btnPI33.setName("btnpi9"); // NOI18N
        btnPI33.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPI33ActionPerformed(evt);
            }
        });
 
        javax.swing.GroupLayout pnlPuzzleInicialLayout = new javax.swing.GroupLayout(pnlPuzzleInicial);
        pnlPuzzleInicial.setLayout(pnlPuzzleInicialLayout);
        pnlPuzzleInicialLayout.setHorizontalGroup(
            pnlPuzzleInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPuzzleInicialLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPuzzleInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlPuzzleInicialLayout.createSequentialGroup()
                        .addComponent(btnPI11, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPI12, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPI13, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlPuzzleInicialLayout.createSequentialGroup()
                        .addComponent(btnPI21, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPI22, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPI23, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlPuzzleInicialLayout.createSequentialGroup()
                        .addComponent(btnPI31, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPI32, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPI33, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlPuzzleInicialLayout.setVerticalGroup(
            pnlPuzzleInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPuzzleInicialLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPuzzleInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPI11)
                    .addComponent(btnPI13)
                    .addComponent(btnPI12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlPuzzleInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPI21)
                    .addComponent(btnPI22)
                    .addComponent(btnPI23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlPuzzleInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPI31)
                    .addComponent(btnPI32)
                    .addComponent(btnPI33))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
 
        lblPuzzleInicial.setFont(new java.awt.Font("Yu Gothic UI Semilight", 0, 14)); // NOI18N
        lblPuzzleInicial.setForeground(new java.awt.Color(93, 69, 66));
        lblPuzzleInicial.setName("lblPuzzleInicial"); // NOI18N
        lblPuzzleInicial.setText("Puzzle Inicial:");
 
        lblInformacion.setFont(new java.awt.Font("Yu Gothic UI Semilight", 0, 14)); // NOI18N
        lblInformacion.setForeground(new java.awt.Color(20, 32, 39));
        lblInformacion.setText("Estadisticas");
        lblInformacion.setName("lblEstadistica"); // NOI18N
 
        txaInformacion.setColumns(20);
        txaInformacion.setRows(5);
        jScrollPane2.setViewportView(txaInformacion);
 
        txaSolucion.setColumns(20);
        txaSolucion.setRows(5);
        jScrollPane1.setViewportView(txaSolucion);
 
        jLabel2.setFont(new java.awt.Font("Yu Gothic UI Semilight", 0, 14)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(20, 32, 39));
        jLabel2.setText("Tipo Puzzle :");
        jLabel2.setName("lblTipoPuzzle"); // NOI18N
 
        jComboBox2.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 12)); // NOI18N
        jComboBox2.setForeground(new java.awt.Color(20, 32, 39));
        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccionar...", "Puzzle 4", "Puzzle 8", "Puzzle 16", " " }));
        jComboBox2.setName("cbxTipoPuzzle"); // NOI18N
 
        btnCargaPuzzle.setBackground(new java.awt.Color(83, 86, 96));
        btnCargaPuzzle.setForeground(new java.awt.Color(222, 230, 234));
        btnCargaPuzzle.setText("Change");
        btnCargaPuzzle.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 14)); // NOI18N
        btnCargaPuzzle.setName("btnChange"); // NOI18N
 
        btnLimpiar.setBackground(new java.awt.Color(83, 86, 96));
        btnLimpiar.setForeground(new java.awt.Color(222, 230, 234));
        btnLimpiar.setText("Limpiar");
        btnLimpiar.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 14)); // NOI18N
        btnLimpiar.setName("btnLimpiar"); // NOI18N
        btnLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLimpiarActionPerformed(evt);
            }
        });
 
        BtnResolver.setBackground(new java.awt.Color(83, 86, 96));
        BtnResolver.setForeground(new java.awt.Color(222, 230, 234));
        BtnResolver.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 14)); // NOI18N
        BtnResolver.setLabel("Resolver");
        BtnResolver.setName("btnResolver"); // NOI18N
        BtnResolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnResolverActionPerformed(evt);
            }
        });
 
        javax.swing.GroupLayout pnlContainerLayout = new javax.swing.GroupLayout(pnlContainer);
        pnlContainer.setLayout(pnlContainerLayout);
        pnlContainerLayout.setHorizontalGroup(
            pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(pnlContainerLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlContainerLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlContainerLayout.createSequentialGroup()
                        .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblSolucion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(pnlContainerLayout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(26, 26, 26)
                                .addComponent(btnCargaPuzzle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlContainerLayout.createSequentialGroup()
                                .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblPuzzleInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(pnlPuzzleInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(11, 11, 11)
                                .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(pnlContainerLayout.createSequentialGroup()
                                        .addGap(20, 20, 20)
                                        .addComponent(lblPuzzleFinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(pnlPuzzleFinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(18, 18, 18)
                        .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cbxMetodoSolucion, 0, 182, Short.MAX_VALUE)
                            .addComponent(lblMetodoSolucion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnLimpiar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblInformacion)
                            .addComponent(BtnResolver, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(0, 21, Short.MAX_VALUE))
        );
        pnlContainerLayout.setVerticalGroup(
            pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlContainerLayout.createSequentialGroup()
                .addComponent(pnlTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlContainerLayout.createSequentialGroup()
                        .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlContainerLayout.createSequentialGroup()
                                .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel2))
                                .addGap(16, 16, 16))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlContainerLayout.createSequentialGroup()
                                .addComponent(btnCargaPuzzle, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)))
                        .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblPuzzleFinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblPuzzleInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(2, 2, 2)
                        .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(pnlPuzzleFinal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(pnlPuzzleInicial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(pnlContainerLayout.createSequentialGroup()
                        .addComponent(lblMetodoSolucion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbxMetodoSolucion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(BtnResolver, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblSolucion, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblInformacion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(17, Short.MAX_VALUE))
        );
 
        lblMetodoSolucion.getAccessibleContext().setAccessibleName("lblMetodoSolucion");
        lblSolucion.getAccessibleContext().setAccessibleName("lblPuzzleInicial");
 
        getContentPane().add(pnlContainer, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 590, 650));
 
        pack();
    }// </editor-fold>                        
 
    private void btnPI11ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
         this.guardarActualizarNumeroButon(btnPI11, 0,0);
    }
 
    private void btnPI12ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI12,0, 1);
    }
 
    private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        System.exit(0);
    }
 
    private void BtnResolverActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
 
        if(cbxMetodoSolucion.getSelectedItem() == "Amplitud"){
 
        }
        else if (cbxMetodoSolucion.getSelectedItem() == "Profundidad") {
 
        }
        else if (cbxMetodoSolucion.getSelectedItem() == "Profundidad Limitada") {
 
        }
        else if (cbxMetodoSolucion.getSelectedItem() == "Profundidad Iterativa"){
 
        }
        else if (cbxMetodoSolucion.getSelectedItem() == "Voraz"){
 
        }
        else if (cbxMetodoSolucion.getSelectedItem() == "A*"){
 
        }
        else if (cbxMetodoSolucion.getSelectedItem() == "Seleccionar..."){
           JOptionPane.showMessageDialog(this, "Debe seleccionar un Metodo de solución", "Metodos de solución", JOptionPane.INFORMATION_MESSAGE);
        }
    }
 
    private void btnPI13ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI13, 0, 2);
    }
 
    private void btnPI21ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI21, 1, 0);
    }
 
    private void btnPI22ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI22, 1, 1);
    }
 
    private void btnPI23ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI23, 1, 2);
    }
 
    private void btnPI31ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI31, 2, 0);
    }
 
    private void btnPI32ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI32, 2, 1);
    }
 
    private void btnPI33ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButon(btnPI33, 2, 2);
    }
 
    private void btnPF11ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF11,0, 0);
 
    }
 
    Integer fi = 0, co = 0;
    private void btnLimpiarActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
 
 
//        String pI = "", pF = "";
//        txaSolucion.append("pI           pF\n");
//        for (int i = 0; i < matrizPuzzleInicial.length; i++) {
//            for (int j = 0; j < matrizPuzzleInicial.length; j++) {
//                
//                pI = pI + matrizPuzzleInicial[i][j].toString() + " ";
//                pF = pF + matrizPuzzleFinal[i][j].toString() + " "; 
//                
//                if(matrizPuzzleInicial[i][j] == 0){
//                    fi = i;
//                    co = j;
//                }
//            }
//            txaSolucion.append(pI + "   " + pF);
//            txaSolucion.append("\n"); 
//            pI = ""; 
//            pF = "";
//        }
//        
//        Integer val;
//        if (movDer()){
//            
//            val = matrizPuzzleInicial[fi][co+1];
//            matrizPuzzleInicial[fi][co+1] = 0;
//            
//            matrizPuzzleInicial[fi][co] = val;
//            
//            co++;           
//        }
//        
//        txaSolucion.append("pI           pF\n");
//        for (int i = 0; i < matrizPuzzleInicial.length; i++) {
//            for (int j = 0; j < matrizPuzzleInicial.length; j++) {
//                
//                pI = pI + matrizPuzzleInicial[i][j].toString() + " ";
//                pF = pF + matrizPuzzleFinal[i][j].toString() + " "; 
//                
//                if(matrizPuzzleInicial[i][j] == 0){
//                    fi = i;
//                    co = j;
//                }
//            }
//            txaSolucion.append(pI + "   " + pF);
//            txaSolucion.append("\n"); 
//            pI = ""; 
//            pF = "";
//        }    
    }
 
    public boolean movDer (){
        return co < 2;
    }
 
    public  boolean movIzq (){
        return co > 0;
    }
 
    public  boolean movArri (){
        return fi > 0;
    }
 
    public  boolean movAbaj (){
        return fi < 2;
    }
 
    private void btnPF12ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF12,0,1);
    }
 
    private void btnPF13ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF13, 0, 2);
    }
 
    private void btnPF21ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF21,1, 0);
    }
 
    private void btnPF22ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF22, 1, 1);
    }
 
    private void btnPF23ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF23, 1, 2);
    }
 
    private void btnPF31ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF31, 2, 0);
    }
 
    private void btnPF32ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF32, 2, 1);
    }
 
    private void btnPF33ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        this.guardarActualizarNumeroButonPF(btnPF33, 2, 2);
    }
 
 
    /**
     * @param args the command line arguments
     */
    //Metodo Main
    public static void main(String[] args) {
 
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Puzzle_JF().setVisible(true);
            }
        });
    }
 
    private void guardarActualizarNumeroButon(JButton selectBoton, Integer positionFila,Integer PositionColumn){
 
        String valorObtenido = JOptionPane.showInputDialog(this, "ingrese el valor");
 
        if(valorObtenido != null){
 
            byte valorInteger = Byte.parseByte(valorObtenido);
            matrizPuzzleInicial[positionFila][PositionColumn] = valorInteger;
 
            selectBoton.setText(valorObtenido);
 
            //JOptionPane.showMessageDialog(this, "el numero guardado es: "+ matrizPuzzleInicial[positionFila][PositionColumn].toString(),"Numero Asignado", JOptionPane.INFORMATION_MESSAGE);          
        }
    }
 
 
    private void guardarActualizarNumeroButonPF(JButton selectBoton, Integer positionFila,Integer PositionColumn){
 
        String valorObtenido = JOptionPane.showInputDialog(this, "ingrese el numero aquí","Valor de la cuadricula ",JOptionPane.PLAIN_MESSAGE);
 
        if(valorObtenido != null){
 
            byte valorInteger;
            valorInteger = Byte.parseByte(valorObtenido);
            matrizPuzzleFinal[positionFila][PositionColumn] = valorInteger;
            selectBoton.setText(valorObtenido);
 
            //JOptionPane.showMessageDialog(this, "el numero guardado es: "+ matrizPuzzleInicial[positionFila][PositionColumn].toString(),"Numero Asignado", JOptionPane.INFORMATION_MESSAGE);
        }
    }
 
    // Variables declaration - do not modify
    private org.edisoncor.gui.button.ButtonTextDown BtnResolver;
    private org.edisoncor.gui.button.ButtonTextDown btnCargaPuzzle;
    private org.edisoncor.gui.button.ButtonTextDown btnLimpiar;
    private javax.swing.JButton btnPF11;
    private javax.swing.JButton btnPF12;
    private javax.swing.JButton btnPF13;
    private javax.swing.JButton btnPF21;
    private javax.swing.JButton btnPF22;
    private javax.swing.JButton btnPF23;
    private javax.swing.JButton btnPF31;
    private javax.swing.JButton btnPF32;
    private javax.swing.JButton btnPF33;
    private javax.swing.JButton btnPI11;
    private javax.swing.JButton btnPI12;
    private javax.swing.JButton btnPI13;
    private javax.swing.JButton btnPI21;
    private javax.swing.JButton btnPI22;
    private javax.swing.JButton btnPI23;
    private javax.swing.JButton btnPI31;
    private javax.swing.JButton btnPI32;
    private javax.swing.JButton btnPI33;
    private org.edisoncor.gui.button.ButtonTextDown btnSalir;
    private javax.swing.JComboBox<String> cbxMetodoSolucion;
    private javax.swing.JComboBox<String> jComboBox2;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblInformacion;
    private java.awt.Label lblMetodoSolucion;
    private java.awt.Label lblPuzzleFinal;
    private java.awt.Label lblPuzzleInicial;
    private java.awt.Label lblSolucion;
    private java.awt.Label lblTitle;
    private java.awt.Panel pnlContainer;
    private org.edisoncor.gui.panel.PanelNice pnlPuzzleFinal;
    private org.edisoncor.gui.panel.PanelNice pnlPuzzleInicial;
    private java.awt.Panel pnlTitle;
    private javax.swing.JTextArea txaInformacion;
    private javax.swing.JTextArea txaSolucion;
    // End of variables declaration
 
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar