APL/APL2.1/TP06/Nuancier/Nuance.java

30 lines
789 B
Java
Raw Normal View History

2022-03-07 17:26:31 +01:00
import java.awt.*;
import javax.swing.*;
public class Nuance extends Panel {
private Panel tagBox;
private Label colorTag;
private Color color;
private void createNuance(String colorCode) {
tagBox = new Panel();
tagBox.setBackground(Color.BLACK);
tagBox.setSize(new Dimension(getWidth(), 20));
color = Color.decode(colorCode);
this.setBackground(color);
this.add(tagBox);
}
public Nuance(String colorCode) {
super();
setPreferredSize(new Dimension(100, 100));
createNuance(colorCode);
}
public Nuance(String colorCode, int x, int y) {
super();
setPreferredSize(new Dimension(100, 100));
setSize(new Dimension(x, y));
createNuance(colorCode);
}
}