package com.aa;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
public class LoginFrame extends JFrame{
BufferedImage img = null;
JButton bt;
public LoginFrame(){
Dimension dimen = Toolkit.getDefaultToolkit().getScreenSize();
int w = (int)(dimen.getWidth());
int h = (int)(dimen.getHeight());
System.out.println("w="+w);
System.out.println("h="+h);
setUndecorated(true);
setSize(w,h);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout(null);
JLayeredPane layeredPane = new JLayeredPane();
layeredPane.setBounds(0, 0, w, h);
layeredPane.setLayout(null);
try{
img = ImageIO.read(new File("C:\\file\\aa.jpg"));
}catch(IOException e){
e.printStackTrace();
}
MyPanel panel = new MyPanel();
panel.setBounds(0, 0, w, h);
bt = new JButton(new ImageIcon("C:\\file\\bb.png"));
bt.setBounds(880, 1015, 104, 48);
bt.setBorderPainted(false);
bt.setFocusPainted(false);
bt.setContentAreaFilled(false);
layeredPane.add(bt);
layeredPane.add(panel);
add(layeredPane);
setVisible(true);
}
public static void main(String[] args){
new LoginFrame();
}
class MyPanel extends JPanel{
public void paint(Graphics g){
g.drawImage(img, 0, 0, null);
}
}
}