我正在尝试创建一个javafx应用程序,只需一个选项卡窗格和javafx组合框,这是我的场景构建器创建的fxml女巫:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="288.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TabPane layoutX="-2.0" prefHeight="400.0" prefWidth="288.0" tabClosingPolicy="UNAVAILABLE">
<tabs>
<Tab text="tab1">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<ComboBox layoutX="32.0" layoutY="39.0" prefHeight="26.0" prefWidth="86.0" />
</children>
</AnchorPane>
</content>
</Tab>
</tabs>
</TabPane>
</children>
</AnchorPane>
这是我的简单主要用于调用fxml
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
/*
* 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.
*/
/**
*
* @author asus
*/
public class Main extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
Scene scene= new Scene(FXMLLoader.load(getClass().getResource("/javaapplication3/test.fxml")));
primaryStage.setScene(scene);
primaryStage.setX(0);
primaryStage.show();
}
public static void main(String[] args) {
launch();
}
}
我正在寻找一种方法来使用与我的fxml文件和我的应用程序集成的swing组合框我怎么能这样做,有没有办法在fxml的场景构建器中使用swing组件?