Configuration for dark themed GUI.
This commit is contained in:
@ -85,7 +85,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
|
||||
@ -113,7 +113,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/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
|
||||
// --------------------------------------------------
|
||||
// Variable Definitions
|
||||
@ -1167,6 +1167,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;
|
||||
|
@ -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;
|
@ -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;
|
||||
@ -151,8 +152,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.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);
|
||||
|
||||
|
@ -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