Changes based on Java 10 recommendations.
This commit is contained in:
@ -311,8 +311,8 @@ public class Gui
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, new Integer(0), 0);
|
||||
layeredPanel.add(systemPanel, new Integer(1), 0);
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherGS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobiush5";
|
||||
final String dir = "sql/game/";
|
||||
|
@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
|
||||
*/
|
||||
public class LauncherLS extends AbstractDBLauncher
|
||||
{
|
||||
public static void main(String[] args)
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
final String defDatabase = "l2jmobiush5";
|
||||
final String dir = "sql/login/";
|
||||
|
@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir)
|
||||
public DBInstallerConsole(String db, String dir) throws Exception
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
final Preferences prop = Preferences.userRoot();
|
||||
@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
* @param pass the password
|
||||
* @param database the database name
|
||||
* @param mode the mode, c: Clean, u:update
|
||||
* @throws Exception
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.commons.util.SplashScreen;
|
||||
import com.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
|
||||
final int height = 220;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
|
||||
|
||||
final ActionListener connectListener = e ->
|
||||
{
|
||||
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
MySqlConnect connector = null;
|
||||
try
|
||||
{
|
||||
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
if ((connector != null) && (connector.getConnection() != null))
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
|
@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
|
||||
|
||||
@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
final int height = 360;
|
||||
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
|
@ -31,11 +31,11 @@ public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
|
Reference in New Issue
Block a user