修复newFile的新建报错
This commit is contained in:
parent
020ee7008e
commit
87e48b9130
@ -25,9 +25,6 @@ public class NewFile implements EventHandler<ActionEvent> {
|
||||
// 获取控制器
|
||||
Controller controller = Controller.getInstance();
|
||||
|
||||
LineNumberTextArea lineNumberTextArea = new LineNumberTextArea();
|
||||
|
||||
|
||||
// 创建一个新的文本编辑区
|
||||
LineNumberTextArea textArea = new LineNumberTextArea();
|
||||
|
||||
@ -42,7 +39,7 @@ public class NewFile implements EventHandler<ActionEvent> {
|
||||
|
||||
// 创建一个新的Tab页
|
||||
Tab tab = new Tab("新建文本 " + ++ViewManager.tabIndex);
|
||||
tab.setContent(lineNumberTextArea.getMainTextArea());
|
||||
tab.setContent(textArea);
|
||||
|
||||
// 将Tab页添加到TabPane中
|
||||
tabPane.getTabs().add(tab);
|
||||
@ -51,9 +48,9 @@ public class NewFile implements EventHandler<ActionEvent> {
|
||||
tabPane.getSelectionModel().select(tab);
|
||||
|
||||
// 更新状态标签
|
||||
controller.updateStatusLabel(lineNumberTextArea);
|
||||
controller.updateStatusLabel(textArea);
|
||||
|
||||
// 更新编码信息
|
||||
controller.upDateEncodingLabel(lineNumberTextArea.getMainTextArea().getText());
|
||||
controller.upDateEncodingLabel(textArea.getMainTextArea().getText());
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.Tab;
|
||||
|
||||
import javafx.scene.control.TextArea;
|
||||
import org.jcnc.jnotepad.Interface.ControllerInterface;
|
||||
import org.jcnc.jnotepad.ui.LineNumberTextArea;
|
||||
import org.jcnc.jnotepad.LunchApp;
|
||||
@ -223,6 +224,9 @@ public class Controller implements ControllerInterface {
|
||||
return caretPosition - text.lastIndexOf("\n", caretPosition - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化标签面板。
|
||||
*/
|
||||
/**
|
||||
* 初始化标签面板。
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user