別の JPanel を非モーダル JDialog としてウィンドウに表示します。右上のメニューボタンが欲しくない場合は、装飾なしにすることができます。
私はあなたが何を意味するのか分かりません:
(つまり、違いは見えないようにする必要があり、ユーザーは空のスペースをクリックしてアプリケーションの背面に移動できます)。
それにかんする
また、別のウィンドウであるため、出力ボックスを選択可能にしたくありません。
ダイアログにフォーカス可能なコンポーネントがないことを確認するか、フォーカス可能な場合は focusable プロパティを false に設定してください。
編集
ダイアログ ウィンドウがフォーカスされないようにするには、次の行を追加します。
dialog.setFocusableWindowState(false);
例えば:
import java.awt.Dimension;
import javax.swing.*;
public class DialogNoFocus {
public DialogNoFocus() {
// TODO Auto-generated constructor stub
}
private static void createAndShowGui() {
DialogNoFocus mainPanel = new DialogNoFocus();
JFrame frame = new JFrame("JFrame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(Box.createRigidArea(new Dimension(400, 300)));
frame.pack();
frame.setLocationByPlatform(true);
frame.setVisible(true);
JDialog dialog = new JDialog(frame, "JDialog", false);
dialog.getContentPane().add(Box.createRigidArea(new Dimension(500, 100)));
int x = frame.getLocation().x;
int y = frame.getLocation().y + frame.getHeight();
dialog.setLocation(x, y);
dialog.pack();
dialog.setFocusableWindowState(false);
dialog.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGui();
}
});
}
}