0

I have a JScrollPane that seats inside of a JTabbedPane and I want to set it to invisible when a non admin user is using the program.

I have tried to use the method setVisible(false) but it doesn't work. If I use the same method such as JTabbedPane.setVisible(false), it will hide the JTabbedPane but I don't want to hide the entire JTabbedPane I only need to hide few panels in it.

Any ideas on how to get this done?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Bob
  • 564
  • 2
  • 10
  • 25

1 Answers1

1

Use a CardLayout as shown in this answer. One card would be the blank panel, the other the scroll-pane.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • This is already part of a CardLayout. The jTabbedPane seats on the first card and it contains many jScrollPanes. Why can I not simply hide the jScrollPanes that I don't want to display? – Bob Feb 08 '15 at 09:58
  • 1
    *"This is already part of a CardLayout."* For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example). *"Why can I not simply.."* I'll answer further questions as soon as I see that MCVE. – Andrew Thompson Feb 08 '15 at 09:59