commit 10/04/2025
This commit is contained in:
@@ -7,6 +7,8 @@ import javafx.application.Platform;
|
||||
import javafx.embed.swing.SwingFXUtils;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import org.bytedeco.javacv.Java2DFrameConverter;
|
||||
import org.bytedeco.javacv.OpenCVFrameConverter;
|
||||
@@ -19,7 +21,6 @@ import org.bytedeco.opencv.opencv_core.Size;
|
||||
import org.bytedeco.opencv.opencv_core.UMat;
|
||||
import org.tinylog.Logger;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
@@ -512,9 +513,7 @@ public class SomeCodes {
|
||||
if (ROI.x()>=0){
|
||||
if (ROI.y()>=0){
|
||||
if (ROI.width()>0){
|
||||
if (ROI.height()>0){
|
||||
return true;
|
||||
}
|
||||
return ROI.height() > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,7 +522,7 @@ public class SomeCodes {
|
||||
}
|
||||
|
||||
public static void Print(String... x){
|
||||
if (x!=null && x.length>0){
|
||||
if (x != null){
|
||||
for(String xx : x){
|
||||
System.out.println(xx);
|
||||
}
|
||||
@@ -604,53 +603,72 @@ public class SomeCodes {
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetText(Object obj, String text){
|
||||
if (obj!=null && ValidString(text)){
|
||||
if (Platform.isFxApplicationThread()){
|
||||
if (obj instanceof Label lbl){
|
||||
if (text.equals(lbl.getText())) return;
|
||||
public static void LabelSetText(Label lbl, String text, String style){
|
||||
if (lbl!=null){
|
||||
if (text!=null){
|
||||
if (text.equals(lbl.getText())) return;
|
||||
if (Platform.isFxApplicationThread()){
|
||||
lbl.setText(text);
|
||||
} else if (obj instanceof TextArea ta){
|
||||
if (text.equals(ta.getText())) return;
|
||||
ta.setText(text);
|
||||
} else if (obj instanceof TextField tf){
|
||||
if (text.equals(tf.getText())) return;
|
||||
tf.setText(text);
|
||||
}
|
||||
} else{
|
||||
Platform.runLater(()->{
|
||||
if (obj instanceof Label lbl){
|
||||
if (text.equals(lbl.getText())) return;
|
||||
lbl.setText(text);
|
||||
} else if (obj instanceof TextArea ta){
|
||||
if (text.equals(ta.getText())) return;
|
||||
ta.setText(text);
|
||||
} else if (obj instanceof TextField tf){
|
||||
if (text.equals(tf.getText())) return;
|
||||
tf.setText(text);
|
||||
if (style!=null && !style.isBlank()){
|
||||
lbl.setStyle(style);
|
||||
}
|
||||
});
|
||||
} else{
|
||||
Platform.runLater(()-> {
|
||||
lbl.setText(text);
|
||||
if (style!=null && !style.isBlank()){
|
||||
lbl.setStyle(style);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void TextAreaSetText(TextArea ta, String text){
|
||||
if (ta!=null){
|
||||
if (text!=null){
|
||||
if (text.equals(ta.getText())) return;
|
||||
if (Platform.isFxApplicationThread()){
|
||||
ta.setText(text);
|
||||
} else{
|
||||
Platform.runLater(()-> ta.setText(text));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void TextFieldSetText(TextField tf, String text){
|
||||
if (tf!=null){
|
||||
if (text!=null){
|
||||
if (text.equals(tf.getText())) return;
|
||||
if (Platform.isFxApplicationThread()){
|
||||
tf.setText(text);
|
||||
} else{
|
||||
Platform.runLater(()-> tf.setText(text));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void LabelVisible(Label label, boolean visible){
|
||||
if (label!=null){
|
||||
if (visible){
|
||||
if (Platform.isFxApplicationThread()){
|
||||
label.setVisible(true);
|
||||
} else{
|
||||
Platform.runLater(()->{
|
||||
label.setVisible(true);
|
||||
});
|
||||
Platform.runLater(()-> label.setVisible(true));
|
||||
}
|
||||
} else {
|
||||
if (Platform.isFxApplicationThread()){
|
||||
label.setVisible(false);
|
||||
} else{
|
||||
Platform.runLater(()->{
|
||||
label.setVisible(false);
|
||||
});
|
||||
Platform.runLater(()-> label.setVisible(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user