标签:
package loginclient; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.Color; public class loginclient extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { loginclient frame = new loginclient(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public loginclient() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBackground(new Color(0, 206, 209)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel = new JPanel() { @Override protected void paintComponent(Graphics g) { ImageIcon icon = new ImageIcon("src//1.PNG"); Image img = icon.getImage(); g.drawImage(img, 0, 0, icon.getIconWidth(), icon.getIconHeight(), icon.getImageObserver()); } }; //panel.setBounds(100, 100, 450, 300); panel.setBounds(41, 51, 58, 20); contentPane.add(panel); //this.add(panel, BorderLayout.CENTER); //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //this.setVisible(true); } }
标签:
原文地址:http://blog.csdn.net/u013076044/article/details/44945003