[英]JtextPane doesn't show in JscrollPane
我有一個想要添加到JscrollPane的文本窗格。 但是我看不到文本窗格。 怎么了
crimepanel.setBounds(new Rectangle(660, 250, 295, 35));
scroll.setBounds(new Rectangle(655, 240, 305, 55));
scroll.add(crimepanel);
this.getContentPane().add(scroll, null);
this.getContentPane().add(crimepanel, null);
我知道了! 正確的代碼是:
scroll.getViewport().add(crimepanel, null);
this.getContentPane().add(scroll, null);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.