JavaFX 到常规 Java 类参数问题
我的目标是创建一个使用 javafx 表单(由单独的 java 类处理)的小型 javafx 应用程序,例如:Login.fx (GUI) 调用 LoginFunc.java 中的方法。处理用户交互。
我的问题是我需要将用户输入的用户名和密码传递给 LoginFunc。 通常在 swing 应用程序中,我使用构造函数,例如
public LoginFunc (String username, String password) { ?
我如何从 javafx 文件调用这样的类 我当前的代码是:
function btnLoginAction(): Void { var 用户名:字符串; var 密码:字符串; var login: LoginFunc;
username = txtUsername.text;
password = txtPassword.text;
}
感谢任何帮助!
My aim is to create a small javafx application that makes use of javafx forms (handled by separate java classes) for example: Login.fx (GUI) calls methods from LoginFunc.java. to handle user interactions.
My problem is that I need to pass the username and password entered by the user to LoginFunc.
Usually in swing applications i use a constructor such as
public LoginFunc (String username, String password) {
}
How can I call such a class from a javafx file? my current code is:
function btnLoginAction(): Void {
var username: String;
var password: String;
var login: LoginFunc;
username = txtUsername.text;
password = txtPassword.text;
}
Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解你的问题,我想你想将其添加到
Login.fx
中:如果我误解了,请告诉我。
If I understand your question correctly, I think you want to add this to
Login.fx
:If I misinterpreted, please let me know.