Configuration for dark themed GUI.
This commit is contained in:
@@ -98,11 +98,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@@ -466,6 +466,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@@ -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;
|
@@ -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;
|
@@ -34,6 +34,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.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@@ -182,8 +183,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();
|
||||
}
|
||||
|
@@ -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.AdminData;
|
||||
@@ -85,6 +86,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@@ -323,7 +329,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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -33,6 +33,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.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
|
@@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
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.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@@ -243,7 +250,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);
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user