优化底部状态栏
This commit is contained in:
parent
dec9193469
commit
60e4eb3f22
@ -1,6 +1,6 @@
|
|||||||
package org.jcnc.jnotepad.root.bottom;
|
package org.jcnc.jnotepad.root.bottom;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||||
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
||||||
|
|
||||||
public class RootBottomSideBarVBox extends AbstractVBox {
|
public class RootBottomSideBarVBox extends AbstractVBox {
|
||||||
@ -12,8 +12,7 @@ public class RootBottomSideBarVBox extends AbstractVBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSidebarVBox() {
|
private void initSidebarVBox() {
|
||||||
setPadding(new Insets(10));
|
getChildren().addAll(JNotepadStatusBox.getInstance());
|
||||||
setSpacing(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RootBottomSideBarVBox getInstance() {
|
public static RootBottomSideBarVBox getInstance() {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package org.jcnc.jnotepad.root.center.main;
|
package org.jcnc.jnotepad.root.center.main;
|
||||||
|
|
||||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
|
||||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||||
import org.jcnc.jnotepad.root.center.main.top.MainTopVBox;
|
import org.jcnc.jnotepad.root.center.main.top.MainTopVBox;
|
||||||
import org.jcnc.jnotepad.ui.module.AbstractBorderPane;
|
import org.jcnc.jnotepad.ui.module.AbstractBorderPane;
|
||||||
@ -14,11 +13,11 @@ public class MainBorderPane extends AbstractBorderPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initRootBorderPane() {
|
private void initRootBorderPane() {
|
||||||
this.setBottomComponent(JNotepadStatusBox.getInstance());
|
//setBottomComponent(JNotepadStatusBox.getInstance());
|
||||||
|
|
||||||
this.setCenter(JNotepadTabPane.getInstance());
|
setCenter(JNotepadTabPane.getInstance());
|
||||||
|
|
||||||
this.setTopComponent(MainTopVBox.getInstance());
|
setTopComponent(MainTopVBox.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MainBorderPane getInstance() {
|
public static MainBorderPane getInstance() {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package org.jcnc.jnotepad.root.center.main.bottom.status;
|
package org.jcnc.jnotepad.root.center.main.bottom.status;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.TextArea;
|
||||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||||
@ -46,6 +47,7 @@ public class JNotepadStatusBox extends AbstractHBox {
|
|||||||
* @since 2023/8/27 9:33
|
* @since 2023/8/27 9:33
|
||||||
*/
|
*/
|
||||||
public void initStatusBox() {
|
public void initStatusBox() {
|
||||||
|
|
||||||
this.getChildren().clear();
|
this.getChildren().clear();
|
||||||
// 创建状态栏
|
// 创建状态栏
|
||||||
statusLabel = new Label();
|
statusLabel = new Label();
|
||||||
@ -57,9 +59,16 @@ public class JNotepadStatusBox extends AbstractHBox {
|
|||||||
this.getChildren().add(statusLabel);
|
this.getChildren().add(statusLabel);
|
||||||
this.getChildren().add(encodingLabel);
|
this.getChildren().add(encodingLabel);
|
||||||
this.getProperties().put("borderpane-margin", new Insets(5, 10, 5, 10));
|
this.getProperties().put("borderpane-margin", new Insets(5, 10, 5, 10));
|
||||||
|
this.setAlignment(Pos.BASELINE_RIGHT);
|
||||||
UiResourceBundle.getInstance().addListener((observable, oldValue, newValue) -> updateWhenTabSelected());
|
UiResourceBundle.getInstance().addListener((observable, oldValue, newValue) -> updateWhenTabSelected());
|
||||||
|
|
||||||
|
/*
|
||||||
|
第一个参数 10 表示上边距。
|
||||||
|
第二个参数 10 表示右边距。
|
||||||
|
第三个参数 10 表示下边距。
|
||||||
|
第四个参数 10 表示左边距。
|
||||||
|
*/
|
||||||
|
setMargin(statusLabel, new Insets(5, 10, 5, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEncodingLabel() {
|
public void updateEncodingLabel() {
|
||||||
@ -75,7 +84,7 @@ public class JNotepadStatusBox extends AbstractHBox {
|
|||||||
if (encoding == null) {
|
if (encoding == null) {
|
||||||
encoding = Charset.defaultCharset().name();
|
encoding = Charset.defaultCharset().name();
|
||||||
}
|
}
|
||||||
this.encodingLabel.setText(getEncodingFormattedText(encoding));
|
this.encodingLabel.setText(getEncodingFormattedText(encoding) + "\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,7 +164,7 @@ public class JNotepadStatusBox extends AbstractHBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String getEncodingFormattedText(String encoding) {
|
protected String getEncodingFormattedText(String encoding) {
|
||||||
String encodingLabelFormat = "\t%s : %s";
|
String encodingLabelFormat = "%s : %s";
|
||||||
return String.format(encodingLabelFormat, UiResourceBundle.getContent(TextConstants.ENCODE), encoding);
|
return String.format(encodingLabelFormat, UiResourceBundle.getContent(TextConstants.ENCODE), encoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package org.jcnc.jnotepad.root.left.sidebar;
|
package org.jcnc.jnotepad.root.left.sidebar;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
||||||
|
|
||||||
public class RootLeftSideBarVBox extends AbstractVBox {
|
public class RootLeftSideBarVBox extends AbstractVBox {
|
||||||
@ -12,10 +11,10 @@ public class RootLeftSideBarVBox extends AbstractVBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSidebarVBox() {
|
private void initSidebarVBox() {
|
||||||
setPadding(new Insets(10));
|
|
||||||
setSpacing(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static RootLeftSideBarVBox getInstance() {
|
public static RootLeftSideBarVBox getInstance() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package org.jcnc.jnotepad.root.right;
|
package org.jcnc.jnotepad.root.right;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
||||||
|
|
||||||
public class RootRightSideBarVBox extends AbstractVBox {
|
public class RootRightSideBarVBox extends AbstractVBox {
|
||||||
@ -12,8 +11,7 @@ public class RootRightSideBarVBox extends AbstractVBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSidebarVBox() {
|
private void initSidebarVBox() {
|
||||||
setPadding(new Insets(10));
|
|
||||||
setSpacing(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RootRightSideBarVBox getInstance() {
|
public static RootRightSideBarVBox getInstance() {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package org.jcnc.jnotepad.root.top;
|
package org.jcnc.jnotepad.root.top;
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
import org.jcnc.jnotepad.ui.module.AbstractVBox;
|
||||||
|
|
||||||
public class RootTopSideBarVBox extends AbstractVBox {
|
public class RootTopSideBarVBox extends AbstractVBox {
|
||||||
@ -12,8 +11,7 @@ public class RootTopSideBarVBox extends AbstractVBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSidebarVBox() {
|
private void initSidebarVBox() {
|
||||||
setPadding(new Insets(10));
|
|
||||||
setSpacing(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RootTopSideBarVBox getInstance() {
|
public static RootTopSideBarVBox getInstance() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user