diff --git a/.gitignore b/.gitignore index 199b890..2d1a980 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ build/ ### VS Code ### .vscode/ /out/artifacts/java_tool_jar/java_tool.jar +/java_tool.jar diff --git a/lib/beautyeye_lnf.jar b/lib/beautyeye_lnf.jar deleted file mode 100644 index daf4827..0000000 Binary files a/lib/beautyeye_lnf.jar and /dev/null differ diff --git a/lib/djnativeswing-swt.jar b/lib/djnativeswing-swt.jar deleted file mode 100644 index 5fd63dd..0000000 Binary files a/lib/djnativeswing-swt.jar and /dev/null differ diff --git a/lib/djnativeswing.jar b/lib/djnativeswing.jar deleted file mode 100644 index b16382d..0000000 Binary files a/lib/djnativeswing.jar and /dev/null differ diff --git a/lib/swt-4.3-win32-win32-x86_64.jar b/lib/swt-4.3-win32-win32-x86_64.jar deleted file mode 100644 index 916306b..0000000 Binary files a/lib/swt-4.3-win32-win32-x86_64.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index 06e225c..35c7f1d 100644 --- a/pom.xml +++ b/pom.xml @@ -70,44 +70,6 @@ ${sqlite.jdbc.version} - - - beautyeye_lnf - beautyeye_lnf - 3.7 - system - ${project.basedir}/lib/beautyeye_lnf.jar - - - - - - djnativeswing - djnativeswing - 4.3 - system - ${project.basedir}/lib/djnativeswing.jar - - - - - - djnativeswing_swt - djnativeswing_swt - 4.3 - system - ${project.basedir}/lib/djnativeswing-swt.jar - - - - - - swt-4.3-win32-win32-x86_64 - swt-4.3-win32-win32-x86_64 - 4.3 - system - ${project.basedir}/lib/swt-4.3-win32-win32-x86_64.jar - diff --git a/run.bat b/run.bat index 412f3fe..b04948b 100644 --- a/run.bat +++ b/run.bat @@ -1,6 +1,6 @@ call :IsAdmin -java -jar app.jar +java -jar java_tool.jar :IsAdmin Reg.exe query "HKU\S-1-5-19\Environment" @@ -9,4 +9,3 @@ If Not %ERRORLEVEL% EQU 0 ( Pause & Exit ) Cls -goto:eof diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF index 7d6d1a6..63a24c1 100644 --- a/src/main/java/META-INF/MANIFEST.MF +++ b/src/main/java/META-INF/MANIFEST.MF @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Main-Class: com.insigma.utils.OsTest +Main-Class: com.insigma.HyToolApplication diff --git a/src/main/java/com/insigma/HyToolApplication.java b/src/main/java/com/insigma/HyToolApplication.java index 6d2a094..740512e 100644 --- a/src/main/java/com/insigma/HyToolApplication.java +++ b/src/main/java/com/insigma/HyToolApplication.java @@ -2,7 +2,6 @@ package com.insigma; import cn.hutool.db.Session; import com.insigma.config.AppCfg; -import com.insigma.demos.SwingSet2; import com.insigma.ui.SwingFrame; import com.insigma.utils.DbUtil; import lombok.extern.slf4j.Slf4j; @@ -12,7 +11,6 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.support.EncodedResource; import org.springframework.core.io.support.PropertiesLoaderUtils; -import javax.swing.*; import java.util.Properties; /** diff --git a/src/main/java/com/insigma/demos/DemoModule.java b/src/main/java/com/insigma/demos/DemoModule.java deleted file mode 100644 index 439a573..0000000 --- a/src/main/java/com/insigma/demos/DemoModule.java +++ /dev/null @@ -1,369 +0,0 @@ -package com.insigma.demos; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JApplet; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.UIManager; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; - -import org.jb2011.lnf.beautyeye.widget.N9ComponentFactory; - -/** - * A generic SwingSet2 demo module. - * - * @author Jeff Dinkins - * @version 1.23 11/17/05 - */ -public class DemoModule extends JApplet { - - /** - * The PREFERRE d_ width. - */ - private int PREFERRED_WIDTH = 680; - - /** - * The PREFERRE d_ height. - */ - private int PREFERRED_HEIGHT = 600; - - /** - * The lowered border. - */ - Border loweredBorder = new EmptyBorder(15, 10, 5, 10); - - /** - * The HGA p2. - */ - public static Dimension HGAP2 = new Dimension(2, 1); - - /** - * The VGA p2. - */ - public static Dimension VGAP2 = new Dimension(1, 2); - - /** - * The HGA p5. - */ - public static Dimension HGAP5 = new Dimension(5, 1); - - /** - * The VGA p5. - */ - public static Dimension VGAP5 = new Dimension(1, 5); - - /** - * The HGA p10. - */ - public static Dimension HGAP10 = new Dimension(10, 1); - - /** - * The VGA p10. - */ - public static Dimension VGAP10 = new Dimension(1, 10); - - /** - * The HGA p15. - */ - public static Dimension HGAP15 = new Dimension(15, 1); - - /** - * The VGA p15. - */ - public static Dimension VGAP15 = new Dimension(1, 15); - - /** - * The HGA p20. - */ - public static Dimension HGAP20 = new Dimension(20, 1); - - /** - * The VGA p20. - */ - public static Dimension VGAP20 = new Dimension(1, 20); - - /** - * The HGA p25. - */ - public static Dimension HGAP25 = new Dimension(25, 1); - - /** - * The VGA p25. - */ - public static Dimension VGAP25 = new Dimension(1, 25); - - /** - * The HGA p30. - */ - public static Dimension HGAP30 = new Dimension(30, 1); - - /** - * The VGA p30. - */ - public static Dimension VGAP30 = new Dimension(1, 30); - - /** - * The swingset. - */ - private SwingSet2 swingset = null; - - /** - * The panel. - */ - private JPanel panel = null; - - /** - * The resource name. - */ - private String resourceName = null; - - /** - * The icon path. - */ - private String iconPath = null; - - /** - * The source code. - */ - private String sourceCode = null; - - // Resource bundle for internationalized and accessible text - /** - * The bundle. - */ - private ResourceBundle bundle = null; - - /** - * Instantiates a new demo module. - * - * @param swingset the swingset - */ - public DemoModule(SwingSet2 swingset) { - this(swingset, null, null); - } - - /** - * Instantiates a new demo module. - * - * @param swingset the swingset - * @param resourceName the resource name - * @param iconPath the icon path - */ - public DemoModule(SwingSet2 swingset, String resourceName, String iconPath) { - UIManager.put("swing.boldMetal", Boolean.FALSE); - panel = new JPanel(); - - panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5)); - panel.setLayout(new BorderLayout()); - - this.resourceName = resourceName; - this.iconPath = iconPath; - this.swingset = swingset; - } - - /** - * Gets the resource name. - * - * @return the resource name - */ - public String getResourceName() { - return resourceName; - } - - /** - * Gets the demo panel. - * - * @return the demo panel - */ - public JPanel getDemoPanel() { - return panel; - } - - /** - * Gets the swing set2. - * - * @return the swing set2 - */ - public SwingSet2 getSwingSet2() { - return swingset; - } - - - /** - * Gets the string. - * - * @param key the key - * @return the string - */ - public String getString(String key) { - String value = "nada"; - if (bundle == null) { - if (getSwingSet2() != null) { - bundle = getSwingSet2().getResourceBundle(); - } else { - bundle = ResourceBundle.getBundle("language.swingset"); - } - } - try { - value = bundle.getString(key); - } catch (MissingResourceException e) { - System.out.println("java.util.MissingResourceException: Couldn't find value for: " + key); - } - return value; - } - - /** - * Gets the mnemonic. - * - * @param key the key - * @return the mnemonic - */ - public char getMnemonic(String key) { - return (getString(key)).charAt(0); - } - - /** - * Creates the image icon. - * - * @param filename the filename - * @param description the description - * @return the image icon - */ - public ImageIcon createImageIcon(String filename, String description) { - if (getSwingSet2() != null) { - return getSwingSet2().createImageIcon(filename, description); - } else { - String path = "/static/images/" + filename; - return new ImageIcon(getClass().getResource(path), description); - } - } - - - /** - * Gets the source code. - * - * @return the source code - */ - public String getSourceCode() { - return sourceCode; - } - - /* (non-Javadoc) - * @see java.awt.Component#getName() - */ - @Override - public String getName() { - return getString(getResourceName() + ".name"); - } - - ; - - /** - * Gets the icon. - * - * @return the icon - */ - public Icon getIcon() { - return createImageIcon(iconPath, getResourceName() + ".name"); - } - - ; - - /** - * Gets the tool tip. - * - * @return the tool tip - */ - public String getToolTip() { - return getString(getResourceName() + ".tooltip"); - } - - ; - - /** - * Main impl. - */ - public void mainImpl() { - JFrame frame = new JFrame(getName()); - frame.getContentPane().setLayout(new BorderLayout()); - frame.getContentPane().add(getDemoPanel(), BorderLayout.CENTER); - getDemoPanel().setPreferredSize(new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT)); - frame.pack(); - frame.show(); - } - - /** - * Creates the horizontal panel. - * - * @param threeD the three d - * @return the j panel - */ - public JPanel createHorizontalPanel(boolean threeD) { - JPanel p = N9ComponentFactory.createPanel_style1(null).setDrawBg(threeD);//modified by jb2011 - p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); - p.setAlignmentY(TOP_ALIGNMENT); - p.setAlignmentX(LEFT_ALIGNMENT); - if (threeD) { - p.setBorder(loweredBorder); - } - //因背景是白色N9图,这里设置它不填充默认背景好看一点,要不然灰色背景出来就不好看了 - p.setOpaque(false);//add by jb2011 2012-08-24 - return p; - } - - /** - * Creates the vertical panel. - * - * @param threeD the three d - * @return the j panel - */ - public JPanel createVerticalPanel(boolean threeD) { - JPanel p = N9ComponentFactory.createPanel_style1(null).setDrawBg(threeD);//modified by jb2011 - p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); - p.setAlignmentY(TOP_ALIGNMENT); - p.setAlignmentX(LEFT_ALIGNMENT); - if (threeD) { - p.setBorder(loweredBorder); - } - return p; - } - - /** - * The main method. - * - * @param args the arguments - */ - public static void main(String[] args) { - DemoModule demo = new DemoModule(null); - demo.mainImpl(); - } - - /* (non-Javadoc) - * @see java.applet.Applet#init() - */ - @Override - public void init() { - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(getDemoPanel(), BorderLayout.CENTER); - } - - /** - * Update drag enabled. - * - * @param dragEnabled the drag enabled - */ - void updateDragEnabled(boolean dragEnabled) { - } - - -} - diff --git a/src/main/java/com/insigma/demos/SwingSet2.java b/src/main/java/com/insigma/demos/SwingSet2.java deleted file mode 100644 index 3a765e6..0000000 --- a/src/main/java/com/insigma/demos/SwingSet2.java +++ /dev/null @@ -1,1481 +0,0 @@ -/* - * Copyright (C) 2015 Jack Jiang(cngeeker.com) The BeautyEye Project. - * All rights reserved. - * Project URL:https: - * Version 3.6 - * - * Jack Jiang PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * SwingSet2.java at 2015-2-1 20:25:37, original version by Jack Jiang. - * You can contact author with jb2011@163.com. - */ - -/* - * @(#)SwingSet2.java 1.54 06/05/31 - */ -package com.insigma.demos; - -import lombok.extern.slf4j.Slf4j; -import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper; -import org.jb2011.lnf.beautyeye.widget.N9ComponentFactory; - -import javax.swing.*; -import javax.swing.border.AbstractBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.plaf.metal.DefaultMetalTheme; -import javax.swing.plaf.metal.MetalLookAndFeel; -import javax.swing.plaf.metal.MetalTheme; -import javax.swing.plaf.metal.OceanTheme; -import java.awt.*; -import java.awt.event.*; -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.Vector; - -/** - * A demo that shows all of the Swing components. - * - * @author Jeff Dinkins - * @version 1.54 05/31/06 - */ -@Slf4j -public class SwingSet2 extends JPanel { - - /** - * The demos. - */ - String[] demos = { - "com.insigma.demos.ButtonDemo", - "com.insigma.demos.ColorChooserDemo", - "com.insigma.demos.ComboBoxDemo", - "com.insigma.demos.FileChooserDemo", - "com.insigma.demos.HtmlDemo", - "com.insigma.demos.ListDemo", - "com.insigma.demos.OptionPaneDemo", - "com.insigma.demos.ProgressBarDemo", - "com.insigma.demos.ScrollPaneDemo", - "com.insigma.demos.SliderDemo", - "com.insigma.demos.SplitPaneDemo", - "com.insigma.demos.TabbedPaneDemo", - "com.insigma.demos.TableDemo", - "com.insigma.demos.ToolTipDemo", - "com.insigma.demos.TreeDemo", - "com.insigma.demos.TextAreaDemo" - }; - - /** - * The Constant metal. - */ - private static final String metal = "javax.swing.plaf.metal.MetalLookAndFeel"; - - /** - * The Constant windows. - */ - private static final String windows = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; - - /** - * The Constant gtk. - */ - private static final String gtk = "org.jb2011.lnf.windows2.Windows2LookAndFeel"; - - /** - * The current look and feel. - */ - private static String currentLookAndFeel = metal; - - /** - * The Constant PREFERRED_WIDTH. - */ - private static final int PREFERRED_WIDTH = 720; - - /** - * The Constant PREFERRED_HEIGHT. - */ - private static final int PREFERRED_HEIGHT = 640; - - - /** - * The HGAP. - */ - private Dimension HGAP = new Dimension(1, 5); - - /** - * The VGAP. - */ - private Dimension VGAP = new Dimension(5, 1); - - - /** - * The bundle. - */ - private ResourceBundle bundle = null; - - /** - * The demo panel. - */ - private JPanel demoPanel = null; - - - /** - * The about box. - */ - private JDialog aboutBox = null; - - - /** - * The status field. - */ - private JLabel statusField = null; - - - /** - * The toolbar. - */ - private ToggleButtonToolBar toolbar = null; - - /** - * The toolbar group. - */ - private ButtonGroup toolbarGroup = new ButtonGroup(); - - /** - * The menu bar. - */ - private JMenuBar menuBar = null; - - /** - * The laf menu. - */ - private JMenu lafMenu = null; - - /** - * The themes menu. - */ - private JMenu themesMenu = null; - - /** - * The audio menu. - */ - private JMenu audioMenu = null; - - /** - * The options menu. - */ - private JMenu optionsMenu = null; - - /** - * The laf menu group. - */ - private ButtonGroup lafMenuGroup = new ButtonGroup(); - - /** - * The themes menu group. - */ - private ButtonGroup themesMenuGroup = new ButtonGroup(); - - /** - * The audio menu group. - */ - private ButtonGroup audioMenuGroup = new ButtonGroup(); - - - /** - * The popup menu. - */ - private JPopupMenu popupMenu = null; - - /** - * The popup menu group. - */ - private ButtonGroup popupMenuGroup = new ButtonGroup(); - - /** - * The frame. - */ - private JFrame frame = null; - - /** - * The DEBUG. - */ - private boolean DEBUG = true; - - /** - * The debug counter. - */ - private int debugCounter = 0; - - /** - * The tabbed pane. - */ - private JTabbedPane tabbedPane = null; - - /** - * The demo src pane. - */ - private JEditorPane demoSrcPane = null; - - /** - * The content pane. - */ - Container contentPane = null; - - /** - * The num s ss. - */ - private static int numSSs = 0; - - /** - * The swing sets. - */ - private static Vector swingSets = new Vector(); - - /** - * The drag enabled. - */ - private boolean dragEnabled = false; - - /** - * The applet. - */ - private SwingSet2Applet applet = null; - - /** - * SwingSet2 Main. Called only if we're an application, not an applet. - * - * @param args the arguments - * @throws Exception the exception - */ - public static void main(String[] args) { - - initBeautyStyle(); - SwingSet2 swingset = new SwingSet2(null, GraphicsEnvironment. - getLocalGraphicsEnvironment(). - getDefaultScreenDevice(). - getDefaultConfiguration()); - log.info("启动成功:{}", swingset); - } - - public static void initBeautyStyle() { - try { - UIManager.put("RootPane.setupButtonVisible", false); - BeautyEyeLNFHelper.debug = false; - BeautyEyeLNFHelper.launchBeautyEyeLNF(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("initBeautyStyle exception..."); - } - } - - /** - * Instantiates a new swing set2. - * - * @param applet the applet - */ - public SwingSet2(SwingSet2Applet applet) { - this(applet, null); - } - - /** - * SwingSet2 Constructor. - * - * @param applet the applet - * @param gc the gc - */ - public SwingSet2(SwingSet2Applet applet, GraphicsConfiguration gc) { - // Note that applet may be null if this is started as an application - this.applet = applet; - - if (!isApplet()) { - frame = createFrame(gc); - } - - // set the layout - setLayout(new BorderLayout()); - - // set the preferred size of the demo - setPreferredSize(new Dimension(PREFERRED_WIDTH,PREFERRED_HEIGHT)); - - initializeDemo(); - - // Show the demo. Must do this on the GUI thread using invokeLater. - SwingUtilities.invokeLater(() -> showSwingSet2()); - } - - /** - * Initialize demo. - */ - public void initializeDemo() { - JPanel top = new JPanel(); - top.setLayout(new BorderLayout()); - - this.setBorder(BorderFactory.createEmptyBorder(2, 0, 4, 0)); - - add(top, BorderLayout.NORTH); - - menuBar = createMenus(); - - frame.setJMenuBar(menuBar); - - popupMenu = createPopupMenu(); - - ToolBarPanel toolbarPanel = new ToolBarPanel(); - toolbarPanel.setLayout(new BorderLayout()); - toolbar = new ToggleButtonToolBar(); - toolbarPanel.add(toolbar, BorderLayout.CENTER); - top.add(toolbarPanel, BorderLayout.SOUTH); - toolbarPanel.addContainerListener(toolbarPanel); - - tabbedPane = new JTabbedPane(); - add(tabbedPane, BorderLayout.CENTER); - tabbedPane.getModel().addChangeListener(null); - - statusField = new JLabel(""); - JPanel hinePanel = new JPanel(new BorderLayout()); - JLabel hintLabel = N9ComponentFactory.createLabel_style1("友情提示"); - hinePanel.add(hintLabel, BorderLayout.WEST); - statusField.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4)); - hinePanel.add(statusField, BorderLayout.CENTER); - hinePanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 0, 4)); - add(hinePanel, BorderLayout.SOUTH); - - demoPanel = new JPanel(); - demoPanel.setLayout(new BorderLayout()); - demoPanel.setBorder(new DemoPanelBorder()); - tabbedPane.addTab("Hi There!", demoPanel); - - - demoSrcPane = new JEditorPane("text/html", getString("SourceCode.loading")); - demoSrcPane.setEditable(false); - - JScrollPane scroller = new JScrollPane(); - scroller.getViewport().add(demoSrcPane); - - tabbedPane.addTab( - "Java源代码", - null, - scroller, - getString("TabbedPane.src_tooltip") - ); - } - - /** - * Create menus. - * - * @return the j menu bar - */ - public JMenuBar createMenus() { - JMenuItem mi; - - JMenuBar menuBar = new JMenuBar(); - menuBar.getAccessibleContext().setAccessibleName( - getString("MenuBar.accessible_description")); - - JMenu fileMenu = (JMenu) menuBar.add(new JMenu(getString("FileMenu.file_label"))); - - fileMenu.setMnemonic(getMnemonic("FileMenu.file_mnemonic")); - fileMenu.getAccessibleContext().setAccessibleDescription(getString("FileMenu.accessible_description")); - - createMenuItem(fileMenu, "FileMenu.about_label", "FileMenu.about_mnemonic", - "FileMenu.about_accessible_description", new AboutAction(this)); - - fileMenu.addSeparator(); - - createMenuItem(fileMenu, "FileMenu.open_label", "FileMenu.open_mnemonic", - "FileMenu.open_accessible_description", null); - - createMenuItem(fileMenu, "FileMenu.save_label", "FileMenu.save_mnemonic", - "FileMenu.save_accessible_description", null); - - createMenuItem(fileMenu, "FileMenu.save_as_label", "FileMenu.save_as_mnemonic", - "FileMenu.save_as_accessible_description", null); - - fileMenu.addSeparator(); - - createMenuItem(fileMenu, "FileMenu.exit_label", "FileMenu.exit_mnemonic", - "FileMenu.exit_accessible_description", new ExitAction(this) - ); - - if (numSSs == 0) { - - lafMenu = (JMenu) menuBar.add(new JMenu(getString("LafMenu.laf_label"))); - lafMenu.setMnemonic(getMnemonic("LafMenu.laf_mnemonic")); - lafMenu.getAccessibleContext().setAccessibleDescription( - getString("LafMenu.laf_accessible_description")); - - mi = createLafMenuItem(lafMenu, "LafMenu.java_label", "LafMenu.java_mnemonic", - "LafMenu.java_accessible_description", metal); - mi.setSelected(true); - - createLafMenuItem(lafMenu, "LafMenu.windows_label", "LafMenu.windows_mnemonic", - "LafMenu.windows_accessible_description", windows); - createLafMenuItem(lafMenu, "LafMenu.gtk_label", "LafMenu.gtk_mnemonic", - "LafMenu.gtk_accessible_description", gtk); - - - themesMenu = (JMenu) menuBar.add(new JMenu(getString("ThemesMenu.themes_label"))); - themesMenu.setMnemonic(getMnemonic("ThemesMenu.themes_mnemonic")); - themesMenu.getAccessibleContext().setAccessibleDescription( - getString("ThemesMenu.themes_accessible_description")); - - - audioMenu = (JMenu) themesMenu.add(new JMenu(getString("AudioMenu.audio_label"))); - audioMenu.setMnemonic(getMnemonic("AudioMenu.audio_mnemonic")); - audioMenu.getAccessibleContext().setAccessibleDescription( - getString("AudioMenu.audio_accessible_description")); - - createAudioMenuItem(audioMenu, "AudioMenu.on_label", - "AudioMenu.on_mnemonic", - "AudioMenu.on_accessible_description", - new OnAudioAction(this)); - - mi = createAudioMenuItem(audioMenu, "AudioMenu.default_label", - "AudioMenu.default_mnemonic", - "AudioMenu.default_accessible_description", - new DefaultAudioAction(this)); - mi.setSelected(true); - - createAudioMenuItem(audioMenu, "AudioMenu.off_label", - "AudioMenu.off_mnemonic", - "AudioMenu.off_accessible_description", - new OffAudioAction(this)); - - - - JMenu fontMenu = (JMenu) themesMenu.add(new JMenu(getString("FontMenu.fonts_label"))); - fontMenu.setMnemonic(getMnemonic("FontMenu.fonts_mnemonic")); - fontMenu.getAccessibleContext().setAccessibleDescription( - getString("FontMenu.fonts_accessible_description")); - ButtonGroup fontButtonGroup = new ButtonGroup(); - mi = createButtonGroupMenuItem(fontMenu, "FontMenu.plain_label", - "FontMenu.plain_mnemonic", - "FontMenu.plain_accessible_description", - new ChangeFontAction(this, true), fontButtonGroup); - mi.setSelected(true); - mi = createButtonGroupMenuItem(fontMenu, "FontMenu.bold_label", - "FontMenu.bold_mnemonic", - "FontMenu.bold_accessible_description", - new ChangeFontAction(this, false), fontButtonGroup); - - - - mi = createThemesMenuItem(themesMenu, "ThemesMenu.ocean_label", - "ThemesMenu.ocean_mnemonic", - "ThemesMenu.ocean_accessible_description", - new OceanTheme()); - mi.setSelected(true); - - createThemesMenuItem(themesMenu, "ThemesMenu.steel_label", - "ThemesMenu.steel_mnemonic", - "ThemesMenu.steel_accessible_description", - new DefaultMetalTheme()); - - - optionsMenu = (JMenu) menuBar.add( - new JMenu(getString("OptionsMenu.options_label"))); - optionsMenu.setMnemonic(getMnemonic("OptionsMenu.options_mnemonic")); - optionsMenu.getAccessibleContext().setAccessibleDescription( - getString("OptionsMenu.options_accessible_description")); - - - mi = createCheckBoxMenuItem(optionsMenu, "OptionsMenu.tooltip_label", - "OptionsMenu.tooltip_mnemonic", - "OptionsMenu.tooltip_accessible_description", - new ToolTipAction()); - mi.setSelected(true); - - } - - return menuBar; - } - - /** - * Create a checkbox menu menu item. - * - * @param menu the menu - * @param label the label - * @param mnemonic the mnemonic - * @param accessibleDescription the accessible description - * @param action the action - * @return the j menu item - */ - private JMenuItem createCheckBoxMenuItem(JMenu menu, String label, - String mnemonic, - String accessibleDescription, - Action action) { - JCheckBoxMenuItem mi = (JCheckBoxMenuItem) menu.add( - new JCheckBoxMenuItem(getString(label))); - mi.setMnemonic(getMnemonic(mnemonic)); - mi.getAccessibleContext().setAccessibleDescription(getString( - accessibleDescription)); - mi.addActionListener(action); - return mi; - } - - /** - * Create a radio button menu menu item for items that are part of a - * button group. - * - * @param menu the menu - * @param label the label - * @param mnemonic the mnemonic - * @param accessibleDescription the accessible description - * @param action the action - * @param buttonGroup the button group - * @return the j menu item - */ - private JMenuItem createButtonGroupMenuItem(JMenu menu, String label, - String mnemonic, - String accessibleDescription, - Action action, - ButtonGroup buttonGroup) { - JRadioButtonMenuItem mi = (JRadioButtonMenuItem) menu.add( - new JRadioButtonMenuItem(getString(label))); - buttonGroup.add(mi); - mi.setMnemonic(getMnemonic(mnemonic)); - mi.getAccessibleContext().setAccessibleDescription(getString( - accessibleDescription)); - mi.addActionListener(action); - return mi; - } - - /** - * Create the theme's audio submenu. - * - * @param menu the menu - * @param label the label - * @param mnemonic the mnemonic - * @param accessibleDescription the accessible description - * @param action the action - * @return the j menu item - */ - public JMenuItem createAudioMenuItem(JMenu menu, String label, - String mnemonic, - String accessibleDescription, - Action action) { - JRadioButtonMenuItem mi = (JRadioButtonMenuItem) menu.add(new JRadioButtonMenuItem(getString(label))); - audioMenuGroup.add(mi); - mi.setMnemonic(getMnemonic(mnemonic)); - mi.getAccessibleContext().setAccessibleDescription(getString(accessibleDescription)); - mi.addActionListener(action); - - return mi; - } - - /** - * Creates a generic menu item. - * - * @param menu the menu - * @param label the label - * @param mnemonic the mnemonic - * @param accessibleDescription the accessible description - * @param action the action - * @return the j menu item - */ - public JMenuItem createMenuItem(JMenu menu, String label, String mnemonic, - String accessibleDescription, Action action) { - JMenuItem mi = (JMenuItem) menu.add(new JMenuItem(getString(label))); - - - mi.setMnemonic(getMnemonic(mnemonic)); - mi.getAccessibleContext().setAccessibleDescription(getString(accessibleDescription)); - mi.addActionListener(action); - if (action == null) { - mi.setEnabled(false); - } - return mi; - } - - /** - * Creates a JRadioButtonMenuItem for the Themes menu. - * - * @param menu the menu - * @param label the label - * @param mnemonic the mnemonic - * @param accessibleDescription the accessible description - * @param theme the theme - * @return the j menu item - */ - public JMenuItem createThemesMenuItem(JMenu menu, String label, String mnemonic, - String accessibleDescription, MetalTheme theme) { - JRadioButtonMenuItem mi = (JRadioButtonMenuItem) menu.add(new JRadioButtonMenuItem(getString(label))); - themesMenuGroup.add(mi); - mi.setMnemonic(getMnemonic(mnemonic)); - mi.getAccessibleContext().setAccessibleDescription(getString(accessibleDescription)); - - - return mi; - } - - /** - * Creates a JRadioButtonMenuItem for the Look and Feel menu. - * - * @param menu the menu - * @param label the label - * @param mnemonic the mnemonic - * @param accessibleDescription the accessible description - * @param laf the laf - * @return the j menu item - */ - public JMenuItem createLafMenuItem(JMenu menu, String label, String mnemonic, - String accessibleDescription, String laf) { - JMenuItem mi = menu.add(new JRadioButtonMenuItem(getString(label))); - lafMenuGroup.add(mi); - mi.setMnemonic(getMnemonic(mnemonic)); - mi.getAccessibleContext().setAccessibleDescription(getString(accessibleDescription)); - - return mi; - } - - /** - * Creates the popup menu. - * - * @return the j popup menu - */ - public JPopupMenu createPopupMenu() { - JPopupMenu popup = new JPopupMenu("JPopupMenu demo"); - - createPopupMenuItem(popup, "LafMenu.java_label", "LafMenu.java_mnemonic", - "LafMenu.java_accessible_description", metal); - - createPopupMenuItem(popup, "LafMenu.windows_label", "LafMenu.windows_mnemonic", - "LafMenu.windows_accessible_description", windows); - - createPopupMenuItem(popup, "LafMenu.gtk_label", "LafMenu.gtk_mnemonic", - "LafMenu.gtk_accessible_description", gtk); - - - InputMap map = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); - map.put(KeyStroke.getKeyStroke(KeyEvent.VK_F10, InputEvent.SHIFT_MASK), - "postMenuAction"); - map.put(KeyStroke.getKeyStroke(KeyEvent.VK_CONTEXT_MENU, 0), "postMenuAction"); - getActionMap().put("postMenuAction", new ActivatePopupMenuAction(this, popup)); - - return popup; - } - - /** - * Creates a JMenuItem for the Look and Feel popup menu. - * - * @param menu the menu - * @param label the label - * @param mnemonic the mnemonic - * @param accessibleDescription the accessible description - * @param laf the laf - * @return the j menu item - */ - public JMenuItem createPopupMenuItem(JPopupMenu menu, String label, String mnemonic, - String accessibleDescription, String laf) { - JMenuItem mi = menu.add(new JMenuItem(getString(label))); - popupMenuGroup.add(mi); - mi.setMnemonic(getMnemonic(mnemonic)); - mi.getAccessibleContext().setAccessibleDescription(getString(accessibleDescription)); - - - - return mi; - } - - - /** - * Bring up the SwingSet2 demo by showing the frame (only - * applicable if coming up as an application, not an applet);. - */ - public void showSwingSet2() { - if (getFrame() != null) { - - JFrame f = getFrame(); - f.setTitle(getString("Frame.title") + " - BeautyEye L&F v3.6 "); - f.getContentPane().add(this, BorderLayout.CENTER); - - f.setSize(1024, 750); - - Rectangle screenRect = f.getGraphicsConfiguration().getBounds(); - Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets( - f.getGraphicsConfiguration()); - - - int centerWidth = screenRect.width < f.getSize().width ? - screenRect.x : - screenRect.x + screenRect.width / 2 - f.getSize().width / 2; - int centerHeight = screenRect.height < f.getSize().height ? - screenRect.y : - screenRect.y + screenRect.height / 2 - f.getSize().height / 2; - - centerHeight = centerHeight < screenInsets.top ? screenInsets.top : centerHeight; - - f.setLocation(centerWidth, centerHeight); - f.show(); - numSSs++; - swingSets.add(this); - } - } - - /** - * Returns the frame instance. - * - * @return the frame - */ - public JFrame getFrame() { - return frame; - } - - - /** - * This method returns a string from the demo's resource bundle. - * - * @param key the key - * @return the string - */ - public String getString(String key) { - String value = null; - try { - value = getResourceBundle().getString(key); - } catch (MissingResourceException e) { - System.out.println("java.util.MissingResourceException: Couldn't find value for: " + key); - } - if (value == null) { - value = "Could not find resource: " + key + " "; - } - return value; - } - - /** - * Checks if is drag enabled. - * - * @return true, if is drag enabled - */ - boolean isDragEnabled() { - return dragEnabled; - } - - /** - * Returns the resource bundle associated with this demo. Used - * to get accessable and internationalized strings. - * - * @return the resource bundle - */ - public ResourceBundle getResourceBundle() { - if (bundle == null) { - bundle = ResourceBundle.getBundle("language.swingset"); - } - return bundle; - } - - /** - * Returns a mnemonic from the resource bundle. Typically used as - * keyboard shortcuts in menu items. - * - * @param key the key - * @return the mnemonic - */ - public char getMnemonic(String key) { - return (getString(key)).charAt(0); - } - - /** - * Creates an icon from an image contained in the "images" directory. - * - * @param filename the filename - * @param description the description - * @return the image icon - */ - public ImageIcon createImageIcon(String filename, String description) { - String path = "/static/images/" + filename; - return new ImageIcon(getClass().getResource(path)); - } - - /** - * If DEBUG is defined, prints debug information out to std ouput. - * - * @param s the s - */ - public void debug(String s) { - if (DEBUG) { - System.out.println((debugCounter++) + ": " + s); - } - } - - /** - * Stores the current L&F, and calls updateLookAndFeel, below. - * - * @param laf the new look and feel - */ - public void setLookAndFeel(String laf) { - if (currentLookAndFeel != laf) { - currentLookAndFeel = laf; - /* The recommended way of synchronizing state between multiple - * controls that represent the same command is to use Actions. - * The code below is a workaround and will be replaced in future - * version of SwingSet2 demo. - */ - String lafName = null; - if (laf == metal) { - lafName = getString("LafMenu.java_label"); - } - if (laf == gtk) { - lafName = getString("LafMenu.gtk_label"); - } - if (laf == windows) { - lafName = getString("LafMenu.windows_label"); - } - - themesMenu.setEnabled(laf == metal); - updateLookAndFeel(); - for (int i = 0; i < lafMenu.getItemCount(); i++) { - JMenuItem item = lafMenu.getItem(i); - if (item.getText() == lafName) { - item.setSelected(true); - } else { - item.setSelected(false); - } - } - } - } - - /** - * Update this swing set. - */ - private void updateThisSwingSet() { - JFrame frame = getFrame(); - if (frame == null) { - SwingUtilities.updateComponentTreeUI(this); - } else { - SwingUtilities.updateComponentTreeUI(frame); - } - - SwingUtilities.updateComponentTreeUI(popupMenu); - if (aboutBox != null) { - SwingUtilities.updateComponentTreeUI(aboutBox); - } - } - - /** - * Sets the current L&F on each demo module. - */ - public void updateLookAndFeel() { - try { - System.out.println("!!currentLookAndFeel=" + currentLookAndFeel); - UIManager.setLookAndFeel(currentLookAndFeel); - for (SwingSet2 ss : swingSets) { - ss.updateThisSwingSet(); - } - } catch (Exception ex) { - System.out.println("Failed loading L&F: " + currentLookAndFeel); - System.out.println(ex); - } - } - - - - - /** - * The zero insets. - */ - static Insets zeroInsets = new Insets(3, 2, 3, 2); - - /** - * The Class ToggleButtonToolBar. - */ - protected class ToggleButtonToolBar extends JToolBar { - - /** - * Instantiates a new toggle button tool bar. - */ - public ToggleButtonToolBar() { - super(); - this.setFloatable(true); - - } - - /** - * Adds the toggle button. - * - * @param a the a - * @return the j toggle button - */ - JToggleButton addToggleButton(Action a) { - JToggleButton tb = new JToggleButton( - (String) a.getValue(Action.NAME), null - - ); - - - tb.setEnabled(a.isEnabled()); - tb.setToolTipText((String) a.getValue(Action.SHORT_DESCRIPTION)); - tb.setAction(a); - add(tb); - return tb; - } - } - - - - - - /** - * The Class ToolBarPanel. - */ - class ToolBarPanel extends JPanel implements ContainerListener { - - /* (non-Javadoc) - * @see javax.swing.JComponent#contains(int, int) - */ - @Override - public boolean contains(int x, int y) { - Component c = getParent(); - if (c != null) { - Rectangle r = c.getBounds(); - return (x >= 0) && (x < r.width) && (y >= 0) && (y < r.height); - } else { - return super.contains(x, y); - } - } - - /* (non-Javadoc) - * @see java.awt.event.ContainerListener#componentAdded(java.awt.event.ContainerEvent) - */ - @Override - public void componentAdded(ContainerEvent e) { - Container c = e.getContainer().getParent(); - if (c != null) { - c.getParent().validate(); - c.getParent().repaint(); - } - } - - /* (non-Javadoc) - * @see java.awt.event.ContainerListener#componentRemoved(java.awt.event.ContainerEvent) - */ - @Override - public void componentRemoved(ContainerEvent e) { - Container c = e.getContainer().getParent(); - if (c != null) { - c.getParent().validate(); - c.getParent().repaint(); - } - } - } - - /** - * Determines if this is an applet or application. - * - * @return true, if is applet - */ - public boolean isApplet() { - return (applet != null); - } - - /** - * The Class OkAction. - */ - class OkAction extends AbstractAction { - - /** - * The about box. - */ - JDialog aboutBox; - - /** - * Instantiates a new ok action. - * - * @param aboutBox the about box - */ - protected OkAction(JDialog aboutBox) { - super("OkAction"); - this.aboutBox = aboutBox; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - aboutBox.setVisible(false); - } - } - - /** - * The Class ChangeLookAndFeelAction. - */ - class ChangeLookAndFeelAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * The laf. - */ - String laf; - - /** - * Instantiates a new change look and feel action. - * - * @param swingset the swingset - * @param laf the laf - */ - protected ChangeLookAndFeelAction(SwingSet2 swingset, String laf) { - super("ChangeTheme"); - this.swingset = swingset; - this.laf = laf; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - swingset.setLookAndFeel(laf); - } - } - - /** - * The Class ActivatePopupMenuAction. - */ - class ActivatePopupMenuAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * The popup. - */ - JPopupMenu popup; - - /** - * Instantiates a new activate popup menu action. - * - * @param swingset the swingset - * @param popup the popup - */ - protected ActivatePopupMenuAction(SwingSet2 swingset, JPopupMenu popup) { - super("ActivatePopupMenu"); - this.swingset = swingset; - this.popup = popup; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - Dimension invokerSize = getSize(); - Dimension popupSize = popup.getPreferredSize(); - popup.show(swingset, (invokerSize.width - popupSize.width) / 2, - (invokerSize.height - popupSize.height) / 2); - } - } - - - - /** - * The Class OnAudioAction. - */ - class OnAudioAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * Instantiates a new on audio action. - * - * @param swingset the swingset - */ - protected OnAudioAction(SwingSet2 swingset) { - super("Audio On"); - this.swingset = swingset; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - - - - - } - } - - - - /** - * The Class DefaultAudioAction. - */ - class DefaultAudioAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * Instantiates a new default audio action. - * - * @param swingset the swingset - */ - protected DefaultAudioAction(SwingSet2 swingset) { - super("Audio Default"); - this.swingset = swingset; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - - - - - } - } - - - - /** - * The Class OffAudioAction. - */ - class OffAudioAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * Instantiates a new off audio action. - * - * @param swingset the swingset - */ - protected OffAudioAction(SwingSet2 swingset) { - super("Audio Off"); - this.swingset = swingset; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - - } - } - - /** - * Create a frame for SwingSet2 to reside in if brought up - * as an application. - * - * @param gc the gc - * @return the j frame - */ - public static JFrame createFrame(GraphicsConfiguration gc) { - JFrame frame = new JFrame(gc); - if (numSSs == 0) { - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - } else { - WindowListener l = new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - numSSs--; - swingSets.remove(this); - } - }; - frame.addWindowListener(l); - } - - frame.setMinimumSize(new Dimension(100,100)); - return frame; - } - - /** - * The Class ToolTipAction. - */ - class ToolTipAction extends AbstractAction { - - /** - * Instantiates a new tool tip action. - */ - protected ToolTipAction() { - super("ToolTip Control"); - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - boolean status = ((JCheckBoxMenuItem) e.getSource()).isSelected(); - ToolTipManager.sharedInstance().setEnabled(status); - } - } - - /** - * The Class ChangeThemeAction. - */ - class ChangeThemeAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * The theme. - */ - MetalTheme theme; - - /** - * Instantiates a new change theme action. - * - * @param swingset the swingset - * @param theme the theme - */ - protected ChangeThemeAction(SwingSet2 swingset, MetalTheme theme) { - super("ChangeTheme"); - this.swingset = swingset; - this.theme = theme; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - MetalLookAndFeel.setCurrentTheme(theme); - swingset.updateLookAndFeel(); - } - } - - /** - * The Class ExitAction. - */ - class ExitAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * Instantiates a new exit action. - * - * @param swingset the swingset - */ - protected ExitAction(SwingSet2 swingset) { - super("ExitAction"); - this.swingset = swingset; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - System.exit(0); - } - } - - /** - * The Class AboutAction. - */ - class AboutAction extends AbstractAction { - - /** - * The swingset. - */ - SwingSet2 swingset; - - /** - * Instantiates a new about action. - * - * @param swingset the swingset - */ - protected AboutAction(SwingSet2 swingset) { - super("AboutAction"); - this.swingset = swingset; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - if (aboutBox == null) { - - JPanel panel = new AboutPanel(swingset); - panel.setLayout(new BorderLayout()); - - aboutBox = new JDialog(swingset.getFrame(), getString("AboutBox.title"), false); - aboutBox.setResizable(false); - aboutBox.getContentPane().add(panel, BorderLayout.CENTER); - - - JPanel buttonpanel = new JPanel(); - buttonpanel.setBorder(new javax.swing.border.EmptyBorder(0, 0, 3, 0)); - buttonpanel.setOpaque(false); - JButton button = (JButton) buttonpanel.add( - new JButton(getString("AboutBox.ok_button_text")) - ); - panel.add(buttonpanel, BorderLayout.SOUTH); - - button.addActionListener(new OkAction(aboutBox)); - } - aboutBox.pack(); - aboutBox.setLocationRelativeTo(getFrame()); - aboutBox.show(); - } - } - - - - - - /** - * The Class AboutPanel. - */ - class AboutPanel extends JPanel { - - /** - * The aboutimage. - */ - ImageIcon aboutimage = null; - - /** - * The swingset. - */ - SwingSet2 swingset = null; - - /** - * Instantiates a new about panel. - * - * @param swingset the swingset - */ - public AboutPanel(SwingSet2 swingset) { - this.swingset = swingset; - aboutimage = swingset.createImageIcon("About.jpg", "AboutBox.accessible_description"); - setOpaque(false); - } - - /* (non-Javadoc) - * @see javax.swing.JComponent#paint(java.awt.Graphics) - */ - @Override - public void paint(Graphics g) { - aboutimage.paintIcon(this, g, 0, 0); - super.paint(g); - } - - /* (non-Javadoc) - * @see javax.swing.JComponent#getPreferredSize() - */ - @Override - public Dimension getPreferredSize() { - return new Dimension(aboutimage.getIconWidth(), - aboutimage.getIconHeight()); - } - } - - - /** - * The Class ChangeFontAction. - */ - private class ChangeFontAction extends AbstractAction { - - /** - * The swingset. - */ - private SwingSet2 swingset; - - /** - * The plain. - */ - private boolean plain; - - /** - * Instantiates a new change font action. - * - * @param swingset the swingset - * @param plain the plain - */ - ChangeFontAction(SwingSet2 swingset, boolean plain) { - super("FontMenu"); - this.swingset = swingset; - this.plain = plain; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e) { - - } - } - - - - - - /** - * The Class DemoPanelBorder. - */ - private class DemoPanelBorder extends AbstractBorder { - - /** - * Instantiates a new demo panel border. - */ - public DemoPanelBorder() { - } - - /* (non-Javadoc) - * @see javax.swing.border.AbstractBorder#paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) - */ - @Override - public void paintBorder(Component c, Graphics g, int x, int y, - int width, int height) { - - Stroke oldStroke = ((Graphics2D) g).getStroke(); - Stroke sroke = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[]{1, 2}, 0); - ((Graphics2D) g).setStroke(sroke); - - g.setColor(new Color(200, 200, 200)); - g.drawLine(x, height - 2, width - 1, height - 2); - - - g.setColor(Color.white); - g.drawLine(x, height - 1, width - 1, height - 1); - - ((Graphics2D) g).setStroke(oldStroke); - } - - - /* (non-Javadoc) - * @see javax.swing.border.AbstractBorder#getBorderInsets(java.awt.Component) - */ - @Override - public Insets getBorderInsets(Component c) { - return new Insets(0, 0, 2, 0); - } - - /* (non-Javadoc) - * @see javax.swing.border.AbstractBorder#getBorderInsets(java.awt.Component, java.awt.Insets) - */ - @Override - public Insets getBorderInsets(Component c, Insets insets) { - - return getBorderInsets(c); - } - } -} - diff --git a/src/main/java/com/insigma/demos/SwingSet2Applet.java b/src/main/java/com/insigma/demos/SwingSet2Applet.java deleted file mode 100644 index fe5b285..0000000 --- a/src/main/java/com/insigma/demos/SwingSet2Applet.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2015 Jack Jiang(cngeeker.com) The BeautyEye Project. - * All rights reserved. - * Project URL:https://github.com/JackJiang2011/beautyeye - * Version 3.6 - * - * Jack Jiang PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * SwingSet2Applet.java at 2015-2-1 20:25:39, original version by Jack Jiang. - * You can contact author with jb2011@163.com. - */ - -/* - * @(#)SwingSet2Applet.java 1.10 05/11/17 - */ - -package com.insigma.demos; - -import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper; - -import javax.swing.*; -import java.awt.*; -import java.net.URL; - -// TODO: Auto-generated Javadoc - -/** - * The Class SwingSet2Applet. - * - * @version 1.10 11/17/05 - * @author Jeff Dinkins - */ - -public class SwingSet2Applet extends JApplet { - - @Override - public void init() { - try { - BeautyEyeLNFHelper.launchBeautyEyeLNF(); - } catch (Exception e) { - System.err.println("BeautyEyeLNF运行失败,原因是:"+e.getMessage()); - } - - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(new SwingSet2(this), BorderLayout.CENTER); - } -} diff --git a/src/main/java/com/insigma/demos/TextAreaDemo.java b/src/main/java/com/insigma/demos/TextAreaDemo.java deleted file mode 100644 index 6159ce5..0000000 --- a/src/main/java/com/insigma/demos/TextAreaDemo.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.insigma.demos; - -import javax.accessibility.AccessibleContext; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; - -public class TextAreaDemo extends DemoModule { - - /** - * main method allows us to run as a standalone demo. - * - * @param args the arguments - */ - public static void main(String[] args) { - //初始化样式 - SwingSet2.initBeautyStyle(); - - TextAreaDemo demo = new TextAreaDemo(null); - demo.mainImpl(); - } - - /* (non-Javadoc) - * @see DemoModule#getName() - */ - @Override public String getName() { - return "文本域"; - }; - - /** - * ProgressBarDemo Constructor. - * - * @param swingset the swingset - */ - public TextAreaDemo(SwingSet2 swingset) { - // Set the title for this demo, and an icon used to represent this - // demo inside the SwingSet2 app. - super(swingset, "TextAreaDemo" - , "toolbar/JProgressBar.gif"); - - createProgressPanel(); - } - - - /** The load action. */ - Action loadAction; - - /** The stop action. */ - Action stopAction; - - /** The progress bar. */ - JProgressBar progressBar; - - /** The progress text area. */ - JTextArea progressTextArea; - - /* (non-Javadoc) - * @see DemoModule#updateDragEnabled(boolean) - */ - @Override - void updateDragEnabled(boolean dragEnabled) { - progressTextArea.setDragEnabled(dragEnabled); - } - - /** - * Creates the progress panel. - */ - public void createProgressPanel() { - getDemoPanel().setLayout(new BorderLayout()); - - JPanel textWrapper = new JPanel(new BorderLayout()); -// textWrapper.setBorder(new SoftBevelBorder(BevelBorder.LOWERED)); - textWrapper.setAlignmentX(LEFT_ALIGNMENT); - progressTextArea = new MyTextArea(); - - progressTextArea.getAccessibleContext().setAccessibleName(getString("ProgressBarDemo.accessible_text_area_name")); - progressTextArea.getAccessibleContext().setAccessibleName(getString("ProgressBarDemo.accessible_text_area_description")); - - - textWrapper.add(new JScrollPane(progressTextArea), BorderLayout.CENTER); - - - getDemoPanel().add(textWrapper, BorderLayout.CENTER); - - JPanel progressPanel = new JPanel(); - getDemoPanel().add(progressPanel, BorderLayout.SOUTH); - - - JPanel p1 = new JPanel(); - p1.add(createLoadButton()); - p1.add(createStopButton()); - - progressPanel.add(p1); - - } - - /** - * Creates the load button. - * - * @return the j button - */ - public JButton createLoadButton() { - loadAction = new AbstractAction(getString("ProgressBarDemo.start_button")) { - @Override - public void actionPerformed(ActionEvent e) { - progressTextArea.append("开始"+getString("ProgressBarDemo.text")); - - } - }; - return createButton(loadAction); - } - - /** - * Creates the stop button. - * - * @return the j button - */ - public JButton createStopButton() { - stopAction = new AbstractAction("开始解析") { - @Override - public void actionPerformed(ActionEvent e) { - AccessibleContext accessibleContext = progressTextArea.getAccessibleContext(); - String tempStr = progressTextArea.getText(); - - - progressTextArea.setText(tempStr); ; - JOptionPane.showMessageDialog( - getDemoPanel(), - getString("OptionPaneDemo.warningtext"), - getString("OptionPaneDemo.warningtitle"), - JOptionPane.WARNING_MESSAGE - ); - } - }; - return createButton(stopAction); - } - - /** - * Creates the button. - * - * @param a the a - * @return the j button - */ - public JButton createButton(Action a) { - JButton b = new JButton(); - // setting the following client property informs the button to show - // the action text as it's name. The default is to not show the - // action text. - b.putClientProperty("displayActionText", Boolean.TRUE); - b.setAction(a); - return b; - } - - - /** - * The Class MyTextArea. - */ - class MyTextArea extends JTextArea { - - /** - * Instantiates a new my text area. - */ - public MyTextArea() { - super(null, 0, 0); -// setEditable(false); - setText(""); - } - - /* (non-Javadoc) - * @see javax.swing.JComponent#getAlignmentX() - */ - @Override - public float getAlignmentX () { - return LEFT_ALIGNMENT; - } - - /* (non-Javadoc) - * @see javax.swing.JComponent#getAlignmentY() - */ - @Override - public float getAlignmentY () { - return TOP_ALIGNMENT; - } - } -} - - diff --git a/src/main/java/com/insigma/demos/TreeDemo.java b/src/main/java/com/insigma/demos/TreeDemo.java deleted file mode 100644 index 96c8019..0000000 --- a/src/main/java/com/insigma/demos/TreeDemo.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.insigma.demos;/* - * Copyright (C) 2015 Jack Jiang(cngeeker.com) The BeautyEye Project. - * All rights reserved. - * Project URL:https://github.com/JackJiang2011/beautyeye - * Version 3.6 - * - * Jack Jiang PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - * TreeDemo.java at 2015-2-1 20:25:39, original version by Jack Jiang. - * You can contact author with jb2011@163.com. - */ - -/* - * @(#)TreeDemo.java 1.13 05/11/17 - */ - - -import java.awt.BorderLayout; -import java.awt.Insets; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; - -import javax.swing.JComponent; -import javax.swing.JScrollPane; -import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; - -// TODO: Auto-generated Javadoc - -/** - * JTree Demo. - * - * @author Jeff Dinkins - * @version 1.13 11/17/05 - */ -public class TreeDemo extends DemoModule { - - /** - * The tree. - */ - JTree tree; - - /** - * main method allows us to run as a standalone demo. - * - * @param args the arguments - */ - public static void main(String[] args) { - SwingSet2.initBeautyStyle(); - TreeDemo demo = new TreeDemo(null); - demo.mainImpl(); - } - - /* (non-Javadoc) - * @see DemoModule#getName() - */ - @Override - public String getName() { - return "树"; - } - - ; - - /** - * TreeDemo Constructor. - * - * @param swingset the swingset - */ - public TreeDemo(SwingSet2 swingset) { - // Set the title for this demo, and an icon used to represent this - // demo inside the SwingSet2 app. - super(swingset, "TreeDemo", "toolbar/JTree.gif"); - - getDemoPanel().add(createTree(), BorderLayout.CENTER); - } - - /** - * Creates the tree. - * - * @return the j component - */ - public JComponent createTree() { - DefaultMutableTreeNode top = new DefaultMutableTreeNode(getString("TreeDemo.music")); - DefaultMutableTreeNode catagory = null; - DefaultMutableTreeNode artist = null; - DefaultMutableTreeNode record = null; - - // open tree data - URL url = getClass().getResource("/tree.txt"); - - try { - // convert url to buffered string - InputStream is = url.openStream(); - InputStreamReader isr = new InputStreamReader(is, "UTF-8"); - BufferedReader reader = new BufferedReader(isr); - - // read one line at a time, put into tree - String line = reader.readLine(); - while (line != null) { - // System.out.println("reading in: ->" + line + "<-"); - char linetype = line.charAt(0); - switch (linetype) { - case 'C': - catagory = new DefaultMutableTreeNode(line.substring(2)); - top.add(catagory); - break; - case 'A': - if (catagory != null) { - catagory.add(artist = new DefaultMutableTreeNode(line.substring(2))); - } - break; - case 'R': - if (artist != null) { - artist.add(record = new DefaultMutableTreeNode(line.substring(2))); - } - break; - case 'S': - if (record != null) { - record.add(new DefaultMutableTreeNode(line.substring(2))); - } - break; - default: - break; - } - line = reader.readLine(); - } - } catch (IOException e) { - } - - tree = new JTree(top) { - @Override - public Insets getInsets() { - return new Insets(5, 5, 5, 5); - } - }; -// tree.setBackground(new Color(250,250,250)); - - tree.setEditable(true); - - return new JScrollPane(tree); -// return tree; - } - - /* (non-Javadoc) - * @see DemoModule#updateDragEnabled(boolean) - */ - @Override - void updateDragEnabled(boolean dragEnabled) { - tree.setDragEnabled(dragEnabled); - } - -} diff --git a/src/main/java/com/insigma/ui/SwingFrame.java b/src/main/java/com/insigma/ui/SwingFrame.java index ebb1411..064ab83 100644 --- a/src/main/java/com/insigma/ui/SwingFrame.java +++ b/src/main/java/com/insigma/ui/SwingFrame.java @@ -431,8 +431,8 @@ public class SwingFrame extends JFrame implements ActionListener { progressBar.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - System.out.println("当前进度值: " + progressBar.getValue() + "; " + - "进度百分比: " + progressBar.getPercentComplete()); + // System.out.println("当前进度值: " + progressBar.getValue() + "; " + + // "进度百分比: " + progressBar.getPercentComplete()); } }); // 添加到内容面板 @@ -580,17 +580,17 @@ public class SwingFrame extends JFrame implements ActionListener { startRestorePanel.add(textField); - new Timer(500, new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - currentProgress++; - if (currentProgress > MAX_PROGRESS) { - currentProgress = MIN_PROGRESS; - } - progressBar.setValue(currentProgress); - progressBar.setForeground(Color.BLUE); - } - }).start(); +// new Timer(500, new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// currentProgress++; +// if (currentProgress > MAX_PROGRESS) { +// currentProgress = MIN_PROGRESS; +// } +// progressBar.setValue(currentProgress); +// progressBar.setForeground(Color.BLUE); +// } +// }).start(); } @Override