Skip to main content

JTabbedPane - What controls layout

3 replies [Last post]
basilbourque
Offline
Joined: 2003-06-16
Points: 0

I add a JPanel to each tab of a JTabbedPane. When the window is resized, the JPanel's contents resize to the center. I see no mention of the tabs having a layout manager.

What controls the layout of a tab's contents?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Scott Violet

On Mon, Jan 26, 2004 at 12:43:22AM -0500, swing-feedback@javadesktop.org wrote:
> I add a JPanel to each tab of a JTabbedPane. When the window is resized, the JPanel's contents resize to the center. I see no mention of the tabs having a layout manager.
>
> What controls the layout of a tab's contents?

Basil,

JTabbedPane, or more correctly it's TabbedPaneUI, provides a
LayoutManager that is responsible for the layout duties.

-Scott

basilbourque
Offline
Joined: 2003-06-16
Points: 0

Not exactly, at least not like other containers such as JPanel.

---| Compare JPanel to JTabbedPane |--------
====
System.out.println( "JPanel's layout mgr:" );
System.out.println( new javax.swing.JPanel().getLayout() );

System.out.println( "TabbedPane's layout mgr:" );
System.out.println( new javax.swing.JTabbedPane().getLayout() );
====
...results:

===
JPanel's layout mgr:
java.awt.FlowLayout[hgap=5,vgap=5,align=center]

JTabbedPane's layout mgr:
apple.laf.AquaTabbedPaneUI$ScrollingTabbedPaneLayout@2f48d2
===

Perhaps this is just an Apple Mac OS X. But I could not find any mention of controlling or tweaking of a JTabbedPane's layout in the Java docs, or Swing books.

--Basil

Message was edited by: basilbourque

Scott Violet

Basil,

I am not familiar with Apples look and feel, it is entirely possible
that they are not using a LayoutManager.

-Scott

On Fri, Jan 30, 2004 at 07:27:34PM -0500, swing-feedback@javadesktop.org wrote:
> Not exactly, at least not like other containers such as JPanel.
>
> ---| Compare JPanel to JTabbedPane |--------
> ====
> System.out.println( "JPanel's layout mgr:" );
> System.out.println( new javax.swing.JPanel().getLayout() );
>
> System.out.println( "TabbedPane's layout mgr:" );
> System.out.println( new javax.swing.JTabbedPane().getLayout() );
> ====
> ...results:
>
> System.out.println("JPanel's layout mgr:");
> System.out.println( new javax.swing.JPanel().getLayout() );
>
> System.out.println("JTabbedPane's layout mgr:");
> System.out.println( new javax.swing.JTabbedPane().getLayout() );
>
> Perhaps this is just an Apple Mac OS X. But I could not find any mention of controlling or tweaking of a JTabbedPane's layout in the Java docs, or Swing books.
>
> --Basil
> ---
> [Message sent by forum member 'basilbourque' (Basil Bourque)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageID=6393&#6393