2016-09-19 8 views
-1

私は私のJInternalFrameの中心に私のJFileChooserの場所を設定したい:センター画面JFileChooserの

JFileChooser fileChooser = new JFileChooser(); 
fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); 
fileChooser.setLocation(); 

答えて

0

あなたはすべてのコンポーネントで、あなたのJFileChooserを埋め込むことができます。

// Your JInternal Frame 
JInternalFrame inFrame = new JInternalFrame("", true, true, true, true); 

// Your JFileChooser 
JFileChooser fileChooser = new JFileChooser(); 
fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); 

// put filechooser in internal frame 
inFrame.add(fileChooser); 
+0

コメントありがとうございましたが、これはfileChooser.showOpenDialog(ヌル)より効果的です。 – MACP

0
fileChooser.showOpenDialog(null); 
+0

詳細を編集してください。コード専用と「試してください」の回答は、検索可能なコンテンツが含まれていないため、推奨されません。なぜ誰かが「これを試してみる」べき理由を説明しません。 – abarisone

関連する問題