feat: 隐藏滚动条
This commit is contained in:
parent
2bda1d8097
commit
7cf9ba2eac
@ -42,6 +42,7 @@ public class LunchApp extends Application {
|
||||
|
||||
scene = new Scene(root, width, length);
|
||||
Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet());
|
||||
scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("/styles.css")).toExternalForm());
|
||||
|
||||
primaryStage.setTitle(name);
|
||||
primaryStage.setWidth(width);
|
||||
|
||||
@ -17,11 +17,11 @@ public class LineNumberTextArea extends BorderPane {
|
||||
mainTextArea = new TextArea();
|
||||
lineNumberArea = new TextArea();
|
||||
lineNumberArea.setEditable(false);
|
||||
lineNumberArea.setMinWidth(55);
|
||||
lineNumberArea.setMaxWidth(55);
|
||||
lineNumberArea.setMinWidth(30);
|
||||
lineNumberArea.setMaxWidth(30);
|
||||
// 设置显示滚动条样式类
|
||||
/* lineNumberArea.getStyleClass().add("hide-scrollbars");
|
||||
mainTextArea.getStyleClass().add("show-scrollbars"); */
|
||||
lineNumberArea.getStyleClass().add("text-line-number");
|
||||
/*mainTextArea.getStyleClass().add("show-scrollbars"); */
|
||||
|
||||
mainTextArea.textProperty().addListener((observable, oldValue, newValue) -> updateLineNumberArea());
|
||||
|
||||
|
||||
@ -5,7 +5,15 @@
|
||||
}
|
||||
|
||||
/* 不显示滚动条 */
|
||||
.hide-scrollbars .scroll-pane {
|
||||
-fx-hbar-policy: never;
|
||||
-fx-vbar-policy: never;
|
||||
.text-line-number .content{
|
||||
-fx-cursor: text;
|
||||
-fx-padding: 8px 1px 8px 1px;
|
||||
}
|
||||
.text-line-number .scroll-bar:vertical {
|
||||
-fx-pref-width: 1;
|
||||
-fx-opacity: 0;
|
||||
}
|
||||
.text-line-number .scroll-bar:horizontal {
|
||||
-fx-pref-height: 1;
|
||||
-fx-opacity: 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user