を作成し、コードJFrame内にを作成し、ウィンドウ上にを作成しました。オンに背景画像が挿入されます。JFrameJWindowJPanelJPanel
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クリックできないようにする必要があります。
望ましい最終効果の例
