Hide tab - Java

2

I have a program with several tabs, so I will test if the user is ADMIN, based on this I would like to hide / disable some tabs, I already tested these commands and they do not disable the window:

private void SetAbasVisiveis( Usuario usuario){
   if(!usuario.getAdmin()){
        this.pnlMedicamentos.setVisible(false);
        this.pnlMedicamentos.setEnabled(false);
        this.pnlMedicamentos.setFocusable(false)
   }
}

Follow elements

    
asked by anonymous 04.04.2015 / 18:57

1 answer

2

I was able to solve my problem using the following command:

Just say the tab index, 0 a N (number of project tabs) and if you want it enabled = true , or disabled = false

    private void setPermissoes(Usuario usuario){
        if(!usuario.getAdmin()){            
            this.TabbedPane.setEnabledAt(3, false);
            this.TabbedPane.setEnabledAt(2, false);
            this.TabbedPane.setEnabledAt(1, false);
        }
    }
    
07.04.2015 / 14:56