Janelas JInternalFrame

0 respostas
L

Estou começando a aprendendo Java, mas já tenho conhecimento em Linguagem Delphi. Eu montei um Menu Principal e dentro dele eu abro as janelas com o JInternalFrame. Como ainda não sei fazer copiei este exemplo abaixo de outro site e gostaria que alguem me ajudasse. QUERO QUE ELE ABRA SOMENTE UMA VEZ A TELA DO JINTERNALFRAME (MyInternalFrame).
Se alguem tiver outro exemplo ou solução melhor agradeceria a ajuda.

//Chama a criação do Menu JInternalFrame:

protected void createFrame()
     { 
             MyInternalFrame frame = new MyInternalFrame();
             frame.setVisible(true); //necessary as of kestrel
             desktop.add(frame);
             try
             {
                     frame.setSelected(true);
             }
             catch (java.beans.PropertyVetoException e)
             {
             }
      }

//Cria o JInternalFrame:

import javax.swing.<em>;

import java.awt.event.</em>;

import java.awt.<em>;

import <a href="http://java.io">java.io</a>.</em>;
public class MyInternalFrame extends JInternalFrame {

static int openFrameCount = 0;

static final int xOffset = 30, yOffset = 30;
public MyInternalFrame() 
 { 
     super(" Cidades #" + (++openFrameCount),
           true, //resizable
           true, //closable
           true, //maximizable
           true);//iconifiable
           
Container tela = getContentPane();
setLayout(null);
           
     //...Create the GUI and put it in the window...

     //...Then set the window size or call pack...
     setSize(200,300);

     //Set the window's location.
     setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
    
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);         

 }

}

Att.
Luciano Parron

Criado 28 de junho de 2007
Respostas 0
Participantes 1