當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。