本文整理汇总了Java中com.gluonhq.charm.down.common.JavaFXPlatform类的典型用法代码示例。如果您正苦于以下问题:Java JavaFXPlatform类的具体用法?Java JavaFXPlatform怎么用?Java JavaFXPlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaFXPlatform类属于com.gluonhq.charm.down.common包,在下文中一共展示了JavaFXPlatform类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUniqueId
import com.gluonhq.charm.down.common.JavaFXPlatform; //导入依赖的package包/类
private String getUniqueId() {
String uniqueId;
if (JavaFXPlatform.isDesktop()) {
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
byte[] mac = network.getHardwareAddress();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) { sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "")); }
uniqueId = sb.toString();
} catch (UnknownHostException | SocketException e) {
uniqueId = "MoodFXDesktop" + RND.nextInt(1000);
}
} else if (JavaFXPlatform.isAndroid()) {
uniqueId = "MoodFXAndroid" + RND.nextInt(1000);
} else if (JavaFXPlatform.isIOS()) {
uniqueId = "MoodFXiOS" + RND.nextInt(1000);
} else {
uniqueId = "MoodFX" + RND.nextInt(1000);
}
return uniqueId;
}
示例2: postInit
import com.gluonhq.charm.down.common.JavaFXPlatform; //导入依赖的package包/类
@Override public void postInit(Scene scene) {
scene.getStylesheets().add(MoodFX.class.getResource("styles.css").toExternalForm());
Swatch.BLUE_GREY.assignTo(scene);
((Stage) scene.getWindow()).getIcons().add(new Image(MoodFX.class.getResourceAsStream("/icon.png")));
// Size to FullScreen on Desktop and Embedded
if (JavaFXPlatform.isDesktop()) {
if (System.getProperty("os.arch").toUpperCase().contains("ARM")) {
((Stage) scene.getWindow()).setFullScreen(true);
((Stage) scene.getWindow()).setFullScreenExitHint("");
} else {
(scene.getWindow()).setWidth(500);
(scene.getWindow()).setHeight(550);
}
}
}
示例3: init
import com.gluonhq.charm.down.common.JavaFXPlatform; //导入依赖的package包/类
private void init() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
if (Double.compare(getMinWidth(), 0.0) <= 0 || Double.compare(getMinHeight(), 0.0) <= 0) {
setMinSize(MINIMUM_WIDTH, MINIMUM_HEIGHT);
}
if (Double.compare(getMaxWidth(), 0.0) <= 0 || Double.compare(getMaxHeight(), 0.0) <= 0) {
if (JavaFXPlatform.isIOS()) {
setMaxSize(350, 350);
} else {
setMaxSize(MAXIMUM_WIDTH, MAXIMUM_HEIGHT);
}
}
}
示例4: postInit
import com.gluonhq.charm.down.common.JavaFXPlatform; //导入依赖的package包/类
@Override
public void postInit(Scene scene) {
Swatch.TEAL.assignTo(scene);
if (JavaFXPlatform.isDesktop()) {
scene.getWindow().setWidth(350);
scene.getWindow().setHeight(650);
}
PlatformFactory.getPlatform().setOnLifecycleEvent(p -> {
if (controlPresenter != null) {
switch (p) {
case PAUSE:
case STOP: stop(); break;
case RESUME: controlPresenter.start(); break;
}
}
return null;
});
}
示例5: getPlatformClassName
import com.gluonhq.charm.down.common.JavaFXPlatform; //导入依赖的package包/类
private static String getPlatformClassName() {
switch (JavaFXPlatform.getCurrent()) {
case ANDROID:
return "com.zeiss.quarkfx.AndroidPlatform";
case IOS:
return "com.zeiss.quarkfx.IosPlatform";
default:
return "com.zeiss.quarkfx.DesktopPlatform";
}
}
示例6: moveToFoV
import com.gluonhq.charm.down.common.JavaFXPlatform; //导入依赖的package包/类
private void moveToFoV(final Node NODE, final boolean WAS_FOCUSED, final boolean IS_FOCUSED) {
if (IS_FOCUSED && !WAS_FOCUSED) { // Got Focus
if (!JavaFXPlatform.isDesktop()) configPane.setTranslateY(-NODE.getLayoutY());
} else if (WAS_FOCUSED && !IS_FOCUSED) { // Lost Focus
resetFoV();
saveConfig();
}
}
示例7: resetFoV
import com.gluonhq.charm.down.common.JavaFXPlatform; //导入依赖的package包/类
private void resetFoV() { if (!JavaFXPlatform.isDesktop()) configPane.setTranslateY(0); }