
alguien me dice como agregar imagen de fondo en java si el programa esta echo en blog de notas
Publicado por oscar (1 intervención) el 26/12/2014 23:56:27
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
import javax.swing.*;
import java.awt.event.*;
public class compra extends JFrame
{
JTextField txtcedula = new JTextField();
JButton bagregar = new JButton();
JButton beditar = new JButton();
JButton bborrar = new JButton();
JButton bgrabar = new JButton();
JButton bcancelar = new JButton();
JButton bsalir = new JButton();
//////////////
JLabel Ltitulo = new JLabel();
JLabel Lproveedor = new JLabel();
JLabel Lruc = new JLabel();
JLabel Ltelefono = new JLabel();
JLabel Lfecha = new JLabel();
JLabel Lproducto = new JLabel();
JLabel Lcodigo = new JLabel();
///////////////
JTextField txtproveedor = new JTextField();
JTextField txtruc = new JTextField();
JTextField txttelefono = new JTextField();
JTextField txtfecha = new JTextField();
JTextField txtproducto = new JTextField();
JTextField txtcodigo = new JTextField();
public static void main(String args[])
{
new compra();
}
public compra()
{
//////////////
bagregar.setText("Agregar");
bagregar.setSize(90,20);
bagregar.setLocation(400,10);
bagregar.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
hab_text();
des_botones();
txtproveedor.requestFocus();
}
});
beditar.setText("Editar");
beditar.setSize(90,20);
beditar.setLocation(400,40);
bborrar.setText("Borrar");
bborrar.setSize(90,20);
bborrar.setLocation(400,70);
bgrabar.setText("Grabar");
bgrabar.setSize(90,20);
bgrabar.setLocation(400,100);
bgrabar.setEnabled(false);
bcancelar.setText("Cancelar");
bcancelar.setSize(90,20);
bcancelar.setLocation(400,130);
bcancelar.setEnabled(false);
bcancelar.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
des_text();
hab_botones();
clear_text();
}
});
bsalir.setText("Salir");
bsalir.setSize(90,20);
bsalir.setLocation(400,160);
Ltitulo.setText("compras");//contenido
Ltitulo.setSize(200,50); // largo, alto
Ltitulo.setLocation(120,1); //col, fila
Lproveedor.setText("PROVEEDOR: ");//contenido
Lproveedor.setSize(200,100); // largo, alto
Lproveedor.setLocation(40,10); //col, fila
Lruc.setText("RUC: ");//contenido
Lruc.setSize(200,100); // largo, alto
Lruc.setLocation(40,40); //col, fila
Ltelefono.setText("TELEFONO: ");//contenido
Ltelefono.setSize(200,100); // largo, alto
Ltelefono.setLocation(40,70); //col, fila
Lfecha.setText("FECHA: ");//contenido
Lfecha.setSize(200,100); // largo, alto
Lfecha.setLocation(40,100); //col, fila
Lproducto.setText("PRODUCTO: ");//contenido
Lproducto.setSize(200,110); // largo, alto
Lproducto.setLocation(40,130); //col, fila
txtproveedor.setText("");
txtproveedor.setSize(100,20);
txtproveedor.setLocation(100,50);
txtproveedor.setEnabled(false);
txtruc.setText("");
txtruc.setSize(200,20);
txtruc.setLocation(100,80);
txtruc.setEnabled(false);
txttelefono.setText("");
txttelefono.setSize(200,20);
txttelefono.setLocation(100,110);
txttelefono.setEnabled(false);
txtfecha.setText("");
txtfecha.setSize(250,20);
txtfecha.setLocation(100,140);
txtfecha.setEnabled(false);
txtproducto.setText("");
txtproducto.setSize(100,20);
txtproducto.setLocation(100,175);
txtproducto.setEnabled(false);
txtcodigo.setText("");
txtcodigo.setSize(100,20);
txtcodigo.setLocation(100,175);
txtcodigo.setEnabled(false);
this.setLayout(null);//ESPECIFICA COMO SE ORDENAN LOS OBJETOS
this.add(bagregar);
this.add(beditar);
this.add(bborrar);
this.add(bgrabar);
this.add(bcancelar);
this.add(bsalir);
this.add(Ltitulo);
this.add(Lproveedor);
this.add(Lruc);
this.add(Ltelefono);
this.add(Lfecha);
this.add(Lproducto);
this.add(Lcodigo);
this.add(txtproveedor);
this.add(txtruc);
this.add(txttelefono);
this.add(txtfecha);
this.add(txtproducto);
this.add(txtcodigo);
setTitle("COMPRAS"); //metodo para poner el titulo
setSize(600,300);//metodo para tamaño fijo de la ventana
setLocation(70,150);//col,fil
setVisible(true); //metodo para poner a vista la ventana
}
private void hab_text()
{
txtproveedor.setEnabled(true);
txtruc.setEnabled(true);
txttelefono.setEnabled(true);
txtfecha.setEnabled(true);
txttproducto.setEnabled(true);
txtcodigo.setEnabled(true);
}
private void des_text()
{
txtproveedor.setEnabled(false);
txruc.setEnabled(false);
txttelefono.setEnabled(false);
txtfecha.setEnabled(false);
txtproducto.setEnabled(false);
txtcodigo.setEnabled(true);
}
private void clear_text()
{
txtproveedor.setText("");
txtruc.setText("");
txttelefono.setText("");
txtfecha.setText("");
txtproducto.setText("");
txtcodigo.setText("");
}
private void des_botones()
{
bagregar.setEnabled(false);
beditar.setEnabled(false);
bborrar.setEnabled(false);
bcancelar.setEnabled(true);
bgrabar.setEnabled(true);
bsalir.setEnabled(false);
}
private void hab_botones()
{
bagregar.setEnabled(true);
beditar.setEnabled(true);
bborrar.setEnabled(true);
bcancelar.setEnabled(false);
bgrabar.setEnabled(false);
bsalir.setEnabled(true);
}
}
Valora esta pregunta


0