"C:\Program Files\Java\jdk1.8.0_31\bin\java" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files\Java\jdk1.8.0_31\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\alloy.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\annotations.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\asm-all.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\asm-commons.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\asm-tree-3.0.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\asm.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\asm4-all.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\automaton.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\batik.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\boot.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\bootstrap.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\cglib-2.2.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\cli-parser-1.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\commons-codec-1.8.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\commons-httpclient-3.1-patched.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\commons-logging-1.1.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\commons-net-3.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\ecj-4.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\extensions.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\fluent-hc-4.3.6.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\forms_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\freemarker.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\fxHelpBrowser.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\groovy-all-2.3.9.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\gson-2.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\guava-17.0.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\hamcrest-core-1.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\hamcrest-library-1.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\httpclient-4.3.6.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\httpcore-4.3.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\httpmime-4.3.6.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\icons.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea-jsp-openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\ideax.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\isorelax.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jasper21_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jasper2_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\javac2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jaxen-1.1.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jayatana-1.2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jcip-annotations.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jdkAnnotations.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jdom.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jettison-1.3.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jgoodies-common-1.2.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jgoodies-forms.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jgoodies-looks-2.4.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jh.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jing.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jna-utils.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jna.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jps-launcher.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jps-model.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jps-server.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsch-0.1.51.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsch.agentproxy.connector-factory.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsch.agentproxy.core.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsch.agentproxy.pageant.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsch.agentproxy.sshagent.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsch.agentproxy.usocket-jna.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsch.agentproxy.usocket-nc.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsp-api.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsr166e.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jsr173_1.0_api.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\junit-4.11.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\jzlib-1.1.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\log4j.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\markdown4j-2.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\markdownj-core-0.4.2-SNAPSHOT.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\microba.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\miglayout-swing.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\nanoxml-2.2.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\nekohtml-1.9.14.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\netty-all-4.1.0.Beta4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\optimizedFileManager.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\oromatcher.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\picocontainer.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\protobuf-2.5.0.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\proxy-vole_20131209.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\pty4j-0.4.15.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\purejavacomm.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\resolver.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\resources.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\resources_en.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\rhino-js-1_7R4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\rngom-20051226-patched.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\sanselan-0.98-snapshot.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\serviceMessages.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\servlet-api.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\slf4j-api-1.7.10.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\slf4j-log4j12-1.7.10.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\snappy-in-java-0.3.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\swingx-core-1.6.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\trang-core.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\trove4j.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\trove4j_src.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\util.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\velocity.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\winp-1.21-patched.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\xbean.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\xerces.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\xml-apis.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\xmlrpc-2.0.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\xpp3-1.1.4-min.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\xstream-1.4.3.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\yjp-controller-api-redist.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\JavaEE\lib\gradle-javaee.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\JavaEE\lib\IntelliLang-javaee.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\JavaEE\lib\javaee-openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\JavaEE\lib\resources_en.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\PersistenceSupport\lib\persistence-openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\PersistenceSupport\lib\resources_en.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\DatabaseTools\lib\database-openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\DatabaseTools\lib\jdba.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\DatabaseTools\lib\resources_en.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\CSS\lib\css-openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\CSS\lib\resources_en.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\uml\lib\diagram-api.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\Spring\lib\spring-aop.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\Spring\lib\spring-api.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\Spring\lib\spring-eclipse.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\Spring\lib\spring-web.jar;C:\Users\Ethan\workspace\CSC 275 Lab 8\out\production\CSC 275 Lab 8" com.intellij.rt.execution.application.AppMain Lab8
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(LauncherImpl.java:157)
at com.sun.javafx.application.LauncherImpl$$Lambda$1/815033865.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: javafx.fxml.LoadException:
/C:/Users/Ethan/workspace/CSC%20275%20Lab%208/out/production/CSC%20275%20Lab%208/Lab8Layout.fxml
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2595)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2435)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3208)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3169)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3142)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3118)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3098)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3091)
at Lab8.start(Lab8.java:14)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821)
at com.sun.javafx.application.LauncherImpl$$Lambda$50/2020077337.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/834634352.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/1656466025.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/1045693783.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/891996806.run(Unknown Source)
... 1 more
Caused by: java.lang.NullPointerException
at Brains.initialize(Brains.java:34)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2542)
... 22 more
Process finished with exit code 1
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Lab8 extends Application {
public static void main(String[]args){
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Lab8Layout.fxml"));
primaryStage.setTitle("Student Interface");
primaryStage.setScene(new Scene(root, 700,700));
primaryStage.show();
}
}
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import java.net.URL;
import java.util.ResourceBundle;
public class Brains implements Initializable {
@FXML public TableView<Student> studentTable;
ObservableList<Student> studentArray = FXCollections.observableArrayList();
//First Name Column
public TableColumn<Student,String> firstNameColumn = new TableColumn<>("First Name");
//Last Name Column
@FXML TableColumn<Student,String> lastNameColumn = new TableColumn<>("Last Name");
//Major Column
@FXML TableColumn<Student,String> majorColumn = new TableColumn<>("Major");
//GPA Column
@FXML TableColumn<Student,Double> gpaColumn = new TableColumn<>("GPA");
//UIN Column
@FXML TableColumn<Student,Integer> uinColumn = new TableColumn<>("UIN");
//Net ID Column
@FXML TableColumn<Student,Integer> netIDColumn = new TableColumn<>("Net ID");
//Age Column
@FXML TableColumn<Student,Integer> ageColumn = new TableColumn<>("Age");
//Gender Column
@FXML TableColumn<Student,String> genderColumn = new TableColumn<>("Gender");
@Override
public void initialize(URL location, ResourceBundle resources){
studentTable.setItems(studentArray);
firstNameColumn.setCellValueFactory(new PropertyValueFactory<>("firstName"));
lastNameColumn.setCellValueFactory(new PropertyValueFactory<>("lastName"));
majorColumn.setCellValueFactory(new PropertyValueFactory<>("major"));
gpaColumn.setCellValueFactory(new PropertyValueFactory<>("gpa"));
uinColumn.setCellValueFactory(new PropertyValueFactory<>("uin"));
netIDColumn.setCellValueFactory(new PropertyValueFactory<>("netID"));
ageColumn.setCellValueFactory(new PropertyValueFactory<>("age"));
genderColumn.setCellValueFactory(new PropertyValueFactory<>("gender"));
}
public void deleteStudent() {
Student selectedStudent = studentTable.getSelectionModel().getSelectedItem();
}
}
学生班
import javafx.beans.property.*;
public class Student {
private String firstName;
private String lastName;
private String major;
private double gpa;
private int uin;
private int netID = 0;
private int age;
private String gender;
public static int counter = 1;
public Student(String newFirstName, String newLastName, String newMajor, double newGpa, int newUin, int newAge, String newGender){
firstName = newFirstName;
lastName = newLastName;
setMajor(newMajor);
setGpa(newGpa);
setUin(newUin);
setAge(newAge);
setGender(newGender);
netID = counter++;
}
public Student(String newFirstName, String newLastName, int newNetID, String newMajor, double newGpa, int newUin, int newAge, String newGender){
firstName = newFirstName;
lastName = newLastName;
setMajor(newMajor);
setGpa(newGpa);
setUin(newUin);
netID = newNetID;
setAge(newAge);
setGender(newGender);
this.netID = counter++;
}
public String getFirstName(){
return firstName;
}
public String getLastName(){
return lastName;
}
public int getID(){
return netID;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public double getGpa() {
return gpa;
}
public void setGpa(double gpa) {
this.gpa = gpa;
}
public int getUin() {
return uin;
}
public void setUin(int uin) {
this.uin = uin;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {this.gender = gender; }
}
FXML文件
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Brains">
<top>
<VBox BorderPane.alignment="CENTER">
<children>
<MenuBar>
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Save" />
<MenuItem mnemonicParsing="false" text="Load Students" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
<HBox prefHeight="0.0" prefWidth="595.0">
<children>
<TextField minWidth="80.0" promptText="First Name">
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<HBox.margin>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</HBox.margin>
</TextField>
<TextField minWidth="80.0" promptText="Last Name">
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<opaqueInsets>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</opaqueInsets>
<HBox.margin>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</HBox.margin>
</TextField>
<TextField minWidth="80.0" promptText="Major">
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<HBox.margin>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</HBox.margin>
</TextField>
<TextField minWidth="20.0" promptText="GPA">
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<HBox.margin>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</HBox.margin>
</TextField>
<TextField promptText="UIN">
<HBox.margin>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</HBox.margin>
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
</TextField>
<TextField minWidth="20.0" promptText="Age">
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<HBox.margin>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</HBox.margin>
</TextField>
<TextField minWidth="30.0" promptText="Gender">
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<HBox.margin>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</HBox.margin>
</TextField>
<Pane prefHeight="29.0" prefWidth="97.0" HBox.hgrow="ALWAYS" />
<Button minWidth="85.0" mnemonicParsing="false" text="Add Student" HBox.hgrow="ALWAYS" />
</children>
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
<VBox.margin>
<Insets bottom="3.0" left="3.0" right="10.0" top="3.0" />
</VBox.margin>
</HBox>
</children>
</VBox>
</top>
<center>
<TableView id="studentTable" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<columns>
<TableColumn text="First Name" id="firstNameColumn"/>
<TableColumn text="Last Name" id="lastNameColumn" />
<TableColumn text="Major" id="majorColumn" />
<TableColumn text="GPA" id="gpaColumn" />
<TableColumn text="UIN" id="uinColumn" />
<TableColumn text="Age" id="ageColumn" />
<TableColumn text="Gender" id="genderColumn" />
</columns>
</TableView>
</center>
<bottom>
<VBox BorderPane.alignment="CENTER">
<children>
<HBox spacing="5.0">
<children>
<Button id="deleteButton" mnemonicParsing="false" onAction="#deleteStudent" text="Delete Student" />
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</HBox>
<TextField editable="false" text="Status Bar" />
</children>
</VBox>
</bottom>
</BorderPane>
为了使其正常工作,您需要:
>
在FXML文件中的所有引用中设置fx:id
,然后用@FXML
进行注释。您正在使用id
。检查这个。
从studenttable
中删除public
用@fxml
注释deleteStudent()
。
现在它将毫无问题地运行。
然后我建议您在student
上使用属性,比如StringProperty
。看看这个。
我已经开始为一个个人项目学习JavaFX,事情进展顺利,直到我遇到了创建一组文本字段的问题。据我所知,代码是正确的,我使用的IDE没有给出任何错误指示。但当我尝试运行程序时,它会抛出一长串错误,这些错误在我注释创建文本字段的代码时不会发生。当这些代码行被省略时,程序将完全按照它应该的方式运行。 我正在使用InteliJ Idea,Windows 10,Javafx SDK 14.0.1和Java
我正在做一个类项目,需要使用Maven作为JavaFx项目的构建工具。 这是我的pom.xml设置,我在其中使用了2个插件。根据我的理解:是强制java jdk 1.8作为编译器,是自动下载javafx库。 另外,我的主启动器main.java文件位于。与文件夹处于同一级别。 然而,编译总是失败。 我不知道哪一步错了...任何想法都将不胜感激。
我是的新手,我正在尝试使用在eclipse上构建一个应用程序,我遵循了一个教程,并且做了完全相同的操作,该应用程序非常简单,当我试图编译它时,我得到了一堆我甚至不理解的错误: 你能告诉我我错过了什么吗。
问题内容: 当我在Netbeans中构建并运行程序时,它可以正常工作。但是当我尝试“ mvn compile”时,使用相同的pom.xml文件会出现以下错误: 我的Java版本不是1.3,这里是“ mvn -version”的结果 这是第53行: 问题答案: 问题是在Maven2中默认使用和 您可以通过将其添加到pom中来解决此问题: 将其放在最顶层的父pom中是很实际的,这样您派生的pom不需要
我遇到了一个初学者的编译错误: 我的简单程序: 我尝试使用以下命令编译它: gcc-g-Wall-ansi launch_瓷砖。c-o tiles\u程序 并得到这些错误: 启动_tiles。c: 在函数“main”中: launch_tiles. c: 17:19:错误:预期')'之前';'令牌 launch_tiles. c: 17:19:错误:太少的参数函数'fget' /usr/inclu
当我退出我的应用程序时,这个folloeing错误已经产生。