Hey guys! So, I created this form, but I can't seem to add color to it. I'm trying to make it color red. I've been trying to change the color for 2 days cuz I'm a noob :)
Thanks guys! Here's code by the way:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Login extends JFrame implements ActionListener{
private JTextField jcomp1;
private JLabel jcomp2;
private JPasswordField jcomp3;
private JLabel jcomp4;
private JButton jcomp5;
private JLabel jcomp6;
private JPanel login = new JPanel();
public Login() {
jcomp1 = new JTextField (10);
jcomp2 = new JLabel ("Username:");
jcomp3 = new JPasswordField (10);
jcomp4 = new JLabel ("Password:");
jcomp5 = new JButton ("Log in");
jcomp6 = new JLabel ("Shirley's Coffee Shop");
setPreferredSize (new Dimension (624, 413));
setLayout (null);
add (jcomp1);
add (jcomp2);
add (jcomp3);
add (jcomp4);
add (jcomp5);
add (jcomp6);
jcomp1.setBounds (285, 135, 100, 25);
jcomp2.setBounds (215, 135, 100, 25);
jcomp3.setBounds (285, 175, 100, 25);
jcomp4.setBounds (215, 175, 100, 25);
jcomp5.setBounds (285, 265, 100, 25);
jcomp6.setBounds (265, 60, 145, 30);
getContentPane().add (login);
jcomp5.addActionListener(this);
}
public static void main (String[] args) {
Login frame = new Login();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(0,0,800,800);
frame.setResizable(false);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==jcomp5) {
MainMenGra mainMenuG;
mainMenuG = new MainMenGra();
setVisible(false);
}
}
}