import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.GroupLayout;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingUtilities;
-import javax.swing.border.BevelBorder;
import nicobrowser.entity.NicoContent;
import org.apache.commons.lang.StringUtils;
import saccubus.ConvertStopFlag.State;
.addComponent(mainOptionLabel)
.addComponent(inputOptionLabel)
.addComponent(outputOptionLabel))
+ .addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup()
.addComponent(extOptionField)
.addComponent(mainOptionField)
* ActionEvent
*/
void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
- SProperties setting = getSetting();
- SProperties.saveSetting(setting);
+ try {
+ SProperties setting = getSetting();
+ SProperties.saveSetting(setting);
+ } catch (Throwable t) {
+ Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, "設定保存に失敗", t);
+ }
System.exit(0);
}
private final JTextField avfilterOptionField = new JTextField();
private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるようリサイズ");
private final JLabel resizeWidthLabel = new JLabel("横");
- private final JTextField resizeWidthField = new JTextField();
+ private final JTextField resizeWidthField = new NumberFormattedTextField();
private final JLabel resizeHeightLabel = new JLabel("縦");
- private final JTextField resizeHeigitField = new JTextField();
+ private final JTextField resizeHeigitField = new NumberFormattedTextField();
private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持");
private final JCheckBox paddingCheckBox = new JCheckBox("黒幕を付与");
// FFmpegの設定 ここまで
--- /dev/null
+package saccubus;
+
+import java.awt.event.FocusEvent;
+import java.text.DecimalFormat;
+import javax.swing.JFormattedTextField;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+
+/**
+ *
+ * @author yuki
+ */
+public class NumberFormattedTextField extends JFormattedTextField {
+
+ private static final long serialVersionUID = 1L;
+
+ public NumberFormattedTextField() {
+ super(new DecimalFormat("#"));
+ this.setHorizontalAlignment(JTextField.RIGHT);
+ this.addFocusListener(new FocusAdapter());
+ }
+
+ public class FocusAdapter extends java.awt.event.FocusAdapter {
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ selectAll();
+ }
+ });
+ }
+ }
+}