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


Java ConditionalFeature类代码示例

本文整理汇总了Java中javafx.application.ConditionalFeature的典型用法代码示例。如果您正苦于以下问题:Java ConditionalFeature类的具体用法?Java ConditionalFeature怎么用?Java ConditionalFeature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConditionalFeature类属于javafx.application包,在下文中一共展示了ConditionalFeature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.application.ConditionalFeature; //导入依赖的package包/类
/**
 *
 * @param primaryStage
 */
@Override
public void start(Stage primaryStage) {
    gameManager = new GameManager();
    gameBounds = gameManager.getLayoutBounds();

    StackPane root = new StackPane(gameManager);
    root.getStyleClass().addAll("game-root");
    ChangeListener<Number> resize = (ov, v, v1) -> {
        double scale = Math.min((root.getWidth() - MARGIN) / gameBounds.getWidth(), (root.getHeight() - MARGIN) / gameBounds.getHeight());
        gameManager.setScale(scale);
        gameManager.setLayoutX((root.getWidth() - gameBounds.getWidth()) / 2d);
        gameManager.setLayoutY((root.getHeight() - gameBounds.getHeight()) / 2d);
    };
    root.widthProperty().addListener(resize);
    root.heightProperty().addListener(resize);

    Scene scene = new Scene(root);
    scene.getStylesheets().add(CSS);
    addKeyHandler(scene);
    addSwipeHandlers(scene);

    if (isARMDevice()) {
        primaryStage.setFullScreen(true);
        primaryStage.setFullScreenExitHint("");
    }

    if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) {
        scene.setCursor(Cursor.NONE);
    }

    Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
    double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN),
            visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN));
    primaryStage.setTitle("2048FX");
    primaryStage.setScene(scene);
    primaryStage.setMinWidth(gameBounds.getWidth() / 2d);
    primaryStage.setMinHeight(gameBounds.getHeight() / 2d);
    primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor);
    primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor);
    primaryStage.show();
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:46,代码来源:Game2048.java

示例2: Scene3D

import javafx.application.ConditionalFeature; //导入依赖的package包/类
public Scene3D(Parent parent, double width, double height) {
//    super(new Group(parent), width, height, true);  // see http://javafx-jira.kenai.com/browse/RT-22696
    super(new Group(parent), width, height);


     if (true == Platform.isSupported(ConditionalFeature.SCENE3D)) {
         setCamera(new PerspectiveCamera());

         Translate centerTranslate = new Translate();
         centerTranslate.xProperty().bind(widthProperty().divide(2));
         centerTranslate.yProperty().bind(heightProperty().divide(2));

         getRoot().getTransforms().addAll(centerTranslate, translateZ, rotateX, rotateY, translateY);
       //  getRoot().setDepthTest(DepthTest.ENABLE);// see http://javafx-jira.kenai.com/browse/RT-22696
     }

 }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:18,代码来源:Scene3D.java

示例3: createDraggingGlobe

