Question: I need help modifying the gui so that it matches the one In the example please. here is the code. /* * To change this

 I need help modifying the gui so that it matches the

I need help modifying the gui so that it matches the one In the example please.

here is the code.

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.example.exercise32_06; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.stage.Stage; import javafx.scene.control.ScrollPane; import javafx.scene.control.TextArea; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; public class Exercise32_06 extends Application { private ComboBox cbTables = new ComboBox(); private TextArea taResult = new TextArea(); private Button btShowContents = new Button("Show Contents"); private Label lblStatus = new Label(); // Statement for executing queries private Statement stmt; @Override // Override the start method in the Application class public void start(Stage primaryStage) { cbTables.getItems().addAll("Enrollment", "Department", "Student", "Subject"); cbTables.setValue("Enrollment"); cbTables.setValue("Department"); cbTables.setValue("Student"); cbTables.setValue("Subject"); HBox hBox = new HBox(5); hBox.getChildren().addAll(new Label("Table Name"), cbTables, btShowContents); hBox.setAlignment(Pos.CENTER); BorderPane pane = new BorderPane(); pane.setCenter(new ScrollPane(taResult)); pane.setTop(hBox); pane.setBottom(lblStatus); // Create a scene and place it in the stage Scene scene = new Scene(pane, 500, 200); primaryStage.setTitle("Database Table Search"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage initializeDB(); btShowContents.setOnAction(e -> showContents()); } private void initializeDB() { try { // Load the JDBC driver Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); System.out.println("Driver loaded"); // Establish a connection Connection connection = DriverManager.getConnection("jdbc:ucanaccess://C:/Data/Northwind.mdb"); // ("jdbc:oracle:thin:@liang.armstrong.edu:1521:ora9i", // "scott", "tiger"); System.out.println("Database connected"); // Create a statement stmt = connection.createStatement(); } catch (Exception ex) { ex.printStackTrace(); } } private void showContents() { String tableName = cbTables.getValue(); try { String queryString = "select * from " + tableName; ResultSet resultSet = stmt.executeQuery(queryString); ResultSetMetaData rsMetaData = resultSet.getMetaData(); for (int i = 1; i   // Style I Idea (GUI Design) II Northwind Database Querv Tool // Tips for the code (Loading the DB driver and connecting your application to the DB. Refer the Lesson 4HW code or Tips for doing Lesson 4HW ) InitializeDB() code is almost identical to the code that you have used in Lesson 4 Homework. However, the database is different. So, the following code is needed, and you have to locate the Northwind.mdb in C;/Data directory. Download Northwind.mdb from "Access Databases for JDBC" folder in Lesson 4 of the Blackboard (download and unzip). // Style I Idea (GUI Design) II Northwind Database Querv Tool // Tips for the code (Loading the DB driver and connecting your application to the DB. Refer the Lesson 4HW code or Tips for doing Lesson 4HW ) InitializeDB() code is almost identical to the code that you have used in Lesson 4 Homework. However, the database is different. So, the following code is needed, and you have to locate the Northwind.mdb in C;/Data directory. Download Northwind.mdb from "Access Databases for JDBC" folder in Lesson 4 of the Blackboard (download and unzip)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!