Configuration for dark themed GUI.

This commit is contained in:
MobiusDevelopment
2021-05-02 15:02:44 +00:00
parent 04042485eb
commit 8de4d585c3
320 changed files with 7672 additions and 4868 deletions

View File

@@ -134,6 +134,23 @@ InstantThreadPoolCount = 120
UrgentPacketThreadCoreSize = 40
# ---------------------------------------------------------------------------
# Look and feel
# ---------------------------------------------------------------------------
# Enable L2jMobius GUI when OS supports it.
# Provides access to admin commands without the need to be online.
# Warning! Do not disable if you use Gameserver.exe
# because server will run in the background!
# Default: True
EnableGUI = True
# Dark theme.
# Use a dark version of the Nimbus theme.
# Default: True
DarkTheme = True
# ---------------------------------------------------------------------------
# Misc Player Settings
# ---------------------------------------------------------------------------

View File

@@ -60,6 +60,23 @@ Password =
MaximumDbConnections = 10
# ---------------------------------------------------------------------------
# Look and feel
# ---------------------------------------------------------------------------
# Enable L2jMobius GUI when OS supports it.
# Provides access to admin commands without the need to be online.
# Warning! Do not disable if you use Gameserver.exe
# because server will run in the background!
# Default: True
EnableGUI = True
# Dark theme.
# Use a dark version of the Nimbus theme.
# Default: True
DarkTheme = True
# ---------------------------------------------------------------------------
# Automatic Database Backup Settings
# ---------------------------------------------------------------------------

View File

@@ -74,7 +74,7 @@ public class Config
private static final String PVP_CONFIG_FILE = "./config/main/PvP.ini";
private static final String RAIDBOSS_CONFIG_FILE = "./config/main/RaidBoss.ini";
private static final String RATES_CONFIG_FILE = "./config/main/Rates.ini";
private static final String SERVER_CONFIG_FILE = "./config/main/Server.ini";
public static final String SERVER_CONFIG_FILE = "./config/main/Server.ini";
private static final String SEVENSIGNS_CONFIG_FILE = "./config/main/SevenSigns.ini";
public static final String SIEGE_CONFIG_FILE = "./config/main/Siege.ini";
// protected
@@ -102,7 +102,7 @@ public class Config
private static final String EVENT_REBIRTH_CONFIG_FILE = "./config/custom/Rebirth.ini";
private static final String EVENT_WEDDING_CONFIG_FILE = "./config/custom/Wedding.ini";
// login
private static final String LOGIN_CONFIG_FILE = "./config/main/LoginServer.ini";
public static final String LOGIN_CONFIG_FILE = "./config/main/LoginServer.ini";
// others
private static final String BANNED_IP_FILE = "./config/others/banned_ip.cfg";
public static final String SERVER_NAME_FILE = "./config/others/servername.xml";
@@ -1128,6 +1128,8 @@ public class Config
public static int SCHEDULED_THREAD_POOL_COUNT;
public static int INSTANT_THREAD_POOL_COUNT;
public static int IO_PACKET_THREAD_CORE_SIZE;
public static boolean ENABLE_GUI;
public static boolean DARK_THEME;
public static String CNAME_TEMPLATE;
public static String PET_NAME_TEMPLATE;
public static String CLAN_NAME_TEMPLATE;

View File

@@ -0,0 +1,57 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.commons.ui;
import java.awt.Color;
import javax.swing.UIManager;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
/**
* @author Mobius
*/
public class DarkTheme
{
public static void activate()
{
// Modify existing white Nimbus look and feel to dark.
UIManager.put("control", new Color(128, 128, 128));
UIManager.put("info", new Color(128, 128, 128));
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
UIManager.put("nimbusGreen", new Color(176, 179, 50));
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
UIManager.put("nimbusOrange", new Color(191, 98, 4));
UIManager.put("nimbusRed", new Color(169, 46, 34));
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
UIManager.put("text", new Color(230, 230, 230));
// Set look and feel.
try
{
UIManager.setLookAndFeel(new NimbusLookAndFeel());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.commons.util;
package org.l2jmobius.commons.ui;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.commons.util;
package org.l2jmobius.commons.ui;
import java.awt.Color;
import java.awt.Frame;

View File

@@ -31,6 +31,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.enums.ServerMode;
import org.l2jmobius.commons.util.Chronos;
import org.l2jmobius.commons.util.DeadlockDetector;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.Util;
import org.l2jmobius.gameserver.cache.CrestCache;
import org.l2jmobius.gameserver.cache.HtmCache;
@@ -147,8 +148,11 @@ public class GameServer
final long serverLoadStart = Chronos.currentTimeMillis();
// GUI
if (!GraphicsEnvironment.isHeadless())
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
{
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
System.out.println("GameServer: Running in GUI mode.");
new Gui();
}

View File

@@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
import org.l2jmobius.commons.util.SplashScreen;
import org.l2jmobius.commons.ui.DarkTheme;
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
import org.l2jmobius.commons.ui.SplashScreen;
import org.l2jmobius.gameserver.Shutdown;
import org.l2jmobius.gameserver.cache.HtmCache;
import org.l2jmobius.gameserver.data.xml.MultisellData;
@@ -85,6 +86,11 @@ public class Gui
public Gui()
{
if (Config.DARK_THEME)
{
DarkTheme.activate();
}
// Initialize console.
txtrConsole = new JTextArea();
txtrConsole.setEditable(false);
@@ -301,7 +307,7 @@ public class Gui
frame.setJMenuBar(menuBar);
frame.setIconImages(icons);
frame.add(layeredPanel, BorderLayout.CENTER);
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
frame.pack();
frame.setLocationRelativeTo(null);

View File

@@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
public SystemPanel()
{
setBackground(Color.WHITE);
if (!Config.DARK_THEME)
{
setBackground(Color.WHITE);
}
setBounds(500, 20, 284, 140);
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
setOpaque(true);

View File

@@ -38,6 +38,7 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.database.DatabaseBackup;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.enums.ServerMode;
import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.loginserver.network.AbstractClientPacket;
import org.l2jmobius.loginserver.network.LoginClient;
import org.l2jmobius.loginserver.ui.Gui;
@@ -62,8 +63,11 @@ public class LoginServer extends FloodProtectedListener
public static void main(String[] args)
{
// GUI
if (!GraphicsEnvironment.isHeadless())
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
{
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
System.out.println("LoginServer: Running in GUI mode.");
new Gui();
}

View File

@@ -44,8 +44,9 @@ import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
import org.l2jmobius.commons.util.SplashScreen;
import org.l2jmobius.commons.ui.DarkTheme;
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
import org.l2jmobius.commons.ui.SplashScreen;
import org.l2jmobius.loginserver.GameServerTable;
import org.l2jmobius.loginserver.GameServerTable.GameServer;
import org.l2jmobius.loginserver.LoginController;
@@ -76,6 +77,11 @@ public class Gui
public Gui()
{
if (Config.DARK_THEME)
{
DarkTheme.activate();
}
// Initialize console.
txtrConsole = new JTextArea();
txtrConsole.setEditable(false);
@@ -247,7 +253,7 @@ public class Gui
frame.setJMenuBar(menuBar);
frame.setIconImages(icons);
frame.add(scrollPanel, BorderLayout.CENTER);
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
frame.pack();
frame.setLocationRelativeTo(null);

View File

@@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import org.l2jmobius.commons.util.SplashScreen;
import org.l2jmobius.commons.ui.SplashScreen;
import org.l2jmobius.tools.dbinstaller.RunTasks;
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;