├── src ├── icon │ └── GUI.png ├── variable │ └── Variable.java ├── item │ └── Setting.java ├── inf │ ├── Objects.java │ └── Create.java ├── object │ ├── Label.java │ ├── Frame.java │ ├── Button.java │ ├── CheckBox.java │ ├── TextField.java │ └── PasswordField.java └── Main.java ├── .idea ├── vcs.xml ├── .gitignore ├── modules.xml ├── misc.xml └── uiDesigner.xml └── OTLanguageGUI.iml /src/icon/GUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PersesTitan/OTLanguageGUI/HEAD/src/icon/GUI.png -------------------------------------------------------------------------------- /src/variable/Variable.java: -------------------------------------------------------------------------------- 1 | package variable; 2 | 3 | public class Variable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /src/item/Setting.java: -------------------------------------------------------------------------------- 1 | package item; 2 | 3 | import inf.Objects; 4 | 5 | public class Setting implements Objects { 6 | 7 | public void start(String line) { 8 | if (button.check(line)) button.create(); 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/inf/Objects.java: -------------------------------------------------------------------------------- 1 | package inf; 2 | 3 | import object.*; 4 | 5 | public interface Objects { 6 | Create button = new Button(); 7 | Create checkBox = new CheckBox(); 8 | Create frame = new Frame(); 9 | Create label = new Label(); 10 | Create passwordField = new PasswordField(); 11 | Create textField = new TextField(); 12 | } 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /OTLanguageGUI.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/inf/Create.java: -------------------------------------------------------------------------------- 1 | package inf; 2 | 3 | public interface Create { 4 | String buttonNull = "버튼이 Null 입니다."; 5 | String checkBoxNull = "체크박스가 Null 입니다."; 6 | String frameNull = "프레임이 Null 입니다."; 7 | String labelNull = "라벨이 Null 입니다."; 8 | String textFieldNull = "텍스트필드가 Null 입니다."; 9 | String passwordFieldNull = "페스워드필드가 Null 입니다."; 10 | 11 | void setText(String text); 12 | void create(String text); 13 | void create(); 14 | boolean check(String line); 15 | } 16 | -------------------------------------------------------------------------------- /src/object/Label.java: -------------------------------------------------------------------------------- 1 | package object; 2 | 3 | import inf.Create; 4 | 5 | import javax.swing.*; 6 | import java.util.regex.Pattern; 7 | 8 | public class Label implements Create { 9 | private final static String PATTERN = "(^|\\s+|\\n)ㄱㄹㄱ(\\s+|$)"; 10 | private final static Pattern pattern = Pattern.compile(PATTERN); 11 | private JLabel label; 12 | 13 | @Override 14 | public void setText(String text) { 15 | if (label == null) throw new NullPointerException(labelNull); 16 | label.setText(text); 17 | } 18 | 19 | @Override 20 | public void create(String text) { 21 | label = new JLabel(text); 22 | } 23 | 24 | @Override 25 | public void create() { 26 | label = new JLabel(); 27 | } 28 | 29 | @Override 30 | public boolean check(String line) { 31 | return pattern.matcher(line).find(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/object/Frame.java: -------------------------------------------------------------------------------- 1 | package object; 2 | 3 | import inf.Create; 4 | 5 | import javax.swing.*; 6 | import java.util.regex.Pattern; 7 | 8 | public class Frame implements Create { 9 | private final static String PATTERN = "(^|\\s+|\\n)ㄱㅍㄱ(\\s+|$)"; 10 | private final static Pattern pattern = Pattern.compile(PATTERN); 11 | private JFrame frame; 12 | 13 | @Override 14 | public void setText(String text) { 15 | if (frame == null) throw new NullPointerException(frameNull); 16 | frame.setTitle(text); 17 | } 18 | 19 | @Override 20 | public void create(String text) { 21 | this.frame = new JFrame(text); 22 | } 23 | 24 | @Override 25 | public void create() { 26 | this.frame = new JFrame(); 27 | } 28 | 29 | @Override 30 | public boolean check(String line) { 31 | return pattern.matcher(line).find(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/object/Button.java: -------------------------------------------------------------------------------- 1 | package object; 2 | 3 | import inf.Create; 4 | 5 | import javax.swing.*; 6 | import java.util.regex.Pattern; 7 | 8 | public class Button implements Create { 9 | private final static String PATTERN = "(\\n|^|\\s+)ㄱㅂㄱ($|\\s+)"; 10 | private final static Pattern pattern = Pattern.compile(PATTERN); 11 | private JButton button; 12 | 13 | @Override 14 | public void setText(String text) { 15 | if (button == null) throw new NullPointerException(buttonNull); 16 | this.button.setText(text); 17 | } 18 | 19 | @Override 20 | public void create(String text) { 21 | this.button = new JButton(text); 22 | } 23 | 24 | @Override 25 | public void create() { 26 | this.button = new JButton(); 27 | } 28 | 29 | @Override 30 | public boolean check(String line) { 31 | return pattern.matcher(line).find(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/object/CheckBox.java: -------------------------------------------------------------------------------- 1 | package object; 2 | 3 | import inf.Create; 4 | 5 | import javax.swing.*; 6 | import java.util.regex.Pattern; 7 | 8 | public class CheckBox implements Create { 9 | private final static String PATTERN = "(^|\\n|\\s+)ㄱㅊㄱ($|\\s+)"; 10 | private final static Pattern pattern = Pattern.compile(PATTERN); 11 | private JCheckBox checkBox; 12 | 13 | @Override 14 | public void setText(String text) { 15 | if (checkBox == null) throw new NullPointerException(checkBoxNull); 16 | checkBox.setText(text); 17 | } 18 | 19 | @Override 20 | public void create(String text) { 21 | this.checkBox = new JCheckBox(text); 22 | } 23 | 24 | @Override 25 | public void create() { 26 | this.checkBox = new JCheckBox(); 27 | } 28 | 29 | @Override 30 | public boolean check(String line) { 31 | return pattern.matcher(line).find(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/object/TextField.java: -------------------------------------------------------------------------------- 1 | package object; 2 | 3 | import inf.Create; 4 | 5 | import javax.swing.*; 6 | import java.util.regex.Pattern; 7 | 8 | public class TextField implements Create { 9 | private final static String PATTERN = "(^|\\s+|\\n)ㄱㅌㄱ($|\\s+)"; 10 | private final static Pattern pattern = Pattern.compile(PATTERN); 11 | private JTextField textField; 12 | 13 | @Override 14 | public void setText(String text) { 15 | if (textField == null) throw new NullPointerException(textFieldNull); 16 | textField.setText(text); 17 | } 18 | 19 | @Override 20 | public void create(String text) { 21 | textField = new JTextField(text); 22 | } 23 | 24 | @Override 25 | public void create() { 26 | textField = new JTextField(); 27 | } 28 | 29 | @Override 30 | public boolean check(String line) { 31 | return pattern.matcher(line).find(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/object/PasswordField.java: -------------------------------------------------------------------------------- 1 | package object; 2 | 3 | import inf.Create; 4 | 5 | import javax.swing.*; 6 | import java.util.regex.Pattern; 7 | 8 | public class PasswordField implements Create { 9 | private final static String PATTERN = "(\\n|\\s+|^)ㄱㅁㄱ(\\s+|$)"; 10 | private final static Pattern pattern = Pattern.compile(PATTERN); 11 | private JPasswordField passwordField; 12 | 13 | @Override 14 | public void setText(String text) { 15 | if (passwordField == null) throw new NullPointerException(passwordFieldNull); 16 | passwordField.setText(text); 17 | } 18 | 19 | @Override 20 | public void create(String text) { 21 | passwordField = new JPasswordField(text); 22 | } 23 | 24 | @Override 25 | public void create() { 26 | passwordField = new JPasswordField(); 27 | } 28 | 29 | @Override 30 | public boolean check(String line) { 31 | return pattern.matcher(line).find(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Main.java: -------------------------------------------------------------------------------- 1 | import item.Setting; 2 | 3 | import javax.swing.*; 4 | import javax.swing.filechooser.FileNameExtensionFilter; 5 | import java.io.BufferedReader; 6 | import java.io.File; 7 | import java.io.FileReader; 8 | import java.nio.charset.StandardCharsets; 9 | import java.util.Locale; 10 | 11 | public class Main extends Setting { 12 | 13 | public static void main(String[] args) throws Exception { 14 | new Main(args); 15 | } 16 | 17 | private Main(String[] args) throws Exception { 18 | String path = args.length > 0 ? args[0] : showGUI(); 19 | if (path == null || path.isBlank()) throw new Exception("파일이 존재하지 않습니다."); 20 | if (new File(path).canRead()) throw new Exception("파일을 읽을 수 없습니다."); 21 | boolean bool = path.toLowerCase(Locale.ROOT).endsWith(".otl"); 22 | bool = bool || path.toLowerCase(Locale.ROOT).endsWith(".otlg"); 23 | if (!bool) throw new Exception("읽을 수 없는 확장자 입니다"); 24 | 25 | try(BufferedReader reader = new BufferedReader(new FileReader(path, StandardCharsets.UTF_8))) { 26 | String line; 27 | while ((line = reader.readLine()) != null) { 28 | start(line); 29 | } 30 | } catch (Exception ignored) {} 31 | } 32 | 33 | private String showGUI() throws Exception { 34 | final JFrame frame = new JFrame(); 35 | final String[] extensions = {"otl", "otlg"}; 36 | final JFileChooser chooser = new JFileChooser(); 37 | final FileNameExtensionFilter filter = new FileNameExtensionFilter(".otl .otlg", extensions); 38 | 39 | frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 40 | chooser.setFileFilter(filter); 41 | int open = chooser.showOpenDialog(frame.getParent()); 42 | if (open == JFileChooser.OPEN_DIALOG) 43 | return chooser.getSelectedFile().getPath(); 44 | else throw new Exception("파일이 존재하지 않습니다."); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | --------------------------------------------------------------------------------