• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Application类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getRobot

import com.sun.glass.ui.Application; //导入依赖的package包/类
public static Robot getRobot() {
    if (robot == null) {
        robot = Environment.getEnvironment().getWaiter(WAIT_FACTORY).ensureState(new State<Robot>() {

            @Override
            public Robot reached() {
                try {
                    return new GetAction<Robot>() {
                        @Override
                        public void run(Object... os) throws Exception {
                            setResult(Application.GetApplication().createRobot());
                        }
                    }.dispatch(env);
                } catch (Exception e) {
                    return null;
                }
            }

            @Override
            public String toString() {
                return "Waiting for the glass robot to init.";
            }
        });
    }
    return robot;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:27,代码来源:GlassInputFactory.java


示例2: newRobot

import com.sun.glass.ui.Application; //导入依赖的package包/类
public static void newRobot() {
    if (robotGlass == null) {
        robotGlass = new GetAction<com.sun.glass.ui.Robot>() {
                    @Override
                    public void run(Object... os) throws Exception {
                        setResult(com.sun.glass.ui.Application.GetApplication().createRobot());
                    }
                }.dispatch(Root.ROOT.getEnvironment());
    }
    if (Utils.isMacOS() || JemmyUtils.usingGlassRobot()) {
        if (robotGlass == null) {
            robotGlass = Application.GetApplication().createRobot();
        }
    } else {
        if (robotAwt == null) {
            try {
                robotAwt = new java.awt.Robot();
            } catch (Exception ex) {
                Logger.getLogger(TestBase.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:TestBase.java


示例3: moveTo

import com.sun.glass.ui.Application; //导入依赖的package包/类
public void moveTo(Main.Location loc) {
    walking = new Timeline(Animation.INDEFINITE,
        new KeyFrame(Duration.seconds(.001), new KeyValue(direction, location.getValue().directionTo(loc))),
        new KeyFrame(Duration.seconds(.002), new KeyValue(location, loc)),
        new KeyFrame(Duration.seconds(1), new KeyValue(translateXProperty(), loc.getX() * Main.CELL_SIZE)),
        new KeyFrame(Duration.seconds(1), new KeyValue(translateYProperty(), loc.getY() * Main.CELL_SIZE)),
        new KeyFrame(Duration.seconds(.25), new KeyValue(frame, 0)),
        new KeyFrame(Duration.seconds(.5), new KeyValue(frame, 1)),
        new KeyFrame(Duration.seconds(.75), new KeyValue(frame, 2)),
        new KeyFrame(Duration.seconds(1), new KeyValue(frame, 1))
    );
    walking.setOnFinished(e -> {
        if (arrivalHandler != null) {
            arrivalHandler.handle(e);
        }
    });
    Application.invokeLater(walking::play);
}
 
开发者ID:victorrentea,项目名称:training,代码行数:19,代码来源:SpriteView.java


示例4: processMemoryViewUpdates

import com.sun.glass.ui.Application; //导入依赖的package包/类
private void processMemoryViewUpdates() {
    if (!Emulator.computer.getRunningProperty().get()) {
        return;
    }
    GraphicsContext context = memoryViewCanvas.getGraphicsContext2D();
    Set<MemoryCell> draw = new HashSet<>(redrawNodes);
    redrawNodes.clear();
    Application.invokeLater(() -> {
        draw.stream().forEach((jace.cheat.MemoryCell cell) -> {
            if (showValuesCheckbox.isSelected()) {
                int val = cell.value.get() & 0x0ff;
                context.setFill(Color.rgb(val, val, val));
            } else {
                context.setFill(Color.rgb(
                        cell.writeCount.get(),
                        cell.readCount.get(),
                        cell.execCount.get()));
            }
            context.fillRect(cell.getX(), cell.getY(), cell.getWidth(), cell.getHeight());
        });
    });
}
 
开发者ID:badvision,项目名称:jace,代码行数:23,代码来源:MetacheatUI.java


示例5: displayNotification

import com.sun.glass.ui.Application; //导入依赖的package包/类
public void displayNotification(String message) {
    Label oldNotification = currentNotification;
    Label notification = new Label(message);
    currentNotification = notification;
    notification.setEffect(new DropShadow(2.0, Color.BLACK));
    notification.setTextFill(Color.WHITE);
    notification.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 80, 0.7), new CornerRadii(5.0), new Insets(-5.0))));
    Application.invokeLater(() -> {
        stackPane.getChildren().remove(oldNotification);
        stackPane.getChildren().add(notification);
    });

    notificationExecutor.schedule(() -> {
        Application.invokeLater(() -> {
            stackPane.getChildren().remove(notification);
        });
    }, 4, TimeUnit.SECONDS);
}
 
开发者ID:badvision,项目名称:jace,代码行数:19,代码来源:JaceUIController.java


示例6: run

import com.sun.glass.ui.Application; //导入依赖的package包/类
public void run() {
    buffer.startIteration();
    // Do not lock the buffer while processing events. We still want to be
    // able to add incoming events to it.
    try {
        inputProcessor.processEvents(LinuxInputDevice.this);
    } catch (RuntimeException e) {
        Application.reportException(e);
    }
    synchronized (buffer) {
        if (buffer.hasNextEvent()) {
            // a new event came in after the call to processEvents
            runnableProcessor.invokeLater(processor);
        } else {
            processor.scheduled = false;
        }
        buffer.compact();
    }
}
 
开发者ID:TestFX,项目名称:Monocle,代码行数:20,代码来源:LinuxInputDevice.java


示例7: runLoop

import com.sun.glass.ui.Application; //导入依赖的package包/类
private Object runLoop() {
    final RunLoopControl control = new RunLoopControl();

    //push this new instance on the stack
    activeRunLoops.push(control);

    control.active = true;
    while (control.active) {
        try {
            queue.getNextRunnable().run();
        } catch (Throwable e) {
            Application.reportException(e);
        }
    }

    return control.release;

}
 
开发者ID:TestFX,项目名称:Monocle,代码行数:19,代码来源:RunnableProcessor.java


示例8: initFx

import com.sun.glass.ui.Application; //导入依赖的package包/类
private static void initFx() {
    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
        System.setProperty("javafx.embed.isEventThread", "true");
        System.setProperty("glass.win.uiScale", "100%");
        System.setProperty("glass.win.renderScale", "100%");
        return null;
    });
    Map map = Application.getDeviceDetails();
    if (map == null) {
        Application.setDeviceDetails(map = new HashMap());
    }
    if (map.get("javafx.embed.eventProc") == null) {
        long eventProc = 0;
        try {
            Field field = Display.class.getDeclaredField("eventProc");
            field.setAccessible(true);
            if (field.getType() == int.class) {
                eventProc = field.getLong(Display.getDefault());
            } else {
                if (field.getType() == long.class) {
                    eventProc = field.getLong(Display.getDefault());
                }
            }
        } catch (Throwable th) {
            //Fail silently
        }
        map.put("javafx.embed.eventProc", eventProc);
    }
    // Note that calling PlatformImpl.startup more than once is OK
    PlatformImpl.startup(() -> {
        Application.GetApplication().setName(Display.getAppName());
    });
}
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:34,代码来源:OldFXCanvas.java


