当前位置: 首页>>代码示例>>Java>>正文


Java FXMLLoader.setRoot方法代码示例

本文整理汇总了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());
}
 
开发者ID:micheledv,项目名称:passepartout,代码行数:23,代码来源:ServerControl.java

示例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);
}
 
开发者ID:micheledv,项目名称:passepartout,代码行数:17,代码来源:FormEntryControl.java

示例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);
	}
	
}
 
开发者ID:goxr3plus,项目名称:JavaFX-Web-Browser,代码行数:23,代码来源:WebBrowserTabContextMenu.java

示例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);
    }
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:22,代码来源:ClickableBitcoinAddress.java

示例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);
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:24,代码来源:ProjectPanePresentation.java

示例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();
            }
        });
    }
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:20,代码来源:SliderControl.java

示例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);
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:21,代码来源:LogController.java

示例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);
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:32,代码来源:JorkPresentation.java

示例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);
    }
}
 
开发者ID:jmblixt3,项目名称:Clash-Royale,代码行数:12,代码来源:CustomControl.java

示例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);
    }
}
 
开发者ID:rumangerst,项目名称:CSLMusicModStationCreator,代码行数:12,代码来源:ControlsHelper.java

示例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();
    }
}
 
开发者ID:bitkylin,项目名称:ClusterDeviceControlPlatform,代码行数:11,代码来源:AboutController.java

示例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);
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:35,代码来源:UndoRedoHistoryEntryPresentation.java

示例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);
    }
}
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:13,代码来源:SplineController.java

示例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();
    }
}
 
开发者ID:bitkylin,项目名称:ClusterDeviceControlPlatform,代码行数:11,代码来源:MainView.java

示例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);
  }
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:14,代码来源:WidgetGallery.java


注:本文中的javafx.fxml.FXMLLoader.setRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。