style: more cleanup of ui and styling
This commit is contained in:
parent
59566aee72
commit
7725313149
8 changed files with 82 additions and 94 deletions
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
|
@ -1,10 +1,15 @@
|
|||
{
|
||||
"java.import.gradle.wrapper.enabled": true,
|
||||
"[po]": {
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": false,
|
||||
"files.trimFinalNewlines": true,
|
||||
},
|
||||
"[java]": {
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": true
|
||||
}
|
||||
},
|
||||
"editor.formatOnSave": true,
|
||||
"better-comments.tags": [
|
||||
{
|
||||
"tag": "#.",
|
||||
|
@ -17,8 +22,10 @@
|
|||
"editor.rulers": [
|
||||
120
|
||||
],
|
||||
"java.import.gradle.wrapper.enabled": true,
|
||||
"java.completion.filteredTypes": [
|
||||
"java.awt.List",
|
||||
"com.sun.*"
|
||||
],
|
||||
"java.codeGeneration.generateComments": true,
|
||||
}
|
||||
|
|
|
@ -224,17 +224,14 @@ public class App {
|
|||
// Setup the Settings and wait for it to finish.
|
||||
settings = new Settings();
|
||||
|
||||
// Load the theme and style everything.
|
||||
loadTheme(settings.getTheme());
|
||||
|
||||
final SplashScreen ss = new SplashScreen();
|
||||
|
||||
// Load and show the splash screen while we load other things.
|
||||
SwingUtilities.invokeLater(() -> ss.setVisible(true));
|
||||
|
||||
// Load the theme and style everything.
|
||||
loadTheme(settings.getTheme());
|
||||
|
||||
// now the theme is loaded, we can intialize the toaster
|
||||
TOASTER = Toaster.instance();
|
||||
|
||||
console = new LauncherConsole();
|
||||
LogManager.start();
|
||||
|
||||
|
@ -447,6 +444,9 @@ public class App {
|
|||
try {
|
||||
setLAF(theme);
|
||||
modifyLAF();
|
||||
|
||||
// now the theme is loaded, we can intialize the toaster
|
||||
TOASTER = Toaster.instance();
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
|
|
@ -17,20 +17,19 @@
|
|||
*/
|
||||
package com.atlauncher.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Insets;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.LineBorder;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CustomLineBorder extends LineBorder {
|
||||
public class HoverLineBorder extends LineBorder {
|
||||
private int insets = 0;
|
||||
|
||||
public CustomLineBorder(int insets, Color color, int thickness, boolean rounded) {
|
||||
super(color, thickness, rounded);
|
||||
|
||||
this.insets = insets;
|
||||
public HoverLineBorder() {
|
||||
super(UIManager.getColor("HoverLineBorder.borderColor"), (int) UIManager.get("HoverLineBorder.borderWidth"));
|
||||
this.insets = (int) UIManager.get("HoverLineBorder.insetWidth");
|
||||
}
|
||||
|
||||
@Override
|
|
@ -72,13 +72,15 @@ public class SplashScreen extends JWindow {
|
|||
* giving a force quit option.
|
||||
*/
|
||||
private final class ContextMenu extends JPopupMenu {
|
||||
private final JMenuItem FORCE_QUIT = new JMenuItem(GetText.tr("Force quit"));
|
||||
|
||||
public ContextMenu() {
|
||||
super();
|
||||
|
||||
this.FORCE_QUIT.addActionListener(e -> System.exit(0));
|
||||
this.add(this.FORCE_QUIT);
|
||||
// no idea why, but this fixes some weird bottom and right margin
|
||||
setLightWeightPopupEnabled(false);
|
||||
|
||||
JMenuItem forceQuit = new JMenuItem(GetText.tr("Force quit"));
|
||||
forceQuit.addActionListener(e -> System.exit(0));
|
||||
add(forceQuit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,17 +20,12 @@ package com.atlauncher.gui.components;
|
|||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JToolTip;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import com.atlauncher.gui.CustomLineBorder;
|
||||
import com.atlauncher.gui.HoverLineBorder;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class JLabelWithHover extends JLabel {
|
||||
private static final Border HOVER_BORDER = new CustomLineBorder((int) UIManager.get("JLabelWithHover.insetWidth"),
|
||||
UIManager.getColor("JLabelWithHover.borderColor"), (int) UIManager.get("JLabelWithHover.borderWidth"),
|
||||
true);
|
||||
|
||||
public JLabelWithHover(Icon icon, String tooltipText, Border border) {
|
||||
super();
|
||||
super.setIcon(icon);
|
||||
|
@ -47,7 +42,7 @@ public class JLabelWithHover extends JLabel {
|
|||
@Override
|
||||
public JToolTip createToolTip() {
|
||||
JToolTip tip = super.createToolTip();
|
||||
tip.setBorder(HOVER_BORDER);
|
||||
tip.setBorder(new HoverLineBorder());
|
||||
return tip;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,20 +17,18 @@
|
|||
*/
|
||||
package com.atlauncher.gui.components;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JToolTip;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import com.atlauncher.builders.HTMLBuilder;
|
||||
import com.atlauncher.data.DisableableMod;
|
||||
import com.atlauncher.data.json.Mod;
|
||||
import com.atlauncher.gui.CustomLineBorder;
|
||||
import com.atlauncher.gui.HoverLineBorder;
|
||||
import com.atlauncher.gui.dialogs.EditModsDialog;
|
||||
import com.atlauncher.gui.dialogs.ModsChooser;
|
||||
import com.atlauncher.utils.OS;
|
||||
|
@ -55,14 +53,6 @@ public class ModsJCheckBox extends JCheckBox {
|
|||
|
||||
private EditModsDialog dialog;
|
||||
|
||||
/**
|
||||
* Static object for the {@link Border} to show around the tooltips for mods
|
||||
* with descriptions.
|
||||
*/
|
||||
private static final Border HOVER_BORDER = new CustomLineBorder((int) UIManager.get("JLabelWithHover.insetWidth"),
|
||||
UIManager.getColor("JLabelWithHover.borderColor"), (int) UIManager.get("JLabelWithHover.borderWidth"),
|
||||
true);
|
||||
|
||||
/**
|
||||
* Constructor for use in the {@link ModsChooser} dialog with new JSON format.
|
||||
*
|
||||
|
@ -243,7 +233,7 @@ public class ModsJCheckBox extends JCheckBox {
|
|||
@Override
|
||||
public JToolTip createToolTip() {
|
||||
JToolTip tip = super.createToolTip();
|
||||
tip.setBorder(HOVER_BORDER);
|
||||
tip.setBorder(new HoverLineBorder());
|
||||
return tip;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,8 @@ import javax.swing.BorderFactory;
|
|||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JToolTip;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import com.atlauncher.gui.CustomLineBorder;
|
||||
import com.atlauncher.gui.HoverLineBorder;
|
||||
import com.atlauncher.utils.Utils;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
|
@ -47,10 +45,7 @@ public class SMButton extends JButton {
|
|||
|
||||
public JToolTip createToolTip() {
|
||||
JToolTip tip = super.createToolTip();
|
||||
Border border = new CustomLineBorder((int) UIManager.get("JLabelWithHover.insetWidth"),
|
||||
UIManager.getColor("JLabelWithHover.borderColor"), (int) UIManager.get("JLabelWithHover.borderWidth"),
|
||||
true);
|
||||
tip.setBorder(border);
|
||||
tip.setBorder(new HoverLineBorder());
|
||||
return tip;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,13 +62,54 @@
|
|||
*.selectionBackgroundInactive=#0e293f
|
||||
*.errorForeground=#ef5350
|
||||
|
||||
#---- BottomBar ----
|
||||
BottomBar.dividerColor=@secondary.500
|
||||
|
||||
#---- Button ----
|
||||
Button.focusedBorderColor=@secondary.400
|
||||
|
||||
#---- Checkbox ----
|
||||
CheckBox.icon.borderColor=@secondary.400
|
||||
CheckBox.icon.selectedBorderColor=@secondary.400
|
||||
CheckBox.icon.background=@secondary.500
|
||||
CheckBox.icon.checkmarkColor=@primary.500
|
||||
CheckBox.icon.selectedFocusedBorderColor=@secondary.400
|
||||
CheckBox.icon.focusedBorderColor=@secondary.400
|
||||
|
||||
#---- CollapsiblePanel ----
|
||||
CollapsiblePanel.normal=@white
|
||||
CollapsiblePanel.error=#ff0000
|
||||
|
||||
#---- Component ----
|
||||
Component.focusWidth=1
|
||||
Component.innerFocusWidth=0
|
||||
Component.arrowType=chevron
|
||||
Component.borderColor=@primary.500
|
||||
Component.disabledBorderColor=@primary.300
|
||||
Component.focusedBorderColor=@primary.700
|
||||
|
||||
#---- Console ----
|
||||
Console.LogType.debug=#ff00ff
|
||||
Console.LogType.error=#ee2222
|
||||
Console.LogType.info=@primary.500
|
||||
Console.LogType.warn=#ffff4c
|
||||
|
||||
#---- HoverLineBorder ----
|
||||
HoverLineBorder.borderColor=@primary.500
|
||||
HoverLineBorder.insetWidth=4
|
||||
HoverLineBorder.borderWidth=1
|
||||
|
||||
#---- Mods ----
|
||||
Mods.modSelectionColor=#32373c
|
||||
|
||||
#---- ModsJCheckBox ----
|
||||
ModsJCheckBox.hoverBorderColor=#50aa6b
|
||||
|
||||
#---- ProgressBar ----
|
||||
ProgressBar.progressColor=@primary.500
|
||||
|
||||
#---- SMButton ----
|
||||
SMButton.hoverBorderColor=#50aa6b
|
||||
|
||||
#---- SplitPane ----
|
||||
SplitPane.dividerSize={integer}0
|
||||
|
||||
#---- TabbedPane ----
|
||||
TabbedPane.tabSelectionHeight=3
|
||||
|
@ -80,54 +121,13 @@ TabbedPane.tabSeparatorColor=@secondary.500
|
|||
TabbedPane.tabSeparatorsFullHeight=true
|
||||
TabbedPane.showTabSeparators=true
|
||||
|
||||
#---- Checkbox ----
|
||||
CheckBox.icon.borderColor=@secondary.400
|
||||
CheckBox.icon.selectedBorderColor=@secondary.400
|
||||
CheckBox.icon.background=@secondary.500
|
||||
CheckBox.icon.checkmarkColor=@primary.500
|
||||
CheckBox.icon.selectedFocusedBorderColor=@secondary.400
|
||||
CheckBox.icon.focusedBorderColor=@secondary.400
|
||||
|
||||
#---- ToolPanel ----
|
||||
ToolPanel.borderColor=@secondary.500
|
||||
|
||||
#---- BottomBar ----
|
||||
BottomBar.dividerColor=@secondary.500
|
||||
|
||||
#---- JLabelWithHover ----
|
||||
JLabelWithHover.borderColor=@primary.500
|
||||
JLabelWithHover.insetWidth=4
|
||||
JLabelWithHover.borderWidth=1
|
||||
|
||||
#---- ProgressBar ----
|
||||
ProgressBar.progressColor=@primary.500
|
||||
|
||||
#---- CollapsiblePanel ----
|
||||
CollapsiblePanel.normal=@white
|
||||
CollapsiblePanel.error=#ff0000
|
||||
|
||||
#---- Console ----
|
||||
Console.LogType.debug=#ff00ff
|
||||
Console.LogType.error=#ee2222
|
||||
Console.LogType.info=@primary.500
|
||||
Console.LogType.warn=#ffff4c
|
||||
|
||||
#---- SplitPane ----
|
||||
SplitPane.dividerSize={integer}0
|
||||
|
||||
#---- Mods ----
|
||||
Mods.modSelectionColor=#32373c
|
||||
|
||||
#---- ModsJCheckBox ----
|
||||
ModsJCheckBox.hoverBorderColor=#50aa6b
|
||||
|
||||
#---- SMButton ----
|
||||
SMButton.hoverBorderColor=#50aa6b
|
||||
#---- TextComponent ----
|
||||
TextComponent.arc=5
|
||||
|
||||
#---- Toaster ----
|
||||
Toaster.bgColor=#1e2328
|
||||
Toaster.msgColor=@white
|
||||
Toaster.borderColor=#50aa6b
|
||||
|
||||
#---- TextComponent ----
|
||||
TextComponent.arc=5
|
||||
#---- ToolPanel ----
|
||||
ToolPanel.borderColor=@secondary.500
|
||||
|
|
Loading…
Reference in a new issue