Skip to content

Commit

Permalink
update laf
Browse files Browse the repository at this point in the history
  • Loading branch information
WearBlackAllDay committed Oct 13, 2022
1 parent 964fbe4 commit 046fc6c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ repositories {
dependencies {
implementation("com.seedfinding:mc_core:1.0.0") {transitive(false)}
implementation("com.seedfinding:mc_biome:1.0.0") {transitive(false)}
implementation("com.seedfinding:mc_reversal:2.0.0") {transitive(false)}
implementation("com.seedfinding:mc_reversal:1.171.1") {transitive(false)}
implementation("com.seedfinding:mc_seed:1.0.0") {transitive(false)}
implementation("com.seedfinding:mc_math:1.0.0") {transitive(false)}
implementation("com.seedfinding:mc_feature:1.0.0") {transitive(false)}
implementation("com.seedfinding:mc_noise:1.0.0") {transitive(false)}
implementation("com.seedfinding:latticg:1.06") {transitive(false)}

implementation "com.github.Wearblackallday:Javautils:bd48987e5f4d714d2e0cd267fea23970fd5e4776"
implementation "com.formdev:flatlaf:2.4"
implementation "com.formdev:flatlaf-intellij-themes:2.4"
implementation 'com.formdev:flatlaf:2.5'
implementation 'com.formdev:flatlaf-intellij-themes:2.5'
}

application {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/wearblackallday/seedcandy/SeedCandy.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private JMenuBar createMenuBar() {

return new LMenuBar()
.addMenu(this.version.name, versionMenu ->
Factory.addSelection(versionMenu, SUPPORTED_VERSIONS, Factory::shortVersionName, this.version::equals, version -> {
Factory.selectionGroup(versionMenu, SUPPORTED_VERSIONS, Factory::shortVersionName, this.version::equals, version -> {
this.setVersion(version);
versionMenu.setText(Factory.shortVersionName(version));
}))
Expand All @@ -89,11 +89,11 @@ private JMenuBar createMenuBar() {
.addMenu("Theme", themeMenu -> themeMenu
.subMenu("dark", darkThemes -> {
darkThemes.getPopupMenu().setLayout(new GridLayout(0, 2));
Factory.addSelection(darkThemes, themes.get(true), FlatIJLookAndFeelInfo::getName,
Factory.selectionGroup(darkThemes, themes.get(true), FlatIJLookAndFeelInfo::getName,
info -> info.getClassName().equals(this.getTheme().className()),
info -> this.setTheme(info::getClassName));
})
.subMenu("light", lightThemes -> Factory.addSelection(lightThemes, themes.get(false), FlatIJLookAndFeelInfo::getName,
.subMenu("light", lightThemes -> Factory.selectionGroup(lightThemes, themes.get(false), FlatIJLookAndFeelInfo::getName,
info -> info.getClassName().equals(this.getTheme().className()),
info -> this.setTheme(info::getClassName)))
);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wearblackallday/seedcandy/util/Factory.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public static JSpinner numberSelector(String tooltip) {
return spinner;
}

public static <T> void addSelection(JMenu menu, Collection<T> options, Function<T, String> buttonName, Predicate<T> selectCondition, Consumer<T> onSelected) {
public static <T> void selectionGroup(JMenu parentMenu, Collection<T> options, Function<T, String> buttonName, Predicate<T> selectCondition, Consumer<T> onSelected) {
ButtonGroup buttonGroup = new ButtonGroup();
for(T option : options) {
JRadioButtonMenuItem button = new JRadioButtonMenuItem(buttonName.apply(option));
button.addActionListener(e -> onSelected.accept(option));
menu.add(button);
parentMenu.add(button);
buttonGroup.add(button);
button.setSelected(selectCondition.test(option));
}
Expand Down

0 comments on commit 046fc6c

Please sign in to comment.