📄 wapoptions.java
字号:
package wapide;import javax.swing.*;import javax.swing.colorchooser.*;import javax.swing.filechooser.*;import java.awt.*;import java.awt.event.*;import javax.swing.event.*;import java.beans.*;import java.io.*;import java.util.*;/** * An Option dialog for the IDEFrame class * Copyright: Copyright (c) 2003 * Company: * @author Mark Busman * @version 1.0 * * For License and contact information see WAPIDE.java */public class WAPOptions extends JDialog { private JPanel MainPanel = new JPanel(); private JTabbedPane OptionPanes = new JTabbedPane(); private BorderLayout borderLayout1 = new BorderLayout(); private JPanel ColorPanel = new JPanel(); private JPanel ButtonPanel = new JPanel(); private JButton CancelButton = new JButton(); private FlowLayout flowLayout1 = new FlowLayout(); private BorderLayout borderLayout2 = new BorderLayout(); private JScrollPane jScrollPane1 = new JScrollPane(); private JButton OkButton = new JButton(); private String[] ColorTypeChoices = {"Caret Color", "Binary Editor Background", "Comments", "Extra Keyword", "Graphical Editor Background", "Plain Text", "Strings", "Text Editor Background", "WML Element", "WML Tag"}; private Color[] ColorChoices = new Color[10]; private JPanel EditorOptionsPanel = new JPanel(); private JPanel FilesPanel = new JPanel(); private GridBagLayout gridBagLayout1 = new GridBagLayout(); private JLabel TabSizelabel = new JLabel(); private JTextField TabSizeText = new JTextField(); private JCheckBox TrailingCheckbox = new JCheckBox(); private JCheckBox SmartIndentCheckbox = new JCheckBox(); private JCheckBox HighlightingCheckbox = new JCheckBox(); private GridBagLayout gridBagLayout2 = new GridBagLayout(); private JLabel BackupLabel = new JLabel(); private JTextField BackupDirText = new JTextField(); private JLabel FileDirectoryLabel = new JLabel(); private JTextField FilesDirText = new JTextField(); private JButton BackupDirButton = new JButton(); private JButton FilesDirButton = new JButton(); private JLabel BackupTimeLabel = new JLabel(); private JTextField BackupTimeText = new JTextField(); private JLabel filerLabel2 = new JLabel(); private JLabel fillerLabel1 = new JLabel(); private JCheckBox EnableBackupCheckbox = new JCheckBox(); private JScrollPane jScrollPane2 = new JScrollPane(); private JColorChooser ColorChooserPanel = new JColorChooser(); private JLabel MinsLabel = new JLabel(); private JPanel jPanel1 = new JPanel(); private JList KeywordColorTypeList = new JList(); private BorderLayout borderLayout3 = new BorderLayout(); private ColorSelectionModel csm = ColorChooserPanel.getSelectionModel(); boolean OKPressed = true; private JPanel EncoderPanel = new JPanel(); private GridBagLayout gridBagLayout3 = new GridBagLayout(); private JCheckBox StringTableCheckbox = new JCheckBox(); public WAPOptions() { try { jbInit(); pack(); setResizable(true); setSize(500, 430); setResizable(false); loadData(); KeywordColorTypeList.setSelectedIndex(0); ColorChooserPanel.setColor(ColorChoices[0]); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) { WAPOptions WAPOptions1 = new WAPOptions(); WAPOptions1.show(); } /**Overridden so we can exit when window is closed*/ protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { CancelButton.doClick(); } } private void jbInit() throws Exception { MainPanel.setLayout(borderLayout1); CancelButton.setText("Cancel"); CancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { CancelButton_actionPerformed(e); } }); ButtonPanel.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.RIGHT); ColorPanel.setLayout(borderLayout2); OkButton.setMaximumSize(new Dimension(81, 23)); OkButton.setMinimumSize(new Dimension(81, 23)); OkButton.setPreferredSize(new Dimension(81, 23)); OkButton.setText("Ok"); OkButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { OkButton_actionPerformed(e); } }); EditorOptionsPanel.setLayout(gridBagLayout1); TabSizelabel.setText("Tab Size:"); TabSizeText.setMinimumSize(new Dimension(60, 17)); TabSizeText.setPreferredSize(new Dimension(60, 17)); TabSizeText.setToolTipText("Enter a size for the tab"); TabSizeText.setText("2"); TrailingCheckbox.setSelected(true); TrailingCheckbox.setText("Strip trailing white space when saving files"); SmartIndentCheckbox.setSelected(true); SmartIndentCheckbox.setText("Smart Indent"); HighlightingCheckbox.setSelected(true); HighlightingCheckbox.setText("Enable Syntax Highlighting"); FilesPanel.setLayout(gridBagLayout2); BackupLabel.setText("Backup Directory"); FileDirectoryLabel.setText("User Files Directory"); BackupDirButton.setToolTipText("Select a directory"); BackupDirButton.setText("..."); BackupDirButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { BackupDirButton_actionPerformed(e); } }); FilesDirButton.setToolTipText("Select a directory"); FilesDirButton.setText("..."); FilesDirButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { FilesDirButton_actionPerformed(e); } }); BackupTimeLabel.setEnabled(false); BackupTimeLabel.setText("Backup Interval"); BackupTimeText.setEnabled(false); BackupTimeText.setPreferredSize(new Dimension(70, 17)); BackupTimeText.setToolTipText("Specify backup time in minutes"); BackupTimeText.setText("10"); filerLabel2.setMaximumSize(new Dimension(10, 13)); filerLabel2.setMinimumSize(new Dimension(10, 13)); filerLabel2.setPreferredSize(new Dimension(10, 13)); fillerLabel1.setMaximumSize(new Dimension(0, 13)); fillerLabel1.setMinimumSize(new Dimension(0, 13)); fillerLabel1.setPreferredSize(new Dimension(0, 13)); BackupDirText.setPreferredSize(new Dimension(104, 17)); FilesDirText.setPreferredSize(new Dimension(104, 17)); EnableBackupCheckbox.setText("Enable Timed Backup"); EnableBackupCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { EnableBackupCheckbox_actionPerformed(e); } }); MainPanel.setMinimumSize(new Dimension(400, 385)); MainPanel.setPreferredSize(new Dimension(400, 385)); ColorChooserPanel.setPreferredSize(new Dimension(440, 327)); ColorChooserPanel.setMinimumSize(new Dimension(440, 327)); ColorChooserPanel.setAutoscrolls(true); ColorChooserPanel.setMaximumSize(new Dimension(440, 2147483647)); MinsLabel.setEnabled(false); MinsLabel.setText("mins."); this.setResizable(false); this.setModal(true); this.setTitle("Options"); jScrollPane1.setMinimumSize(new Dimension(200, 22)); KeywordColorTypeList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { KeywordColorTypeList_valueChanged(e); } }); KeywordColorTypeList.setMaximumSize(new Dimension(100, 0)); KeywordColorTypeList.setMinimumSize(new Dimension(100, 0)); KeywordColorTypeList.setPreferredSize(new Dimension(200, 0)); jPanel1.setLayout(borderLayout3); jPanel1.setMinimumSize(new Dimension(100, 0)); jPanel1.setPreferredSize(new Dimension(150, 0)); EncoderPanel.setLayout(gridBagLayout3); StringTableCheckbox.setSelected(true); StringTableCheckbox.setText("Encode files using a string table"); this.getContentPane().add(MainPanel, BorderLayout.CENTER); MainPanel.add(OptionPanes, BorderLayout.CENTER); MainPanel.add(ButtonPanel, BorderLayout.SOUTH); ButtonPanel.add(OkButton, null); ButtonPanel.add(CancelButton, null); OptionPanes.add(ColorPanel, "Colors"); ColorPanel.add(jScrollPane1, BorderLayout.WEST); jScrollPane1.getViewport().add(jPanel1, null); jPanel1.add(KeywordColorTypeList, BorderLayout.CENTER); ColorPanel.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.getViewport().add(ColorChooserPanel, null); OptionPanes.add(EditorOptionsPanel, "Editor"); EditorOptionsPanel.add(TrailingCheckbox, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); EditorOptionsPanel.add(TabSizelabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 1, 0, 0), 26, 0)); EditorOptionsPanel.add(HighlightingCheckbox, new GridBagConstraints(0, 5, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); EditorOptionsPanel.add(SmartIndentCheckbox, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0 ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); EditorOptionsPanel.add(TabSizeText, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0 ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); EditorOptionsPanel.add(fillerLabel1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); OptionPanes.add(FilesPanel, "Files"); FilesPanel.add(BackupDirButton, new GridBagConstraints(4, 1, 2, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); FilesPanel.add(BackupLabel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); FilesPanel.add(BackupDirText, new GridBagConstraints(0, 1, 4, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 274, 0)); FilesPanel.add(FileDirectoryLabel, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); FilesPanel.add(filerLabel2, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 5, 0), 0, 0)); FilesPanel.add(BackupTimeText, new GridBagConstraints(2, 5, 1, 3, 0.0, 0.0 ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 73, 0));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -