Boa noite Pessoal, estor com uma dificuldade tremenda para colocar uma imagem em um formulário,
alguem pode me ajudar. segue abaixo o código fonte do formulário.
Já importei a classe, criei e instanciei, estou usando imageIcon.
segue código
import javax.swing.;
import java.awt.;
import javax.swing.ImageIcon;
import java.awt.event.*;
public class formulario extends JFrame implements ActionListener
{
// Criar
JLabel lb_titulo;
JLabel lb_igreja;
JLabel lb_rua;
JLabel lb_cid;
JLabel lb_cep;
JLabel lb_fone;
JLabel lb_foto;
JLabel lb_traço;
ImageIcon imagem_logo;
JButton jb_balancete;
JButton jb_cartao;
JButton jb_lista;
JButton jb_recomendaçao;
JButton jb_casamento;
JButton jb_oficio;
JButton jb_convite;
JButton jb_ficha;
public formulario () //metodo construtor
{
setTitle ("Igreja Evangelica Assembleia de Deus - TRACUNHAEM - PE");
setSize(800,570);
setLocation(75,75);
getContentPane().setBackground(new Color(0,140,205));
//INSTANCIAR
// Label
imagem_logo = new ImageIcon("C:/Users/Jose Antonio/Pictures/assembleia.jpg");
lb_titulo = new JLabel ("ARQUIVOS DA SECRETARIA");
lb_igreja = new JLabel ("IGREJA EVANGÉLICA ASSEMBLEIA DE DEUS");
lb_rua = new JLabel ("RUA SETE DE SETEMBRO, 31");
lb_cid = new JLabel ("CENTRO - TRACUNHAÉM - PE");
lb_cep = new JLabel ("CEP: 55805-000");
lb_fone = new JLabel ("FONE: 3646-1695");
lb_foto = new JLabel ("imagem_logo");
lb_traço = new JLabel ("_________________________________________________________________________________________________________");
//Button
jb_balancete = new JButton ("BALANCETE MENSAL");
jb_cartao = new JButton ("CARTÃO DE MEMBRO");
jb_lista = new JButton ("LISTA DE CULTO");
jb_recomendaçao = new JButton ("CARTA RECOMENDAÇÃO");
jb_casamento = new JButton ("TERMO DE CASAMENTO");
jb_oficio = new JButton ("EMISSÃO DE OFÍCIO");
jb_convite = new JButton ("EMISSÃO DE CONVITE");
jb_ficha = new JButton ("FICHA DE MEMBRO");
//redefinindo cores
lb_titulo.setForeground(Color.ORANGE);
lb_igreja.setForeground(Color.BLACK);
lb_rua.setForeground(Color.BLACK);
lb_cid.setForeground(Color.BLACK);
lb_cep.setForeground(Color.BLACK);
lb_fone.setForeground(Color.BLACK);
lb_traço.setForeground(Color.RED);
// manipulando fontes
lb_titulo.setFont(new Font("Arial",Font.BOLD,30));
lb_igreja.setFont(new Font("Arial",Font.BOLD,18));
lb_rua.setFont(new Font("Arial",Font.BOLD,16));
lb_cid.setFont(new Font("Arial",Font.BOLD,14));
lb_cep.setFont(new Font("Arial",Font.BOLD,12));
lb_fone.setFont(new Font("Arial",Font.BOLD,10));
//INSERIR
getContentPane().add(lb_titulo);
getContentPane().add(lb_igreja);
getContentPane().add(lb_rua);
getContentPane().add(lb_cid);
getContentPane().add(lb_cep);
getContentPane().add(lb_fone);
getContentPane().add(lb_foto);
getContentPane().add(lb_traço);
getContentPane().add(jb_balancete);
getContentPane().add(jb_cartao);
getContentPane().add(jb_lista);
getContentPane().add(jb_recomendaçao);
getContentPane().add(jb_casamento);
getContentPane().add(jb_oficio);
getContentPane().add(jb_convite);
getContentPane().add(jb_ficha);
//posicionamento
// lebal
getContentPane().setLayout(null);
lb_titulo.setBounds(200,110,500,40);
lb_igreja.setBounds(205,10,500,40);
lb_rua.setBounds(295,25,400,40);
lb_cid.setBounds(305,40,400,40);
lb_cep.setBounds(360,55,400,40);
lb_fone.setBounds(360,70,400,40);
lb_foto.setBounds(390,100,700,700);
lb_traço.setBounds(20,140,800,20);
//Button
jb_balancete.setBounds (20,200,200,25);
jb_cartao.setBounds (20,240,200,25);
jb_lista.setBounds (20,280,200,25);
jb_recomendaçao.setBounds (20,320,200,25);
jb_casamento.setBounds (20,360,200,25);
jb_oficio.setBounds (20,400,200,25);
jb_convite.setBounds (20,440,200,25);
jb_ficha.setBounds (20,480,200,25);
// registro dos objetos que sofrerão açao
jb_balancete.addActionListener(this);
jb_cartao.addActionListener(this);
jb_lista.addActionListener(this);
jb_recomendaçao.addActionListener(this);
jb_casamento.addActionListener(this);
jb_oficio.addActionListener(this);
jb_convite.addActionListener(this);
jb_ficha.addActionListener(this);
}
public static void main (String args[])
{
JFrame form_java = new formulario();
form_java.setVisible(true);
}
public void actionPerformed(ActionEvent e )
{
if (e.getSource()==jb_balancete)
JOptionPane.showMessageDialog(null," BALANCETE MENSAL ");
if (e.getSource()==jb_cartao)
JOptionPane.showMessageDialog(null," CARTÃO DE MEMBRO ");
if (e.getSource()==jb_lista)
JOptionPane.showMessageDialog(null," LISTA DE CULTO ");
if (e.getSource()==jb_recomendaçao)
JOptionPane.showMessageDialog(null,"CARTA DE RECOMENDAÇÃO");
if (e.getSource()==jb_casamento)
JOptionPane.showMessageDialog(null,"TERMO DE CASAMENTO");
if (e.getSource()==jb_oficio)
JOptionPane.showMessageDialog(null,"MODELO DE OFFICIO ");
if (e.getSource()==jb_convite)
JOptionPane.showMessageDialog(null,"CONVITE ");
if (e.getSource()==jb_ficha)
JOptionPane.showMessageDialog(null,"FICHA CADASTRAL ");
}
}
ajude-me por favor, mostrando-me onde errei que não consigo exibir a imagem na tela.
só aparece no local onde era para ficar a imagem a seguinte mensagem “imagem_icon”.