import javax.swing.*;
import java.awt.*;
import java.net.URL;
import static java.lang.Math.abs;
public class Main {
public static void main(String[] args) {
myFrame x=new myFrame(50,50,600,600,Color.WHITE,"登录");
}
}
class myFrame extends JFrame {
myFrame (int x,int y,int w,int h,Color color,String s)
{
setTitle(s);
setBounds(x,y,w,h);
setBackground(color);
setVisible(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JLabel label =new JLabel("Imageicon");
label.setIcon(new ImageIcon(ImageIcon.class.getResource("RC.jpg")));
getContentPane().add(label);
}
}
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/732820022486126.png?x-oss-process=image/auto-orient,1/resize,w_320,m_lfit)
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/266500122486124.png?x-oss-process=image/auto-orient,1/resize,w_320,m_lfit)