Mercurial > hg > Database > Christie
view src/main/java/christie/textEditor/NewTextEditor.java @ 267:1ac366f96815
remake for CommandPattern
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 29 Jan 2020 18:50:14 +0900 |
parents | 9d0b932ad84f |
children | 1f42a0903440 |
line wrap: on
line source
package christie.textEditor; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultStyledDocument; import javax.swing.text.Document; import javax.swing.text.StyleContext; import java.awt.*; @org.msgpack.annotation.Message public class NewTextEditor extends JFrame { private static boolean canSend = false; TextFrame textFrame = new TextFrame(); static JTextArea textArea = new JTextArea(); public void insertMessage(int offset, String str){ textFrame.insertText(offset, str); } public boolean checkPermission(){ return textFrame.SendPermission(); } public int returnOffset(){ return textFrame.returnOffset(); } public String returnString(){return textFrame.returnString();} public int returnEndOffset() {return textFrame.returnEndOffset();} public void protectToExcessiveInsert(){textFrame.protectToExcessiveInsert();} public boolean deleteFrag() {return textFrame.deleteFrag();} public void delete(int pos, int ePos){textFrame.delete(pos, ePos);} public void changeToFalseDeleteFrag(){textFrame.changeToFalseDeleteFrag();}; public void changeToFalseSendPermmision(){ textFrame.changeToFalseSend(); } // public static void main(String[] args){ // NewTextEditor editor = new NewTextEditor(); // // editor.setTitle("text Editor"); // editor.setSize(1024,768); // editor.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // editor.NewTextEditor(); // editor.setVisible(true); // // } public void StartEditor(String name) { setTitle(name); setSize(1024, 768); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); NewTextEditor(); setVisible(true); } public void NewTextEditor(){ JDesktopPane desktop; MainFrame instance; Container container = getContentPane(); JMenuBar menuBar = new JMenuBar(); container.add(menuBar, BorderLayout.NORTH); desktop = new JDesktopPane(); container.add(desktop); desktop.add(textFrame); //textFrame.InsertText(); textFrame.setVisible(true); System.out.println("call"); } }