示例9: show

import com.sun.glass.ui.Application; //导入依赖的package包/类
public void show(Window window) {
	if(window == null) {
		return;
	}
	Application.invokeAndWait(new Runnable() {
		@Override
		public void run() {
			long viewPointer = JavaFXUtils.getViewPointer(window);
			JTouchBarJNI.setTouchBar0(viewPointer, JTouchBar.this);
		}
	});
}
 
开发者ID:Thizzer,项目名称:JTouchBar,代码行数:13,代码来源:JTouchBar.java


示例10: closeDialogWindowByClosingWindow

import com.sun.glass.ui.Application; //导入依赖的package包/类
protected void closeDialogWindowByClosingWindow() {
    Application.invokeAndWait(() -> {
        final Robot robot = Application.GetApplication().createRobot();
        Wrap<? extends com.sun.glass.ui.Window> dialogWindow = Root.ROOT.lookup(new ByWindowType(Window.class)).lookup(Scene.class).wrap(0);
        robot.mouseMove(dialogWindow.getScreenBounds().x + dialogWindow.getScreenBounds().width - 2, dialogWindow.getScreenBounds().y - 20);
        robot.mousePress(1);
        robot.mouseRelease(1);
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:10,代码来源:DialogTest.java


示例11: doFactoryChange

import com.sun.glass.ui.Application; //导入依赖的package包/类
protected void doFactoryChange(final CellsApp.CellType cellType) {
    final Wrap<? extends ComboBox<CellType>> comboBox = parent.lookup(ComboBox.class, new ByID(choiceID)).wrap();
    Application.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            try {
                comboBox.getControl().getSelectionModel().select(cellType);
            } catch (Throwable ex) {
                ex.printStackTrace();
            }
        }
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:15,代码来源:CellsTestBase.java


示例12: GlassImage

import com.sun.glass.ui.Application; //导入依赖的package包/类
GlassImage(GlassImage orig, Dimension size) {
    this.image = Application.GetApplication().createPixels(size.width, size.height,
            ByteBuffer.allocate(size.width * size.height * 4)); //same logic as in Pixels
    supported = orig.supported;
    bytesPerPixel = orig.bytesPerPixel;
    bytesPerComponent = orig.bytesPerComponent;
    maxColorComponent = orig.maxColorComponent;
    data = getInitialData();
    this.size = size;
    env = Environment.getEnvironment();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:12,代码来源:GlassImage.java


示例13: getInitialSize

import com.sun.glass.ui.Application; //导入依赖的package包/类
private Dimension getInitialSize() {
    final AtomicReference<Dimension> sizeRef = new AtomicReference<Dimension>();
    Application.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            sizeRef.set(new Dimension(image.getWidth(), image.getHeight()));
        }
    });
    return sizeRef.get();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:12,代码来源:GlassImage.java


示例14: getInitialData

import com.sun.glass.ui.Application; //导入依赖的package包/类
private ByteBuffer getInitialData() {
    final AtomicReference<ByteBuffer> dataRef = new AtomicReference<ByteBuffer>();
    Application.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            dataRef.set(image.asByteBuffer());
        }
    });
    return dataRef.get();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:12,代码来源:GlassImage.java


