When I use JLabel.setBackground(Color);
it simply gives a visual bug.
Layout:
quarto1 = new JPanel();
quarto1.setBounds(10, 11, 158, 82);
frame.getContentPane().add(quarto1);
quarto1.setLayout(null);
JButton novoB = new JButton("");
novoB.setIcon(new ImageIcon(layout.class.getResource("/imagens/novo.png")));
novoB.setBorderPainted(false);
novoB.setBounds(10, 48, 30, 30);
quarto1.add(novoB);
JButton editarB = new JButton("");
editarB.setIcon(new ImageIcon(layout.class.getResource("/imagens/editar.png")));
editarB.setBorderPainted(false);
editarB.setBounds(118, 48, 30, 30);
quarto1.add(editarB);
frame.repaint();
Code:
insira o código aquistatic Color ocupado = new Color(252, 36, 36, 140);
static Color livre = new Color(70, 250, 34, 140);
static Color sujo = new Color(251, 117, 9, 140);
public static void setRoomState(JPanel quarto, Color state)
{
quarto.setBackground(state);
System.out.println(quarto.getComponent(1).getName().toString());
}
Bug: