blob: 3b000076b3225b27212c3131647e1991179a0b9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* ========================================================
*
* MPCC
* Copyright Mahrouss Logic, all rights reserved.
*
* ========================================================
*/
package org.elmahrouss;
import javafx.beans.property.ObjectProperty;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.*;
public class CodeEditor extends Pane {
private Pane linePane;
private Label lines;
private boolean readOnly;
CodeEditor()
{
super();
readOnly = false;
lines = new Label();
lines.setStyle("-fx-font-size: 20");
lines.setWrapText(true);
lines.setTranslateX(70);
lines.setTranslateY(30);
linePane = new Pane();
linePane.setStyle("-fx-background-color: #" + CodeEditorTheme.lineTheme);
linePane.setMinSize(52, 720);
linePane.setMaxSize(52, 1080);
this.getChildren().addAll(linePane, lines);
this.setStyle("-fx-background-color: #" + CodeEditorTheme.backgroundTheme);
this.setMinSize(1280, 720);
this.setMaxSize(1920, 1080);
if (!readOnly) {
}
}
@Override
public ObservableList<Node> getChildren() {
return super.getChildren();
}
public boolean isReadOnly() { return readOnly; }
public void setReadOnly(Boolean readOnly) { this.readOnly = readOnly; }
public String getContents() { return lines.getText(); }
public void setContents(String content)
{
if (readOnly)
return;
lines.setText(content);
}
}
|