wmvccontroller.java

来自「绝对经典!好动西和大家一起分享 呵呵 你们不应该如此限制的,不好」· Java 代码 · 共 56 行

JAVA
56 行
字号
/* * WmvcController - implements a general purpose Swing based *     Controler using the Command pattern - for Wmvc framework * Used to simplify Swing controls * * (c) 2001, Bruce E. Wampler */import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;public class WmvcController        implements      ActionListener,                        ItemListener{    protected JComponent myComponent;    private WmvcExecutor wmvcExecutor;  // The Executor object    // This constructor is use by the subobjects    public WmvcController(JComponent comp,    // the component			  String tip,    			  WmvcExecutor wExec)    {	myComponent = comp;	wmvcExecutor = wExec;	if (tip != null)	    myComponent.setToolTipText(tip);    }    public WmvcExecutor getWmvcExecutor()        { return wmvcExecutor; }    /* ------------------------------------------------------     * Implement the Listeners for components.     * Each listener will send a message to the appropriate     * execute method from the associated WmvcExecutor. The type     * of event determines the signature of the execute method.     */    // implment the ActionListener    public void actionPerformed(ActionEvent event)    {        if (wmvcExecutor != null)            wmvcExecutor.execute(event);    }    // implement ItemLisetener    public void itemStateChanged(ItemEvent event)    {        if (wmvcExecutor != null)            wmvcExecutor.execute(event);    }}

⌨️ 快捷键说明

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