Chamando um metodo

pessoal criei esse metodo para abrir uma pequena tela quando pressionar o botao F a tela abre tudo ok mas nao aparece o meu jlabel pq?

    public void botaoF()
    {
        JFrame telaF = new JFrame();
        Container tela = this.getContentPane();
        labelf1 = new JLabel("Cliente");
        labelf1.setBounds(30,10,50,20);
        labelf1.setFont(new Font("Serif", Font.BOLD, 14));
        labelf1.setForeground(new Color(255,255,0));
        tela.add(labelf1);
        telaF.setSize(250, 250);
        telaF.setVisible(true);
        telaF.setResizable(false);
        telaF.setLocationRelativeTo(null);
    }

tenta adcionar isso

telaF.pack();

no final… e move o setVisible pra ser o ultimo comando… logodepois de pack();

veja como ficou

    public void botaoF()
    {
        JFrame telaF = new JFrame();
        Container tela = this.getContentPane();
        labelf1 = new JLabel("Cliente");
        labelf1.setBounds(30,10,50,20);
        labelf1.setFont(new Font("Serif", Font.BOLD, 14));
        labelf1.setForeground(new Color(255,255,0));
        tela.add(labelf1);
        telaF.setPreferredSize(new Dimension(500, 500));
        telaF.setResizable(false);
        
        telaF.pack();
        telaF.setLocationRelativeTo(null);
        telaF.setVisible(true);
    }  

com esse telaF.pack o painel n aparece so apareec a barra de titulo e nada em baixo ;/

mudei para isso e a tela volto abrir do jeito que eu queria porem os label nao aparece

    public void botaoF()
    {
        JFrame telaF = new JFrame();
        Container tela = this.getContentPane();
        labelf1 = new JLabel("Cliente");
        labelf1.setBounds(30,10,50,20);
        labelf1.setFont(new Font("Serif", Font.BOLD, 14));
        labelf1.setForeground(new Color(255,255,0));
        tela.add(labelf1);
        telaF.setPreferredSize(new Dimension(500, 500));
        telaF.setResizable(false);
        
        telaF.pack();
        telaF.setLocationRelativeTo(null);
        telaF.setVisible(true);
    }

é que vc precisa adcionar 1 painel ao ContentPanel() … algo assim

[code]public void botaoF()
{
JFrame telaF = new JFrame();
labelf1 = new JLabel(“Cliente”);
labelf1.setBounds(30,10,50,20);
labelf1.setFont(new Font(“Serif”, Font.BOLD, 14));
labelf1.setForeground(new Color(255,255,0));
JPanel panelQueFaltava = new JPanel();
panelQueFaltava.add(labelf1);
this.getContentPane().add(panelQueFaltava);
telaF.setPreferredSize(new Dimension(500, 500));
telaF.setResizable(false);

telaF.pack();  
telaF.setLocationRelativeTo(null);  
telaF.setVisible(true);  

} [/code]

fis exatamente o que vc me falo e chamei o metodo e nada nao aparee a jlabel :l eestranho…

a solução perfeita é… baixa o Jigloo

http://www.cloudgarden.com/jigloo/

se vc usa eclipse… Help->Software Updates->Find and Install

vai la em add site… e poem http://cloudgarden1.com/update-site

e instala ^^ be happy ^^

Na linha 4 você colocou:
Container tela = this.getContentPane();

altere para:
Container tela = telaF.getContentPane();

E ser for usar o setBounds() não se esqueça de setar o Layout para null:
telaF.setLayout(null);

no meu caso uso o netbeans ! :L

Faltou uma coisinha só:

    public void botaoF()
    {
        JFrame telaF = new JFrame();
        Container tela = this.getContentPane(); // o gerenciador de leiaute padrão aqui é o BorderLayout!!!
        labelf1 = new JLabel("Cliente");
        labelf1.setBounds(30,10,50,20);
        labelf1.setFont(new Font("Serif", Font.BOLD, 14));
        labelf1.setForeground(new Color(255,255,0));
        tela.add(labelf1, BorderLayout.CENTER); // logo, faltou isso!!!
        telaF.setSize(250, 250);
        telaF.setVisible(true);
        telaF.setResizable(false);
        telaF.setLocationRelativeTo(null);
    }