當前位置: 首頁>>代碼示例>>Java>>正文


Java Platform類代碼示例

本文整理匯總了Java中javafx.application.Platform的典型用法代碼示例。如果您正苦於以下問題:Java Platform類的具體用法?Java Platform怎麽用?Java Platform使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Platform類屬於javafx.application包,在下文中一共展示了Platform類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getWebtoon

import javafx.application.Platform; //導入依賴的package包/類
/**
 * 웹툰조회
 */
public void getWebtoon(String code) {

	if (!"".equals(code)) {
		CommonService cs = new CommonService();

		Connection conn = cs.getConnection(code);
		conn.timeout(5000);

		Document doc = null;
		
		codeInputField.setText(code);
		wDesc.setWrapText(true);

		try {

			doc = conn.get();

			String title = doc.select("title").text().split("::")[0];
			setTitle(title);

			String author = doc.select("div.detail h2 > span").text();
			wTitle.setText(title + "(" + author + ")");

			String desc = doc.select("div.detail p").text();
			wDesc.setText(desc);

			String img = doc.select("div.thumb > a img").attr("src");
			thumbnail.setImage(new Image(img, true));

		} catch (Exception e) {
			e.printStackTrace();
		}
	} else {
		Platform.runLater(new Runnable() {
			@Override
			public void run() {
				AlertSupport alert = new AlertSupport("웹툰코드를 입력하세요.");
				alert.alertInfoMsg(stage);
			}
		});
	}
}
 
開發者ID:kimyearho,項目名稱:WebtoonDownloadManager,代碼行數:46,代碼來源:ManualController.java

示例2: loadFX

import javafx.application.Platform; //導入依賴的package包/類
@Test public void loadFX() throws Exception {
    final CountDownLatch cdl = new CountDownLatch(1);
    final CountDownLatch done = new CountDownLatch(1);
    final JFXPanel p = new JFXPanel();
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            Node wv = TestPages.getFX(10, cdl);
            Scene s = new Scene(new Group(wv));
            p.setScene(s);
            done.countDown();
        }
    });
    done.await();
    JFrame f = new JFrame();
    f.getContentPane().add(p);
    f.pack();
    f.setVisible(true);
    cdl.await();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:ComponentsTest.java

示例3: handleInput

import javafx.application.Platform; //導入依賴的package包/類
@Override public void handleInput(GroupInputInfo info) {
    try {
        File file = info.getFile();
        if (file == null) {
            return;
        }
        Group group = Group.createGroup(type, file.toPath(), info.getName());
        if (group == null) {
            return;
        }
        fileUpdated(file);
        navigatorPanel.updated(DisplayWindow.this, new FileResource(file.getParentFile()));
        suitesPanel.updated(DisplayWindow.this, new FileResource(file));
        featuresPanel.updated(DisplayWindow.this, new FileResource(file));
        storiesPanel.updated(DisplayWindow.this, new FileResource(file));
        issuesPanel.updated(DisplayWindow.this, new FileResource(file));
        Platform.runLater(() -> openFile(file));
    } catch (Exception e) {
        e.printStackTrace();
        FXUIUtils.showConfirmDialog(DisplayWindow.this,
                "Could not complete creation of " + type.fileType().toLowerCase() + " file.",
                "Error in creating a " + type.fileType().toLowerCase() + " file", AlertType.ERROR);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:25,代碼來源:DisplayWindow.java

示例4: performSetup

import javafx.application.Platform; //導入依賴的package包/類
@Override
protected void performSetup() {
    setTitle();
    // TODO: Better loading.
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            devicesLoadingLabel.setVisible(true);
            diskListView.setCellFactory(lv -> {
                TextFieldListCell<Disk> cell = new TextFieldListCell<>();
                cell.setConverter(workflowController.getStringConverterForDisks());
                return cell;
            });
            ObservableList<Disk> disks = FXCollections.observableArrayList();
            disks.addAll(workflowController.getAvailableDisks());
            devicesLoadingLabel.setVisible(false);
            diskListView.setItems(disks);
        }});
}
 
開發者ID:ciphertechsolutions,項目名稱:IO,代碼行數:20,代碼來源:SelectDeviceController.java

示例5: getText

