Zaedy, o problema que eu tive em usar 1 frame e só alterar os painéis foi
que eu não consegui mudar o background quando mudava de painel, ja com
vários frames eu consigo colocar o background que eu quiser em cada um
essa é a classe que uso para pintar num painel uma imagem de fundo:
public class Background extends JPanel{
private static final long serialVersionUID = 1L;
Image imagem;
public Background(String img) {
this.imagem = new ImageIcon(getClass().getResource(img)).getImage();
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Dimension dDesktop = this.getSize();
double width = dDesktop.getWidth();
double height = dDesktop.getHeight();
Image background = new ImageIcon(this.imagem.getScaledInstance(
(int) width, (int) height, 1)).getImage();
g.drawImage(background, 0, 0, this);
}
}
tem algum jeito melhor para fazer o background, para que eu possa usar só 1
frame como voce recomendou?
--
Fernando Carvalhosa Neves
Graduando em Ciências da Computação
Universidade Federal do Rio de Janeiro
--
You received this message because you are subscribed to the Google Groups "Comp
2 - Geral" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/comp2-geral?hl=en.