use of main.gui.sub.TaskComponent.TASK_COMMAND in project Eidolons by IDemiurge.
the class TaskComponent method addButtons.
private void addButtons() {
int i = 0;
int wrap = getPanelHeight() / getButtonMaxHeight();
String pos = "";
int x = 0;
int y = 0;
int width = getButtonMaxWidth();
int height = getButtonMaxHeight();
for (TASK_COMMAND cmd : TASK_COMMAND.values()) {
if (!task.checkCommandShown(cmd)) {
continue;
}
Image image = cmd.getImage();
if (image == null) {
image = ImageManager.getEmptyItemIcon(true).getImage();
}
CustomButton btn = new ActionButtonEnum<>(null, image, cmd, this);
i++;
y += height;
if (i >= wrap) {
y = 0;
x += width;
pos = "pos " + x + " " + y;
}
mouseMap.put(new Rectangle(x, y, image.getWidth(null), image.getHeight(null)), cmd);
buttonPanel.add(btn, pos);
}
}
Aggregations