diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/FileUtility.java | 2 | ||||
| -rw-r--r-- | src/main/java/TagEditorScreen.form | 13 | ||||
| -rw-r--r-- | src/main/java/TagEditorScreen.java | 25 |
3 files changed, 36 insertions, 4 deletions
diff --git a/src/main/java/FileUtility.java b/src/main/java/FileUtility.java index fbe7f80..067e9ea 100644 --- a/src/main/java/FileUtility.java +++ b/src/main/java/FileUtility.java @@ -84,7 +84,7 @@ public class FileUtility { }
return map;
}
-
+
public void moveFile(String source, String destination) {
File sourceFile = new File(source);
File destinationFile = new File(destination);
diff --git a/src/main/java/TagEditorScreen.form b/src/main/java/TagEditorScreen.form index 828484c..48133ed 100644 --- a/src/main/java/TagEditorScreen.form +++ b/src/main/java/TagEditorScreen.form @@ -14,6 +14,8 @@ <rowspec value="center:max(d;4px):noGrow"/> <rowspec value="top:4dlu:noGrow"/> <rowspec value="center:max(d;4px):noGrow"/> + <rowspec value="top:4dlu:noGrow"/> + <rowspec value="center:max(d;4px):noGrow"/> <colspec value="fill:d:noGrow"/> <colspec value="left:4dlu:noGrow"/> <colspec value="fill:d:grow"/> @@ -93,7 +95,7 @@ </component> <component id="c4b6c" class="javax.swing.JButton" binding="applyChangesButton" default-binding="true"> <constraints> - <grid row="12" column="0" row-span="1" col-span="5" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> + <grid row="14" column="0" row-span="1" col-span="5" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <forms/> </constraints> <properties> @@ -152,6 +154,15 @@ <text value="Search"/> </properties> </component> + <component id="8c79d" class="javax.swing.JButton" binding="listenButton"> + <constraints> + <grid row="12" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> + <forms/> + </constraints> + <properties> + <text value="Listen"/> + </properties> + </component> </children> </grid> </form> diff --git a/src/main/java/TagEditorScreen.java b/src/main/java/TagEditorScreen.java index 764404c..ee6d911 100644 --- a/src/main/java/TagEditorScreen.java +++ b/src/main/java/TagEditorScreen.java @@ -2,6 +2,7 @@ import org.jaudiotagger.audio.*; import org.jaudiotagger.tag.FieldKey; import org.jaudiotagger.tag.Tag; import org.jaudiotagger.tag.datatype.Artwork; +import java.io.File; import javax.imageio.ImageIO; import javax.swing.*; @@ -26,6 +27,7 @@ public class TagEditorScreen extends JFrame{ private JButton applyChangesButton; private JLabel artIconLabel; private JTextField textField2; + private JButton listenButton; private FileUtility fileUtil = new FileUtility(); private String setDirPath = ""; private String selectedAlbumArt = ""; @@ -37,8 +39,9 @@ public class TagEditorScreen extends JFrame{ this.setContentPane(mainPanel); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); - this.setSize(600, 450); + this.setSize(700, 550); initializeTable(); + listenButton.setEnabled(false); this.setVisible(true); chooseAudioDirectoryButton.addActionListener(new ActionListener() { @Override @@ -135,6 +138,15 @@ public class TagEditorScreen extends JFrame{ } }); + listenButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("CURRENT PATH " + currPath); + playMP3(currPath); + + + } + }); } public void initializeTable(){ songTable.setDefaultEditor(Object.class, null); @@ -167,7 +179,7 @@ public class TagEditorScreen extends JFrame{ ImageIcon albumArtIcon = new ImageIcon(resizeImage(albumArt.getImage(),320,180)); artIconLabel.setIcon(albumArtIcon); artIconLabel.setText(""); - + listenButton.setEnabled(true); } catch (Exception e){ @@ -182,5 +194,14 @@ public class TagEditorScreen extends JFrame{ return outputImage; } + public void playMP3(String filepath){ + try { + File file = new File(filepath); + Desktop.getDesktop().open(file); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } |
