?? projectproperties.java
字號:
package com.sutternow.swingkar.gui;import javax.swing.*;import java.awt.event.*;import org.dom4j.Element;import net.sf.easylayouts.*;import com.gargoylesoftware.base.gui.TableLayout;import com.sutternow.swingkar.ConfigManager;import com.sutternow.misc.Utils;/** * Created by IntelliJ IDEA. * User: Matthew Payne * Date: Jan 18, 2003 * Time: 1:01:50 AM * To change this template use Options | File Templates. */public class ProjectProperties implements SimpleForm, ActionListener { public String Title = "Project Properts"; public ProjectProperties(ConfigManager _cm) { cm = _cm; } public String getTitle() { return Title; } public JPanel getEditForm() { final TableLayout layout = new TableLayout(); // Border etched = BorderFactory.createEtchedBorder(); final JPanel panel = new JPanel(); final JPanel topPanel = new JPanel(new TableLayout()); final JPanel bottomPanel = new JPanel(); RowLayout rowLayout = new RowLayout(panel, 1, 25); topPanel.add(new JLabel("Application Name:"), "1,1"); projectName = new JTextField(30); topPanel.add(projectName, "1,2"); topPanel.add(new JLabel("Version:"), "2,1"); version = new JTextField(30); topPanel.add(version, "2,2"); topPanel.add(new JLabel("Author:"), "3,1"); author = new JTextField(30); topPanel.add(author, "3,2"); topPanel.add(new JLabel("Company:"), "4,1"); company = new JTextField(30); topPanel.add(company, "4,2"); /*cmdSave = new JButton("Save"); cmdCancel = new JButton("Cancel"); cmdSave.addActionListener(this); cmdCancel.addActionListener(this); bottomPanel.add(cmdSave); bottomPanel.add(cmdCancel);*/ layout.setColumnExpandable(0, true); layout.setColumnExpandable(1, true); rowLayout.add(topPanel, 0); rowLayout.add(bottomPanel, 1); return panel; } public void setValues(Element propCfg) { this.clearForm(); propElement = propCfg; String relPath = propCfg.getUniquePath(); projectName.setText(Utils.parseNull(propCfg.valueOf(relPath + "/name"))); author.setText(Utils.parseNull(propCfg.valueOf(relPath + "/author"))); version.setText(Utils.parseNull(propCfg.valueOf(relPath + "/version"))); company.setText(Utils.parseNull(propCfg.valueOf(relPath + "/company"))); } public void actionPerformed(ActionEvent ae) { JButton src = (JButton) ae.getSource(); } private void clearForm() { projectName.setText(""); version.setText(""); author.setText(""); company.setText(""); } public void doSave() { propElement.element("name").setText(projectName.getText()); propElement.element("version").setText(version.getText()); propElement.element("author").setText(author.getText()); propElement.element("company").setText(company.getText()); System.out.println(this.Title + " Saved"); } private JTextField projectName; private JTextField version; private JTextField company; private JTextField author; //private JButton cmdSave; //private JButton cmdCancel; private ConfigManager cm; private Element propElement;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -