本文整理汇总了Java中javafx.fxml.FXMLLoader.setRoot方法的典型用法代码示例。如果您正苦于以下问题:Java FXMLLoader.setRoot方法的具体用法?Java FXMLLoader.setRoot怎么用?Java FXMLLoader.setRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.fxml.FXMLLoader
的用法示例。
在下文中一共展示了FXMLLoader.setRoot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ServerControl
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public ServerControl(MainControl mainControl, ServerModel server) {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/server.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
this.mainControl = mainControl;
this.server = server;
final ConfigurationModel configuration = App.getConfiguration();
this.server.getServices().forEach(service -> {
servicesContainer.getPanes().add(new ServiceControl(this, service));
});
this.setText(this.server.getName());
}
示例2: FormEntryControl
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public FormEntryControl(ServiceControl serviceControl, String paramName, String description) {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/formEntry.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
this.serviceControl = serviceControl;
this.paramName = paramName;
descriptionLabel.setText(description);
}
示例3: WebBrowserTabContextMenu
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
* Constructor
*
* @param tab
* @param webBrowserController
*/
public WebBrowserTabContextMenu(WebBrowserTabController webBrowserTabController, WebBrowserController webBrowserController) {
this.webBrowserTabController = webBrowserTabController;
this.webBrowserController = webBrowserController;
// ------------------------------------FXMLLOADER ----------------------------------------
FXMLLoader loader = new FXMLLoader(getClass().getResource(InfoTool.FXMLS + "WebBrowserTabContextMenu.fxml"));
loader.setController(this);
loader.setRoot(this);
try {
loader.load();
} catch (IOException ex) {
logger.log(Level.SEVERE, "", ex);
}
}
示例4: ClickableBitcoinAddress
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public ClickableBitcoinAddress() {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("bitcoin_address.fxml"));
loader.setRoot(this);
loader.setController(this);
// The following line is supposed to help Scene Builder, although it doesn't seem to be needed for me.
loader.setClassLoader(getClass().getClassLoader());
loader.load();
AwesomeDude.setIcon(copyWidget, AwesomeIcon.COPY);
Tooltip.install(copyWidget, new Tooltip("Copy address to clipboard"));
AwesomeDude.setIcon(qrCode, AwesomeIcon.QRCODE);
Tooltip.install(qrCode, new Tooltip("Show a barcode scannable with a mobile phone for this address"));
addressStr = convert(address);
addressLabel.textProperty().bind(addressStr);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例5: ProjectPanePresentation
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public ProjectPanePresentation() {
final URL location = this.getClass().getResource("ProjectPanePresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
controller = fxmlLoader.getController();
initializeRightBorder();
initializeBackground();
initializeToolbar();
initializeToolbarButton(controller.createComponent);
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例6: initialize
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void initialize() {
final FXMLLoader loader = new FXMLLoader();
loader.setLocation(SliderControl.class.getResource("/fxml/FXMLSliderControl.fxml")); //NOI18N
loader.setController(this);
loader.setRoot(this);
try {
loader.load();
} catch (IOException ex) {
Logger.getLogger(SliderControl.class.getName()).log(Level.SEVERE, null, ex);
}
// when we detect a width change, we know node layout is resolved so we position stop in track
thumb.widthProperty().addListener((ov, oldValue, newValue) -> {
if (newValue.doubleValue() > 0) {
thumbWidth = newValue.doubleValue();
}
});
}
示例7: LogTab
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public LogTab(String name, Process process) {
setText(name);
this.process = process;
URL loc = Thread.currentThread().getContextClassLoader().getResource("gui/log_tab.fxml");
FXMLLoader fxmlLoader = new FXMLLoader(loc);
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
kill.setOnAction(event -> kill());
clear.setOnAction(event -> textArea.clear());
upload.setOnAction(event -> MiscUtil.uploadLog(textArea.getText()));
textArea.setTextFormatter(new TextFormatter<String>(change ->
change.getControlNewText().length() <= MAX_CHARS ? change : null));
setOnCloseRequest(this::close);
}
示例8: JorkPresentation
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public JorkPresentation(final Jork newJork, final Component component) {
final URL url = this.getClass().getResource("JorkPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(url);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(url.openStream());
controller = fxmlLoader.getController();
controller.setComponent(component);
controller.setJork(newJork);
setLayoutX(newJork.getX());
setLayoutY(newJork.getY());
newJork.xProperty().bind(layoutXProperty());
newJork.yProperty().bind(layoutYProperty());
setTranslateY(JORK_Y_TRANSLATE);
initializeShape();
initializeColor();
initializeRotationBasedOnType();
initializeIdLabel();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例9: CustomControl
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public CustomControl() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("custom_control.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
示例10: initControl
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public static void initControl(Node node, String fxml) {
FXMLLoader fxmlLoader = new FXMLLoader(node.getClass().getResource(fxml));
fxmlLoader.setRoot(node);
fxmlLoader.setController(node);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
示例11: AboutController
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public AboutController() {
FXMLLoader loader = new FXMLLoader(getClass().getResource("about.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
e.printStackTrace();
}
}
示例12: UndoRedoHistoryEntryPresentation
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public UndoRedoHistoryEntryPresentation(final UndoRedoStack.Command command, final boolean isUndo) {
this.command = command;
final URL location = this.getClass().getResource("UndoRedoHistoryEntryPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
// Must be the indicator for the current state
if (command == null) {
color = Color.GREY_BLUE;
colorIntensity = Color.Intensity.I500;
} else if (isUndo) {
color = Color.GREEN;
colorIntensity = Color.Intensity.I600;
} else {
color = Color.DEEP_ORANGE;
colorIntensity = Color.Intensity.I800;
}
initializeRippler();
initializeIcon();
initializeBackground();
initializeLabel();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例13: initialize
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void initialize() {
try {
final FXMLLoader loader = new FXMLLoader();
loader.setLocation(SplineController.class.getResource("/fxml/FXMLSplinePanel.fxml")); //NOI18N
loader.setController(this);
loader.setRoot(this);
loader.load();
createSpineEditor();
} catch (IOException ex) {
Logger.getLogger(SplineController.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例14: loadFxml
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void loadFxml() {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/main-view.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
e.printStackTrace();
}
}
示例15: WidgetGallery
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
* Creates a new WidgetGallery. This loads WidgetGallery.fxml and set up the constructor
*/
public WidgetGallery() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("WidgetGallery.fxml"));
fxmlLoader.setRoot(this);
try {
fxmlLoader.load();
} catch (IOException e) {
throw new IllegalStateException("Can't load FXML : " + getClass().getSimpleName(), e);
}
}