簡體   English   中英

如何使用javaSwing在正確的組件上顯示我的jframe?

[英]how can I display my jframe on right component using javaSwing?

private void PersonalInfoJButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                    

    JPanel createUserJPanel =new CreateUserJPanel(user);
    JSplitPane.setRightComponent(createUserJPanel);

}

它向我顯示了諸如non-static method cannot be reffered to static component類的錯誤non-static method cannot be reffered to static component

如何在正確的組件上顯示我的jframe?

由於setRightComponent()不是static方法,因此要創建一個instance以使用該method

喜歡

final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setRightComponent(createUserJPanel);

您需要創建一個JSplitPane的實例:

JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setRightComponent(createUserJPanel);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM