This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Scrolling within a JTabbedPane

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
I have an application that is, at the moment, a GUI frame with a JToolBar at the top and, below it, a JTabbedPane with a JScrollPane inside it. The JScrollPane has a JPanel which contains various text areas (more than can fit on the screen). My problem is, that when I scroll downwards, the content of the panel moves upwards, as expected, but it covers the tabbedPane and the toolBar as well!! How do I prevent this from happening?? Also, I�m using
this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
to operate in "full screen" mode, but the bottom of the GUI is covered by the Windows start bar thingy that goes along the bottom of the screen.
Here�s some code...
JToolBar toolbar = new JToolBar();
//add buttons to toolBar..
JTabbedPane tabbedPane = new JTabbedPane();
JScrollPane sp = new JScrollPane();
//myPanel is an instance of a class that extends JPanel
sp.getViewport().add( myPanel );
tabbedPane.addTab( nameOfTab, sp );
this.getContentPane().add(toolbar, BorderLayout.NORTH);
this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
I�ve got lots of other stuff going on, adding buttons and listeners, but this is the part that applies to the tab. I�ll post more detail if necesary.
Thanks very much to all who can help!
Malc.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not having a problem with the panel scrolling over the top components... make sure you are really using a JPanel and not an AWT Panel... this will happen if you just use an AWT Panel.
 
malcolm bailey
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nate,
Unfortunately, I�m really using JPanel. I�m going to check through the code again, see what I can find...
 
malcolm bailey
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.. still not working... I have no idea why. My subclass of JPanel has BoxLayout as it�s layout, I don�t know if this helps. Is there anything I should specify, or not specify in terms of layout, size... anything??
 
Do not threaten THIS beaver! Not even with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!