示例15: dndRobot

import com.sun.glass.ui.Application; //导入依赖的package包/类
private void dndRobot(Wrap from, Point fromPoint, Wrap to, Point toPoint) throws InterruptedException {
    Point absFromPoint = new Point(fromPoint);
    Point absToPoint = new Point(toPoint);
    absFromPoint.translate((int) from.getScreenBounds().getX(), (int) from.getScreenBounds().getY());
    absToPoint.translate((int) to.getScreenBounds().getX(), (int) to.getScreenBounds().getY());
    Semaphore s = new Semaphore(0);
    Platform.runLater(() -> {
        if (robot == null) {
            robot = Application.GetApplication().createRobot();
        }
        robot.mouseMove(absFromPoint.x, absFromPoint.y);
        robot.mousePress(Robot.MOUSE_LEFT_BTN);
        final int STEPS = 50;
        int dx = absToPoint.x - absFromPoint.x;
        int dy = absToPoint.y - absFromPoint.y;
        for (int i = 0; i <= STEPS; i++) {
            robot.mouseMove(absFromPoint.x + dx * i / STEPS, absFromPoint.y + dy * i / STEPS);
            try {
                Thread.sleep(20);
            } catch (InterruptedException ex) {
                System.err.println("Error while dragging: " + ex);
                ex.printStackTrace();
            }
        }
        robot.mouseRelease(Robot.MOUSE_LEFT_BTN);
        s.release();
    });
    s.acquire();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:30,代码来源:TestBase.java


示例16: MacApplicationAdapter

import com.sun.glass.ui.Application; //导入依赖的package包/类
public MacApplicationAdapter() throws ReflectiveOperationException {
	app = Application.GetApplication();

	hide = ReflectionUtils.getHandle(app, "_hide");
	hideOtherApplications = ReflectionUtils.getHandle(app, "_hideOtherApplications");
	unhideAllApplications = ReflectionUtils.getHandle(app, "_unhideAllApplications");
}
 
开发者ID:codecentric,项目名称:NSMenuFX,代码行数:8,代码来源:MacApplicationAdapter.java


示例17: quit

import com.sun.glass.ui.Application; //导入依赖的package包/类
public void quit() {
	Application.EventHandler eh = app.getEventHandler();
	if (eh != null) {
		eh.handleQuitAction(Application.GetApplication(), System.nanoTime());
	}
	if (forceQuitOnCmdQ) {
		Platform.exit();
	}
}
 
开发者ID:codecentric,项目名称:NSMenuFX,代码行数:10,代码来源:MacApplicationAdapter.java


示例18: pauseClicked

import com.sun.glass.ui.Application; //导入依赖的package包/类
@FXML
void pauseClicked(ActionEvent event) {
    Application.invokeLater(() -> {
        if (Emulator.computer.isRunning()) {
            Emulator.computer.pause();
        } else {
            Emulator.computer.resume();
        }
    });
}
 
开发者ID:badvision,项目名称:jace,代码行数:11,代码来源:MetacheatUI.java


示例19: registerMetacheatEngine

import com.sun.glass.ui.Application; //导入依赖的package包/类
public void registerMetacheatEngine(MetaCheat engine) {
    cheatEngine = engine;

    cheatsTableView.setItems(cheatEngine.getCheats());
    searchResultsListView.setItems(cheatEngine.getSearchResults());
    snapshotsListView.setItems(cheatEngine.getSnapshots());
    searchTypeSigned.selectedProperty().bindBidirectional(cheatEngine.signedProperty());
    searchStartAddressField.textProperty().bindBidirectional(cheatEngine.startAddressProperty());
    searchEndAddressField.textProperty().bindBidirectional(cheatEngine.endAddressProperty());
    searchValueField.textProperty().bindBidirectional(cheatEngine.searchValueProperty());
    searchChangeByField.textProperty().bindBidirectional(cheatEngine.searchChangeByProperty());

    Application.invokeLater(this::redrawMemoryView);
}
 
开发者ID:badvision,项目名称:jace,代码行数:15,代码来源:MetacheatUI.java


示例20: addIndicator

import com.sun.glass.ui.Application; //导入依赖的package包/类
void addIndicator(Label icon, long TTL) {
    if (!iconTTL.containsKey(icon)) {
        Application.invokeLater(() -> {
            if (!notificationBox.getChildren().contains(icon)) {
                notificationBox.getChildren().add(icon);
            }
        });
    }
    trackTTL(icon, TTL);
}
 
开发者ID:badvision,项目名称:jace,代码行数:11,代码来源:JaceUIController.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Message类代码示例发布时间:2022-05-21
下一篇:
Java RoleChecker类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap