を作成し、コードJFrame
内にを作成し、ウィンドウ上にを作成しました。オンに背景画像が挿入されます。JFrame
JWindow
JPanel
JPanel
JButton btnImage= new JButton("My Button");
Image splashImg = Toolkit.getDefaultToolkit().getImage("images/image1.jpeg");
JPanel pnlSplashWindow= new JPanel(){
public void paint(Graphics g){
g.drawImage(splashImg,0,0,splashImg.getWidth(this),splashImg.getHeight(this),this);
}
};
pnlSplashWindow.setLayout(new BorderLayout());
pnlSplashWindow.add(BorderLayout.SOUTH,btnImage);
JWindo window= new JWindow(this); // this refers to my class which has extended JFrame
window.setContentPane(pnlSplashWindow);
window.setSize(688, 344);
btnImg.setVisible(true);
window.setLocationRelativeTo(this);
私は初めてでJWindow
、次の質問があります。
- ボタンやラベルなどの要素を
JWindow
(またはJPanel
にあるJWindow
)に追加するにはどうすればよいですか? - 私
JFrame
をこの親として設定するにはどうすればよいJWindow
ですか?JWindow
つまり、アクティブな間はJFrame
クリックできないようにする必要があります。