JavaFx .jar文件未正确运行

时间:2013-09-18 14:57:53

标签: java javafx

我正在使用javafx开发一个应用程序,它在从net bean运行时工作正常,但是当我尝试通过.jar文件运行应用程序时,应用程序启动并且我能够使用它的一些功能,但是不是所有的人。

当它开始时总是给我这个错误:

enter image description here

这是部分代码:

@Override
public void start(Stage primaryStage)
{

    bd=new BD();
    bd.iniciarConexao();


    stage= primaryStage;
    stage.setTitle("Gestão de eventos - AAC");

    layerPane = new StackPane();
    initRoot();

    scene = new Scene(layerPane, 1020, 700);
    scene.getStylesheets().addAll(ProjectV2.class.getResource("ProjectV2.css").toExternalForm(),
    ProjectV2.class.getResource("calendarstyle.css").toExternalForm());




    //MainToolBar-----------------------------------------------------------
    nomeAplicacao = new Label("Gestão de eventos - AAC");


    hbNomeAplicacao= new HBox();

    hbEmblemas = new HBox(40);

    emblemas = new ArrayList<>();

    toolBar = new ToolBar();


    logo = new ImageView(new Image(ProjectV2.class.getResourceAsStream("images/gestaoDeEventos2_2.png")));
    //----------------------------------------------------------------------

    spacer1= new Region();
    spacer2= new Region();
    spacer3= new Region();
    spacer4= new Region();


    centerPane= new BorderPane();

    paScrollPane= new ScrollPane();

    paVb= new VBox();
    paVb.setPrefHeight(500);
    hbSubtitulo= new HBox();
    subtitulo= new Label("Funcionalidades");
    //----------------------------------------------------------------------

    //LogToolBar------------------------------------------------------------
    logToolBar= new ToolBar();


    loginButton = new MenuButton();
    loginButton.setId("SettingsButton");   
    loginButton.setPopupSide(Side.TOP);    
    loginButton.setGraphic(new ImageView(new Image(ProjectV2.class.getResourceAsStream("images/business_user2.png"))));

    mLogin = MenuItemBuilder.create().text("Login").build();
    mAddFunc = MenuItemBuilder.create().text("Mudar password").build();
    mLogout = MenuItemBuilder.create().text("Logout").build();
    //mEditUser = MenuItemBuilder.create().text("Editar funcionário").build();
    mFactura= MenuItemBuilder.create().text("Factura").build();

    //----------------------------------------------------------------------


    stage.setScene(scene);

    stage.show();
    toogleMaximized();
}


public void toogleMaximized() 
{

    screen = Screen.getScreensForRectangle(stage.getX(), stage.getY(), 1, 1).get(0);

    if (maximized) 
    {
        maximized = false;
        if (backupWindowBounds != null) {
            stage.setX(backupWindowBounds.getMinX());
            stage.setY(backupWindowBounds.getMinY());
            stage.setWidth(backupWindowBounds.getWidth());
            stage.setHeight(backupWindowBounds.getHeight());
        }
    } 
    else 
    {
        maximized = true;
        backupWindowBounds = new Rectangle2D(stage.getX(), stage.getY(), stage.getWidth(), stage.getHeight());
        stage.setX(screen.getVisualBounds().getMinX());
        stage.setY(screen.getVisualBounds().getMinY());
        stage.setWidth(screen.getVisualBounds().getWidth());
        stage.setHeight(screen.getVisualBounds().getHeight());
    }
}

0 个答案:

没有答案