I'm using Netbeans gui to create a simple app.
This is my structure (the layout is free design ):
Basically I have 3 tabs and want to hide one of them (the select one in the image) based on a condition. Something like if the user as some privileges show that tab, otherwise don't show that tab.
On my code I've tried;
if (userRole == 1){
pnlAdiconarSala.setVisible(false);
}
but this tab is always showing.
With my implementation, can I hide the tab?
To create a tabbed pane, instantiate JTabbedPane , create the components you wish it to display, and then add the components to the tabbed pane using the addTab method.
A JTabbedPane contains a tab that can have a tool tip and a mnemonic, and it can display both text and an image. The shape of a tab and the way in which the selected tab is displayed varies by Look and Feel.
Here is an clean example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With