OSDN Git Service

4db3c9c335364b467dcdc17772ffda2afb3e4dce
[delesterandomselector/DelesteRandomSelector.git] / src / com / ranfa / main / DelesteRandomSelector.java
1 package com.ranfa.main;
2
3 import java.awt.BorderLayout;
4 import java.awt.EventQueue;
5 import java.util.ArrayList;
6
7 import javax.swing.JFrame;
8 import javax.swing.JPanel;
9 import javax.swing.border.EmptyBorder;
10
11 import com.ranfa.lib.Scraping;
12 import com.ranfa.lib.Song;
13 import com.ranfa.lib.Version;
14
15 @Version(major = 1, minor = 0, patch = 0)
16 public class DelesteRandomSelector extends JFrame {
17
18         private JPanel contentPane;
19
20         /**
21          * Launch the application.
22          */
23         public static void main(String[] args) {
24                 EventQueue.invokeLater(new Runnable() {
25                         public void run() {
26                                 try {
27                                         DelesteRandomSelector frame = new DelesteRandomSelector();
28                                         frame.setVisible(true);
29                                 } catch (Exception e) {
30                                         e.printStackTrace();
31                                 }
32                         }
33                 });
34         }
35
36         /**
37          * Create the frame.
38          */
39         public DelesteRandomSelector() {
40                 System.out.println(getVersion());
41                 ArrayList<Song> tmp = Scraping.getWholeData();
42                 for(int i = 0; i < tmp.size(); i++) {
43                         System.out.println(tmp.get(i).toString());
44                 }
45                 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
46                 setBounds(100, 100, 450, 300);
47                 contentPane = new JPanel();
48                 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
49                 contentPane.setLayout(new BorderLayout(0, 0));
50                 setContentPane(contentPane);
51         }
52
53
54         /**
55          * アノテーションで記載されているバージョンを取得します
56          * @since v1.0.0
57          * @return アノテーションで定義されているバージョン
58          */
59         public static String getVersion() {
60                 String value = "v"
61                                 + getMajorVersion() + "."
62                                 + getMinorVersion() + "."
63                                 + getPatchVersion();
64                 return value;
65         }
66
67         public static int getMajorVersion() {
68                 Version version = (Version) DelesteRandomSelector.class.getAnnotation(Version.class);
69                 return version.major();
70         }
71
72         public static int getMinorVersion() {
73                 Version version = (Version) DelesteRandomSelector.class.getAnnotation(Version.class);
74                 return version.minor();
75         }
76
77         public static int getPatchVersion() {
78                 Version version = (Version) DelesteRandomSelector.class.getAnnotation(Version.class);
79                 return version.patch();
80         }
81
82 }