Mercurial > hg > Database > Christie
changeset 248:4794710670bf
case fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 24 Jan 2020 20:32:22 +0900 |
parents | 901d65bad48d |
children | 6fe174283811 |
files | src/main/java/christie/textEditor/MenuActionOpen.java src/main/java/christie/textEditor/mainFrame.java src/main/java/christie/textEditor/menuActionOpen.java src/test/java/christie/example/PrefixTree/PrefixNode.java src/test/java/christie/example/PrefixTree/prefixNode.java |
diffstat | 5 files changed, 0 insertions(+), 158 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/textEditor/MenuActionOpen.java Fri Jan 24 18:59:24 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -package christie.textEditor; - -import java.awt.event.ActionEvent; - -import javax.swing.AbstractAction; - -class MenuActionOpen extends AbstractAction{ - - @Override - public void actionPerformed(ActionEvent e){ - MainFrame.getInstance().openFile(); - } - - MenuActionOpen(){ - super("開く"); - } -}
--- a/src/main/java/christie/textEditor/mainFrame.java Fri Jan 24 18:59:24 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -package christie.textEditor; - -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.event.KeyEvent; - -import java.io.File; -import java.io.IOException; - -import javax.swing.JDesktopPane; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.KeyStroke;; - -public class MainFrame extends JFrame{ - private JDesktopPane desktop; - - private JFileChooser fileChooser; - - private static MainFrame instance; - - private MainFrame(){ - //タイトルを設定 - super("テキストエディタ") ; - setSize(1024,768); - //ウィンドウを閉じたらアプリを終了する。 - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - //メインウィンドウにコンポーネントを配置する領域とのこと。 - Container container = this.getContentPane(); - - //メニューバーを初期化 - JMenuBar menuBar = new JMenuBar(); - //コンテナにメニューバーを配置する(ウインドウ上部に) - container.add(menuBar, BorderLayout.NORTH); - JMenu menuFile = new JMenu("ファイル"); - menuBar.add(menuFile); - //開くメニューの作成 - JMenuItem menuOpen = new JMenuItem(new MenuActionOpen()); - //CTRT + oショートカットキーの設定 - menuOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,KeyEvent.CTRL_DOWN_MASK)); - //ファイルメニューに開くを追加する - menuFile.add(menuOpen); - - desktop = new JDesktopPane(); - container.add(desktop); - - TextFrame textFrame = new TextFrame(); - - desktop.add(textFrame); - textFrame.setVisible(true); - - //ファイル選択ダイアグの初期化 - fileChooser = new JFileChooser(); - //テキストファイル(*.txt)のみ表示するフィルターを追加 - //fileChooser.addChoosableFileFilter(new TextFileFilter()); - } - - void openFile(){ - //ファイルを開くダイアログを表示する - int result = fileChooser.showOpenDialog(this); - //ファイル選択時の処理 - if (JFileChooser.APPROVE_OPTION == result) { - File selectedFile = fileChooser.getSelectedFile(); - System.out.println(selectedFile); - try{ - TextFrame textFrame = new TextFrame(selectedFile); - //JDesktopPaneにテキストウィンドウを追加 - this.desktop.add(textFrame); - textFrame.setVisible(true); - }catch(IOException e){ - JOptionPane.showMessageDialog(this, "IOExeption: ファイルを開くのに失敗しました。"); - } - } - } - - public static MainFrame getInstance(){ - if (instance == null){ - instance = new MainFrame(); - } - return instance; - } - -}
--- a/src/main/java/christie/textEditor/menuActionOpen.java Fri Jan 24 18:59:24 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -package christie.textEditor; - -import java.awt.event.ActionEvent; - -import javax.swing.AbstractAction; - -class MenuActionOpen extends AbstractAction{ - - @Override - public void actionPerformed(ActionEvent e){ - MainFrame.getInstance().openFile(); - } - - MenuActionOpen(){ - super("開く"); - } -}
--- a/src/test/java/christie/example/PrefixTree/PrefixNode.java Fri Jan 24 18:59:24 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -package christie.example.PrefixTree; - -import christie.codegear.CodeGearManager; -import christie.topology.node.StartTopologyNode; -import christie.topology.node.TopologyNodeConfig; - -public class PrefixNode { - - public static void main(String[] args){ - PrefixTreeNodeConfig prefixTreeNodeConfig = new PrefixTreeNodeConfig(args); - int totalNodeNum = prefixTreeNodeConfig.getTotalNodeNum(); - - StartTopologyNode startTopologyNode = new StartTopologyNode((TopologyNodeConfig) prefixTreeNodeConfig, new CheckMyName()); - - startTopologyNode.put("num", prefixTreeNodeConfig.getI()); - startTopologyNode.put("totalNodeNum", totalNodeNum - 1); - } -}
--- a/src/test/java/christie/example/PrefixTree/prefixNode.java Fri Jan 24 18:59:24 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -package christie.example.PrefixTree; - -import christie.codegear.CodeGearManager; -import christie.topology.node.StartTopologyNode; -import christie.topology.node.TopologyNodeConfig; - -public class PrefixNode { - - public static void main(String[] args){ - PrefixTreeNodeConfig prefixTreeNodeConfig = new PrefixTreeNodeConfig(args); - int totalNodeNum = prefixTreeNodeConfig.getTotalNodeNum(); - - StartTopologyNode startTopologyNode = new StartTopologyNode((TopologyNodeConfig) prefixTreeNodeConfig, new CheckMyName()); - - startTopologyNode.put("num", prefixTreeNodeConfig.getI()); - startTopologyNode.put("totalNodeNum", totalNodeNum - 1); - } -}