📄 preferencesdialog.java
字号:
package net.sf.memoranda.ui;import java.io.File;import java.util.Vector;import net.sf.memoranda.util.Configuration;import net.sf.memoranda.util.CurrentStorage;import net.sf.memoranda.util.Local;import net.sf.memoranda.util.MimeTypesList;import java.awt.*;import javax.swing.*;import javax.swing.border.*;import java.awt.event.*;/*$Id: PreferencesDialog.java,v 1.16 2006/06/28 22:58:31 alexeya Exp $*/public class PreferencesDialog extends JDialog { JPanel topPanel = new JPanel(new BorderLayout()); JTabbedPane tabbedPanel = new JTabbedPane(); JPanel GeneralPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc; JLabel jLabel1 = new JLabel(); ButtonGroup minGroup = new ButtonGroup(); JRadioButton minTaskbarRB = new JRadioButton(); JRadioButton minHideRB = new JRadioButton(); ButtonGroup closeGroup = new ButtonGroup(); JLabel jLabel2 = new JLabel(); JRadioButton closeExitRB = new JRadioButton(); JCheckBox askConfirmChB = new JCheckBox(); JRadioButton closeHideRB = new JRadioButton(); JLabel jLabel3 = new JLabel(); ButtonGroup lfGroup = new ButtonGroup(); JRadioButton lfKunststoffRB = new JRadioButton(); JRadioButton lfSystemRB = new JRadioButton(); JRadioButton lfJavaRB = new JRadioButton(); JRadioButton lfCustomRB = new JRadioButton(); JLabel classNameLabel = new JLabel(); JTextField lfClassName = new JTextField(); JLabel jLabel4 = new JLabel(); JCheckBox enSystrayChB = new JCheckBox(); JCheckBox startMinimizedChB = new JCheckBox(); JCheckBox enSplashChB = new JCheckBox(); JCheckBox enL10nChB = new JCheckBox(); JCheckBox firstdow = new JCheckBox(); JPanel resourcePanel = new JPanel(new BorderLayout()); ResourceTypePanel resourceTypePanel = new ResourceTypePanel(); Border rstPanelBorder; JPanel rsBottomPanel = new JPanel(new GridBagLayout()); TitledBorder rsbpBorder; JButton okB = new JButton(); JButton cancelB = new JButton(); JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); JLabel jLabel5 = new JLabel(); JTextField browserPath = new JTextField(); JButton browseB = new JButton(); JLabel lblExit = new JLabel(); JPanel soundPanel = new JPanel(); JCheckBox enableSoundCB = new JCheckBox(); BorderLayout borderLayout1 = new BorderLayout(); TitledBorder titledBorder1; ButtonGroup soundGroup = new ButtonGroup(); JPanel jPanel2 = new JPanel(); JButton soundFileBrowseB = new JButton(); GridLayout gridLayout1 = new GridLayout(); JPanel jPanel1 = new JPanel(); JRadioButton soundBeepRB = new JRadioButton(); JLabel jLabel6 = new JLabel(); JTextField soundFile = new JTextField(); JRadioButton soundDefaultRB = new JRadioButton(); BorderLayout borderLayout3 = new BorderLayout(); JPanel jPanel3 = new JPanel(); JRadioButton soundCustomRB = new JRadioButton(); BorderLayout borderLayout2 = new BorderLayout(); JPanel editorConfigPanel = new JPanel(new BorderLayout()); JPanel econfPanel = new JPanel(new GridLayout(5, 2)); Vector fontnames = getFontNames(); JComboBox normalFontCB = new JComboBox(fontnames); JComboBox headerFontCB = new JComboBox(fontnames); JComboBox monoFontCB = new JComboBox(fontnames); JSpinner baseFontSize = new JSpinner(); JCheckBox antialiasChB = new JCheckBox(); JLabel normalFontLabel = new JLabel(); JLabel headerFontLabel = new JLabel(); JLabel monoFontLabel = new JLabel(); JLabel baseFontSizeLabel = new JLabel(); public PreferencesDialog(Frame frame) { super(frame, Local.getString("Preferences"), true); try { jbInit(); } catch (Exception ex) { new ExceptionDialog(ex); } } public PreferencesDialog() { this(null); } void jbInit() throws Exception { titledBorder1 = new TitledBorder(BorderFactory.createEtchedBorder( Color.white, new Color(156, 156, 158)), Local .getString("Sound")); this.setResizable(false); // Build Tab1 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT); jLabel1.setText(Local.getString("Window minimize action:")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(10, 10, 0, 15); gbc.anchor = GridBagConstraints.EAST; enableSoundCB.setText(Local.getString("Enable sound notifications")); enableSoundCB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { enableSoundCB_actionPerformed(e); } }); soundPanel.setLayout(borderLayout1); soundFileBrowseB.setText(Local.getString("Browse")); soundFileBrowseB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { soundFileBrowseB_actionPerformed(e); } }); gridLayout1.setRows(4); jPanel1.setBorder(titledBorder1); jPanel1.setLayout(gridLayout1); soundBeepRB.setText(Local.getString("System beep")); soundBeepRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { soundBeepRB_actionPerformed(e); } }); jLabel6.setText(Local.getString("Sound file") + ":"); soundDefaultRB.setText(Local.getString("Default")); soundDefaultRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { soundDefaultRB_actionPerformed(e); } }); jPanel3.setLayout(borderLayout3); soundCustomRB.setText(Local.getString("Custom")); soundCustomRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { soundCustomRB_actionPerformed(e); } }); jPanel2.setLayout(borderLayout2); soundPanel.add(jPanel2, BorderLayout.CENTER); jPanel2.add(jPanel1, BorderLayout.NORTH); jPanel1.add(soundDefaultRB, null); jPanel1.add(soundBeepRB, null); jPanel1.add(soundCustomRB, null); this.soundGroup.add(soundDefaultRB); this.soundGroup.add(soundBeepRB); this.soundGroup.add(soundCustomRB); jPanel1.add(jPanel3, null); jPanel3.add(soundFile, BorderLayout.CENTER); jPanel3.add(soundFileBrowseB, BorderLayout.EAST); jPanel3.add(jLabel6, BorderLayout.WEST); GeneralPanel.add(jLabel1, gbc); minGroup.add(minTaskbarRB); minTaskbarRB.setSelected(true); minTaskbarRB.setText(Local.getString("Minimize to taskbar")); minTaskbarRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { minTaskbarRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.insets = new Insets(10, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(minTaskbarRB, gbc); minGroup.add(minHideRB); minHideRB.setText(Local.getString("Hide")); minHideRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { minHideRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(minHideRB, gbc); jLabel2.setHorizontalAlignment(SwingConstants.RIGHT); jLabel2.setText(Local.getString("Window close action:")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.insets = new Insets(2, 10, 0, 15); gbc.anchor = GridBagConstraints.EAST; GeneralPanel.add(jLabel2, gbc); closeGroup.add(closeExitRB); closeExitRB.setSelected(true); closeExitRB.setText(Local.getString("Close and exit")); closeExitRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { closeExitRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(closeExitRB, gbc); closeGroup.add(closeHideRB); closeHideRB.setText(Local.getString("Hide")); closeHideRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { closeHideRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(closeHideRB, gbc); jLabel3.setHorizontalAlignment(SwingConstants.RIGHT); jLabel3.setText(Local.getString("Look and feel:")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.insets = new Insets(2, 10, 0, 15); gbc.anchor = GridBagConstraints.EAST; GeneralPanel.add(jLabel3, gbc); lfGroup.add(lfKunststoffRB); lfKunststoffRB.setText(Local.getString("Kunststoff")); lfKunststoffRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { lfKunststoffRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(lfKunststoffRB, gbc); lfGroup.add(lfSystemRB); lfSystemRB.setText(Local.getString("System")); lfSystemRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { lfSystemRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(lfSystemRB, gbc); lfGroup.add(lfJavaRB); lfJavaRB.setText(Local.getString("Java default")); lfJavaRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { lfJavaRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(lfJavaRB, gbc); lfGroup.add(lfCustomRB); lfCustomRB.setText(Local.getString("Custom")); lfCustomRB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { lfCustomRB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 7; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(lfCustomRB, gbc); classNameLabel.setEnabled(false); classNameLabel.setText(Local.getString("L&F class name:")); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 8; gbc.insets = new Insets(2, 20, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(classNameLabel, gbc); lfClassName.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 9; gbc.insets = new Insets(7, 20, 0, 10); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; GeneralPanel.add(lfClassName, gbc); jLabel4.setHorizontalAlignment(SwingConstants.RIGHT); jLabel4.setText(Local.getString("Startup:")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 10; gbc.insets = new Insets(2, 10, 0, 15); gbc.anchor = GridBagConstraints.EAST; GeneralPanel.add(jLabel4, gbc); enSystrayChB.setText(Local.getString("Enable system tray icon")); enSystrayChB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { enSystrayChB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 10; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(enSystrayChB, gbc); startMinimizedChB.setText(Local.getString("Start minimized")); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 11; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(startMinimizedChB, gbc); enSplashChB.setText(Local.getString("Show splash screen")); enSplashChB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { enSplashChB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 12; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(enSplashChB, gbc); enL10nChB.setText(Local.getString("Enable localization")); enL10nChB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { enL10nChB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 13; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(enL10nChB, gbc); firstdow.setText(Local.getString("First day of week - Monday")); firstdow.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 14; gbc.insets = new Insets(2, 0, 0, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(firstdow, gbc); lblExit.setHorizontalAlignment(SwingConstants.RIGHT); lblExit.setText(Local.getString("Exit") + ":"); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 15; gbc.insets = new Insets(2, 10, 10, 15); gbc.anchor = GridBagConstraints.EAST; GeneralPanel.add(lblExit, gbc); askConfirmChB.setSelected(true); askConfirmChB.setText(Local.getString("Ask confirmation")); askConfirmChB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { askConfirmChB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 15; gbc.insets = new Insets(2, 0, 10, 10); gbc.anchor = GridBagConstraints.WEST; GeneralPanel.add(askConfirmChB, gbc); // Build Tab2 rstPanelBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5); resourceTypePanel.setBorder(rstPanelBorder); resourcePanel.add(resourceTypePanel, BorderLayout.CENTER); rsbpBorder = new TitledBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5), Local.getString("Web browser executable")); rsBottomPanel.setBorder(rsbpBorder); jLabel5.setText(Local.getString("Path") + ":"); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(0, 5, 0, 5); gbc.anchor = GridBagConstraints.WEST; rsBottomPanel.add(jLabel5, gbc); browserPath.setPreferredSize(new Dimension(250, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.insets = new Insets(0, 5, 0, 10); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; rsBottomPanel.add(browserPath, gbc); browseB.setText(Local.getString("Browse")); browseB.setPreferredSize(new Dimension(110, 25)); browseB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -