30 lines
789 B
Java
30 lines
789 B
Java
|
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);
|
||
|
}
|
||
|
}
|