Settings tabs stuff
This commit is contained in:
parent
d72ce18141
commit
beaa3d6f07
@ -76,54 +76,56 @@ public class Main extends Application {
|
|||||||
|
|
||||||
Home_btn.setOnMouseClicked(event ->{
|
Home_btn.setOnMouseClicked(event ->{
|
||||||
if(!activeTab.equals(Home_btn)){
|
if(!activeTab.equals(Home_btn)){
|
||||||
updateTabSelection(Home_btn);
|
updateTabSelection(Home_btn, TabType.MAIN);
|
||||||
Tabs.switchTab("home", tab);
|
Tabs.switchTab("home", tab);
|
||||||
}
|
}
|
||||||
}); // Sets the active tab to the home tab unless it's already active
|
}); // Sets the active tab to the home tab unless it's already active
|
||||||
|
|
||||||
Modpack_btn.setOnMouseClicked(event ->{
|
Modpack_btn.setOnMouseClicked(event ->{
|
||||||
if(!activeTab.equals(Modpack_btn)){
|
if(!activeTab.equals(Modpack_btn)){
|
||||||
updateTabSelection(Modpack_btn);
|
updateTabSelection(Modpack_btn, TabType.MAIN);
|
||||||
Tabs.switchTab("modpacks", tab);
|
Tabs.switchTab("modpacks", tab);
|
||||||
if(stringUpdater!=null && stringUpdater.isAlive()) stringUpdater.cancel();
|
if(stringUpdater!=null && stringUpdater.isAlive()) stringUpdater.cancel();
|
||||||
stringUpdater = new Async(SafeReflection.getFirstMethod(Main.class, "detectStringUpdate"), Tabs.load("settings").lookup("#search-modpacks"));
|
stringUpdater = new Async(SafeReflection.getFirstMethod(Main.class, "detectStringUpdate"), Tabs.load("settings").lookup("#search-modpacks"));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Instance_btn.setOnMouseClicked(event -> {
|
Instance_btn.setOnMouseClicked(event -> {
|
||||||
if(!activeTab.equals(Instance_btn)){
|
if(!activeTab.equals(Instance_btn)){
|
||||||
updateTabSelection(Instance_btn);
|
updateTabSelection(Instance_btn, TabType.MAIN);
|
||||||
Tabs.switchTab("instance", tab);
|
Tabs.switchTab("instance", tab);
|
||||||
Tabs.load("instance").lookup("#Launch-VM").setOnMouseClicked(event1 -> {
|
Tabs.load("instance").lookup("#Launch-VM").setOnMouseClicked(event1 -> {
|
||||||
Dialog d1 = new Dialog<>();
|
|
||||||
DialogPane d2 = d1.getDialogPane();
|
|
||||||
d2.setContent(new TextArea("Launching"));
|
|
||||||
d1.show();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Settings_btn.setOnMouseClicked(event ->{
|
Settings_btn.setOnMouseClicked(event ->{
|
||||||
if(!activeTab.equals(Settings_btn)){
|
if(!activeTab.equals(Settings_btn)){
|
||||||
updateTabSelection(Settings_btn);
|
updateTabSelection(Settings_btn, TabType.MAIN);
|
||||||
Node n = Tabs.switchTab("settings", tab); // Sets the active tab to the settings tab unless it's already active
|
Node n = Tabs.switchTab("settings", tab); // Sets the active tab to the settings tab unless it's already active
|
||||||
|
|
||||||
(settings_activeTab=n.lookup("#Settings-Gen-btn")).setOnMouseClicked(event1 -> {
|
(settings_activeTab=n.lookup("#Settings-Gen-btn")).setOnMouseClicked(event1 -> {
|
||||||
// Generic Settings Sub-tab
|
// Generic Settings Sub-tab
|
||||||
if(!settings_activeTab.equals(n.lookup("#Settings-Gen-btn"))){
|
if(!settings_activeTab.getId().equals(n.lookup("#Settings-Gen-btn").getId())){
|
||||||
updateSettingsTabSelection(n.lookup("#Settings-Gen-btn"));
|
updateTabSelection(n.lookup("#Settings-Gen-btn"), TabType.SETTINGS);
|
||||||
Node genericLayout = Tabs.switchTab("settings_generic", (Pane) n.lookup("#Settings-Pane"));
|
Node genericLayout = Tabs.switchTab("settings_generic", (Pane) n.lookup("#Settings-Pane"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
n.lookup("#Settings-Mine-btn").setOnMouseClicked(event1 -> {
|
n.lookup("#Settings-Mine-btn").setOnMouseClicked(event1 -> {
|
||||||
// Minecraft Settings Sub-tab
|
// Minecraft Settings Sub-tab
|
||||||
if(!settings_activeTab.equals(n.lookup("#Settings-Mine-btn"))){
|
if(!settings_activeTab.getId().equals(n.lookup("#Settings-Mine-btn").getId())){
|
||||||
updateSettingsTabSelection(n.lookup("#Settings-Mine-btn"));
|
updateTabSelection(n.lookup("#Settings-Mine-btn"), TabType.SETTINGS);
|
||||||
Node minecraftLayout = Tabs.switchTab("settings_minecraft", (Pane) n.lookup("#Settings-Pane"));
|
Node minecraftLayout = Tabs.switchTab("settings_minecraft", (Pane) n.lookup("#Settings-Pane"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Tabs.switchTab("settings_generic", (Pane) n.lookup("#Settings-Pane"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -143,9 +145,7 @@ public class Main extends Application {
|
|||||||
icon.setImage(appIcon);
|
icon.setImage(appIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) { launch(args); }
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for packs with an 80% match compared to detected string.
|
* Search for packs with an 80% match compared to detected string.
|
||||||
@ -157,19 +157,25 @@ public class Main extends Application {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTabSelection(Node newTab){
|
void updateTabSelection(Node newTab, TabType t){
|
||||||
activeTab.getStyleClass().remove("selected");
|
Node n = t==TabType.MAIN?activeTab:settings_activeTab;
|
||||||
activeTab.getStyleClass().add("tab");
|
n.getStyleClass().remove("selected");
|
||||||
activeTab = newTab;
|
n.getStyleClass().add("tab");
|
||||||
activeTab.getStyleClass().remove("tab");
|
if(t==TabType.MAIN) activeTab = newTab;
|
||||||
activeTab.getStyleClass().add("selected");
|
else settings_activeTab = newTab;
|
||||||
|
newTab.getStyleClass().remove("tab");
|
||||||
|
newTab.getStyleClass().add("selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateSettingsTabSelection(Node newTab){
|
|
||||||
settings_activeTab.getStyleClass().remove("selected");
|
|
||||||
settings_activeTab.getStyleClass().add("tab");
|
|
||||||
settings_activeTab = newTab;
|
|
||||||
settings_activeTab.getStyleClass().remove("tab");
|
|
||||||
settings_activeTab.getStyleClass().add("selected");
|
|
||||||
|
|
||||||
|
|
||||||
|
public enum TabType{
|
||||||
|
SETTINGS, MAIN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user