Académique Documents
Professionnel Documents
Culture Documents
Clase principal
package Mis_applets;
{
Ventana v1= new Ventana();
v1.setVisible(true);
}
}
package Mis_applets;
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
this.setSize(500,500);
setTitle("Curso Sena Aplicacion Java");
//setLocation(500,500);
setLocationRelativeTo(null);
//this.getContentPane().setBackground(Color.BLUE);
setDefaultCloseOperation(EXIT_ON_CLOSE);
IniciarComponentes();
ColocarBotones();
TextArea ();
}
{
panel= new JPanel ();
panel.setLayout(null);
panel.setBackground(Color.lightGray);
this.getContentPane().add(panel);
JLabel etiqueta =new JLabel("Actividad 3.4");
etiqueta.setBounds(10, 10, 120, 40);
etiqueta.setForeground(Color.WHITE);
etiqueta.setOpaque(true);
etiqueta.setBackground(Color.GRAY);
etiqueta.setFont(new Font("times new roman",Font.ITALIC,20));
panel.add(etiqueta);
panel.add(areatexto);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (e.getSource()==boton1)
{
areatexto.setText("azul y rojo");
areatexto.setEditable(true);
areatexto.setBackground(Color.blue);
areatexto.setForeground(Color.RED);
areatexto.setFont(new Font("times new
roman",Font.ITALIC,40));
System.out.println("El texto es "+ areatexto.getText());
areatexto.setText("blanco");
areatexto.setEditable(true);
areatexto.setBackground(Color.white);
areatexto.setForeground(Color.black);
areatexto.setFont(new Font("times new
roman",Font.ITALIC,40));
System.out.println("El texto es "+ areatexto.getText());
}
}