-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCreateGenres.java
More file actions
30 lines (23 loc) · 841 Bytes
/
CreateGenres.java
File metadata and controls
30 lines (23 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import javax.swing.*;
import java.io.*;
public class CreateGenres{
public CreateGenres(){}
public static void createGenres(){
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame();
String dirName = JOptionPane.showInputDialog("Enter a name for the genre");
File dir = new File("Genres/", dirName);
dir.mkdir();
dir.mkdirs();
if(dir.exists()){
JOptionPane.showMessageDialog(frame, "Directory genre was successfully created !", "That's right !", JOptionPane.PLAIN_MESSAGE);
}else{
JOptionPane.showMessageDialog(frame, "An attempt to create a genre directory failed!", "Something wrong!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
}