This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtema.java
245 lines (208 loc) · 11.3 KB
/
tema.java
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
package youtube;
// @author rafael
import java.io.*;
import javax.swing.JOptionPane;
public class Tema extends javax.swing.JFrame {
boolean aplicar=false;
public Tema() {
initComponents();
temass.add(tema1);
temass.add(tema2);
temass.add(tema3);
temass.add(tema4);
temass.add(tema5);
temass.add(tema6);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
temass = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
t3 = new javax.swing.JLabel();
t2 = new javax.swing.JLabel();
t1 = new javax.swing.JLabel();
tema1 = new javax.swing.JRadioButton();
tema2 = new javax.swing.JRadioButton();
tema3 = new javax.swing.JRadioButton();
info = new javax.swing.JLabel();
Aplicar = new javax.swing.JButton();
tema4 = new javax.swing.JRadioButton();
t4 = new javax.swing.JLabel();
t5 = new javax.swing.JLabel();
tema5 = new javax.swing.JRadioButton();
tema6 = new javax.swing.JRadioButton();
t6 = new javax.swing.JLabel();
setTitle("Configuracion de Tema");
setResizable(false);
t3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/youtube/thumb3.png"))); // NOI18N
t2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/youtube/thumb2.jpg"))); // NOI18N
t1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/youtube/thumb1.jpg"))); // NOI18N
tema1.setText("Tema 1");
tema2.setText("Tema 2");
tema3.setText("Tema 3");
info.setText("Seleccione su tema y haga click en Aplicar");
Aplicar.setText("Aplicar");
Aplicar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AplicarActionPerformed(evt);
}
});
tema4.setText("Tema 4");
t4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/youtube/thumb4.jpg"))); // NOI18N
t5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/youtube/thumb5.jpg"))); // NOI18N
tema5.setText("Tema 5");
tema6.setText("Tema 6");
t6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/youtube/thumb6.jpg"))); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(tema1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(t1, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(tema3)
.addGap(18, 18, 18)
.addComponent(t3, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(tema2)
.addGap(18, 18, 18)
.addComponent(t2, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(40, 40, 40)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(tema5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(t5, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(tema4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(t4, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(tema6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(t6, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(48, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(info)
.addGap(160, 160, 160))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Aplicar)
.addGap(270, 270, 270))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(56, 56, 56)
.addComponent(tema1)
.addGap(102, 102, 102)
.addComponent(tema2)
.addGap(99, 99, 99)
.addComponent(tema3))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(tema4))
.addComponent(t4, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(69, 69, 69)
.addComponent(tema5)
.addGap(102, 102, 102)
.addComponent(tema6))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(t1, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(t2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(t5, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(31, 31, 31)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(t6, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(t3, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addGap(18, 18, 18)
.addComponent(info)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(Aplicar)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void AplicarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AplicarActionPerformed
if (tema1.isSelected()) {
setTema("back.jpg");
} else if (tema2.isSelected()) {
setTema("back2.jpg");
} else if (tema3.isSelected()) {
setTema("back3.jpg");
} else if (tema4.isSelected()) {
setTema("greenback.jpg");
} else if (tema5.isSelected()) {
setTema("blueback.jpg");
} else if (tema6.isSelected()) {
setTema("techback.jpg");
} else {
JOptionPane.showMessageDialog(null, "Seleccione un tema", "Información", 1);
}
if (temass.getSelection() != null) {
JOptionPane.showMessageDialog(null, "Reinicie aplicación para aplicar tema\n (Archivo -> Reiniciar Aplicación)", "Información", 1);
}
this.dispose();
}//GEN-LAST:event_AplicarActionPerformed
void setTema(String ntema){
File tema=null;
PrintStream pw=null;
try{
tema=new File("tema");
pw=new PrintStream(tema);
pw.print(ntema);
}catch(Exception e){
}
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new Tema().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Aplicar;
private javax.swing.JLabel info;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel t1;
private javax.swing.JLabel t2;
private javax.swing.JLabel t3;
private javax.swing.JLabel t4;
private javax.swing.JLabel t5;
private javax.swing.JLabel t6;
private javax.swing.JRadioButton tema1;
private javax.swing.JRadioButton tema2;
private javax.swing.JRadioButton tema3;
private javax.swing.JRadioButton tema4;
private javax.swing.JRadioButton tema5;
private javax.swing.JRadioButton tema6;
private javax.swing.ButtonGroup temass;
// End of variables declaration//GEN-END:variables
}