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

📄 componentchooser.java

📁 java xml 应用开发
💻 JAVA
字号:
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;

import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

/*
 * ComponentChooser.java
 * @author SvenoniusI
 */

public class ComponentChooser extends JPanel implements ActionListener
{
    /**
     * Comment for <code>serialVersionUID</code>
     */
    private static final long serialVersionUID = -8989231145248120133L;
    
    private String component;
    private ResourceBundle bundle;
    private JRadioButton processButton;
    private JRadioButton inOutButton;
    private JRadioButton jdfTreeButton;
    private ButtonGroup rbg;
    
    public ComponentChooser(ResourceBundle bundle)
    {
        super();
        this.setLayout(new GridLayout(4,1));
        this.bundle = bundle;
        this.component = bundle.getString("ProcessViewKey");
        init();
        setVisible(true);
    }
    
    private void init()
    {
        final JLabel label = new JLabel("Choose Component to Print:");
        add(label);
        
        rbg = new ButtonGroup();
        
        processButton = new JRadioButton(bundle.getString("ProcessViewKey"));
        processButton.setActionCommand(bundle.getString("ProcessViewKey"));
        rbg.add(processButton);
        if (Editor.getEditor().getFrame().processAreaIsNull())
            processButton.setEnabled(false);
        else
        {
            processButton.setEnabled(true);
            processButton.setSelected(true);
        }
        processButton.addActionListener(this);
        add(processButton);
        
        inOutButton = new JRadioButton(bundle.getString("NextNeighbourKey"));
        inOutButton.setActionCommand(bundle.getString("NextNeighbourKey"));
        rbg.add(inOutButton);
        if (Editor.getEditor().getFrame().inOutIsNull())
            inOutButton.setEnabled(false);
        else
        {
            inOutButton.setEnabled(true);
            if (Editor.getEditor().getFrame().processAreaIsNull())
                inOutButton.setSelected(true);
        }
        inOutButton.addActionListener(this);
        add(inOutButton);
        
        jdfTreeButton = new JRadioButton(bundle.getString("TreeViewKey"));
        jdfTreeButton.setActionCommand(bundle.getString("TreeViewKey"));
        rbg.add(jdfTreeButton);
        if (Editor.getEditor().getFrame().jdfTreeIsNull())
            jdfTreeButton.setEnabled(false);
        else
        {
            jdfTreeButton.setEnabled(true);
            if (Editor.getEditor().getFrame().processAreaIsNull()
                && Editor.getEditor().getFrame().inOutIsNull())
                jdfTreeButton.setSelected(true);
        }
        jdfTreeButton.addActionListener(this);
        add(jdfTreeButton);
    }
    
    public String getComponent()
    {
        return this.component;
    }
    
    public void actionPerformed(ActionEvent e)
    {
        this.component = rbg.getSelection().getActionCommand();
    }
}

⌨️ 快捷键说明

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