⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertieslookplugins.java

📁 eq跨平台查询工具源码 eq跨平台查询工具源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * PropertiesLookPlugins.java * * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis * * 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 2 * of the License, or 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. * */package org.executequery.gui.prefs;import java.awt.Dimension;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.FocusListener;import java.awt.event.FocusEvent;import java.awt.event.KeyListener;import java.awt.event.KeyEvent;import java.io.File;import java.io.IOException;import java.net.MalformedURLException;import java.util.Vector;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JFileChooser;import javax.swing.JLabel;import javax.swing.JList;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextField;import javax.swing.SwingUtilities;import javax.swing.ListSelectionModel;import javax.swing.event.ListSelectionEvent;import javax.swing.event.ListSelectionListener;import org.executequery.LookAndFeelProperties;import org.executequery.Constants;import org.executequery.GUIUtilities;import org.executequery.gui.SimpleValueSelectionDialog;import org.executequery.components.FileChooserDialog;import org.underworldlabs.swing.FileSelector;import org.executequery.plaf.LookAndFeelDefinition;import org.underworldlabs.util.MiscUtils;/* ---------------------------------------------------------- * CVS NOTE: Changes to the CVS repository prior to the  *           release of version 3.0.0beta1 has meant a  *           resetting of CVS revision numbers. * ---------------------------------------------------------- *//** * * @author   Takis Diakoumis * @version  $Revision: 1.4 $ * @date     $Date: 2006/05/14 06:56:52 $ */public class PropertiesLookPlugins extends JPanel                                   implements ListSelectionListener,                                              UserPreferenceFunction,                                              ActionListener,                                              KeyListener,                                              FocusListener {        private JList list;        private JTextField nameField;    private JTextField libPathField;    private JTextField classField;    private JTextField themeField;        private JCheckBox skinCheck;    private JCheckBox installedCheck;        private Vector lfdv;    private JButton findClassButton;    private JButton libBrowseButton;    private JButton themeBrowseButton;        private JButton newButton;    private JButton deleteButton;        private JLabel themeLabel;    private JLabel nameLabel;    private JLabel libLabel;    private JLabel classLabel;        public PropertiesLookPlugins() {        super(new GridBagLayout());        setBorder(BorderFactory.createLineBorder(                GUIUtilities.getDefaultBorderColour()));        try {            jbInit();        } catch(Exception e) {            e.printStackTrace();        }            }        private void jbInit() {                LookAndFeelDefinition[] lfda = LookAndFeelProperties.getLookAndFeelArray();        lfdv = new Vector();                if (lfda != null && lfda.length > 0) {                        for (int i = 0; i < lfda.length; i++)                lfdv.add(lfda[i]);                    }                list = new JList(lfdv);        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);               list.addListSelectionListener(this);                nameField = new JTextField();        libPathField = new JTextField();        classField = new JTextField();        themeField = new JTextField();                findClassButton = new JButton("Find");        libBrowseButton = new JButton("Browse");        themeBrowseButton = new JButton("Browse");        Insets btnInsets = new Insets(2,2,2,2);        libBrowseButton.setMargin(btnInsets);        themeBrowseButton.setMargin(btnInsets);        findClassButton.setMargin(btnInsets);                skinCheck = new JCheckBox("Skin Look and Feel");        installedCheck = new JCheckBox("Install");                newButton = new JButton("New");        deleteButton = new JButton("Delete");                newButton.addActionListener(this);        deleteButton.addActionListener(this);        findClassButton.addActionListener(this);        libBrowseButton.addActionListener(this);        themeBrowseButton.addActionListener(this);        skinCheck.addActionListener(this);        installedCheck.addActionListener(this);                Dimension btnDim = new Dimension(60, 25);        findClassButton.setPreferredSize(btnDim);        libBrowseButton.setPreferredSize(btnDim);        themeBrowseButton.setPreferredSize(btnDim);                        nameField.addFocusListener(this);                nameField.addKeyListener(this);        libPathField.addKeyListener(this);        classField.addKeyListener(this);        themeField.addKeyListener(this);                themeLabel = new JLabel("Theme Pack:");        nameLabel = new JLabel("Name:");        classLabel = new JLabel("Class Name:");        libLabel = new JLabel("Library Path:");        JPanel buttons = new JPanel(new GridBagLayout());        GridBagConstraints gbc = new GridBagConstraints();        gbc.gridy = 0;        gbc.gridx = 0;        gbc.insets.right = 10;        gbc.weightx = 1.0;        gbc.fill = GridBagConstraints.HORIZONTAL;        buttons.add(newButton, gbc);        gbc.gridx++;        gbc.insets.right = 0;        buttons.add(deleteButton, gbc);                JPanel panel = new JPanel(new GridBagLayout());        gbc.gridy = 0;        gbc.gridx = 0;        gbc.weightx = 0;        gbc.insets.bottom = 10;        gbc.gridwidth = GridBagConstraints.REMAINDER;        gbc.anchor = GridBagConstraints.NORTHWEST;        panel.add(new JLabel("Look and Feel Plugins"), gbc);        gbc.gridy++;        gbc.weighty = 1.0;        gbc.weightx = 1.0;        gbc.insets.bottom = 5;        gbc.fill = GridBagConstraints.BOTH;        panel.add(new JScrollPane(list), gbc);        gbc.gridy++;        gbc.weighty = 0;        gbc.fill = GridBagConstraints.HORIZONTAL;        panel.add(buttons, gbc);        gbc.gridwidth = 1;        gbc.gridy++;        gbc.weightx = 0;        gbc.fill = GridBagConstraints.NONE;        panel.add(installedCheck, gbc);        gbc.gridx++;        gbc.insets.left = 5;        panel.add(skinCheck, gbc);        gbc.gridy++;        gbc.gridx = 0;        gbc.insets.left = 0;        gbc.insets.right = 5;        panel.add(nameLabel, gbc);        gbc.gridx++;        gbc.insets.right = 0;        gbc.fill = GridBagConstraints.HORIZONTAL;        gbc.gridwidth = GridBagConstraints.REMAINDER;        panel.add(nameField, gbc);        gbc.gridy++;        gbc.gridx = 0;        gbc.insets.right = 5;        gbc.gridwidth = 1;        gbc.insets.top = 2;        gbc.weightx = 0;        gbc.fill = GridBagConstraints.NONE;        panel.add(libLabel, gbc);        gbc.gridx++;        gbc.weightx = 1.0;        gbc.fill = GridBagConstraints.HORIZONTAL;        panel.add(libPathField, gbc);        gbc.gridx++;        gbc.insets.right = 0;        gbc.weightx = 0;        gbc.insets.top = 0;        gbc.fill = GridBagConstraints.NONE;        panel.add(libBrowseButton, gbc);        gbc.gridy++;        gbc.gridx = 0;        gbc.insets.right = 5;        gbc.insets.top = 2;        panel.add(classLabel, gbc);        gbc.gridx++;        gbc.weightx = 1.0;        gbc.fill = GridBagConstraints.HORIZONTAL;        panel.add(classField, gbc);        gbc.gridx++;        gbc.insets.right = 0;        gbc.weightx = 0;        gbc.insets.top = 0;        gbc.fill = GridBagConstraints.HORIZONTAL;        panel.add(findClassButton, gbc);        gbc.gridy++;        gbc.gridx = 0;        gbc.insets.top = 2;        gbc.insets.right = 5;        gbc.fill = GridBagConstraints.NONE;        panel.add(themeLabel, gbc);        gbc.gridx++;        gbc.weightx = 1.0;        gbc.fill = GridBagConstraints.HORIZONTAL;        panel.add(themeField, gbc);        gbc.gridx++;        gbc.insets.top = 0;        gbc.insets.right = 0;        gbc.weightx = 0;        gbc.fill = GridBagConstraints.NONE;        panel.add(themeBrowseButton, gbc);        gbc.gridy++;        gbc.gridx = 0;        gbc.anchor = GridBagConstraints.CENTER;        gbc.gridwidth = GridBagConstraints.REMAINDER;        panel.add(new JLabel("Note: Activate this feature from the 'Display' node."), gbc);        add(panel, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,                                          GridBagConstraints.NORTHWEST,                                           GridBagConstraints.BOTH,                                          new Insets(5, 5, 0, 5), 0, 0));        if (lfdv.size() > 0) {            list.setSelectedIndex(0);        } else {            enableAllFields(false);            enableSkinFields(false);        }            }    public void actionPerformed(ActionEvent e) {        Object obj = e.getSource();        if (obj == newButton)            addNewLookAndFeel();        else if (obj == deleteButton)            deleteLookAndFeel();        else if (obj == skinCheck)            skinCheckedAction();        else if (obj == installedCheck)            installedCheckedAction();        else if (obj == findClassButton)            findClassNames();        else            browseButton_actionPerformed(obj);    }    private void findClassNames() {        String paths = libPathField.getText();        if (MiscUtils.isNull(paths)) {            GUIUtilities.displayErrorMessage(                    "A valid path to the look and feel library is required");            return;        }        String[] looks = null;        try {            GUIUtilities.showWaitCursor();            looks = MiscUtils.findImplementingClasses(                                            "javax.swing.LookAndFeel", paths, false);        } catch (MalformedURLException urlExc) {            GUIUtilities.showNormalCursor();            GUIUtilities.displayErrorMessage(                    "A valid path to the library is required");            return;        } catch (IOException ioExc) {            GUIUtilities.showNormalCursor();            StringBuffer sb = new StringBuffer();            sb.append("An error occured accessing the specified file.").               append("\n\nThe system returned:\n").               append(ioExc.getMessage());

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -