📄 pluginmanager.java
字号:
package jim;
import javax.swing.*;
import javax.swing.event.*;
/* Copyright, 2001 Jason Dominiczak.
*
* This file is part of JIM - The Java Instant Messenger.
* eMailer 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, or (at your option)
* any later version.
* JIM 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 eMailer; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
public class PluginManager extends JFrame implements ListSelectionListener {
IvjEventHandler ivjEventHandler = new IvjEventHandler();
private JButton ivjJButton1 = null;
private JPanel ivjJFrameContentPane = null;
private JLabel ivjJLabel1 = null;
private JList ivjJList1 = null;
private JPanel ivjJPanel1 = null;
private JSplitPane ivjJSplitPane1 = null;
private JEditorPane ivjJTextArea1 = null;
private Jim ivjJIM = null;
public javax.swing.DefaultListModel listModel = new DefaultListModel();
private PluginLoader ivjPluginLoader = null;
private JScrollPane ivjJScrollPane1 = null;
class IvjEventHandler implements java.awt.event.ActionListener {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (e.getSource() == PluginManager.this.getJButton1())
connEtoM1(e);
};
};
/**
* PluginManager constructor comment.
*/
public PluginManager() {
super();
initialize();
}
/**
* PluginManager constructor comment.
* @param title java.lang.String
*/
public PluginManager(String title) {
super(title);
}
/**
* connEtoM1: (JButton1.action.actionPerformed(java.awt.event.ActionEvent) --> PluginManager.dispose()V)
* @param arg1 java.awt.event.ActionEvent
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void connEtoM1(java.awt.event.ActionEvent arg1) {
try {
// user code begin {1}
// user code end
this.dispose();
// user code begin {2}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
}
}
/**
* Return the JButton1 property value.
* @return javax.swing.JButton
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JButton getJButton1() {
if (ivjJButton1 == null) {
try {
ivjJButton1 = new javax.swing.JButton();
ivjJButton1.setName("JButton1");
ivjJButton1.setText("OK");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJButton1;
}
/**
* Return the JFrameContentPane property value.
* @return javax.swing.JPanel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JPanel getJFrameContentPane() {
if (ivjJFrameContentPane == null) {
try {
ivjJFrameContentPane = new javax.swing.JPanel();
ivjJFrameContentPane.setName("JFrameContentPane");
ivjJFrameContentPane.setLayout(new java.awt.BorderLayout());
getJFrameContentPane().add(getJLabel1(), "North");
getJFrameContentPane().add(getJPanel1(), "South");
getJFrameContentPane().add(getJSplitPane1(), "Center");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJFrameContentPane;
}
/**
* Return the JIM property value.
* @return jim.Jim
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private Jim getJIM() {
// user code begin {1}
// user code end
return ivjJIM;
}
/**
* Method generated to support the promotion of the JIMThis attribute.
* @return jim.Jim
*/
public Jim getJIMThis() {
return getJIM();
}
/**
* Return the JLabel1 property value.
* @return javax.swing.JLabel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JLabel getJLabel1() {
if (ivjJLabel1 == null) {
try {
ivjJLabel1 = new javax.swing.JLabel();
ivjJLabel1.setName("JLabel1");
ivjJLabel1.setText("Instaled Plugins: ");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJLabel1;
}
/**
* Return the JList1 property value.
* @return javax.swing.JList
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JList getJList1() {
if (ivjJList1 == null) {
try {
ivjJList1 = new javax.swing.JList();
ivjJList1.setName("JList1");
ivjJList1.setModel(new javax.swing.DefaultListModel());
ivjJList1.setPreferredSize(new java.awt.Dimension(100, 0));
ivjJList1.setMinimumSize(new java.awt.Dimension(100, 0));
ivjJList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
// user code begin {1}
ivjJList1.addListSelectionListener(this);
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJList1;
}
/**
* Return the JPanel1 property value.
* @return javax.swing.JPanel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JPanel getJPanel1() {
if (ivjJPanel1 == null) {
try {
ivjJPanel1 = new javax.swing.JPanel();
ivjJPanel1.setName("JPanel1");
ivjJPanel1.setLayout(new java.awt.BorderLayout());
getJPanel1().add(getJButton1(), "West");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJPanel1;
}
/**
* Return the JScrollPane1 property value.
* @return javax.swing.JScrollPane
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JScrollPane getJScrollPane1() {
if (ivjJScrollPane1 == null) {
try {
ivjJScrollPane1 = new javax.swing.JScrollPane();
ivjJScrollPane1.setName("JScrollPane1");
ivjJScrollPane1.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
getJScrollPane1().setViewportView(getJTextArea1());
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJScrollPane1;
}
/**
* Return the JSplitPane1 property value.
* @return javax.swing.JSplitPane
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JSplitPane getJSplitPane1() {
if (ivjJSplitPane1 == null) {
try {
ivjJSplitPane1 = new javax.swing.JSplitPane(javax.swing.JSplitPane.HORIZONTAL_SPLIT);
ivjJSplitPane1.setName("JSplitPane1");
ivjJSplitPane1.setDividerLocation(150);
getJSplitPane1().add(getJList1(), "left");
getJSplitPane1().add(getJScrollPane1(), "right");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJSplitPane1;
}
/**
* Return the JTextArea1 property value.
* @return javax.swing.JEditorPane
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JEditorPane getJTextArea1() {
if (ivjJTextArea1 == null) {
try {
ivjJTextArea1 = new javax.swing.JEditorPane();
ivjJTextArea1.setName("JTextArea1");
ivjJTextArea1.setDocument(new javax.swing.text.html.HTMLDocument());
ivjJTextArea1.setText("");
ivjJTextArea1.setBounds(0, 0, 172, 154);
ivjJTextArea1.setEditable(false);
ivjJTextArea1.setContentType("text/html");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJTextArea1;
}
/**
* Return the PluginLoader property value.
* @return jim.PluginLoader
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private PluginLoader getPluginLoader() {
// user code begin {1}
// user code end
return ivjPluginLoader;
}
/**
* Method generated to support the promotion of the pluginLoaderThis attribute.
* @return jim.PluginLoader
*/
public PluginLoader getPluginLoaderThis() {
return getPluginLoader();
}
/**
* Called whenever the part throws an exception.
* @param exception java.lang.Throwable
*/
private void handleException(java.lang.Throwable exception) {
/* Uncomment the following lines to print uncaught exceptions to stdout */
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
// exception.printStackTrace(System.out);
}
/**
* Initializes connections
* @exception java.lang.Exception The exception description.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initConnections() throws java.lang.Exception {
// user code begin {1}
// user code end
getJButton1().addActionListener(ivjEventHandler);
}
/**
* Initialize the class.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
try {
// user code begin {1}
// user code end
setName("PluginManager");
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setSize(332, 195);
setTitle("Plugin Manager");
setContentPane(getJFrameContentPane());
initConnections();
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
// user code begin {2}
// user code end
}
/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args) {
// Insert code to start the application here.
}
/**
* Comment
*/
public void pluginManager_Initialize() {
DefaultListModel dtm = ((DefaultListModel)getJList1().getModel());
dtm.removeAllElements();
PluginLoader pLoader = getPluginLoader();
DefaultListModel sampleModel = new DefaultListModel();
PluginInterface[] pInterface = pLoader.getPlugins();
for(int i=0; i<pInterface.length; i++)
dtm.addElement(pInterface[i].getTreeName());
return;
}
/**
* Set the JIM to a new value.
* @param newValue jim.Jim
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void setJIM(Jim newValue) {
if (ivjJIM != newValue) {
try {
jim.Jim oldValue = getJIM();
ivjJIM = newValue;
firePropertyChange("JIMThis", oldValue, newValue);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
// user code begin {3}
// user code end
}
/**
* Method generated to support the promotion of the JIMThis attribute.
* @param arg1 jim.Jim
*/
public void setJIMThis(Jim arg1) {
setJIM(arg1);
}
/**
* Set the PluginLoader to a new value.
* @param newValue jim.PluginLoader
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void setPluginLoader(PluginLoader newValue) {
if (ivjPluginLoader != newValue) {
try {
jim.PluginLoader oldValue = getPluginLoader();
ivjPluginLoader = newValue;
firePropertyChange("pluginLoaderThis", oldValue, newValue);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
// user code begin {3}
// user code end
}
/**
* Method generated to support the promotion of the pluginLoaderThis attribute.
* @param arg1 jim.PluginLoader
*/
public void setPluginLoaderThis(PluginLoader arg1) {
setPluginLoader(arg1);
}
/**
* Insert the method's description here.
* Creation date: (10/9/2001 4:09:54 PM)
* @param event javax.swing.event.ListSelectionEvent
*/
public void valueChanged(javax.swing.event.ListSelectionEvent event) {
if (!event.getValueIsAdjusting()) {
String selection = getJList1().getSelectedValue().toString();
PluginLoader pLoader = getPluginLoader();
PluginInterface[] pInterface = pLoader.getPlugins();
//getJTextArea1().removeAll();
//getJTextArea1().setContentType("text/html");
//try{
//getJTextArea1().setText("");
//getJTextArea1().setText(pInterface[getJList1().getSelectedIndex()].getDescription());
try{
getJTextArea1().setPage(pInterface[getJList1().getSelectedIndex()].getURL());
} catch (java.io.IOException e ) {
System.out.println("--------- CAUGHT EXCEPTION ---------");
e.printStackTrace(System.out);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -