本文整理匯總了Java中javafx.embed.swing.JFXPanel類的典型用法代碼示例。如果您正苦於以下問題:Java JFXPanel類的具體用法?Java JFXPanel怎麽用?Java JFXPanel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JFXPanel類屬於javafx.embed.swing包,在下文中一共展示了JFXPanel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupJavaFX
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
protected void setupJavaFX() throws InterruptedException {
long timeMillis = System.currentTimeMillis();
final CountDownLatch latch = new CountDownLatch(1);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// initializes JavaFX environment
new JFXPanel();
latch.countDown();
}
});
System.out.println("javafx initialising...");
latch.await();
System.out.println("javafx is initialised in " + (System.currentTimeMillis() - timeMillis) + "ms");
}
示例2: loadFX
import javafx.embed.swing.JFXPanel; //導入依賴的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();
}
示例3: initializeContext
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
@BeforeClass
public static void initializeContext() throws Exception {
final JFXPanel p = new JFXPanel();
final URL u = DialogsTest.class.getResource("/org/netbeans/api/htmlui/empty.html");
Platform.runLater(new Runnable() {
@Override
public void run() {
WebView v = new WebView();
Scene s = new Scene(v);
p.setScene(s);
NbBrowsers.load(v, u, new Runnable() {
@Override
public void run() {
ctx = BrwsrCtx.findDefault(DialogsTest.class);
down.countDown();
}
}, null);
}
});
down.await();
JFrame f = new JFrame();
f.getContentPane().add(p);
f.pack();
f.setVisible(true);
}
示例4: showPopOver
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
/**
* Show popover UI
*
* @param hovered
*/
public void showPopOver(boolean hovered) {
Platform.runLater(new Runnable() {
@Override
public void run() {
JFXPanel fxPanel = getPopOverUI().getDropzonePopover().getJFXPanel();
Parent root = fxPanel.getScene().getRoot();
Point pos = Util.getPopOverPosition();
int x = pos.x;
int y = pos.y;
setArrowLocation(Util.getArrowLocation());
setAnchorLocation(Util.getAnchorLocation());
if (!isShowing()) {
show(root, x, y);
applyStyle();
show(root, x, y);
setContentNode(createPopoverContent(hovered));
}
}
});
}
示例5: FInfoDialogWeb
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
/**
* Creates new form FInfoDialogWeb
*/
public FInfoDialogWeb(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
javafxPanel = new JFXPanel();
javafxPanel.setOpaque(false);
javafxPanel.setBorder(new BevelBorder(0));
javafxPanel.setLayout(new GridLayout(1, 1));
final GridLayout gl = new GridLayout(1, 1);
panel.setLayout(gl);
panel.add(javafxPanel, BorderLayout.CENTER);
Platform.runLater(() -> {
bro = new Browser();
Scene scene = new Scene(bro, 750, 500, Color.web("#666970"));
//bro.load(WelcomeParams.getInstance().infoURL);
javafxPanel.setScene(scene);
});
if (WelcomeParams.getInstance().btnFont != null) {
btnBack.setFont(WelcomeParams.getInstance().btnFont);
btnClose.setFont(WelcomeParams.getInstance().btnFont);
btnForward.setFont(WelcomeParams.getInstance().btnFont);
btnHome.setFont(WelcomeParams.getInstance().btnFont);
}
}
示例6: WysiwygDlg
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
private WysiwygDlg(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
setDefaultCloseOperation(HIDE_ON_CLOSE);
try {
setIconImage(ImageIO
.read(FAdmin.class
.getResource("/ru/apertum/qsystem/client/forms/resources/admin.png")));
} catch (IOException ex) {
System.err.println(ex);
}
panel.removeAll();
javafxPanel = new JFXPanel();
Platform.runLater(() -> {
htmlEditor = new HTMLEditor();
Scene scene = new Scene(htmlEditor, 750, 500, Color.web("#666970"));
javafxPanel.setScene(scene);
});
final GridLayout gl = new GridLayout(1, 1);
panel.setLayout(gl);
panel.add(javafxPanel);
}
示例7: BrowserFX
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
public BrowserFX() {
javafxPanel = new JFXPanel();
GridLayout gl = new GridLayout(1, 1);
setLayout(gl);
add(javafxPanel, BorderLayout.CENTER);
try {
Thread.sleep(3000);
} catch (InterruptedException ex) {
}
Platform.runLater(() -> {
bro = new Browser();
bro.getWebEngine().setJavaScriptEnabled(true);
Scene scene = new Scene(bro, 750, 500, Color.web("#666970"));
javafxPanel.setScene(scene);
ready = true;
});
}
示例8: createWindow
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
public void createWindow(Project project) {
jFXPanel = new JFXPanel();
ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow("Basis.js", false, ToolWindowAnchor.BOTTOM, false);
toolWindow.setIcon(IconLoader.getIcon("/icons/basisjs.png"));
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(jFXPanel, "inspector", false);
toolWindow.getContentManager().addContent(content);
InspectorController sceneInspectorController = new InspectorController();
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/com/basisjs/ui/windows/tools/inspector/InspectorScene.fxml"));
fxmlLoader.setController(sceneInspectorController);
Platform.setImplicitExit(false);
PlatformImpl.runLater(() -> {
try {
Scene scene = new Scene(fxmlLoader.load());
jFXPanel.setScene(scene);
webView = sceneInspectorController.webView;
webView.setContextMenuEnabled(false);
} catch (IOException e) {
e.printStackTrace();
}
});
}
示例9: setUp
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
@Before
public void setUp() {
new JFXPanel();
sankey = new SankeyChart();
node1 = new SankeyNode("node1");
node2 = new SankeyNode("node2");
node3 = new SankeyNode("node3");
node4 = new SankeyNode("node4");
sankey.addNode(node1);
sankey.addNode(node2);
sankey.addNode(node3);
sankey.addNode(node4);
link1 = new SankeyLink(node1, node2, 2.);
link2 = new SankeyLink(node1, node3, 5.);
link3 = new SankeyLink(node3, node4, 1.);
link4 = new SankeyLink(node1, node4, 6.);
sankey.addLink(link1);
sankey.addLink(link2);
sankey.addLink(link3);
sankey.addLink(link4);
}
示例10: createAndShowGUI
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
private void createAndShowGUI() {
setDefaultLookAndFeelDecorated(true);
setTitle("Test Swing Frame");
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JPanel mainPanel = new JPanel();
mainPanel.setMinimumSize(new Dimension(600, 400));
mainPanel.setPreferredSize(mainPanel.getMinimumSize());
fxMainPanel = new JFXPanel();
mainPanel.add(fxMainPanel, "0,0");
Platform.setImplicitExit(false);
Platform.runLater(() -> {
createScene(fxMainPanel);
latch.countDown();
});
getContentPane().add(mainPanel);
pack();
setVisible(true);
}
示例11: createScene
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
private void createScene(JFXPanel fxMainPanel) {
redPane = new StackPane();
redPane.setPrefSize(100.0, 100.0);
redPane.setStyle("-fx-background-color: red");
ContextMenu contextMenu = new ContextMenu();
MenuItem menuItem = new MenuItem("Test Menu Item");
contextMenu.getItems().add(menuItem);
redPane.setOnContextMenuRequested(event -> {
contextMenu.show(redPane, event.getScreenX(), event.getScreenY());
event.consume();
});
contextMenu.showingProperty().addListener(this::onchange);
scene = new Scene(redPane);
fxMainPanel.setScene(scene);
robot.setAutoWaitForIdle(true);
}
示例12: setUp
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
@Before
public void setUp() {
scene = Root.ROOT.lookup().wrap();
parent = scene.as(Parent.class, Node.class);
contentPane = parent.lookup(new ByID<Node>(JFXPanelScrollApp.SCROLL_CONTAINER_ID)).wrap();
frame = new JFrameOperator(JFXPanelScrollApp.class.getSimpleName());
fxpane = new JComponentOperator(frame, new ComponentChooser() {
public boolean checkComponent(Component component) {
if (JFXPanel.class.isInstance(component)) {
return true;
}
return false;
}
public String getDescription() {
return "JFXPanel chooser";
}
});
}
示例13: setUpClass
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
@BeforeClass
public static void setUpClass() throws Exception {
System.setProperty("javafx.swinginteroperability", "true");
JFXPanelApp.main(null);
JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
frame = new JFrameOperator(JFXPanelApp.class.getSimpleName());
menuBtn = new JButtonOperator(frame, JFXPanelApp.MENU_POPUP_BTN);
alphaSlider = new JSliderOperator(frame);
fxpanel = new JComponentOperator(frame, new ComponentChooser() {
public boolean checkComponent(Component component) {
return JFXPanel.class.isInstance(component);
}
public String getDescription() {
return "JFXPanel chooser";
}
});
}
示例14: applyOnyxSkin
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
private void applyOnyxSkin() {
new JFXPanel(); // hack to initialize the FX toolkit
Skin onyxSkin = new Skin(
Client.class
.getResource("/skins/onyx/base.css")
.toExternalForm(),
Client.class
.getResource("/skins/onyx/settingsScreen.css")
.toExternalForm(),
Client.class
.getResource("/skins/onyx/frameTitleBar.css")
.toExternalForm(),
Client.class
.getResource("/skins/onyx/settingsTitleBar.css")
.toExternalForm()
);
SkinManager.applySkin(onyxSkin);
}
示例15: createPanel
import javafx.embed.swing.JFXPanel; //導入依賴的package包/類
/**
* Creates a panel that makes use of the global stylesheet.
* <p>
* {@link SkinManager#applySkin(Skin)}
* must have been called before calling this method.
*
* @return a new JFXPanel that uses the global stylesheet
*/
public static JFXPanel createPanel() {
synchronized (SYNC_OBJECT) {
if (currentSkin == null) {
throw new IllegalStateException("A skin must be set before creating a panel");
}
}
JFXPanel panel = new JFXPanel();
runAndWait(panel, () -> {
synchronized (SYNC_OBJECT) {
Scene scene = new Scene(new BorderPane());
scene.getStylesheets()
.addAll("https://fonts.googleapis.com/css?family=Overpass:300,400,600,700,800,900");
panel.setScene(scene);
panels.add(panel);
}
});
return panel;
}