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


Java JFXPanel.setPreferredSize方法代码示例

本文整理汇总了Java中javafx.embed.swing.JFXPanel.setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JFXPanel.setPreferredSize方法的具体用法?Java JFXPanel.setPreferredSize怎么用?Java JFXPanel.setPreferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.embed.swing.JFXPanel的用法示例。


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

示例1: initGui

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
/**
 * Initializes the interface
 */
private void initGui() {
    JFXPanel jfxPanel = new JFXPanel();
    jfxPanel.setPreferredSize(new Dimension(800, 600));
    Platform.runLater(() -> {
        webView = new WebView();
        webView.getEngine().setUserStyleSheetLocation(MarkdownViewer.class.getResource("MarkdownViewer.css").toExternalForm());
        Scene scene = new Scene(webView);
        jfxPanel.setScene(scene);
    });
    setLayout(new BorderLayout());
    add(jfxPanel);
}
 
开发者ID:VISNode,项目名称:VISNode,代码行数:16,代码来源:MarkdownViewer.java

示例2: GameArena

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
/**
    * Constructor. Creates an instance of the GameArena class, and displays a window on the
    * screen upon which shapes can be drawn.
    *
    * @param width The width of the window, in pixels.
    * @param height The height of the window, in pixels.
    * @param createWindow Determines if a JFrame containing the GameArena should be created (true) or not (false).
 */
public GameArena(int width, int height, boolean createWindow)
{   
       this.arenaWidth = width;
       this.arenaHeight = height;
       this.objectCount = 0;
       this.initialised = false;

       // Create a lock to reduce flicker on rendering
       renderLock = new ReentrantLock();

       // Create a JavaFX canvas as a Swing panel.
       jfxPanel = new JFXPanel();
       jfxPanel.setPreferredSize(new java.awt.Dimension(width, height));

       // Create a window, if necessary.
       if (createWindow)
       {
           window = new JFrame();
           window.setTitle("Let's Play!");
           window.setContentPane(jfxPanel);
           window.setResizable(false);
           window.pack();
           window.setVisible(true);
           window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       }

       root = new Group();
       scene = new Scene(root, arenaWidth, arenaHeight, Color.BLACK);

       renderLock.lock();

       Platform.runLater(new Runnable() {
           @Override
           public void run() {
               initFX();
           }
       });
}
 
开发者ID:finneyj,项目名称:Racer,代码行数:47,代码来源:GameArena.java

示例3: initSwingDialog

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
void initSwingDialog() {
	LOG.trace("initSwingDialog()");
	setTitle(title);
	setMinimumSize(new Dimension(600, 300));
	addWindowListener(new java.awt.event.WindowAdapter() {
		@Override
		public void windowClosing(java.awt.event.WindowEvent evt) {
			closeDialog(true);
		}
	});
	JFXPanel fxContainer = createJavaFXUI();
	fxContainer.setPreferredSize(new Dimension(width, height));
	add(fxContainer, BorderLayout.CENTER);
	pack();
}
 
开发者ID:nasa,项目名称:OpenVSP3Plugin,代码行数:16,代码来源:SwingDialog.java

示例4: GameArena

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
/**
    * Constructor. Creates an instance of the GameArena class, and displays a window on the
    * screen upon which shapes can be drawn.
    *
    * @param width The width of the window, in pixels.
    * @param height The height of the window, in pixels.
    * @param createWindow Determines if a JFrame containing the GameArena should be created (true) or not (false).
 */
public GameArena(int width, int height, boolean createWindow)
{   
       this.arenaWidth = width;
       this.arenaHeight = height;
       this.objectCount = 0;

       // Create a lock to reduce flicker on rendering
       renderLock = new ReentrantLock();

       // Create a JavaFX canvas as a Swing panel.
       jfxPanel = new JFXPanel();
       jfxPanel.setPreferredSize(new java.awt.Dimension(width, height));

       // Create a window, if necessary.
       if (createWindow)
       {
           window = new JFrame();
           window.setTitle("Let's Play!");
           window.setContentPane(jfxPanel);
           window.setResizable(false);
           window.pack();
           window.setVisible(true);
           window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       }

       root = new Group();
       scene = new Scene(root, arenaWidth, arenaHeight, Color.BLACK);

       renderLock.lock();

       Platform.runLater(new Runnable() {
           @Override
           public void run() {
               initFX();
           }
       });
}
 
开发者ID:finneyj,项目名称:GameArena,代码行数:46,代码来源:GameArena.java

示例5: GameArena

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
/**
    * Constructor. Creates an instance of the GameArena class, and displays a window on the
    * screen upon which shapes can be drawn.
    *
    * @param width The width of the window, in pixels.
    * @param height The height of the window, in pixels.
 */
public GameArena(int width, int height)
{   
       this.arenaWidth = width;
       this.arenaHeight = height;
       this.objectCount = 0;

       // Create a window
       window = new JFrame();
       window.setTitle("Let's Play!");

       // Create a JavaFX canvas as a Swing panel.
       jfxPanel = new JFXPanel();
       jfxPanel.setPreferredSize(new java.awt.Dimension(width, height));

       window.setContentPane(jfxPanel);
       window.setResizable(false);
       window.pack();
       window.setVisible(true);
       window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       root = new Group();
       scene = new Scene(root, arenaWidth, arenaHeight, Color.BLACK);

       Platform.runLater(new Runnable() {
           @Override
           public void run() {
               initFX();
           }
       });
}
 
开发者ID:finneyj,项目名称:GameArena,代码行数:38,代码来源:GameArena.java

示例6: GameArena

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
/**
    * Constructor. Creates an instance of the GameArena class, and displays a window on the
    * screen upon which shapes can be drawn.
    *
    * @param width The width of the window, in pixels.
    * @param height The height of the window, in pixels.
 */
