I wrote a simple tag generator for music blogs sometimes back. I now have come up with a GUI. As mentioned before, this application will generate tags to be used for some music blogs or youtube etc. You have the flexibility to choose whether you want the tags to be generated for the lyrics of the song or for the music video.
One feature I have added in this feature is that when you generate tags using this aplication, the tags are automatically copied to system clipboard, so you can just paste them. I am avoiding a step you have to go through in copying the generated tags.
package com.kushal.utils;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTextPane;
/**
* @author KushalP For those who maintain music blog, this simple program might
* be useful for generating music tags.
*
* I developed this for my personal use for my following blog:
* http://www.sanjaal.com/nepalisongs
*/
public class SimpleTagGeneratorGUI extends JFrame {
private static final long serialVersionUID = 2444120930689467400L;
JTextField albumField, artistField, songField;
JTextPane tagsPane;
JCheckBox lyricsMode;
public SimpleTagGeneratorGUI() {
super("Simple Tag Generator - Generate Tags For Your Music Blog");
setLayout(new FlowLayout());
Box verticalBox = Box.createVerticalBox();
Box lyricsHB = Box.createHorizontalBox();
JPanel lyricsPanel = new JPanel();
JLabel lyricsLabel = new JLabel("Lyrics Mode");
lyricsMode = new JCheckBox();
lyricsPanel.add(lyricsLabel);
lyricsPanel.add(lyricsMode);
lyricsHB.add(lyricsPanel);
Box artistHB = Box.createHorizontalBox();
JPanel artistPanel = new JPanel();
JLabel artistLabel = new JLabel("Artist");
artistField = new JTextField(20);
artistPanel.add(artistLabel);
artistPanel.add(artistField);
artistHB.add(artistPanel);
Box songHB = Box.createHorizontalBox();
JPanel songPanel = new JPanel();
JLabel songLabel = new JLabel("Song");
songField = new JTextField(20);
songPanel.add(songLabel);
songPanel.add(songField);
songHB.add(songPanel);
Box albumHB = Box.createHorizontalBox();
JPanel albumPanel = new JPanel();
JLabel albumLabel = new JLabel("Album");
albumField = new JTextField(20);
albumPanel.add(albumLabel);
albumPanel.add(albumField);
albumHB.add(albumPanel);
Box generateHB = Box.createHorizontalBox();
JPanel generatePanel = new JPanel();
JButton generateButton = new JButton(
"Generate Tags & Copy To Clipboard");
generatePanel.add(generateButton);
generateHB.add(generatePanel);
generateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if ("Generate Tags & Copy To Clipboard".equalsIgnoreCase(e
.getActionCommand())) {
String tags = SimpleTagGeneratorGUI.this.generateTag(
albumField.getText(), artistField.getText(),
songField.getText(), lyricsMode.isSelected());
tagsPane.setText(tags);
/*
* Set the data to system clipboard So that you don't need
* to copy it.
*/
setClipboardData(tags);
}
}
});
Box tagsHB = Box.createHorizontalBox();
tagsPane = new JTextPane();
tagsPane.setEditable(true);
// tagsPane.setLineWrap(true);
// tagsHB.add(tagsArea);
JScrollPane scrollpane = new JScrollPane(tagsPane,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// scrollpane.add(tagsArea);
scrollpane.setPreferredSize(new Dimension(300, 200));
tagsHB.add(scrollpane);
verticalBox.add(lyricsHB);
verticalBox.add(artistHB);
verticalBox.add(songHB);
verticalBox.add(albumHB);
verticalBox.add(generateHB);
verticalBox.add(tagsHB);
getContentPane().add(verticalBox);
setVisible(true);
setLocation(200, 200);
setSize(500, 450);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[]) {
new SimpleTagGeneratorGUI().show();
}
/**
* Param 1 : Album Name Param 2 : Artist Name Param 3 : Song Name Param 4 :
* Lyrics Mode
*/
public static String generateTag(String album, String artist, String song,
boolean lyricsMode) {
String artistTags = "";
String albumTags = "";
String songTags = "";
if (artist != null && artist.length() > 0) {
artistTags += artist + " Guitar Tabs, " + artist
+ " Latest Songs, "
+ (lyricsMode ? "" : artist + " MP3 Downloads,") + artist
+ " Latest Albums, "
+ (lyricsMode ? "" : artist + " Songs Download, ") + artist
+ " Lyrics Download, "
+ (lyricsMode ? "" : artist + " MP3 Songs,")
+ (lyricsMode ? artist + " Lyrics Collection," : "");
}
if (album != null && album.length() > 0) {
albumTags += artist + " " + album + " " + "Songs Download, "
+ artist + " " + album + " " + "MP3 Download," + artist
+ " " + album + " " + "Lyrics Download, " + artist + " "
+ album + " " + "Guitar Tabs," + artist + " " + album + " "
+ "Guitar Chords,";
}
if (song != null && song.length() > 0) {
songTags += artist
+ " "
+ song
+ " "
+ "Guitar Tabs, "
+ (lyricsMode ? "" : artist + " " + song + " "
+ "MP3 Downloads,")
+ (lyricsMode ? "" : artist + " " + song + " "
+ "Songs Download,")
+ artist
+ " "
+ song
+ " "
+ "Guitar Chords,"
+ (lyricsMode ? "" : artist + " " + song + " "
+ "MP3 Song,")
+ artist
+ " "
+ song
+ " "
+ "Lyrics Download,"
+ (lyricsMode ? "" : artist + " " + song + " "
+ "Music Video");
}
String tags = artistTags + "," + albumTags + "," + songTags;
System.out.println(tags);
return tags;
}
/*
* This method sets the input parameter string
* into the sytem clipboard, so you can paste it.
*/
public static void setClipboardData(String string) {
StringSelection stringSelection = new StringSelection(string);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
stringSelection, null);
}
}
=====================
Here are some snapshots of this application.

(Tag Generator In Songs Mode)

(Tag Generator In Lyrics Mode)
Originally posted 2009-08-04 11:45:51.
Non GUI version of this application is available below:
http://sanjaal.com/java/2009/03/20/simple-tag-generator-in-java-for-music-blogs/