當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。