jInternalFrame maximizado

2 respostas
nagpaulo

Quero fazer um metodo que deixe sempre maximizado a jInternalFrame em uma jDesktoPane. Alguem pode ajudar?
segue o metodo que esta funcionando mas sem esta maximizado.

public class JIFGenerico extends javax.swing.JInternalFrame {   
         
    public JIFGenerico(){   
        this.setClosable(true);   
        this.setMaximizable(true);   
    }   
     
    protected void centralizar() {   
        //Centraliza o JInternalFrame no Desktop   
        Dimension paneSize = this.getSize();   
        Dimension screenSize = this.getToolkit().getScreenSize();   
        this.setLocation((screenSize.width - paneSize.width) / 2,   
                (screenSize.height - paneSize.height) / 2);   
    }   
       
    public void centralizar(JComponent c) {   
        //Centraliza o JInternalFrame no Desktop   
        Dimension paneSize = this.getSize();   
        Dimension screenSize = c.getSize();   
        this.setLocation((screenSize.width - paneSize.width) / 2,   
                (screenSize.height - paneSize.height) / 2);   
    }       
       
    public void limpar() {   
        limpar(getContentPane());   
    }   
       
    public void limpar(Container comp) {   
        Component[] cs = comp.getComponents();   
        for(Component c : cs) {   
            if( c instanceof JTextComponent ) {   
                JTextComponent txc = (JTextComponent)c;   
                txc.setText("");   
            } else if( c instanceof Container ) {   
                limpar((Container)c);   
            }   
        }   
    }

2 Respostas

JavaFXMan

coloca no construtor da classe:

setMaximum(true);
nagpaulo

da um erro e pede para eu colocar try-catch ai eu coloquei assim.

try { this.setMaximum(true); } catch (PropertyVetoException ex) { Logger.getLogger(JIFGenerico.class.getName()).log(Level.SEVERE, null, ex); }

e ainda nao ficou maximizado…
To usando a IDE Netbeans.

Criado 5 de agosto de 2010
Ultima resposta 5 de ago. de 2010
Respostas 2
Participantes 2