Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I do not know what to do . I have this error and the issue is I dont have a module - info.java file and

I do not know what to do. I have this error and the issue is I dont have a module-info.java file and it doesn't like when I try to make the module-info.java file. I am using netbeans and this is for a assignment that I have to make a javafx applitcation that allows users to update a database and the java program has to connect to the SQL database and add the info and then retrieves the info and the java program shows the user the database information
I have used chatGPT and classmates to help and they don't even know how I have this problem, I am struggling and any help would be greatly appreciated Sorry here is my code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;
import static javafx.application.Application.launch;
public class Demo extends Application {
// Main method is not needed in JavaFX application when extending Application class
@Override
public void start(Stage stage){
Scanner input = new Scanner(System.in);
// JavaFX Application requires setting up a Stage (window) with a Scene (content)
// Database connection details
String user =""; // Initialize with your MySQL username
String pass =""; // Initialize with your MySQL password
Connection myConn = null;
Statement myStmt = null;
ResultSet myRs = null;
try {
// Establishing database connection
myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/demo", user, pass);
// Creating statement
myStmt = myConn.createStatement();
// Executing SQL query
myRs = myStmt.executeQuery("SELECT last_name, first_name FROM employees");
// Processing the result set
StringBuilder data = new StringBuilder();
while (myRs.next()){
String lastName = myRs.getString("last_name");
String firstName = myRs.getString("first_name");
data.append(lastName).append(",").append(firstName).append("
");
System.out.println(lastName +","+ firstName);
}
// Displaying data in JavaFX
Text text1= new Text();
text1.setText(data.toString());
VBox root = new VBox();
root.getChildren().addAll(text1);
root.setSpacing(10);
root.setStyle("-fx-padding: 10;"+
"-fx-border-style: solid inside;" +
"-fx-border-width: 2;"+
"-fx-border-insets: 5;"+
"-fx-border-radius: 5;"+
"-fx-border-color: blue;");
the picture I have is the error I get, Can anyone please explain how this is possible? I am using netbeans and I have all have javafx jar files in my library for the project.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions

Question

Presentations Approaches to Conveying Information

Answered: 1 week ago