import javafx.application.Platform; //導入依賴的package包/類
@Test public void getText() {
    ChoiceBox<?> choiceBox = (ChoiceBox<?>) getPrimaryStage().getScene().getRoot().lookup(".choice-box");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    Platform.runLater(() -> {
        RFXChoiceBox rfxChoiceBox = new RFXChoiceBox(choiceBox, null, null, lr);
        choiceBox.getSelectionModel().select(1);
        rfxChoiceBox.focusLost(null);
        text.add(rfxChoiceBox._getText());
    });
    new Wait("Waiting for choice box text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("Cat", text.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:RFXChoiceBoxTest.java

示例6: initStatusBar

import javafx.application.Platform; //導入依賴的package包/類
/**
 * Initialize the status bar
 */
private void initStatusBar() {
    statusPanel.getFixtureLabel().setOnMouseClicked((e) -> {
        onSelectFixture();
    });
    statusPanel.getRowLabel().setOnMouseClicked((e) -> {
        gotoLine();
    });
    statusPanel.getInsertLabel().setOnMouseClicked((e) -> {
        Platform.runLater(() -> {
            if (currentEditor != null) {
                currentEditor.toggleInsertMode();
            }
        });
    });
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:DisplayWindow.java

示例7: onViewCreated

import javafx.application.Platform; //導入依賴的package包/類
@Override
protected void onViewCreated() {
    siderBarView.setOnItemSelectedListener(contentView::loadBucket);
    contentView.setOnItemSelectedListener(this::updateSelectItem);
    contentView.setUpdateListener(bucketFile -> {
        if (Platform.isFxApplicationThread()) {
            updateSelectItem(bucketFile);
        } else {
            runOnUiThread(() -> this.updateSelectItem(bucketFile));
        }
    });

    // 初始化菜單
    Menu setting = new Menu("設置");
    setting.getItems().add(getMenuItem("TinyPNG", "tinypng"));
    setting.getItems().add(getMenuItem("七牛", "qiniu"));
    setting.getItems().add(getMenuItem("Gif", "gif"));

    Menu about = new Menu("關於");
    about.getItems().add(getMenuItem("關於BlogHelper", "aboutBlogHelper"));
    about.getItems().add(getMenuItem("關於作者cmlanche", "aboutAnchor"));

    menuBar.getMenus().add(setting);
    menuBar.getMenus().add(about);

    if (PlatformUtil.isMac()) {
        menuBar.setUseSystemMenuBar(true);
    }

    // 操作按鈕
    downloadBtn.setOnAction(event -> contentView.handleAction("download"));
    renameBtn.setOnAction(event -> contentView.handleAction("rename"));
    deleteBtn.setOnAction(event -> contentView.handleAction("delete"));
    optimizeBtn.setOnAction(event -> contentView.handleAction("optimize"));
    uploadBtn.setOnAction(event -> contentView.handleAction("upload"));
}
 
開發者ID:cmlanche,項目名稱:javafx-qiniu-tinypng-client,代碼行數:37,代碼來源:MainView.java

示例8: spellcheckDocument

import javafx.application.Platform; //導入依賴的package包/類
public boolean spellcheckDocument() {
    editorToolBar.setActionText("Spell checking document \'" + file.getName() + "\'");
    Platform.runLater(() -> {
        try {
            timer.start();
            List<RuleMatch> matches = spellcheck.check(getContent());
            MarkdownHighligher.computeSpellcheckHighlighting(matches, this);
            editorToolBar.setActionText("Found " + matches.size() + " misspellings in the document \'" + file.getName() + "\' (" + timer.end() + "ms)");
        } catch (IOException e) {
            dialogFactory.buildExceptionDialogBox(
                    dict.DIALOG_EXCEPTION_TITLE,
                    dict.DIALOG_EXCEPTION_SPELLCHECK_CONTENT,
                    e.getMessage(),
                    e
            );
        }
    });

    return true;
}
 
開發者ID:jdesive,項目名稱:textmd,代碼行數:21,代碼來源:EditorPane.java

示例9: select

import javafx.application.Platform; //導入依賴的package包/類
@Test public void select() {
    TreeView<?> treeView = (TreeView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(new Runnable() {
        @Override public void run() {
            Point2D point = getPoint(treeView, 1);
            RFXTreeView rfxListView = new RFXTreeView(treeView, null, point, lr);
            rfxListView.focusGained(rfxListView);
            CheckBoxTreeItem<?> treeItem = (CheckBoxTreeItem<?>) treeView.getTreeItem(1);
            treeItem.setSelected(true);
            rfxListView.focusLost(rfxListView);
        }
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Child Node 1:checked", recording.getParameters()[0]);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:RFXTreeViewCheckBoxTreeCellTest.java

示例10: initialize

import javafx.application.Platform; //導入依賴的package包/類
public void initialize() {
    MenuBar menuBar = new MenuBar();
    // Make same width as the stage
    menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
    rootPane.setTop(menuBar);

    // File menu - new, save, exit
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = createMenuItem("New", actionEvent -> this.onNewFile());

    MenuItem openMenuItem = createMenuItem("Open", actionEvent -> this.onOpenFile());

    MenuItem saveMenuItem = createMenuItem("Save", actionEvent -> this.onSaveFile());
    saveMenuItem.disableProperty().bind(jwkSetData.changedProperty().not());

    MenuItem exitMenuItem = createMenuItem("Exit", actionEvent -> Platform.exit());

    fileMenu.getItems().addAll(newMenuItem, openMenuItem, saveMenuItem,
            new SeparatorMenuItem(), exitMenuItem);

    menuBar.getMenus().addAll(fileMenu);
}
 
開發者ID:atbashEE,項目名稱:atbash-octopus,代碼行數:23,代碼來源:ApplicationMenu.java

示例11: testNormalStart

import javafx.application.Platform; //導入依賴的package包/類
@Test
public void testNormalStart() throws Exception {
    Platform.runLater(() -> {
        Ember ember = new Ember();
        Stage stage = new Stage();
        try {
            ember.start(stage);
        } catch (Exception ex) {
            fail("An exception is thrown.");
            Logger.getLogger(
                    EmberTest.class.getName()).
                    log(Level.SEVERE, null, ex);
        }
    });

}
 
開發者ID:Soheibooo,項目名稱:EMBER,代碼行數:17,代碼來源:EmberTest.java

示例12: startGUI

import javafx.application.Platform; //導入依賴的package包/類
public void startGUI(Pane pane) {
    Platform.runLater(new Runnable() {
        @Override public void run() {
            primaryStage.hide();
            primaryStage.setScene(new Scene(pane));
            primaryStage.sizeToScene();
            primaryStage.show();
        }
    });
    new Wait("Waiting for applicationHelper to be initialized") {
        @Override public boolean until() {
            try {
                return primaryStage.getScene().getRoot() == pane;
            } catch (Throwable t) {
                return false;
            }
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:JavaFXElementTest.java

示例13: startAutoSync

import javafx.application.Platform; //導入依賴的package包/類
@FXML
    public void startAutoSync() {
        DataSync.getMainStage().setOnCloseRequest(closeEvent -> this.syncController.kill());
        this.syncController.execute((count) -> {
            Platform.runLater(() -> {
                Date date = new Date();
                TOALogger.log(Level.INFO, "Executing update #" + count + " at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(date));
                TOALogger.log(Level.INFO, "There are " + Thread.activeCount() + " threads.");
                this.matchesController.syncMatches();
                this.matchesController.checkMatchSchedule();
                this.matchesController.checkMatchDetails();
//                this.rankingsController.syncRankings();
                // We're going to try THIS instead....
                this.rankingsController.getRankingsByFile();
                this.rankingsController.postRankings();
                if (this.btnSyncMatches.selectedProperty().get()) {
                     this.matchesController.postCompletedMatches();
                }
            });
        });
    }
 
開發者ID:orange-alliance,項目名稱:TOA-DataSync,代碼行數:22,代碼來源:DataSyncController.java

示例14: duplicateMenuPath

import javafx.application.Platform; //導入依賴的package包/類
@Test public void duplicateMenuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");

        MenuItem clear = new MenuItem("Clear");
        MenuItem clear1 = new MenuItem("Clear");
        MenuItem clear2 = new MenuItem("Clear");

        MenuItem exit = new MenuItem("Exit");

        menuFile.getItems().addAll(add, clear, clear1, clear2, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear2));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>Clear(2)", path.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:24,代碼來源:RFXMenuItemTest.java

示例15: startMe

import javafx.application.Platform; //導入依賴的package包/類
/**
 * Called by a thread created when
 */
public static void startMe()
{
    if (primaryStage == null)
    {
        try
        {
            Platform.setImplicitExit(false);
            Bootstrap.launch();
        }
        catch (Exception exception)
        {
            FlexFXBundle.setStartupException(exception);
        }
    }
    else
    {
        FlexFXBundle.setStage(primaryStage, IS_FX_THREAD_RESTART);
    }
}
 
開發者ID:jtkb,項目名稱:flexfx,代碼行數:23,代碼來源:Bootstrap.java


注:本文中的javafx.application.Platform類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。