Campos_Color
package Repaso;
import java.awt.Color;
import java.awt.Font;
@SuppressWarnings("serial")
public class Campos_Color extends javax.swing.JFrame {
//VARIABLE PARA DEFINIR 10 CAMPOS DE TEXTO
javax.swing.JTextField mensaje, mensaje1, mensaje2, mensaje3,mensaje4, mensaje5, mensaje6, mensaje7, mensaje8, mensaje9;
public Campos_Color() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(700,500);
setTitle("Campos De Texto");
Font f1 = new Font("Comic Sans MS", Font.BOLD, 15);
//DEFINICION DE LAS ETIQUETAS
mensaje = new javax.swing.JTextField();
mensaje1 = new javax.swing.JTextField();
mensaje2 = new javax.swing.JTextField();
mensaje3 = new javax.swing.JTextField();
mensaje4 = new javax.swing.JTextField();
mensaje5 = new javax.swing.JTextField();
mensaje6 = new javax.swing.JTextField();
mensaje7 = new javax.swing.JTextField();
mensaje8 = new javax.swing.JTextField();
mensaje9 = new javax.swing.JTextField();
//SE DETERMINA QUE LLEVARA LA VENTANA
getContentPane().setLayout(null);
mensaje.setText("Hola, de nuevo \"Buenos dias\" o buenas tardes");
getContentPane().add(mensaje);
mensaje1.setText("Recuerda que ahora\"Soy un campo de texto\",");
getContentPane().add(mensaje1);
mensaje2.setText("No olvides, Que soy simila a una etiqueta");
getContentPane().add(mensaje2);
mensaje3.setText("La diferencia es que puedes escribir y borrar,");
getContentPane().add(mensaje3);
mensaje4.setText("Lo que quieras igual que con las etiquetas");
getContentPane().add(mensaje4);
mensaje5.setText("No importa cuantas lineas seamos \'Lo que importa\'");
getContentPane().add(mensaje5);
mensaje6.setText("Es saber cuanto mide la ventana y colocarnos");
getContentPane().add(mensaje6);
mensaje7.setText("\"Dentro de los parametros permitidos\" Recordando como referencia,");
getContentPane().add(mensaje7);
mensaje8.setText("El punto Inicial (Columna y fila, ancho y largo)");
getContentPane().add(mensaje8);
mensaje9.setText("Medido en pixeles 800x600 o 1024x768 \"Hasta la próxima");
getContentPane().add(mensaje9);
//SE LLAMAN LOS ELEMENTOS Y SE LE PROPORCIONANA LA POSICION Y EL ANCHO (COLUMNAS) Y LARGO(FILAS)
mensaje.setBounds(20,10,500,20);
mensaje1.setBounds(20,50,500,20);
mensaje2.setBounds(20,90,500,20);
mensaje3.setBounds(80,130,500,20);
mensaje4.setBounds(80,170,500,20);
mensaje5.setBounds(80,210,500,20);
mensaje6.setBounds(140,250,500,20);
mensaje7.setBounds(140,290,500,20);
mensaje8.setBounds(140,330,500,20);
mensaje9.setBounds(140,370,500,20);
getContentPane().setBackground(Color.lightGray);
mensaje.setBackground(Color.gray);
mensaje1.setBackground(Color.gray);
mensaje2.setBackground(Color.gray);
mensaje3.setBackground(Color.gray);
mensaje4.setBackground(Color.gray);
mensaje5.setBackground(Color.gray);
mensaje6.setBackground(Color.gray);
mensaje7.setBackground(Color.gray);
mensaje8.setBackground(Color.gray);
mensaje9.setBackground(Color.gray);
mensaje.setForeground(Color.GREEN);
mensaje1.setForeground(Color.GREEN);
mensaje2.setForeground(Color.GREEN);
mensaje3.setForeground(Color.GREEN);
mensaje4.setForeground(Color.GREEN);
mensaje5.setForeground(Color.GREEN);
mensaje6.setForeground(Color.GREEN);
mensaje7.setForeground(Color.GREEN);
mensaje8.setForeground(Color.GREEN);
mensaje9.setForeground(Color.GREEN);
mensaje.setFont(f1);
mensaje1.setFont(f1);
mensaje2.setFont(f1);
mensaje3.setFont(f1);
mensaje4.setFont(f1);
mensaje5.setFont(f1);
mensaje6.setFont(f1);
mensaje7.setFont(f1);
mensaje8.setFont(f1);
mensaje9.setFont(f1);
}
public static void main(String[] args) {
new Campos_Color().setVisible(true);
}
}