小编Pro*_*oob的帖子

Password validate 8 digits, contains upper, lowercase, and a special character

So I wrote a method that makes the user enter a password and this password must pass the following specs:

1. Be at least 8 digits long

2. Have an uppercase

3. Have a lowercase

4. Have special digit

I'm not sure as to why when I input it, the output doesn't account for the special Character and throws an error.

Here is my code so far:

public static void main(String[] args) {

    Scanner in = new Scanner(System.in);
    System.out.print("Please enter …
Run Code Online (Sandbox Code Playgroud)

java passwords validation

5
推荐指数
1
解决办法
5万
查看次数

打开文本文件的javafx gui,如何读取文本文件中的内容并编辑/保存文本文件

我在 javaFX 中编写了代码来打开一个文本文件,我的代码打开了它,但它没有显示文本文件中的任何内容。而且只是为了好玩,我想知道编辑文本文件然后使用用户刚刚所做的编辑保存文本文件的最佳方法是什么。任何提示将非常感谢。

这是我的代码:

 package blah;
 import javafx.application.Application;
 import javafx.stage.Stage;
 import javafx.stage.FileChooser;
 import javafx.scene.Scene;
 import javafx.scene.layout.VBox;
 import javafx.scene.layout.HBox;
 import javafx.scene.text.Text;
 import javafx.scene.control.Button;
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
 import java.io.File;

public class blah
    extends Application {

private Text actionStatus;
private Stage savedStage;


public static void main(String [] args) {

    Application.launch(args);
}

@Override
public void start(Stage primaryStage) {
    Button open = new Button("open");
    open.setOnAction(new SingleFcButtonListener());
    HBox open1 = new HBox(10);
    open1.getChildren().addAll(open);
    Button save = new Button("Save");
            HBox save1 = new HBox(10);
            save1.getChildren().addAll(save);

    actionStatus …
Run Code Online (Sandbox Code Playgroud)

java javafx

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

java ×2

javafx ×1

passwords ×1

validation ×1