Adcionando imagem com WindowsBuilder [RESOLVIDO]

1 resposta
C

no meu codigo de fonte, gostaria de adcionar uma imagem qualquer no meu frame... estou meio perdido

package melzometro_gui;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.IOException;

public class GUIMelzometro2_02 extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					GUIMelzometro2_02 frame = new GUIMelzometro2_02();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public GUIMelzometro2_02() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBackground(Color.WHITE);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblMelzometro = new JLabel("Melzometro 2.02");
		lblMelzometro.setBounds(10, 5, 184, 29);
		lblMelzometro.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 24));
		contentPane.add(lblMelzometro);
		
		JButton btnCadastroDeAtaques = new JButton("Cadastro de Ataques");
		btnCadastroDeAtaques.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//Chamando Regas do Animal
				System.out.println("Chamando Regras do animal");
				RegrasDoAnimal acao = new RegrasDoAnimal();
				try {
					acao.CriarArquivo();
				} catch (IOException e1) {
					
					e1.printStackTrace();
				}
			}
		});
		btnCadastroDeAtaques.setBounds(10, 45, 184, 23);
		contentPane.add(btnCadastroDeAtaques);
	}
}

1 Resposta

C
Criado 2 de agosto de 2011
Ultima resposta 2 de ago. de 2011
Respostas 1
Participantes 1