public GameArena(int width, int height)
{   
       this.arenaWidth = width;
       this.arenaHeight = height;
       this.objectCount = 0;

       // Create a lock to reduce flicker on rendering
       renderLock = new ReentrantLock();

       // Create a window
       window = new JFrame();
       window.setTitle("Let's Play!");

       // Create a JavaFX canvas as a Swing panel.
       jfxPanel = new JFXPanel();
       jfxPanel.setPreferredSize(new java.awt.Dimension(width, height));

       window.setContentPane(jfxPanel);
       window.setResizable(false);
       window.pack();
       window.setVisible(true);
       window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       root = new Group();
       scene = new Scene(root, arenaWidth, arenaHeight, Color.BLACK);

       renderLock.lock();

       Platform.runLater(new Runnable() {
           @Override
           public void run() {
               initFX();
           }
       });
}
 
开发者ID:finneyj,项目名称:GameArena,代码行数:43,代码来源:GameArena.java

示例7: init

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
@Override
public void init() {
    fxContainer = new JFXPanel();
    fxContainer.setPreferredSize(new Dimension(JFXPANEL_WIDTH_INT, JFXPANEL_HEIGHT_INT));
    add(fxContainer, BorderLayout.CENTER);
    // create JavaFX scene
    Platform.runLater(new Runnable() {
        
        @Override
        public void run() {
            createScene();
        }
    });
}
 
开发者ID:LouisJenkinsCS,项目名称:Code-Glosser,代码行数:15,代码来源:main.java

示例8: init

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
@Override
public void init() {
    fxContainer = new JFXPanel();
    fxContainer.setPreferredSize(new Dimension(JFXPANEL_WIDTH_INT, JFXPANEL_HEIGHT_INT));
    add(fxContainer, BorderLayout.CENTER);
    // create JavaFX scene
    Platform.runLater(new Runnable() {

        @Override
        public void run() {
            tabScene();
        }
    });
}
 
开发者ID:Buddhilive,项目名称:Buddhilive-JavaFX-Browser,代码行数:15,代码来源:BuddhiBrowser2.java

示例9: init

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
public void init() {
    tableModel = new SampleTableModel();
    // create javafx panel for charts
    chartFxPanel = new JFXPanel();
    chartFxPanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, PANEL_HEIGHT_INT));

    // create javafx panel for browser
    browserFxPanel = new JFXPanel();

    //create tabbed pane
    JTabbedPane tabbedPane = new JTabbedPane();
    
    //JTable
    JTable table = new JTable(tableModel);
    table.setAutoCreateRowSorter(true);
    table.setGridColor(Color.DARK_GRAY);
    SwingInterop.DecimalFormatRenderer renderer = new SwingInterop.DecimalFormatRenderer();
    renderer.setHorizontalAlignment(JLabel.RIGHT);
    for (int i = 0; i < table.getColumnCount(); i++) {
        table.getColumnModel().getColumn(i).setCellRenderer(renderer);
    }
    JScrollPane tablePanel = new JScrollPane(table);
    tablePanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, TABLE_PANEL_HEIGHT_INT));

    JPanel chartTablePanel = new JPanel();
    chartTablePanel.setLayout(new BorderLayout());

    //Split pane that holds both chart and table
    JSplitPane jsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    jsplitPane.setTopComponent(chartTablePanel);
    jsplitPane.setBottomComponent(tablePanel);
    jsplitPane.setDividerLocation(410);
    chartTablePanel.add(chartFxPanel, BorderLayout.CENTER);

    tabbedPane.addTab("JavaFX Chart and Swing JTable", jsplitPane);
    tabbedPane.addTab("Web Browser", browserFxPanel);

    add(tabbedPane, BorderLayout.CENTER);
    
    // create JavaFX scene
    Platform.runLater(new Runnable() {
        public void run() {
            createScene();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:SwingInterop.java

示例10: init

import javafx.embed.swing.JFXPanel; //导入方法依赖的package包/类
public void init() {
    tableModel = new SampleTableModel();
    // create javafx panel for charts
    chartFxPanel = new JFXPanel();
    chartFxPanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, PANEL_HEIGHT_INT));

    // create javafx panel for browser
    browserFxPanel = new JFXPanel();

    //create tabbed pane
    JTabbedPane tabbedPane = new JTabbedPane();
    
    //JTable
    JTable table = new JTable(tableModel);
    table.setAutoCreateRowSorter(true);
    table.setGridColor(Color.DARK_GRAY);
    DecimalFormatRenderer renderer = new DecimalFormatRenderer();
    renderer.setHorizontalAlignment(JLabel.RIGHT);
    for (int i = 0; i < table.getColumnCount(); i++) {
        table.getColumnModel().getColumn(i).setCellRenderer(renderer);
    }
    JScrollPane tablePanel = new JScrollPane(table);
    tablePanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, TABLE_PANEL_HEIGHT_INT));

    JPanel chartTablePanel = new JPanel();
    chartTablePanel.setLayout(new BorderLayout());

    //Split pane that holds both chart and table
    JSplitPane jsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    jsplitPane.setTopComponent(chartTablePanel);
    jsplitPane.setBottomComponent(tablePanel);
    jsplitPane.setDividerLocation(410);
    chartTablePanel.add(chartFxPanel, BorderLayout.CENTER);

    tabbedPane.addTab("JavaFX Chart and Swing JTable", jsplitPane);
    tabbedPane.addTab("Web Browser", browserFxPanel);

    add(tabbedPane, BorderLayout.CENTER);
    
    // create JavaFX scene
    Platform.runLater(new Runnable() {
        public void run() {
            createScene();
        }
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:47,代码来源:SwingInterop.java


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