📄 preferences.java
字号:
/* ---------------------------------------------------------------------- The SINUS Firewall -- a TCP/IP packet filter for Linux Written within the SINUS project at the University of Zurich, SWITCH, Telekurs Payserv AG, ETH Zurich. originally based on the sf Firewall Software (C) 1996 by Robert Muchsel and Roland Schmid. 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 (at your option) 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., 675 Mass Ave, Cambridge, MA 02139, USA. SINUS Firewall resources: SINUS Homepage: http://www.ifi.unizh.ch/ikm/SINUS/ Firewall Homepage: http://www.ifi.unizh.ch/ikm/SINUS/firewall.html Frequently asked questions: http://www.ifi.unizh.ch/ikm/SINUS/sf_faq.html Mailing list for comments, questions, bug reports: firewall@ifi.unizh.ch ---------------------------------------------------------------------- */package sfclasses;import java.awt.*;import java.awt.event.*;import java.util.*;import com.sun.java.swing.*;public class Preferences extends JFrame implements ActionListener { public Preferences() { super("Preferences"); JPanel p = new JPanel(); GridLayout gl = new GridLayout(9, 2); gl.setHgap(5); gl.setVgap(5); p.setLayout(gl); p.add(new JLabel("Configuration Directory")); confDir = new JTextField(ManageControl.custom.getProperty("CONF_DIR"), 20); p.add(confDir); p.add(new JLabel("Log Directory")); logDir = new JTextField(ManageControl.custom.getProperty("LOG_DIR"), 20); p.add(logDir); p.add(new JLabel("Main Logfile")); log = new JTextField(ManageControl.custom.getProperty("LOG"), 20); p.add(log); p.add(new JLabel("Spy Logfile")); spy = new JTextField(ManageControl.custom.getProperty("SPY_LOG"), 20); p.add(spy); p.add(new JLabel("Report Logfile")); report = new JTextField(ManageControl.custom.getProperty("REPORT"), 20); p.add(report); p.add(new JLabel("Global Configuration")); globalConf = new JTextField(ManageControl.custom.getProperty("GLOBAL_CONFIG"), 20); p.add(globalConf); p.add(new JLabel("Generated Configuration")); newConf = new JTextField(ManageControl.custom.getProperty("GENERATE_CONFIG"), 20); p.add(newConf); p.add(new JLabel("Directory for TempFiles")); tmpDir = new JTextField(ManageControl.custom.getProperty("TMP_DIR"), 20); p.add(tmpDir); JPanel buttons = new JPanel(); saveButton = new JButton("Save"); saveButton.addActionListener(this); buttons.add(saveButton); applyButton = new JButton("Apply"); applyButton.addActionListener(this); buttons.add(applyButton); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttons.add(cancelButton); JPanel label = new JPanel(); label.add("Center", new JLabel("Configuration Parameters")); getContentPane().add("North", label); getContentPane().add("Center", p); getContentPane().add("South", buttons); pack(); } public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if ((source == saveButton) || (source == applyButton)) { ManageControl.custom.put("CONF_DIR", confDir.getText()); ManageControl.custom.put("LOG_DIR", logDir.getText()); ManageControl.custom.put("LOG", log.getText()); ManageControl.custom.put("SPY_LOG", spy.getText()); ManageControl.custom.put("REPORT", report.getText()); ManageControl.custom.put("GLOBAL_CONFIG", globalConf.getText()); ManageControl.custom.put("GENERATE_CONFIG", newConf.getText()); ManageControl.custom.put("TMP_DIR", tmpDir.getText()); if (source == saveButton) ManageControl.custom.save(); dispose(); } if (source == cancelButton) { this.dispose(); } } // actionPerformed private JButton saveButton; private JButton applyButton; private JButton cancelButton; private JTextField confDir; private JTextField logDir; private JTextField tmpDir; private JTextField log; private JTextField spy; private JTextField report; private JTextField globalConf; private JTextField newConf;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -