Skip to content

Commit 2388b71

Browse files
committed
Versión 1.2 del programa
1 parent ce56383 commit 2388b71

File tree

5 files changed

+251
-6
lines changed

5 files changed

+251
-6
lines changed

src/codekonami/AboutDialog.form

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
4+
<Properties>
5+
<Property name="defaultCloseOperation" type="int" value="2"/>
6+
<Property name="title" type="java.lang.String" value="Acerca de"/>
7+
</Properties>
8+
<SyntheticProperties>
9+
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
10+
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
11+
</SyntheticProperties>
12+
<AuxValues>
13+
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
14+
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
15+
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
16+
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
17+
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
18+
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
19+
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
20+
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
21+
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
22+
</AuxValues>
23+
24+
<Layout>
25+
<DimensionLayout dim="0">
26+
<Group type="103" groupAlignment="0" attributes="0">
27+
<Group type="102" alignment="0" attributes="0">
28+
<EmptySpace max="32767" attributes="0"/>
29+
<Component id="jPnlMain" max="32767" attributes="0"/>
30+
<EmptySpace max="32767" attributes="0"/>
31+
</Group>
32+
</Group>
33+
</DimensionLayout>
34+
<DimensionLayout dim="1">
35+
<Group type="103" groupAlignment="0" attributes="0">
36+
<Group type="102" alignment="0" attributes="0">
37+
<EmptySpace max="32767" attributes="0"/>
38+
<Component id="jPnlMain" max="32767" attributes="0"/>
39+
<EmptySpace max="32767" attributes="0"/>
40+
</Group>
41+
</Group>
42+
</DimensionLayout>
43+
</Layout>
44+
<SubComponents>
45+
<Container class="javax.swing.JPanel" name="jPnlMain">
46+
47+
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
48+
<Property name="columns" type="int" value="0"/>
49+
<Property name="rows" type="int" value="4"/>
50+
</Layout>
51+
<SubComponents>
52+
<Component class="javax.swing.JLabel" name="jLblTItle">
53+
<Properties>
54+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
55+
<Font name="Dialog" size="24" style="1"/>
56+
</Property>
57+
<Property name="horizontalAlignment" type="int" value="0"/>
58+
<Property name="text" type="java.lang.String" value="Code Konami"/>
59+
</Properties>
60+
</Component>
61+
<Component class="javax.swing.JLabel" name="jLblVersion">
62+
<Properties>
63+
<Property name="horizontalAlignment" type="int" value="0"/>
64+
<Property name="text" type="java.lang.String" value="Versi&#xf3;n 1.2 - 4 de octubre de 2023"/>
65+
</Properties>
66+
</Component>
67+
<Component class="javax.swing.JLabel" name="jLblDescription">
68+
<Properties>
69+
<Property name="text" type="java.lang.String" value="Es un programa escrito en Java que prueba un c&#xf3;digo konami"/>
70+
</Properties>
71+
</Component>
72+
<Component class="javax.swing.JLabel" name="jLblAuthor">
73+
<Properties>
74+
<Property name="horizontalAlignment" type="int" value="0"/>
75+
<Property name="text" type="java.lang.String" value="Autor: SrUsuario"/>
76+
</Properties>
77+
</Component>
78+
</SubComponents>
79+
</Container>
80+
</SubComponents>
81+
</Form>

src/codekonami/AboutDialog.java

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package codekonami;
2+
3+
/**
4+
*
5+
* Interfaz gráfica de Acerca de
6+
*
7+
* @author SrUsuario
8+
*/
9+
public class AboutDialog extends javax.swing.JDialog {
10+
11+
/**
12+
* Creates new form AboutDialog
13+
*
14+
* @param parent owner the Frame from which the dialog is displayed
15+
* @param modal specifies whether dialog blocks user input to other
16+
* top-level
17+
*/
18+
public AboutDialog(java.awt.Frame parent, boolean modal) {
19+
super(parent, modal);
20+
initComponents();
21+
setLocationRelativeTo(null);
22+
}
23+
24+
/**
25+
* This method is called from within the constructor to initialize the form.
26+
* WARNING: Do NOT modify this code. The content of this method is always
27+
* regenerated by the Form Editor.
28+
*/
29+
@SuppressWarnings("unchecked")
30+
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
31+
private void initComponents() {
32+
33+
jPnlMain = new javax.swing.JPanel();
34+
jLblTItle = new javax.swing.JLabel();
35+
jLblVersion = new javax.swing.JLabel();
36+
jLblDescription = new javax.swing.JLabel();
37+
jLblAuthor = new javax.swing.JLabel();
38+
39+
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
40+
setTitle("Acerca de");
41+
42+
jPnlMain.setLayout(new java.awt.GridLayout(4, 0));
43+
44+
jLblTItle.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
45+
jLblTItle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
46+
jLblTItle.setText("Code Konami");
47+
jPnlMain.add(jLblTItle);
48+
49+
jLblVersion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
50+
jLblVersion.setText("Versión 1.2 - 4 de octubre de 2023");
51+
jPnlMain.add(jLblVersion);
52+
53+
jLblDescription.setText("Es un programa escrito en Java que prueba un código konami");
54+
jPnlMain.add(jLblDescription);
55+
56+
jLblAuthor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
57+
jLblAuthor.setText("Autor: SrUsuario");
58+
jPnlMain.add(jLblAuthor);
59+
60+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
61+
getContentPane().setLayout(layout);
62+
layout.setHorizontalGroup(
63+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
64+
.addGroup(layout.createSequentialGroup()
65+
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
66+
.addComponent(jPnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
67+
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
68+
);
69+
layout.setVerticalGroup(
70+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
71+
.addGroup(layout.createSequentialGroup()
72+
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
73+
.addComponent(jPnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
74+
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
75+
);
76+
77+
pack();
78+
}// </editor-fold>//GEN-END:initComponents
79+
80+
// Variables declaration - do not modify//GEN-BEGIN:variables
81+
private javax.swing.JLabel jLblAuthor;
82+
private javax.swing.JLabel jLblDescription;
83+
private javax.swing.JLabel jLblTItle;
84+
private javax.swing.JLabel jLblVersion;
85+
private javax.swing.JPanel jPnlMain;
86+
// End of variables declaration//GEN-END:variables
87+
}

src/codekonami/CodeKonami.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public class CodeKonami {
3434
*/
3535
private boolean flagVerify = false;
3636
/**
37-
* Cada 4 segundos llama al método verify()
37+
* Cada milisegundo llama al método verify()
3838
*/
39-
private Timer timerKonami = new Timer(4000, new ActionListener() {
39+
private Timer timerKonami = new Timer(0, new ActionListener() {
4040
@Override
4141
public void actionPerformed(ActionEvent e) {
4242
verify();
@@ -96,11 +96,8 @@ private void verify() {
9696
&& arrayKonami.get(i + 9) == KeyEvent.VK_A) {
9797
flagVerify = true;
9898
konami();
99-
return;
10099
} else {
101100
flagVerify = false;
102-
remove();
103-
return;
104101
}
105102
}
106103
}
@@ -111,6 +108,7 @@ private void verify() {
111108
private void konami() {
112109
frame.getjLblInformation().setText("Enhorabuena, has activado el Code Konami");
113110
frame.getjBtnKonami().setVisible(true);
111+
remove();
114112
}
115113

116114
/**

src/codekonami/codeKonamiFrame.form

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,52 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22

33
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
4+
<NonVisualComponents>
5+
<Menu class="javax.swing.JMenuBar" name="jMBar">
6+
<SubComponents>
7+
<Menu class="javax.swing.JMenu" name="jMnu">
8+
<Properties>
9+
<Property name="text" type="java.lang.String" value="Menu"/>
10+
</Properties>
11+
<SubComponents>
12+
<MenuItem class="javax.swing.JMenuItem" name="AboutJMnuItem">
13+
<Properties>
14+
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
15+
<KeyStroke key="Ctrl+H"/>
16+
</Property>
17+
<Property name="text" type="java.lang.String" value="Acerca de"/>
18+
</Properties>
19+
<Events>
20+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="AboutJMnuItemActionPerformed"/>
21+
</Events>
22+
</MenuItem>
23+
<MenuItem class="javax.swing.JMenuItem" name="ExitJMnuItem">
24+
<Properties>
25+
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
26+
<KeyStroke key="Ctrl+P"/>
27+
</Property>
28+
<Property name="text" type="java.lang.String" value="Salir"/>
29+
</Properties>
30+
<Events>
31+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ExitJMnuItemActionPerformed"/>
32+
</Events>
33+
</MenuItem>
34+
</SubComponents>
35+
</Menu>
36+
</SubComponents>
37+
</Menu>
38+
</NonVisualComponents>
439
<Properties>
540
<Property name="defaultCloseOperation" type="int" value="3"/>
641
<Property name="title" type="java.lang.String" value="CodeKonami"/>
742
<Property name="location" type="java.awt.Point" editor="org.netbeans.beaninfo.editors.PointEditor">
843
<Point value="[0, 0]"/>
944
</Property>
1045
<Property name="name" type="java.lang.String" value="frame" noResource="true"/>
46+
<Property name="resizable" type="boolean" value="false"/>
1147
</Properties>
1248
<SyntheticProperties>
49+
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMBar"/>
1350
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
1451
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
1552
</SyntheticProperties>

src/codekonami/codeKonamiFrame.java

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,16 @@ private void initComponents() {
5555
jBtnKonami = new javax.swing.JButton();
5656
jPnlInformation = new javax.swing.JPanel();
5757
jLblKeys = new javax.swing.JLabel();
58+
jMBar = new javax.swing.JMenuBar();
59+
jMnu = new javax.swing.JMenu();
60+
AboutJMnuItem = new javax.swing.JMenuItem();
61+
ExitJMnuItem = new javax.swing.JMenuItem();
5862

5963
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
6064
setTitle("CodeKonami");
6165
setLocation(new java.awt.Point(0, 0));
6266
setName("frame"); // NOI18N
67+
setResizable(false);
6368

6469
jPnlMain.setFocusable(false);
6570
jPnlMain.setLayout(new java.awt.GridLayout(3, 1));
@@ -94,12 +99,36 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
9499
});
95100
jPnlMain.add(jBtnKonami);
96101

97-
jPnlInformation.setLayout(new java.awt.GridLayout());
102+
jPnlInformation.setLayout(new java.awt.GridLayout(1, 0));
98103

99104
jLblKeys.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
100105
jLblKeys.setText("Combinación: Up, up, down, down, left, right, left, right, B, A");
101106
jPnlInformation.add(jLblKeys);
102107

108+
jMnu.setText("Menu");
109+
110+
AboutJMnuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_DOWN_MASK));
111+
AboutJMnuItem.setText("Acerca de");
112+
AboutJMnuItem.addActionListener(new java.awt.event.ActionListener() {
113+
public void actionPerformed(java.awt.event.ActionEvent evt) {
114+
AboutJMnuItemActionPerformed(evt);
115+
}
116+
});
117+
jMnu.add(AboutJMnuItem);
118+
119+
ExitJMnuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_DOWN_MASK));
120+
ExitJMnuItem.setText("Salir");
121+
ExitJMnuItem.addActionListener(new java.awt.event.ActionListener() {
122+
public void actionPerformed(java.awt.event.ActionEvent evt) {
123+
ExitJMnuItemActionPerformed(evt);
124+
}
125+
});
126+
jMnu.add(ExitJMnuItem);
127+
128+
jMBar.add(jMnu);
129+
130+
setJMenuBar(jMBar);
131+
103132
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
104133
getContentPane().setLayout(layout);
105134
layout.setHorizontalGroup(
@@ -133,11 +162,24 @@ private void jBtnAlwaysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
133162
jLblKeys.setVisible(true);
134163
}//GEN-LAST:event_jBtnAlwaysActionPerformed
135164

165+
private void ExitJMnuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitJMnuItemActionPerformed
166+
System.exit(0);
167+
}//GEN-LAST:event_ExitJMnuItemActionPerformed
168+
169+
private void AboutJMnuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AboutJMnuItemActionPerformed
170+
AboutDialog dialog = new AboutDialog(this, true);
171+
dialog.setVisible(true);
172+
}//GEN-LAST:event_AboutJMnuItemActionPerformed
173+
136174
// Variables declaration - do not modify//GEN-BEGIN:variables
175+
private javax.swing.JMenuItem AboutJMnuItem;
176+
private javax.swing.JMenuItem ExitJMnuItem;
137177
private javax.swing.JButton jBtnAlways;
138178
private javax.swing.JButton jBtnKonami;
139179
private javax.swing.JLabel jLblInformation;
140180
private javax.swing.JLabel jLblKeys;
181+
private javax.swing.JMenuBar jMBar;
182+
private javax.swing.JMenu jMnu;
141183
private javax.swing.JPanel jPnlInformation;
142184
private javax.swing.JPanel jPnlMain;
143185
// End of variables declaration//GEN-END:variables

0 commit comments

Comments
 (0)