Skip to content

Commit

Permalink
Merge branch 'main' into new-config-system
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Nov 23, 2023
2 parents 3cf1e5b + b961b98 commit e9266d5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/main/java/net/pistonmaster/serverwrecker/gui/GUIFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
import net.pistonmaster.serverwrecker.gui.libs.HintManager;
import net.pistonmaster.serverwrecker.gui.navigation.CardsContainer;
import net.pistonmaster.serverwrecker.gui.navigation.ControlPanel;
import net.pistonmaster.serverwrecker.util.TimeUtil;

import javax.swing.*;
import java.awt.*;
import java.util.concurrent.TimeUnit;

public class GUIFrame extends JFrame {
public static final String MAIN_MENU = "MainMenu";
Expand Down Expand Up @@ -65,11 +63,13 @@ public void initComponents(Injector injector) {
public void open(Injector injector) {
setVisible(true);

// User says they are a first time user that wants hints
if (GUIClientProps.getBoolean("firstTimeUser", false)) {
SwingUtilities.invokeLater(() -> showHints(injector));
return;
}

// Ask whether the user wants hints
if (GUIClientProps.getBoolean("firstRun", true)) {
var result = JOptionPane.showConfirmDialog(
this,
Expand All @@ -78,15 +78,17 @@ public void open(Injector injector) {
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE
);

if (result == JOptionPane.YES_OPTION) {
GUIClientProps.setBoolean("firstTimeUser", true);
GUIClientProps.setBoolean("firstRun", false);

// Give the window a bit of time to close
TimeUtil.waitTime(50, TimeUnit.MILLISECONDS);
requestFocusInWindow();
SwingUtilities.invokeLater(() -> showHints(injector));
} else if (result == JOptionPane.NO_OPTION || result == JOptionPane.CLOSED_OPTION) {
GUIClientProps.setBoolean("firstTimeUser", false);
GUIClientProps.setBoolean("firstRun", false);
}

GUIClientProps.setBoolean("firstRun", false);
}
}

Expand Down
17 changes: 15 additions & 2 deletions src/main/java/net/pistonmaster/serverwrecker/gui/SWMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
package net.pistonmaster.serverwrecker.gui;

import com.formdev.flatlaf.FlatDarculaLaf;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatIntelliJLaf;
import com.formdev.flatlaf.intellijthemes.FlatOneDarkIJTheme;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.intellijthemes.*;
import com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialDarkerIJTheme;
import com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMaterialOceanicIJTheme;
import com.formdev.flatlaf.themes.FlatMacDarkLaf;
import com.formdev.flatlaf.themes.FlatMacLightLaf;
import javafx.stage.FileChooser;
Expand All @@ -47,9 +51,18 @@ public class SWMenuBar extends JMenuBar {
var tempThemes = new ArrayList<>(List.of(
FlatDarculaLaf.class,
FlatIntelliJLaf.class,
FlatDarkLaf.class,
FlatLightLaf.class,
FlatMacDarkLaf.class,
FlatMacLightLaf.class,
FlatOneDarkIJTheme.class
FlatOneDarkIJTheme.class,
FlatArcOrangeIJTheme.class,
FlatArcDarkOrangeIJTheme.class,
FlatCyanLightIJTheme.class,
FlatDarkPurpleIJTheme.class,
FlatMaterialDarkerIJTheme.class,
FlatMaterialOceanicIJTheme.class,
FlatCarbonIJTheme.class
));
THEMES = List.copyOf(tempThemes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ private void updateBalloonBorder() {

void showHint() {
var rootPane = SwingUtilities.getRootPane(hint.owner);
if (rootPane == null)
if (rootPane == null) {
return;
}

var layeredPane = rootPane.getLayeredPane();

Expand Down

0 comments on commit e9266d5

Please sign in to comment.