import javafx.application.ConditionalFeature; //导入依赖的package包/类
public Parent createDraggingGlobe() {
 boolean support = Platform.isSupported(ConditionalFeature.SCENE3D);
 if (support)
  logger.info("JavaFX 3D features supported");
 else
  logger.info("JavaFX 3D features NOT supported");

    globe = new Globe();
    rotateGlobe();

 // Use a SubScene
    subScene = new SubScene(globe.getRoot(), WIDTH, HEIGHT);//, true, SceneAntialiasing.BALANCED);
    subScene.setId("sub");
    subScene.setCamera(globe.getCamera());//subScene));

    //return new Group(subScene);
    return new HBox(subScene);
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:19,代码来源:SpinningGlobe.java

示例4: init

import javafx.application.ConditionalFeature; //导入依赖的package包/类
@Override
public void init() throws Exception {
	appInstance = this;
	VERSION = getVersion();

	// Lets install/update the overlays if newer version
	AppSetup.install(VERSION);
	log = LogManager.getLogger(TokenTool.class);
	log.info("3D Hardware Available? " + Platform.isSupported(ConditionalFeature.SCENE3D));

	// Now lets cache any overlays we find and update preLoader with progress
	overlayCount = (int) Files.walk(AppConstants.OVERLAY_DIR.toPath()).filter(Files::isRegularFile).count();
	overlayTreeItems = cacheOverlays(AppConstants.OVERLAY_DIR, null, THUMB_SIZE);

	// All Done!
	notifyPreloader(new Preloader.ProgressNotification(1.0));
}
 
开发者ID:RPTools,项目名称:tokentool,代码行数:18,代码来源:TokenTool.java

示例5: getSearchTextChanged

import javafx.application.ConditionalFeature; //导入依赖的package包/类
public void getSearchTextChanged(InputMethodEvent event) {
    Platform.isSupported(ConditionalFeature.INPUT_METHOD);
    if (!event.getCommitted().isEmpty()) {
        searchText += event.getCommitted();
        searchTextId.setText(searchText);
        searchTextId.end();
        System.out.println(searchText);
        List<SearchedResult> searchedResults = getSearchResult(searchText, searchField);
        showTableData(searchedResults);
    }
}
 
开发者ID:neal1991,项目名称:everywhere,代码行数:12,代码来源:Controller.java

示例6: mouseEventDeliveryTest

import javafx.application.ConditionalFeature; //导入依赖的package包/类
@Test
public void mouseEventDeliveryTest()
{
    if(Platform.isSupported(ConditionalFeature.SCENE3D))
    {
        final Object referenceColor = getCenterColor(referenceGreen);

        iterate(new TestCore() {

            @Override
            protected void catchError()
            {
                Object detectedColor = getCenterColor(indicator);

                if(!(JemmyUtils.usingGlassRobot() ? Arrays.equals((double[]) detectedColor, (double[]) referenceColor) : ((Integer) detectedColor).intValue() == ((Integer) referenceColor).intValue()))
                {
                    StringBuilder builder = new StringBuilder();
                    builder.append("Wrong node reached with following configuration:\nFirst node: ").
                            append(firstNodeCombo.getControl().getValue()).append("\nSecond node: ").
                            append(secondNodeCombo.getControl().getValue()).
                            append("\nFirst node DepthTest: ").append(firstDTest.getControl().getValue()).
                            append("\nSecond node DepthTest: ").append(secondDTest.getControl().getValue()).
                            append("\nParent node DepthTest: ").append(parentDTest.getControl().getValue()).
                            append("\nWith ").append(firstToFront.getControl().isSelected() ? "first" : "second").
                            append(" node infront\n");
                    System.err.println(builder.toString());
                    setPassed(false);
                }
            }
        });
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:33,代码来源:DepthTestTest.java

示例7: HelloIoTApp

import javafx.application.ConditionalFeature; //导入依赖的package包/类
public HelloIoTApp(ApplicationConfig config) {

        this.config = config;

        // Load resources
        resources = ResourceBundle.getBundle("com/adr/helloiot/fxml/main");

        // System devices units
        addSystemDevicesUnits(config.mqtt_topicapp);

        // MQTT Manager   
        mqttmanager = new MQTTManager(
                config.mqtt_url,
                config.mqtt_username,
                config.mqtt_password,
                config.mqtt_clientid,
                config.mqtt_connectiontimeout,
                config.mqtt_keepaliveinterval,
                config.mqtt_defaultqos,
                config.mqtt_version,
                config.mqtt_cleansession,
                null,
                config.mqtt_topicprefix);
        mqttmanager.setOnConnectionLost(t -> {
            LOGGER.log(Level.WARNING, "Connection lost to broker.", t);
            Platform.runLater(() -> {
                stopUnits();
                connection();
            });
        });

        styleConnection = config.app_retryconnection ? this::tryConnection : this::oneConnection;

        mqttnode = new MQTTMainNode(
                this,
                Platform.isSupported(ConditionalFeature.MEDIA) ? new StandardClipFactory() : new SilentClipFactory(),
                config.app_clock,
                config.app_exitbutton);
    }
 
开发者ID:adrianromero,项目名称:helloiot,代码行数:40,代码来源:HelloIoTApp.java

示例8: createFixedGlobe

import javafx.application.ConditionalFeature; //导入依赖的package包/类
public Parent createFixedGlobe() {
  boolean support = Platform.isSupported(ConditionalFeature.SCENE3D);
  if (support)
   logger.info("JavaFX 3D features supported");
  else
   logger.info("JavaFX 3D features NOT supported");

    globe = new Globe();
    rotateGlobe();

    //return new Group(globe.getRoot());
    return new HBox(globe.getRoot());
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:14,代码来源:SpinningGlobe.java

示例9: openInnerBrowser

import javafx.application.ConditionalFeature; //导入依赖的package包/类
/**
 * open url(non-blank) using JavaFx web engine.
 */
public static void openInnerBrowser(String openUrl) {
	if (Strings.isBlank(openUrl)) return;
	if (Platform.isSupported(ConditionalFeature.WEB)) {
		try {
			new CookieCatcher(openUrl, openUrl);
		} catch (Exception e) {
			String errMsg = "open URL failed:" + openUrl;
			JOptionPane.showMessageDialog(null, errMsg + "\n" + e.getMessage());
			log.error(errMsg, e);
		}
	} else {
		log.error("javaFx web not supported, url not opened: " + openUrl);
	}
}
 
开发者ID:myshzzx,项目名称:mlib,代码行数:18,代码来源:UIs.java

示例10: start

import javafx.application.ConditionalFeature; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    root = new GamePane();

    Scene scene = new Scene(root);
    scene.getStylesheets().add("game2048/game.css");

    if (isARMDevice()) {
        primaryStage.setFullScreen(true);
        primaryStage.setFullScreenExitHint("");
    }

    if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) {
        scene.setCursor(Cursor.NONE);
    }

    Bounds gameBounds = root.getGameManager().getLayoutBounds();
    int MARGIN = GamePane.getMargin();
    Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
    double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN),
            visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN));
    primaryStage.setTitle("2048FX");
    primaryStage.setScene(scene);
    primaryStage.setMinWidth(gameBounds.getWidth() / 2d);
    primaryStage.setMinHeight(gameBounds.getHeight() / 2d);
    primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor);
    primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor);
    
    primaryStage.setOnCloseRequest(t->{
        t.consume();
        root.getGameManager().quitGame();
    });
    primaryStage.show();
}
 
