Tag: javafx 2

JavaFX:如何动态反序列化创建区域图系列?

我使用区域图中的列表动态添加系列。 我想打开这个系列。 我需要这个,因为我想在db中保存Area Chart系列数据。 当app执行时,它是这样的: 用户可以通过填写文本字段并单击“添加”按钮来添加系列: 我想要的是当用户点击“保存”按钮时,它应该将已添加的系列转换为数据,这样我就可以将其存储在数据库中。 但是我尝试过它并没有给我准确的数据。 根据聊天系列我想得到这样的输出: Series 0 Employees: 5 Series 0 Start: 1 Series 0 End: 7 Series 1 Employees: 3 Series 1 Start: 9 Series 1 End: 12 但是我得到了这个: Series 0 Employees: 5 Series 0 Start: 1 Series 0 End: 5 Series 1 Employees: 3 Series 1 Start: 10 Series […]

是否可以在同一帧中打开一个新的fxml文件

我已经在锚窗格中创建了fxml文件,但每次我点击按钮我都会在新框架中获得下一个fxml我希望它在同一个框架中打开 public void baropen(ActionEvent event) { // handle the event here BorderPane bp = new BorderPane(); bp.setPadding(new Insets(10, 50, 50, 50)); Stage stage = new Stage(); Scene scene ; // scene= new Scene(root); scene = new Scene(bp); stage.setScene(scene); stage.show(); try { new RecBar().start(stage); } catch (Exception ex) { Logger.getLogger(RecController.class.getName()).log(Level.SEVERE, null,ex); } }

为什么我在加载fxml时会得到stackoverflow?

我调整了我的控制器构造函数和fxml,以便控制器的fxml的所有设置都在fxml中,除了FXML构造和fxml加载。 这是我的控制器: public class MainOverviewTab extends Tab { @FXML private AnchorPane content; public MainOverviewTab() { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(“main_overview_tab.fxml”)); // fxmlLoader.setRoot(content); // fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (Exception e) { e.printStackTrace(); } } 和我的fxml文件: …. 当调用fxmlLoader.load()并返回到FXMLLoader fxmlLoader = new FXMLLoader(…)然后再次调用fxmlLoader.load()时发生stackoverflow …为什么会发生这种情况以及如何保持我的控制器构造函数相同并加载fxml相同? 或者这不可能吗?

为什么“错误:无法找到或加载主类addstudent.AddStudent”正在显示

我正在使用NetBeans IDE开发一个项目。 我是javafx的新手。 我在一个名为“addstudent”的包中创建了一个“AddStudent”类。 当我运行该类时,我得到“错误:无法找到或加载主类addstudent.AddStudent”。 为什么会出现此错误? 它怎么解决了?

JavaFx:如果我想在initialize()之后做一些事情,在场景秀之前,我该如何实现呢?

我想做一些事情,在控制器的initialize()方法完成之后,但在场景show之前。在场景显示之前是否会调用任何方法?我想在方法中加入一些代码。 FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource(“sample.fxml”)); AnchorPane pane = loader.load(); Scene gameScene = new Scene(pane); //I load a secne above,the I will get the controller,set some properties,then,use the properties to read a file before the secene show. GameUIController controller = loader.getController(); controller.setGameFileLoacation(“game1.txt”);//I set a property here.I want to use it to read game file,and […]

JavaFX应用程序无法使用本机exe包启动

我已经构建了一个可以通过其jar文件执行的JavaFX应用程序。 但是,如果我尝试使用本机exe包运行它,我收到两个弹出窗口: com / npap / dicomrouter / Main – 没有主类 无法启动JVM 并且应用程序无法启动。 这是我的Main类(大部分内容): package com.npap.dicomrouter; public class Main extends Application { … public static void main(String[] args) throws IOException { try { JUnique.acquireLock(appId); alreadyRunning = false; log.info(“application is going to start running!!!!”); } catch (AlreadyLockedException e) { alreadyRunning = true; log.info(“application is already running!!!!”); […]

移动刻度标签JavaFx 2

是否可以将刻度标签移动/移动到图表中。 目前我看到api’s隐藏/显示刻度标签是否有一个API移动图表内的刻度标签? 如果没有API,那么我是否可以使用/应用这项技术来完成这项工作? 目前的代码 public class Graph extends Application{ private NumberAxis xAxis; private NumberAxis yAxis; public static void main(final String[] args) { launch(args); } @Override public void start(final Stage primaryStage) throws Exception { xAxis = new NumberAxis(0, 300, 20); xAxis.setAutoRanging(false); xAxis.setAnimated(false); xAxis.setMinorTickVisible(false); xAxis.setTickLabelsVisible(false); xAxis.setTickMarkVisible(false); yAxis = new NumberAxis(30, 240, 30); yAxis.setAutoRanging(false); yAxis.setAnimated(false); yAxis.setTickMarkVisible(false); yAxis.setMinorTickVisible(false); yAxis.setMinorTickCount(3); […]

简单的JavaFX HelloWorld不起作用

我仍然一遍又一遍地得到这个错误: Error resolving onAction=’#sayHelloWorld’, either the event handler is not in the Namespace or there is an error in the script. 。 我已经在互联网上搜索了一个解决方案,但没有任何作用,当然我是一个小细节,因为我是JAvaFX的新手,这是我的第一个HelloWorld应用程序。 无论如何,这是我正在使用的代码: sample.fxml: 和SampleController.java package sample; import javafx.scene.control.Label; import java.awt.event.ActionEvent; public class SampleController { public Label helloWorld; public void sayHelloWorld(ActionEvent actionEvent) { } } 任何帮助,将不胜感激。

Java FX从不同场景改变Label的值

我有两个场景。 第一个场景使用以下代码调用第二个场景。 @FXML private void confirmation(ActionEvent event) throws IOException{ Stage confirmation_stage; Parent confirmation; confirmation_stage=new Stage(); confirmation=FXMLLoader.load(getClass().getResource(“Confirmation.fxml”)); confirmation_stage.setScene(new Scene(confirmation)); confirmation_stage.initOwner(generate_button.getScene().getWindow()); confirmation_stage.show(); } “Confirmation.fxml”中有一个名为“Proceed”的标签。 我需要在此函数中更改该标签的内容并返回结果(true / false)。 帮帮我?

如何在javaFx中为一个场景创建一个菜单栏

我基本上是Java FX 2的新手。 场景: 我有3个场景,我想要一种方法来添加菜单栏,这样我就不想从前一个场景中明确删除菜单栏并将其添加到新场景中。 像某些东西,父场景或某种方式菜单栏附加到舞台。 我的意思是菜单栏只添加了一次,并且无论前面或下面的场景是什么都会出现。 如果这是可能的我该怎么做? 以下是Oracle Docs of JavaFX提供的默认示例http://docs.oracle.com/javafx/2/ui_controls/MenuSample.java.html public class Main extends Application { final ImageView pic = new ImageView(); final Label name = new Label(); final Label binName = new Label(); final Label description = new Label(); public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) […]