总结:
总之遵循一条,所有的组件都不是直接放入frame里的。还要label的重要性,panel。面板类

虽然我还是不会做,但总算出了个图片出来~~~~~~~~~~~~~
package com.kk;
import javax.swing.ImageIcon;
import javax.swing.*;
import java.awt.FlowLayout;
import javax.swing.JPanel;
import java.awt.BorderLayout;
public class yc {
public yc() {
}
public static void main(String[] args) {
JFrame frame = new JFrame("背景图片设置");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// 妈的。想哭啊。我不知道为什么我ll
ImageIcon ico = new ImageIcon("d:\21.jpg");
JLabel label = new JLabel(ico);// 把背景图片放在标签里
// JPanel im=new JPanel(ico);//将图片放入panel里有错吗?
frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE));// 将背景图片加入到frame里的layeredpane面板里
label.setBounds(0, 0, ico.getIconWidth(), ico.getIconHeight());// 设置背景标签的位置
JButton b = new JButton("赞");
JButton b2 = new JButton("喜欢");
// frame.add(label,BorderLayout.SOUTH);
frame.add(label);
frame.add(b2);
frame.add(b);
frame.setLayout(new FlowLayout());
// frame.setLayout(new BorderLayout());
frame.setBounds(0, 0, 444, 444);
frame.setVisible(true);
}
}