开发者ID:brunoborges,项目名称:fx2048,代码行数:35,代码来源:Game2048.java

示例11: StylesConfig

import javafx.application.ConditionalFeature; //导入依赖的package包/类
public StylesConfig(Theme theme) {
    requireNotNull(theme, "Theme cannot be null");
    LOG.debug(DefaultI18nContext.getInstance().i18n("Installing theme {0}.", theme.friendlyName()));
    theme.styleSheets().stream().map(s -> this.getClass().getResource(s).toExternalForm()).forEach(styles::add);
    styles.add(this.getClass().getResource(GlyphsStyle.DEFAULT.getStylePath()).toExternalForm());
    if (!Platform.isSupported(ConditionalFeature.TRANSPARENT_WINDOW)) {
        styles.add(this.getClass().getResource("/themes/transparent-incapable.css").toExternalForm());
        LOG.info("Transparent windows not supported by the platform");
    }
}
 
开发者ID:torakiki,项目名称:pdfsam,代码行数:11,代码来源:StylesConfig.java

示例12: init

import javafx.application.ConditionalFeature; //导入依赖的package包/类
@Override
    public void init() throws Exception {
        super.init();
        log.setLevel(Level.DEBUG);
        log.info("Log system initialized");
        km = KernelManager.getManager();
        nm = NetManager.getManager();
        gm = GUIManager.getManager();
        log.info("All moduels initialized");
        if (Platform.isSupported(ConditionalFeature.EFFECT))
            log.info("Check Effect support...Yes!");
        else
            log.warn("Check Effect support...No!");
        // The following check is only allowed on the event thread. I've commented it in the last commit
//		if (Platform.isSupported(ConditionalFeature.INPUT_METHOD))
//			log.info("Check Input Method support...Yes!");
//		else
//			log.warn("Check Input Method support...No!");
        if (Platform.isSupported(ConditionalFeature.SCENE3D))
            log.info("Check 3D Scene support...Yes!");
        else {
            log.warn("Check 3D Scene support...No!");
            log.warn("Turn down Effect-Level automatically...");
            GUIManager.enableReflectionEffect = false;
            GUIManager.enableSmooth = false;
        }
        if (Platform.isSupported(ConditionalFeature.SHAPE_CLIP))
            log.info("Check Shape Clip support...Yes!");
        else
            log.warn("Check Shape Clip support...No!");
    }
 
开发者ID:tjumyk,项目名称:sevenwonders,代码行数:32,代码来源:Manager.java

示例13: start

