use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.
the class TabBuilder method getTree.
public JTree getTree() {
JTree tree;
if (top) {
if (getTabbedPane().getSelectedIndex() >= builderArray.length) {
G_Panel tabComp = (G_Panel) getTabbedPane().getSelectedComponent();
tree = (JTree) tabComp.getComponent(0);
} else {
tree = ((TabBuilder) builderArray[getTabbedPane().getSelectedIndex()]).getTree();
}
} else {
int index = getTabbedPane().getSelectedIndex();
TreeViewBuilder selectedTree = ((TreeViewBuilder) builderArray[index]);
tree = selectedTree.getTree();
}
if (tree == null) {
Err.info("NULL TREE OBJECT!");
}
return tree;
}
use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.
the class LE_MapViewComp method addLevel.
public void addLevel(Level level) {
if (mission == null) {
levels.add(level);
} else {
mission.addLevel(level);
}
G_Panel panel = new G_Panel();
panel.setKeyManager(mainPanel.getKeyManager());
panel.addKeyListener(mainPanel.getKeyManager());
panel.setPanelSize(SIZE);
tabs.addTab(level.getName(), level.getDungeon().getImagePath(), panel);
// TODO support tab sort/swap
try {
tabs.selectLast();
// tabSelected(tabs.getTabs().size() - 1);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.
the class LE_Palette method refresh.
public void refresh() {
if (workspaceControlTab == null) {
workspaceControlTab = new G_Panel(VISUALS.H_LIST_2_8);
workspaceControlTab.setLayout(new MigLayout("fill, insets 5 2 20 0"));
CustomButton newButton = new CustomButton("New") {
public void handleClick() {
newPalette();
}
};
workspaceControlTab.add(newButton);
CustomButton addButton = new CustomButton("Add") {
public void handleClick() {
addWorkspaces();
}
};
workspaceControlTab.add(addButton);
CustomButton deleteButton = new CustomButton("Delete") {
public void handleClick() {
deletePalettes(false);
}
public void handleAltClick() {
deletePalettes(true);
}
};
workspaceControlTab.add(deleteButton);
paletteTabs.addTab(// PAGE_SIZE - 1, "Custom",
"Custom", workspaceControlTab);
}
paletteTabs.refresh();
}
use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.
the class ListButtonPanel method refresh.
@Override
public void refresh() {
removeAll();
int n = 0;
int i = 0;
for (final String chars : map.keySet()) {
List<String> lines = map.get(chars);
lines = panel.sort(lines, chars);
int wrap = customWrap;
if (wrap != 0) {
wrap += Math.min(2, Math.abs(Math.round((wrap * 10 - lines.size()) / 10)));
TextComp comp = new TextComp(StringMaster.getWellFormattedString(musicConsts.get(i)), Color.black) {
@Override
public int getPanelHeight() {
return super.getPanelHeight() / 3 * 2;
}
@Override
protected int getDefaultFontSize() {
return 15;
}
};
add(comp, "x @center_x");
if (i == 0) {
add(comp, "x @center_x");
}
i++;
}
G_Panel subPanel = new G_Panel("flowy");
if (wrap == 0) {
subPanel.setPanelSize(new Dimension(GuiManager.getScreenWidthInt(), GuiManager.getScreenHeightInt() / map.keySet().size()));
add(subPanel);
} else {
add(subPanel, "w " + GuiManager.getScreenWidthInt());
}
Character lastLetter = null;
boolean letterAdded = false;
for (String line : lines) {
try {
char letter = AHK_Master.getLetter(line);
n = addButton(wrap, n, subPanel, lastLetter, letterAdded, line, letter);
lastLetter = letter;
letterAdded = n == 0;
} catch (Exception e) {
LogMaster.log(1, "failed: " + line);
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
}
use of main.swing.generic.components.G_Panel in project Eidolons by IDemiurge.
the class MC_ControlPanel method addBox.
private void addBox(JComboBox<?> box, String tooltip, boolean wrap) {
box.addActionListener(this);
G_Panel wrapper = SwingMaster.decorateWithText(tooltip, Color.black, box, "pos 0 20");
boxPanel.add(wrapper, (wrap ? "wrap" : ""));
}
Aggregations