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


Java JFXPanel.setSize方法代碼示例

本文整理匯總了Java中javafx.embed.swing.JFXPanel.setSize方法的典型用法代碼示例。如果您正苦於以下問題:Java JFXPanel.setSize方法的具體用法?Java JFXPanel.setSize怎麽用?Java JFXPanel.setSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.embed.swing.JFXPanel的用法示例。


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

示例1: createTabs

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
private static void createTabs(){
        rootPanel = new JPanel();
//        canvasPanel.setSize(640, 480);
//        canvasPanel.add(canvas);
//        frame.setSize(640, 480);

        
        frame.getContentPane().add(rootPanel);
        OverlayLayout layout = new OverlayLayout(rootPanel);
//        BorderLayout layout = new BorderLayout(1, 1);
        
        JFXPanel jfxPanel = new JFXPanel();
        jfxPanel.setBounds(0, 0, 100, 100);
        jfxPanel.setSize(100, 100);
        
        rootPanel.setLayout(layout);
//        rootPanel.add(jfxPanel);
        rootPanel.add(new JButton("fsfdsfj;dsj;fjds;jfasf;afja;fd"));
        rootPanel.add(canvas);
        
        Platform.runLater(() -> {
            Button btn = new Button("Hello JFX!");
            StackPane root = new StackPane();
            root.setBackground(Background.EMPTY);
            root.getChildren().add(btn);
//            root.setStyle("-fx-background-color: transparent;");
//            root.setStyle("-fx-background-color:#0000FF;");
            
            Scene scene = new Scene(root);
            scene.setFill(Color.TRANSPARENT);
            
            Stage stage = new Stage();
            stage.initStyle(StageStyle.TRANSPARENT);
            stage.setScene(scene);
            stage.show();
        });
    }
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:38,代碼來源:TestSwing.java

示例2: initAndShowGUI

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
public String initAndShowGUI(final String url, final SyncState state ) {

        log.info("Displaying OAuth Login frame...");

        final JFrame frame = new JFrame("Authenticate Picasa");
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        frame.getContentPane().setLayout(null); // do the layout manually

        final JFXPanel fxPanel = new JFXPanel();

        frame.add(fxPanel);
        frame.setVisible(true);

        fxPanel.setSize(frameSize);
        fxPanel.setLocation(0,0);

        frame.getContentPane().setPreferredSize(frameSize);

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation(screenSize.width / 2 - fxPanel.getSize().width / 2, screenSize.height / 2 - fxPanel.getSize().height / 2);

        frame.pack();
        frame.setResizable(false);

        String authToken = "";

        try {
            Platform.runLater(new Runnable() {
                public void run() {
                    log.info( "Initialising login frame on background thread.");
                    synchronized ( lock ){
                        initWebView(fxPanel, frame, url, state );
                    }
                }
            });

            synchronized ( lock ) {
                lock.wait();

                log.info( "User closed window.");

                authToken = token;
            }
        }
        catch( Exception ex ){
            log.error("Unexpected exception opening interactive login screen.");
        }

        return authToken;
    }
 
開發者ID:Webreaper,項目名稱:GooglePhotoSync,代碼行數:52,代碼來源:OAuthGUI.java

示例3: initGUI

import javafx.embed.swing.JFXPanel; //導入方法依賴的package包/類
void initGUI() {
    initHeaderAndLink();
    
    card = new JFrame();
    card.setPreferredSize(new Dimension(WConstants.wordcard_width, WConstants.wordcard_height));
    card.setMinimumSize(new Dimension(WConstants.wordcard_min_width, WConstants.wordcard_min_height));
    
    final JFXPanel fxPanel = new JFXPanel();
    
    VBox root_vbox = new VBox();
    root_vbox.setSpacing(10);
    root_vbox.setPadding(new Insets(1,  0,    10,    5));

    
    ScrollPane sp = new ScrollPane();
    sp.setVmax(WConstants.wordcard_height*2);
    sp.setPrefSize(WConstants.wordcard_width, WConstants.wordcard_height);

    sp.setContent(root_vbox);
    sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    sp.setFitToWidth(true);
    //sp.setFitToHeight(true);
    
    
    Scene scene = new Scene(sp, WConstants.wordcard_width, WConstants.wordcard_height);
    fxPanel.setScene(scene);
    
    HBox root2_hbox = new HBox();
    root2_hbox.setSpacing(12);
    //                          top right bottom left
    root2_hbox.setPadding(new Insets(1,  0,    10,    5));
    
    lang_VBox = new VBox();
    lang_VBox.setSpacing(20);
    
    root2_hbox.getChildren().addAll(headerText);
    root2_hbox.getChildren().addAll(link_to_wikt);

    
    root_vbox.getChildren().addAll(root2_hbox);
    root_vbox.getChildren().addAll(lang_VBox);
    //root_vbox.getChildren().addAll(sp);
    
    fxPanel.setSize(WConstants.wordcard_height, WConstants.wordcard_width);
    card.add(fxPanel);
    card.setVisible(true);
}
 
開發者ID:componavt,項目名稱:wikokit,代碼行數:49,代碼來源:WC.java


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