import javafx.application.ConditionalFeature; //导入依赖的package包/类
@Override
public void start(Stage stage) {
    VBox vb = new VBox();
    Scene scene = new Scene(vb);
    stage.setScene(scene);
    stage.setWidth(500);
    stage.setHeight(480);

    Pane p = new Pane();
    p.setTranslateX(75);
    p.setTranslateY(75);
    final Text strOutput = new Text();
    strOutput.setId("strOutput");


    MyTextInput mti = new MyTextInput();
    mti.setId("inputfield");
    TextInputControl www = new TextField("bwbeb");
    for (ConditionalFeature c : ConditionalFeature.values()) {
        System.out.println(c);
    }


    EventHandler<? super InputEvent> qqq = new EventHandler<InputEvent>() {

        public void handle(InputEvent e) {
            System.out.println("*");
            //strOutput.setText("ok"); // let it be here for debug
        }
    };

    EventHandler<? super InputMethodEvent> qqq2 = new EventHandler<InputMethodEvent>() {

        public void handle(InputMethodEvent t) {
            strOutput.setText("ok");

            // TODO: test all these getters listed below.
            // "setOnInputMethodTextChanged" does not work now (see http://javafx-jira.kenai.com/browse/RT-12915),
            // and exact values returned by getters are not documented in details, so,
            // this test should be improved and expanded after RT-12915 fix.

            int caretPosition = t.getCaretPosition();
            String committedString = t.getCommitted();
            String strRepresentation = t.toString();
            ObservableList<InputMethodTextRun> lstRun =t.getComposed();
            for (InputMethodTextRun run: lstRun) {
                String runText = run.getText();
                String runString = run.toString();
                InputMethodHighlight imh = run.getHighlight();
                InputMethodHighlight imh1 = InputMethodHighlight.SELECTED_RAW;
                InputMethodHighlight imh2 = InputMethodHighlight.valueOf("SELECTED_RAW");
            }
        }
    };

    mti.setOnInputMethodTextChanged(qqq2);
    mti.setOnKeyTyped(qqq);
    www.setOnInputMethodTextChanged(qqq2);
    www.setOnKeyTyped(qqq);

    vb.getChildren().add(mti);
    vb.getChildren().add(www);
    vb.getChildren().add(strOutput);

    stage.show();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:67,代码来源:SceneInputApp.java

示例14: getScene

import javafx.application.ConditionalFeature; //导入依赖的package包/类
@Override
protected Scene getScene() {

    root = new Pane();
    scene = new Scene(root, 320, 200, Color.WHITE);

    HBox hbox = new HBox();

    rectGreen = new Rectangle(50, 50, 100, 100);
    rectGreen.setFill(Color.GREEN);
    rectGreen.setId("RectGreen");
    root.getChildren().add(rectGreen);

    AbstractButton btnShowPopup = ButtonBuilderFactory.newButtonBuilder()
            .text("Show Popup")
            .id("BtnShowPopup")
            .setOnClickHandler( new OnClickHandler() {

                @Override
                public void onClick() {
                    Popup popup = new Popup();
                    popup.setWidth(stage.getWidth());
                    popup.setHeight(stage.getHeight());
                    popup.setOpacity(0.5);

                    Pane rootPopup = new Pane();
                    Rectangle rectBg = new Rectangle(0, 0, rectGreen.getWidth() + smallRectSize * 2, rectGreen.getHeight() + smallRectSize * 2);
                    rectBg.setId("RectPopupBg");
                    rectBg.setFill(Color.BLUE);
                    rectBg.setOpacity(0.5);

                    rootPopup.getChildren().add(rectBg);
                    rootPopup.getChildren().add(new Rectangle(0, 0, smallRectSize, smallRectSize));
                    rootPopup.getChildren().add(new Rectangle(rectBg.getWidth() - smallRectSize, rectBg.getHeight() - smallRectSize, smallRectSize, smallRectSize));
                    rootPopup.getChildren().add(new Rectangle(0, rectBg.getHeight() - smallRectSize, smallRectSize, smallRectSize));
                    rootPopup.getChildren().add(new Rectangle(rectBg.getWidth() - smallRectSize, 0, smallRectSize, smallRectSize));

                    popup.getContent().add(rootPopup);

                    popup.show(stage,
                            stage.getX() + scene.getX() + rectGreen.getX() - smallRectSize,
                            stage.getY() + scene.getY() + rectGreen.getY() - smallRectSize);
                        }

                    }
            ).build();

    AbstractCheckBox chIsSupportedTransparentWindow = CheckBoxBuilderFactory.newCheckboxBuilder()
            .text("Platform.isSupported(ConditionalFeature.TRANSPARENT_WINDOW)")
            .id("TRANSPARENT_WINDOW")
            .setChecked(Platform.isSupported(ConditionalFeature.TRANSPARENT_WINDOW))
            .build();


    hbox.getChildren().addAll(btnShowPopup.node(), chIsSupportedTransparentWindow.node());
    root.getChildren().add(hbox);

    Utils.addBrowser(scene);
    return scene;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:61,代码来源:TransparencyWindowApp.java

示例15: runUI

import javafx.application.ConditionalFeature; //导入依赖的package包/类
@BeforeClass
public static void runUI() {
    is3DCapablePlatform = Platform.isSupported(ConditionalFeature.SCENE3D);
    Layout3DApp.main(null);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:6,代码来源:Layout3DTest.java


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