我正在按照教程开发android的图标包,当我导入项目时,我遇到了几个错误,这里解决了 - Gradle Version 4.6 - 设置输出文件名时不支持绝对路径
解决该错误后,出现以下错误.
Could not find com.android.tools.build:aapt2:3.2.0-4818971.
Searched in the following locations:
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/C:/Users/Tomin Jacob/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
https://jitpack.io/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://jitpack.io/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-windows.jar
Required by:
project :licensing
Run Code Online (Sandbox Code Playgroud)
我试图打开URL,我能够从前2个URL下载JAR(aapt2-3.2.0-4818971-windows.jar)和JSON(aapt2-3.2.0-4818971.pom.json)文件.我应该在某处复制这些文件吗?我该怎么做才能解决这个错误?
在下面的代码中,我有一个TextField和一个Button.我需要在TextField为空时禁用Button,以便我可以避免向数据库输入空值.如何禁用该按钮?
private VBox addVBox() {
VBox vb1 = new VBox();
vb1.setPadding(new Insets(15, 20, 25, 20));
vb1.setSpacing(15);
vb1.setStyle("-fx-background-color: #333333;");
final Label label = new Label("Staff Details");
label.setFont(Font.font("Arial", FontWeight.BOLD, 20));
label.setTextFill(Color.WHITE);
TableColumn sub = new TableColumn("Staff Name");
sub.setMinWidth(400);
sub.setCellValueFactory(
new PropertyValueFactory<Staff, String>("subName"));
table.setItems(data);
table.getColumns().addAll(sub);
addSubName = new TextField();
addSubName.setPromptText("Staff Name");
addSubName.setPrefSize(200, 30);
final Button b2 = new Button("Add");
b2.setFont(Font.font("Calibri", FontWeight.BOLD, 17));
b2.setPrefSize(70, 30);
b2.setStyle(" -fx-base: #0066ff;");
b2.setTextFill(Color.BLACK);
b2.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
msg = addSubName.getText();
try {
enterStaff(); …Run Code Online (Sandbox Code Playgroud) 我是JavaFX的新手,我正在尝试用它做一个项目.在一些教程中,他们提到了FXML.两者有什么区别?
我正在使用NetBeans IDE开发我的项目,并在使用FXML时听说过使用Scene Builder.什么是Scene Builder?我应该使用JavaFX,FXML和Scene Builder来顺利开发我的项目吗?
请用简单的语言回答上述问题.如果可能的话,请给我一些关于如何使用JavaFX的好教程.
从今天开始,我收到了这个例外。昨天一切正常。我会发布我的代码:
public void enterStaff() throws ClassNotFoundException, SQLException {
try {
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager
.getConnection("jdbc:mysql://localhost:3306/project?"
+ "user=root&password=virus");
statement = connect.createStatement();
preparedStatement = connect
.prepareStatement("SELECT count(*)FROM information_schema.tables\n"
+ "WHERE table_schema = 'project' AND table_name = 'staff'");
rs = preparedStatement.executeQuery();
rs.next();
int chk = rs.getInt(1);
if (chk != 1) {
preparedStatement = connect
.prepareStatement("create table staff (staffname varchar(30) primary key);");
preparedStatement.executeUpdate();
}
preparedStatement = connect
.prepareStatement("insert into staff values(?);");
preparedStatement.setString(1, addSubName.getText());
preparedStatement.executeUpdate();
} catch (ClassNotFoundException | SQLException e) {
throw e;
} …Run Code Online (Sandbox Code Playgroud) 我试图从MySQL数据库中读取一些值并将其显示在JavaFX的菜单中.我的代码如下.以前我使用Buttons而不是Menu.它运行良好,但我用Buttons感觉不太好,所以我决定使用Menu.我得到了这个代码时标题中提到的异常.
private VBox userSelection() throws ClassNotFoundException, SQLException {
VBox vb1 = new VBox();
vb1.setPadding(new Insets(40, 150, 20, 200));
vb1.setSpacing(20);
MenuBar menuBar = new MenuBar();
Menu menuFile1 = new Menu("CHOOSE YOUR ACCOUNT");
menuFile1.setStyle("-fx-border-color: green; -fx-font-size: 14pt; "
+ "-fx-font-family: Comic Sans MS; -fx-padding: 1 10 1 1");
Text scenetitle2 = new Text("Choose Your Account");
scenetitle2.setFont(Font.font("Tahoma", FontWeight.BOLD, 20));
scenetitle2.setUnderline(true);
vb1.getChildren().addAll(scenetitle2);
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager
.getConnection("jdbc:mysql://localhost:3306/project?"
+ "user=root&password=virus");
statement = connect.createStatement();
rs = statement.executeQuery("select * from user");
while (rs.next()) {
String username = …Run Code Online (Sandbox Code Playgroud) 我正在javafx做一个项目.作为其中的一部分,我创建了一个警告框.它的文字字体太小.警告框的代码是:
Stage dialogStage = new Stage();
dialogStage.initStyle(StageStyle.UTILITY);
dialogStage.setScene(new Scene(VBoxBuilder.create().
children(new Text("Username or Password Error...!\n"
+ "Please Enter Correct Details...")).
alignment(Pos.CENTER).padding(new Insets(15,15,15,15)).build()));
dialogStage.show();
Run Code Online (Sandbox Code Playgroud)
如何更改或增加文本字体大小?
private VBox addVBox() {
VBox vb1 = new VBox();
vb1.setPadding(new Insets(40, 40, 20, 40));
vb1.setSpacing(20);
vb1.setStyle("-fx-background-color: #333333;");
TextField txt1 = new TextField();
txt1.setPromptText("Class Number");
txt1.setPrefSize(70, 30);
Button b1 = new Button("DELETE");
b1.setFont(Font.font("Calibri", FontWeight.BOLD, 17));
b1.setPrefSize(100, 30);
b1.setStyle(" -fx-base: #ffffff;");
b1.setTextFill(Color.BLACK);
vb1.getChildren().addAll( txt1, b1);
return vb1;
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码。其中 setPromptText() 函数正在运行,但未显示指定的文本内容。这是因为当程序运行时,文本字段是其中的第一个控件,当窗口打开时,文本字段将被选中,因此不会显示提示文本。如何在窗口打开时使提示文本可见?
我Label在javafx中创建了一个包含大量文本的内容.
Label l1 = new Label("\t\tC-Mark and Attendance Calculator is a simple "
+ "software to find both the C-Mark and monthly attendance "
+ "of students. Inorder to use the features of this software,"
+ " user has to create an account for him first. Then he should "
+ "login using the username and password. He will be able to "
+ "perform all the operations then. Further details are mentioned"
+ " in the 'HELP' …Run Code Online (Sandbox Code Playgroud) b1.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
try {
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager
.getConnection("jdbc:mysql://localhost:3306/project?"
+ "user=root&password=virus");
statement = connect.createStatement();
preparedStatement = connect
.prepareStatement("select * from mark where clsnum = " + txt1.getText() + "");
rs = preparedStatement.executeQuery();
if (rs.next()) {
delete();
} else {
msg.setText("Student Not Found...!");
}
} catch (ClassNotFoundException | SQLException ex) {
Logger.getLogger(DeleteMark.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是我的代码,如果查询不起作用,则显示消息(我的意思是如果没有行返回到ResultSet rs).msg是Text的对象,其声明和其他细节是 -
Text msg = new Text();
msg.setFont(Font.font("Calibri", FontWeight.THIN, 18));
msg.setFill(Color.RED);
Run Code Online (Sandbox Code Playgroud)
我希望文本在一段时间后消失,比如3或4秒.是否可以在JavaFX中执行此操作(借助计时器或您知道的其他内容)?如果有,怎么样?
我正在使用 javafx 创建一个项目。我正在使用 netbeans IDE。我创建了很多类。当按下按钮时,必须使用其他类的函数。如何让它工作?