From bd6d9ed4744a60f99347ff2bbeceb221f8ba2b20 Mon Sep 17 00:00:00 2001 From: yukihane Date: Fri, 2 Sep 2011 23:13:16 +0900 Subject: [PATCH] =?utf8?q?=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB=E5=8B=95?= =?utf8?q?=E7=94=BB/=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=83=95=E3=82=A1?= =?utf8?q?=E3=82=A4=E3=83=AB=E9=81=B8=E6=8A=9E=E3=83=80=E3=82=A4=E3=82=A2?= =?utf8?q?=E3=83=AD=E3=82=B0=E8=B5=B7=E5=8B=95=E7=94=A8=E3=83=9C=E3=82=BF?= =?utf8?q?=E3=83=B3=E3=82=92=E5=BE=A9=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- frontend/src/yukihane/inqubus/gui/MainFrame.java | 32 ++++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/frontend/src/yukihane/inqubus/gui/MainFrame.java b/frontend/src/yukihane/inqubus/gui/MainFrame.java index 53fbfcf..0ad9888 100644 --- a/frontend/src/yukihane/inqubus/gui/MainFrame.java +++ b/frontend/src/yukihane/inqubus/gui/MainFrame.java @@ -41,6 +41,7 @@ import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JButton; import javax.swing.JCheckBox; +import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; @@ -156,6 +157,8 @@ public class MainFrame extends JFrame { cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP); fldVideo = new JTextField(); fldVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP); + btnVideo.addActionListener( + new FileChooseAction(MainFrame.this, JFileChooser.FILES_ONLY, fldVideo)); final JLabel lblComment = new JLabel(); fldBackLog.setToolTipText("YYYY/MM/DD hh:mm:ss形式、あるいは1970/01/01からの経過秒を入力します。"); @@ -191,6 +194,8 @@ public class MainFrame extends JFrame { }); fldComment = new JTextField(); fldComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP); + btnComment.addActionListener( + new FileChooseAction(MainFrame.this, JFileChooser.FILES_ONLY, fldComment)); final JLabel lblOutput = new JLabel(); cbOutputEnable = new JCheckBox(); fldOutput = new JTextField(); @@ -320,6 +325,10 @@ public class MainFrame extends JFrame { .addComponent(fldComment, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) ) + .addGroup(glInputMain.createParallelGroup() + .addComponent(btnVideo) + .addComponent(btnComment) + ) .addContainerGap() ) ); @@ -338,13 +347,17 @@ public class MainFrame extends JFrame { .addPreferredGap(ComponentPlacement.RELATED) .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE) .addComponent(lblVideo) + .addComponent(cbVideoLocal) .addComponent(fldVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(cbVideoLocal)) + .addComponent(btnVideo) + ) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE) .addComponent(lblComment) + .addComponent(cbCommentLocal) .addComponent(fldComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(cbCommentLocal)) + .addComponent(btnComment) + ) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE) .addComponent(lblOutput) @@ -600,18 +613,23 @@ public class MainFrame extends JFrame { final ItemSelectable source = evt.getItemSelectable(); + JButton button; JTextField field; File dir; if (source == cbVideoLocal) { + button = btnVideo; field = fldVideo; dir = new File(p.getVideoDir()); } else { + button = btnComment; field = fldComment; dir = new File(p.getCommentDir()); } final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED); + button.setEnabled(useLocal); + String text; if (useLocal) { final File f = searchFileMatchId(dir, fldId.getText()); @@ -671,8 +689,10 @@ public class MainFrame extends JFrame { private final JTextField fldBackLog = new JTextField(); private final JCheckBox cbVideoLocal; private final JTextField fldVideo; + private final JButton btnVideo = new JButton("..."); private final JCheckBox cbCommentLocal; private final JTextField fldComment; + private final JButton btnComment = new JButton("..."); private final JCheckBox cbOutputEnable; private final JTextField fldOutput; // 入力領域 - ffmpeg @@ -697,17 +717,19 @@ public class MainFrame extends JFrame { fldBackLog.setEnabled(false); cbBackLog.setEnabled(true); - final boolean movieLocal = p.getVideoUseLocal(); - cbVideoLocal.setSelected(movieLocal); - if (!movieLocal) { + final boolean videoLocal = p.getVideoUseLocal(); + cbVideoLocal.setSelected(videoLocal); + if (!videoLocal) { fldVideo.setText(p.getVideoFileNamePattern()); } + btnVideo.setEnabled(videoLocal); final boolean commentLocal = p.getCommentUseLocal(); cbCommentLocal.setSelected(commentLocal); if (!commentLocal) { fldComment.setText(p.getCommentFileNamePattern()); } + btnComment.setEnabled(commentLocal); final boolean convert = p.getOutputEnable(); cbOutputEnable.setSelected(convert); -- 2.11.0