📄 executequery.java
字号:
frame.setSize(frameDim); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); } else if (SystemProperties.containsKey("user", "window.position")) { ((ExecuteQueryFrame)frame).setSizeAndPosition(); } else { // center the frame frame.setSize(frameDim); if (frameDim.height > screenSize.height) { frameDim.height = screenSize.height; } if (frameDim.width > screenSize.width) { frameDim.width = screenSize.width; } frame.setLocation((screenSize.width - frameDim.width) / 2, (screenSize.height - frameDim.height) / 2); } /* SwingUtilities.invokeLater(new Runnable() { public void run() { GUIUtilities.setDisplayOptions(false); } }); */ GUIUtilities.setDisplayOptions(false); ActionBuilder.setActionMaps( frame.getRootPane(), SystemResources.getUserActionShortcuts()); GUIUtilities.initPanels(); /* SwingUtilities.invokeLater(new Runnable() { public void run() { GUIUtilities.initPanels(); } }); */ advanceSplash(splash); //Thread.sleep(15000); // kill the splash panel if (splash != null) { splash.dispose(); } GUIUtils.invokeLater(new Runnable() { public void run() { frame.setVisible(true); } }); // auto-login if selected if (openConnection) { final String name = SystemProperties.getProperty("user", "startup.connection.name"); if (!MiscUtils.isNull(name)) { SwingUtilities.invokeLater(new Runnable() { public void run() { openConnection( ConnectionProperties.getDatabaseConnection(name)); } }); } } } catch(Exception e) { e.printStackTrace(); } } /** * Loads the custom look and feel plugin. */ private void loadCustomLookAndFeel() { try { PluginLookAndFeelManager lfManager = new PluginLookAndFeelManager(); lfManager.loadLookAndFeel(); if (!lfManager.isInstalled()) { loadDefaultLookAndFeel(); } } catch (Exception e) { e.printStackTrace(); Log.error("An error occurred loading the selected look and feel: " + e.getMessage()); Log.error("Reverting to system default look and feel"); loadDefaultLookAndFeel(); } } /** * Sets the default metal look and feel theme on Metal. */ private void loadDefaultMetalLookAndFeelTheme() { try { javax.swing.plaf.metal.MetalLookAndFeel metal = new javax.swing.plaf.metal.MetalLookAndFeel(); metal.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); UIManager.setLookAndFeel(metal); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); lookAndFeelError(); loadCrossPlatformLookAndFeel(); } } /** * Sets the default look and feel theme on Metal. */ private void loadDefaultLookAndFeelTheme() { try { javax.swing.plaf.metal.MetalLookAndFeel metal = new javax.swing.plaf.metal.MetalLookAndFeel(); metal.setCurrentTheme(new ExecuteQueryTheme()); UIManager.setLookAndFeel(metal); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); lookAndFeelError(); loadCrossPlatformLookAndFeel(); } } /** * Sets the default look and feel theme on Metal. */ private void loadDefaultLookAndFeelTheme2() { try { javax.swing.plaf.metal.MetalLookAndFeel metal = new javax.swing.plaf.metal.MetalLookAndFeel(); metal.setCurrentTheme(new ExecuteQueryTheme2()); UIManager.setLookAndFeel(metal); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); lookAndFeelError(); loadCrossPlatformLookAndFeel(); } } /** * Simple dialog with generic look and feel error message. */ private void lookAndFeelError() { GUIUtilities.displayWarningMessage( "The selected look and feel is not " + "supported within this environment." + "\nThe system will revert to the default look and feel."); } /** * Sets the default 'Execute Query' look and feel. */ private void loadDefaultLookAndFeel() { try { org.underworldlabs.swing.plaf.ShadesOfGrayLookAndFeel metal = new org.underworldlabs.swing.plaf.ShadesOfGrayLookAndFeel(); /* org.underworldlabs.swing.plaf.smoothgradient.SmoothGradientLookAndFeel metal = new org.underworldlabs.swing.plaf.smoothgradient.SmoothGradientLookAndFeel(); metal.setCurrentTheme(new ExecuteQueryTheme()); */ UIManager.setLookAndFeel(metal); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); lookAndFeelError(); loadCrossPlatformLookAndFeel(); } } /** * Loads the cross-platform look and feel. */ private void loadCrossPlatformLookAndFeel() { try { UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } } /** <p>Opens the first frame to be displayed * on the desktop - the Login Frame */ /* private void openFirstFrame() { SwingUtilities.invokeLater(new Runnable() { public void run() { LoginPanel panel = new LoginPanel(LoginPanel.STARTUP); GUIUtilities.addInternalFrame("Login", LoginPanel.FRAME_ICON, panel, true, false, false, false); } }); } */ /** * Advances the splash progress bar. */ private void advanceSplash(SplashPanel splash) { if (splash != null) { splash.advance(); } } /** * Returns the main frame. * * @return the primary <code>JFrame</code> */ public static JFrame getFrame() { return frame; } /** * Opens a database connection at startup if this * option was selected. * * @param dc the connection to be opened as a * <code>DatabaseConnection</code> object */ private static void openConnection(DatabaseConnection dc) { if (dc == null) { return; } if (!dc.isPasswordStored()) { PasswordDialog pd = new PasswordDialog(frame, "Password", "Enter password"); int result = pd.getResult(); String pwd = pd.getValue(); pd.dispose(); if (result <= PasswordDialog.CANCEL) { return; } dc.setPassword(pwd); } dc.setJDBCDriver(JDBCProperties.getDatabaseDriver(dc.getDriverId())); try { SystemUtilities.connect(dc); } catch (DataSourceException e) { GUIUtilities.displayErrorMessage(e.getMessage()); } } /** * Application entry point - main method. */ public static void main(String[] args) { // make sure the installed java version is at least 1.5 if (!MiscUtils.isMinJavaVersion(1, 5)) { JOptionPane.showMessageDialog(null, "The minimum required Java version is 1.5.\n" + "The reported version is " + System.getProperty("java.vm.version") + ".\n\nPlease download and install the latest Java " + "version\nfrom http://java.sun.com and try again.\n\n", "Java Version Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } // check args for help or uninstall option if (args.length > 0) { String value = args[0]; if (value.toUpperCase().equals("HELP")) { HelpWindow.main(args); } /* else if (value.toUpperCase().equals("UNINSTALL")) { Uninstall.main(args); } */ } else { new ExecuteQuery(); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -