Olá Pessoas!
Eu tava fazendo um trabalho de faculdade que abre vários JInternalFrame ai me surgiu a seguinte dúvida: [i]“COMO FAZER COM QUE AS TELAS ABERTAS SEJAM EXIBIDAS EM UM MENU (janela por exemplo) E AO CLICAR NESTE ITEM DE MENU ELE SE TORNE ATIVO?”[/i]
Nâo sei se existe algum componente que faça isso mas eu tentei fazer na mão e não obtive muito sucesso e ficou da seguinte forma:
jDesktopPane1.addContainerListener(new ContainerListener() {
public void componentAdded(ContainerEvent arg0) {
JMenuItem menuItem = new JMenuItem(
((JInternalFrame) jDesktopPane1.getComponent(jDesktopPane1.getComponentCount() - 1)).getTitle());
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
jDesktopPane1.getDesktopManager().activateFrame((JInternalFrame) jDesktopPane1.getComponent(jDesktopPane1.getComponentCount() - 1));
jDesktopPane1.setFocusable(true);
}});
jJanelas.add(menuItem);
}
public void componentRemoved(ContainerEvent arg0) {
}
public void limpaclasse(JInternalFrame frame) {
frame = null;
}
});
Alguem já fez algo parecido ?
