你好Stackoverflow代码爱好者,我真的需要一些帮助,我一直在搞乱,我不断得到IllegalAccessException(java.lang.IllegalAccessException:类sun.reflect.misc.Trampoline无法访问类的成员main.TableContent with modifiers)在尝试编译我的代码时..样本在下面..
Full StackTrace:
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.IllegalAccessException: Class sun.reflect.misc.Trampoline can not access a member of class main.TableContent with modifiers "public"
人员类:
package main;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ObservableList;
import sun.java2d.pipe.SpanShapeRenderer;
class TableContent {
public SimpleStringProperty fecha;
public SimpleStringProperty hora;
public SimpleIntegerProperty folio;
public SimpleIntegerProperty estacion;
public SimpleStringProperty circuito;
public SimpleStringProperty receta;
public SimpleStringProperty usuario;
public String getFecha() {
return fecha.get();
}
public void setFecha(String v) {
fecha.set(v);
}
public String getHora() {
return hora.get();
}
public void setHora(String v) {
hora.set(v);
}
public Integer getFolio() {
return folio.get();
}
public void setFolio(int v) {
folio.set(v);
}
public Integer getEstacion() {
return estacion.get();
}
public void setEstacion(int v) {
estacion.set(v);
}
public String getCircuito() {
return circuito.get();
}
public void setCircuito(String v) {
circuito.set(v);
}
public String getReceta() {
return receta.get();
}
public void setReceta(String v) {
receta.set(v);
}
public String getUsuario() {
return usuario.get();
}
public void setUsuario(String v) {
usuario.set(v);
}
public TableContent(String fechax, String horax, Integer foliox, Integer estacionx, String circuitox, String recetax, String usuariox) {
this.fecha = new SimpleStringProperty(fechax);
this.hora = new SimpleStringProperty(horax);
this.folio = new SimpleIntegerProperty(foliox);
this.estacion = new SimpleIntegerProperty(estacionx);
this.circuito = new SimpleStringProperty(circuitox);
this.receta = new SimpleStringProperty(recetax);
this.usuario = new SimpleStringProperty(usuariox);
}
}
这是我的ControllerClass ...(HELP PLEASE)。
package main;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.DatePicker;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
public class WindowController implements Initializable {
@FXML
private TableView<TableContent> tableView;
@FXML
private TableColumn<TableContent, String> getFecha;
@FXML
private TableColumn<TableContent, String> getHora;
@FXML
private TableColumn<TableContent, Integer> getFolio;
@FXML
private TableColumn<TableContent, Integer> getEstacion;
@FXML
private TableColumn<TableContent, String> getCircuito;
@FXML
private TableColumn<TableContent, String> getReceta;
@FXML
private TableColumn<TableContent, String> getUsuario;
@FXML
private DatePicker startTime;
@FXML
private Button saveToCSV;
@FXML
private Button cancel;
@FXML
private Button load;
@FXML
private DatePicker finishTime;
final ObservableList<TableContent> C = FXCollections.observableArrayList(
new TableContent("1","5pm",20,50,"hello","world","Juanito"),
new TableContent("2","5pm",20,5,"hello","world","Juanito"),
new TableContent("3","5pm",20,60,"hello","world","Juanito"),
new TableContent("4","5pm",20,7,"hello","world","Juanito"),
new TableContent("5","5pm",20,80,"hello","world","Juanito")
);
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
getFecha.setCellValueFactory(new PropertyValueFactory<TableContent, String>("fecha"));
getHora.setCellValueFactory(new PropertyValueFactory<TableContent, String>("hora"));
getFolio.setCellValueFactory(new PropertyValueFactory<TableContent, Integer>("folio"));
getEstacion.setCellValueFactory(new PropertyValueFactory<TableContent, Integer>("estacion"));
getCircuito.setCellValueFactory(new PropertyValueFactory<TableContent, String>("circuito"));
getReceta.setCellValueFactory(new PropertyValueFactory<TableContent, String>("receta"));
getUsuario.setCellValueFactory(new PropertyValueFactory<TableContent, String>("usuario"));
tableView.setItems(data);
}
}
请大家帮帮忙,建议的任何帮助都很好用。
提前感谢..当我尝试编译这个时,我得到上面提到的例外...有人告诉我为什么以及如何解决请...