view src/main/java/christie/textEditor/NewTextEditor.java @ 225:401981622a1e

Provisional completion Editor's communication
author ichikitakahiro <e165713@ie.u-ryukyu.ac.jp>
date Fri, 27 Dec 2019 16:09:10 +0900
parents 0c74d9168aff
children b312656c7ec0 665d56665b7e
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.*;

public class NewTextEditor extends JFrame {
    private static boolean canSend = false;
    TextFrame textFrame = new TextFrame();
    static JTextArea textArea = new JTextArea();

    public boolean checkPermission(){
        return textFrame.SendPermission();
    }

    public int getOffset(){
        return textFrame.returnOffset();
    }

    public String getString(){return textFrame.returnString();}

    public void prohibitDL(){textFrame.prohibitDL();}

    public void changeToFalseSendPermmision(){
        textFrame.changeToFalseSend();
    }

    public void insertMessage(int offset, String str){textFrame.insertText(offset, str);}

//    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");


    }

}