Revisión | db7516836772174cb620cc731c475f0e219f916d (tree) |
---|---|
Tiempo | 2014-06-13 16:04:15 |
Autor | Yu Hayashi <Yu.Hayashi@teca...> |
Commiter | Yu Hayashi |
GUI 化
@@ -0,0 +1,3 @@ | ||
1 | +*.zip | |
2 | +*.class | |
3 | +gpx2osm/gpx2osm.jar | |
\ No newline at end of file |
@@ -0,0 +1,6 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<classpath> | |
3 | + <classpathentry kind="src" path="src"/> | |
4 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | |
5 | + <classpathentry kind="output" path="classes"/> | |
6 | +</classpath> |
@@ -0,0 +1,17 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<projectDescription> | |
3 | + <name>gpx2osm</name> | |
4 | + <comment></comment> | |
5 | + <projects> | |
6 | + </projects> | |
7 | + <buildSpec> | |
8 | + <buildCommand> | |
9 | + <name>org.eclipse.jdt.core.javabuilder</name> | |
10 | + <arguments> | |
11 | + </arguments> | |
12 | + </buildCommand> | |
13 | + </buildSpec> | |
14 | + <natures> | |
15 | + <nature>org.eclipse.jdt.core.javanature</nature> | |
16 | + </natures> | |
17 | +</projectDescription> |
@@ -0,0 +1,132 @@ | ||
1 | +package osm.jp.osmtracker.tool.gui; | |
2 | +import java.awt.*; | |
3 | + | |
4 | +@SuppressWarnings("serial") | |
5 | +public class AboutDialog extends Dialog | |
6 | +{ | |
7 | + //{{DECLARE_CONTROLS | |
8 | + java.awt.Label label1; | |
9 | + java.awt.Button okButton; | |
10 | + java.awt.Label label2; | |
11 | + //}} | |
12 | + | |
13 | + // Used for addNotify redundency check. | |
14 | + boolean fComponentsAdjusted = false; | |
15 | + | |
16 | + class SymWindow extends java.awt.event.WindowAdapter | |
17 | + { | |
18 | + public void windowClosing(java.awt.event.WindowEvent event) | |
19 | + { | |
20 | + Object object = event.getSource(); | |
21 | + if (object == AboutDialog.this) | |
22 | + AboutDialog_WindowClosing(event); | |
23 | + } | |
24 | + } | |
25 | + | |
26 | + class SymAction implements java.awt.event.ActionListener | |
27 | + { | |
28 | + public void actionPerformed(java.awt.event.ActionEvent event) | |
29 | + { | |
30 | + Object object = event.getSource(); | |
31 | + if (object == okButton) | |
32 | + okButton_Clicked(event); | |
33 | + } | |
34 | + } | |
35 | + | |
36 | + public AboutDialog(Frame parent, boolean modal) | |
37 | + { | |
38 | + super(parent, modal); | |
39 | + | |
40 | + // This code is automatically generated by Visual Cafe when you add | |
41 | + // components to the visual environment. It instantiates and initializes | |
42 | + // the components. To modify the code, only use code syntax that matches | |
43 | + // what Visual Cafe can generate, or Visual Cafe may be unable to back | |
44 | + // parse your Java file into its visual environment. | |
45 | + | |
46 | + | |
47 | + //{{INIT_CONTROLS | |
48 | + setLayout(null); | |
49 | + setVisible(false); | |
50 | + setSize(360,114); | |
51 | + label1 = new java.awt.Label(Gps2osm.PROGRAM_NAME +" Version "+ Gps2osm.PROGRAM_VARSION +" ("+ Gps2osm.PROGRAM_UPDATE +")", Label.CENTER); | |
52 | + label1.setBounds(10,10,340,20); | |
53 | + add(label1); | |
54 | + okButton = new java.awt.Button(); | |
55 | + okButton.setLabel("OK"); | |
56 | + okButton.setBounds(145,65,66,27); | |
57 | + add(okButton); | |
58 | + label2 = new java.awt.Label("CC0.",Label.RIGHT); | |
59 | + label2.setBounds(10,40,340,20); | |
60 | + add(label2); | |
61 | + setTitle("About... "+ Gps2osm.PROGRAM_NAME); | |
62 | + //}} | |
63 | + | |
64 | + //{{REGISTER_LISTENERS | |
65 | + SymWindow aSymWindow = new SymWindow(); | |
66 | + this.addWindowListener(aSymWindow); | |
67 | + SymAction lSymAction = new SymAction(); | |
68 | + okButton.addActionListener(lSymAction); | |
69 | + //}} | |
70 | + | |
71 | + } | |
72 | + | |
73 | + public AboutDialog(Frame parent, String title, boolean modal) | |
74 | + { | |
75 | + this(parent, modal); | |
76 | + setTitle(title); | |
77 | + } | |
78 | + | |
79 | + public void addNotify() | |
80 | + { | |
81 | + // Record the size of the window prior to calling parents addNotify. | |
82 | + | |
83 | + super.addNotify(); | |
84 | + | |
85 | + // Only do this once. | |
86 | + if (fComponentsAdjusted) | |
87 | + return; | |
88 | + | |
89 | + // Adjust components according to the insets | |
90 | + setSize(getInsets().left + getInsets().right + getSize().width, getInsets().top + getInsets().bottom + getSize().height); | |
91 | + Component components[] = getComponents(); | |
92 | + for (int i = 0; i < components.length; i++) | |
93 | + { | |
94 | + Point p = components[i].getLocation(); | |
95 | + p.translate(getInsets().left, getInsets().top); | |
96 | + components[i].setLocation(p); | |
97 | + } | |
98 | + | |
99 | + // Used for addNotify check. | |
100 | + fComponentsAdjusted = true; | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * Shows or hides the component depending on the boolean flag b. | |
105 | + * @param b if true, show the component; otherwise, hide the component. | |
106 | + * @see java.awt.Component#isVisible | |
107 | + */ | |
108 | + public void setVisible(boolean b) | |
109 | + { | |
110 | + if(b) | |
111 | + { | |
112 | + Rectangle bounds = getParent().getBounds(); | |
113 | + Rectangle abounds = getBounds(); | |
114 | + setLocation(bounds.x + (bounds.width - abounds.width)/ 2, | |
115 | + bounds.y + (bounds.height - abounds.height)/2); | |
116 | + } | |
117 | + super.setVisible(b); | |
118 | + } | |
119 | + | |
120 | + void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) | |
121 | + { | |
122 | + dispose(); | |
123 | + } | |
124 | + | |
125 | + void okButton_Clicked(java.awt.event.ActionEvent event) | |
126 | + { | |
127 | + //{{CONNECTION | |
128 | + // Clicked from okButton Hide the Dialog | |
129 | + dispose(); | |
130 | + //}} | |
131 | + } | |
132 | +} |
@@ -0,0 +1,188 @@ | ||
1 | +package osm.jp.osmtracker.tool.gui; | |
2 | +import java.awt.*; | |
3 | +import javax.swing.*; | |
4 | + | |
5 | +/** | |
6 | + * 本プログラムのメインクラス | |
7 | + */ | |
8 | +@SuppressWarnings("serial") | |
9 | +public class Gps2osm extends JFrame | |
10 | +{ | |
11 | + public static final String PROGRAM_NAME = "GPX to OSM"; | |
12 | + public static final String PROGRAM_VARSION = "0.2"; | |
13 | + public static final String PROGRAM_UPDATE = "2014/06/12"; | |
14 | + | |
15 | + // Used for addNotify check. | |
16 | + boolean fComponentsAdjusted = false; | |
17 | + | |
18 | + //{{DECLARE_CONTROLS | |
19 | + JPanel argsPanel; // パラメータ設定パネル (上部) | |
20 | + JTextArea textArea; | |
21 | + //}} | |
22 | + | |
23 | + //{{DECLARE_MENUS | |
24 | + java.awt.MenuBar mainMenuBar; | |
25 | + java.awt.Menu menu1; | |
26 | + java.awt.MenuItem miDoNewFileList; | |
27 | + java.awt.MenuItem miDoDirSize; | |
28 | + java.awt.MenuItem miDoReadXML; | |
29 | + java.awt.MenuItem miExit; | |
30 | + java.awt.Menu menu3; | |
31 | + java.awt.MenuItem miAbout; | |
32 | + //}} | |
33 | + | |
34 | + class SymWindow extends java.awt.event.WindowAdapter { | |
35 | + /** | |
36 | + * このFrameが閉じられるときの動作。 | |
37 | + * 終了確認のパネルを表示して、[OK]が押されたら終了する | |
38 | + */ | |
39 | + public void windowClosing(java.awt.event.WindowEvent event) { | |
40 | + Object object = event.getSource(); | |
41 | + if (object == Gps2osm.this) { | |
42 | + DbMang_WindowClosing(event); | |
43 | + } | |
44 | + } | |
45 | + } | |
46 | + | |
47 | + class SymAction implements java.awt.event.ActionListener { | |
48 | + public void actionPerformed(java.awt.event.ActionEvent event) { | |
49 | + Object object = event.getSource(); | |
50 | + if (object == miAbout) { | |
51 | + miAbout_Action(event); | |
52 | + } | |
53 | + else if (object == miExit) { | |
54 | + miExit_Action(event); | |
55 | + } | |
56 | + } | |
57 | + } | |
58 | + | |
59 | + /** | |
60 | + * データベース内のテーブルを一覧で表示するFrame | |
61 | + */ | |
62 | + public Gps2osm() | |
63 | + { | |
64 | + // INIT_CONTROLS | |
65 | + //setLayout(new BorderLayout()); | |
66 | + Container container = getContentPane(); | |
67 | + container.setLayout(new BorderLayout()); | |
68 | + setVisible(false); | |
69 | + setSize(getInsets().left + getInsets().right + 500,getInsets().top + getInsets().bottom + 480); | |
70 | + setTitle(Gps2osm.PROGRAM_NAME +" v"+ Gps2osm.PROGRAM_VARSION); | |
71 | + | |
72 | + // パラメータ設定パネル | |
73 | + argsPanel = new JPanel(); | |
74 | + argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS)); | |
75 | + arg1Panel = new ParameterPanel("基準フォルダ: ", "C:\\TEMP"); | |
76 | + argsPanel.add(arg1Panel); | |
77 | + | |
78 | + this.getContentPane().add("North", argsPanel); | |
79 | + | |
80 | + // 説明文 | |
81 | + textArea = new JTextArea(5,20); | |
82 | + textArea.setEditable(false); | |
83 | + try { | |
84 | + textArea.append("1.メニュー[File]-[+ NewFileListDialog.TITLE +]\n"); | |
85 | + textArea.append("\t指定された時刻以降に更新されたファイルをリストアップする\n"); | |
86 | + textArea.append("\n\n"); | |
87 | + | |
88 | + textArea.append("2.メニュー[File]-[+ DirSizeDialog.TITLE +]\n"); | |
89 | + textArea.append("\tディレクトリのファイル利用量を調べる\n"); | |
90 | + textArea.append("\n\n"); | |
91 | + | |
92 | + textArea.append("3.メニュー[File]-['+ ReadXMLDialog.TITLE +']\n"); | |
93 | + textArea.append("\tファイルが整形式XML文書であるかどうかを調べる\n"); | |
94 | + textArea.append("\n\n"); | |
95 | + } | |
96 | + catch (Exception e) { | |
97 | + System.out.println(e.toString()); | |
98 | + textArea.append(e.toString()); | |
99 | + } | |
100 | + this.getContentPane().add("Center", textArea); | |
101 | + | |
102 | + // INIT_MENUS | |
103 | + menu1 = new java.awt.Menu("File"); | |
104 | + miExit = new java.awt.MenuItem(QuitDialog.TITLE); | |
105 | + miExit.setFont(new Font("Dialog", Font.PLAIN, 12)); | |
106 | + menu1.add(miExit); | |
107 | + | |
108 | + miAbout = new java.awt.MenuItem("About..."); | |
109 | + miAbout.setFont(new Font("Dialog", Font.PLAIN, 12)); | |
110 | + | |
111 | + menu3 = new java.awt.Menu("Help"); | |
112 | + menu3.setFont(new Font("Dialog", Font.PLAIN, 12)); | |
113 | + menu3.add(miAbout); | |
114 | + | |
115 | + mainMenuBar = new java.awt.MenuBar(); | |
116 | + mainMenuBar.setHelpMenu(menu3); | |
117 | + mainMenuBar.add(menu1); | |
118 | + mainMenuBar.add(menu3); | |
119 | + setMenuBar(mainMenuBar); | |
120 | + | |
121 | + | |
122 | + //{{REGISTER_LISTENERS | |
123 | + SymWindow aSymWindow = new SymWindow(); | |
124 | + this.addWindowListener(aSymWindow); | |
125 | + SymAction lSymAction = new SymAction(); | |
126 | + miAbout.addActionListener(lSymAction); | |
127 | + miExit.addActionListener(lSymAction); | |
128 | + //}} | |
129 | + } | |
130 | + | |
131 | + /** | |
132 | + * Shows or hides the component depending on the boolean flag b. | |
133 | + * @param b trueのときコンポーネントを表示; その他のとき, componentを隠す. | |
134 | + * @see java.awt.Component#isVisible | |
135 | + */ | |
136 | + public void setVisible(boolean b) { | |
137 | + if(b) { | |
138 | + setLocation(50, 50); | |
139 | + | |
140 | + } | |
141 | + super.setVisible(b); | |
142 | + } | |
143 | + | |
144 | + /** | |
145 | + * このクラスをインスタンスを生成して表示する。 | |
146 | + * コマンドラインの引数はありません。 | |
147 | + */ | |
148 | + static public void main(String args[]) { | |
149 | + (new Gps2osm()).setVisible(true); | |
150 | + } | |
151 | + | |
152 | + public void addNotify() { | |
153 | + // Record the size of the window prior to calling parents addNotify. | |
154 | + Dimension d = getSize(); | |
155 | + | |
156 | + super.addNotify(); | |
157 | + | |
158 | + if (fComponentsAdjusted) | |
159 | + return; | |
160 | + | |
161 | + // Adjust components according to the insets | |
162 | + setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height); | |
163 | + Component components[] = getComponents(); | |
164 | + for (int i = 0; i < components.length; i++){ | |
165 | + Point p = components[i].getLocation(); | |
166 | + p.translate(getInsets().left, getInsets().top); | |
167 | + components[i].setLocation(p); | |
168 | + } | |
169 | + fComponentsAdjusted = true; | |
170 | + } | |
171 | + | |
172 | + void DbMang_WindowClosing(java.awt.event.WindowEvent event) { | |
173 | + setVisible(false); // hide the Manager | |
174 | + dispose(); // free the system resources | |
175 | + System.exit(0); // close the application | |
176 | + } | |
177 | + | |
178 | + void miAbout_Action(java.awt.event.ActionEvent event) { | |
179 | + // Action from About Create and show as modal | |
180 | + (new AboutDialog(this, true)).setVisible(true); | |
181 | + } | |
182 | + | |
183 | + void miExit_Action(java.awt.event.ActionEvent event) { | |
184 | + // Action from Exit Create and show as modal | |
185 | + //(new hayashi.yuu.tools.gui.QuitDialog(this, true)).setVisible(true); | |
186 | + (new QuitDialog(this, true)).setVisible(true); | |
187 | + } | |
188 | +} |
@@ -0,0 +1,48 @@ | ||
1 | +package osm.jp.osmtracker.tool.gui; | |
2 | +import java.awt.LayoutManager; | |
3 | + | |
4 | +import javax.swing.BoxLayout; | |
5 | +import javax.swing.JLabel; | |
6 | +import javax.swing.JPanel; | |
7 | +import javax.swing.JTextField; | |
8 | + | |
9 | +/** | |
10 | + * パラメータを設定する為のパネル。 | |
11 | + * この1インスタンスで、1パラメータをあらわす。 | |
12 | + */ | |
13 | +@SuppressWarnings("serial") | |
14 | +public class ParameterPanel extends JPanel { | |
15 | + JTextField argField; | |
16 | + JLabel argLabel; | |
17 | + | |
18 | + public ParameterPanel(String label, String text) { | |
19 | + super(); | |
20 | + | |
21 | + argLabel = new JLabel(label); | |
22 | + argField = new JTextField(text); | |
23 | + | |
24 | + this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); | |
25 | + this.add(argLabel); | |
26 | + this.add(argField); | |
27 | + } | |
28 | + | |
29 | + public String getText() { | |
30 | + return this.argField.getText(); | |
31 | + } | |
32 | + | |
33 | + public ParameterPanel(boolean isDoubleBuffered) { | |
34 | + super(isDoubleBuffered); | |
35 | + // TODO 自動生成されたコンストラクター・スタブ | |
36 | + } | |
37 | + | |
38 | + public ParameterPanel(LayoutManager layout) { | |
39 | + super(layout); | |
40 | + // TODO 自動生成されたコンストラクター・スタブ | |
41 | + } | |
42 | + | |
43 | + public ParameterPanel(LayoutManager layout, boolean isDoubleBuffered) { | |
44 | + super(layout, isDoubleBuffered); | |
45 | + // TODO 自動生成されたコンストラクター・スタブ | |
46 | + } | |
47 | + | |
48 | +} |
@@ -0,0 +1,93 @@ | ||
1 | +package osm.jp.osmtracker.tool.gui; | |
2 | + | |
3 | +import java.awt.Font; | |
4 | +import java.awt.Rectangle; | |
5 | +import java.awt.Toolkit; | |
6 | +import java.awt.Window; | |
7 | +import java.awt.event.WindowEvent; | |
8 | +import java.awt.event.WindowListener; | |
9 | + | |
10 | +import javax.swing.JButton; | |
11 | +import javax.swing.JDialog; | |
12 | +import javax.swing.JFrame; | |
13 | +import javax.swing.JLabel; | |
14 | + | |
15 | +@SuppressWarnings("serial") | |
16 | +public class QuitDialog extends JDialog implements WindowListener | |
17 | +{ | |
18 | + public static final String TITLE = "終了?"; | |
19 | + JButton yesButton; | |
20 | + JButton noButton; | |
21 | + JLabel label1; | |
22 | + | |
23 | + public QuitDialog(JFrame parent, boolean modal) { | |
24 | + super(parent, modal); | |
25 | + addWindowListener((WindowListener) this); | |
26 | + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
27 | + | |
28 | + setLayout(null); | |
29 | + setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135); | |
30 | + | |
31 | + yesButton = new JButton(" 終了 "); | |
32 | + yesButton.addActionListener(new java.awt.event.ActionListener() { | |
33 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
34 | + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201)); | |
35 | + System.exit(0); | |
36 | + } | |
37 | + }); | |
38 | + yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22); | |
39 | + yesButton.setFont(new Font("Dialog", 1, 12)); | |
40 | + add(yesButton); | |
41 | + | |
42 | + noButton = new JButton("キャンセル"); | |
43 | + noButton.addActionListener(new java.awt.event.ActionListener() { | |
44 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
45 | + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING)); | |
46 | + setVisible(false); | |
47 | + } | |
48 | + }); | |
49 | + noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22); | |
50 | + noButton.setFont(new Font("Dialog", 1, 12)); | |
51 | + add(noButton); | |
52 | + | |
53 | + label1 = new JLabel("プログラムを終了します。", JLabel.CENTER); | |
54 | + label1.setBounds(78, 33, 180, 23); | |
55 | + add(label1); | |
56 | + setTitle("プログラムの終了"); | |
57 | + setResizable(false); | |
58 | + setVisible(true); | |
59 | + } | |
60 | + | |
61 | + public void setVisible(boolean b) { | |
62 | + if(b) { | |
63 | + Rectangle bounds = getParent().getBounds(); | |
64 | + Rectangle abounds = getBounds(); | |
65 | + setLocation(bounds.x + (bounds.width - abounds.width) / 2, bounds.y + (bounds.height - abounds.height) / 2); | |
66 | + } | |
67 | + super.setVisible(b); | |
68 | + } | |
69 | + | |
70 | + | |
71 | + public void windowActivated(WindowEvent e) { | |
72 | + } | |
73 | + | |
74 | + public void windowClosed(WindowEvent e) { | |
75 | + setVisible(false); | |
76 | + } | |
77 | + | |
78 | + public void windowClosing(WindowEvent e) { | |
79 | + setVisible(false); | |
80 | + } | |
81 | + | |
82 | + public void windowDeactivated(WindowEvent e) { | |
83 | + } | |
84 | + | |
85 | + public void windowDeiconified(WindowEvent e) { | |
86 | + } | |
87 | + | |
88 | + public void windowIconified(WindowEvent e) { | |
89 | + } | |
90 | + | |
91 | + public void windowOpened(WindowEvent e) { | |
92 | + } | |
93 | +} |