📄 verifycreateplaypenpanel.java
字号:
package org.fife.rtext.plugins.rtextl10ngen;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.fife.RUtilities;
import org.fife.ui.app.WizardPluginDialog;
import org.fife.ui.app.WizardDialogInfoPanel;
import org.fife.ui.rtextfilechooser.RDirectoryChooser;
/**
* The panel that prompts the user to verify that they are sure they want to
* use the specified directory and locale for their playpen.
*
* @author Robert Futrell
* @version 1.0
*/
class VerifyCreatePlaypenPanel extends WizardDialogInfoPanel {
private ResourceBundle msg;
private JLabel playpenLabel;
private JLabel localeLabel;
private JLabel localeAbbrevLabel;
/*****************************************************************************/
/**
* Constructor.
*
* @param msg The plugin's resource bundle.
*/
public VerifyCreatePlaypenPanel(ResourceBundle msg) {
super(msg.getString("Plugin.Wizard.Create.Verify.Header"));
this.msg = msg;
setLayout(new BorderLayout());
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
JPanel temp = new JPanel(new BorderLayout());
String desc = msg.getString("Plugin.Wizard.Create.Verify.WillDo.Desc");
temp.add(new JLabel(desc));//, BorderLayout.WEST);
contentPane.add(temp);
contentPane.add(Box.createVerticalStrut(30));
JPanel temp2 = new JPanel(new SpringLayout());
desc = msg.getString("Plugin.Wizard.Common.PPen.Prompt");
temp2.add(new JLabel(desc));
playpenLabel = new JLabel("xxxxxxxxxxxxx");
temp2.add(playpenLabel);
desc = msg.getString("Plugin.Wizard.Common.Locale.Prompt");
temp2.add(new JLabel(desc));
localeLabel = new JLabel("xxxxxxxxxxxxx");
temp2.add(localeLabel);
desc = msg.getString("Plugin.Wizard.Common.Locale.Code.Prompt");
temp2.add(new JLabel(desc));
localeAbbrevLabel = new JLabel("xxxxxxxxxxxxx");
temp2.add(localeAbbrevLabel);
RUtilities.makeSpringCompactGrid(temp2, 3,2, 0,0, 5,5);
temp = new JPanel(new BorderLayout());
temp.add(temp2);
contentPane.add(temp);
//contentPane.add(temp2);
add(contentPane, BorderLayout.NORTH);
}
/*****************************************************************************/
/**
* Called when this panel is "accepted" in the wizard (e.g., the user
* clicks "Next" and <code>validateInput</code> returns <code>null</code>).
* This method extracts the proper properties files from the currently-
* running RText.jar (as Unicode, not ASCII).
*
* @see #isDisplayed
*/
public void isAccepted() {
WizardPluginDialog wiz = getWizard();
RTextL10nGenPlugin plugin = (RTextL10nGenPlugin)wiz.getPlugin();
try {
boolean rc = plugin.extractPropFiles(
(File)wiz.getWizardProperty("Playpen"),
(Locale)wiz.getWizardProperty("Locale"));
} catch (IOException ioe) {
ioe.printStackTrace();
System.exit(0); // FIXME: What to do???
}
}
/*****************************************************************************/
/**
* Called when this panel is displayed in the wizard. This gives the
* panel to do anything "extra" it wants to do, such as disable the
* "Next" button.<p>
*
* The default implementation does nothing.
*/
public void isDisplayed() {
WizardPluginDialog wizard = getWizard();
File playpen = (File)wizard.getWizardProperty("Playpen");
Locale locale = (Locale)wizard.getWizardProperty("Locale");
playpenLabel.setText(playpen.getAbsolutePath());
localeLabel.setText(locale.getDisplayName());
localeAbbrevLabel.setText(locale.toString());
}
/*****************************************************************************/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -