Java: jpprogressbar (or equivalent) is in the jtabbedpane tab header

If I really want to do this, I can place a jpprogressbar (or equivalent) in the jtabbedpane tab (I mean, not in the tag itself,

How can I do such a thing?

Edit I really want to put the progress bar in the title of the tag, not the tag itself

This is some ASCII Art:

----------------------------------------------------
|  Tab 1  || Tab   2||Tab-with-progress-bar||Tab  4|
-----------         --------------------------------
'                                                  '
'                                                  '
'                                                  '
'                                                  '
'                                                  '
'                                                  '
'                                                  '
'                                                  '
----------------------------------------------------

So it's true that "label 2" is currently visible, but I want the progress bar (or equivalent) to be visible in the title of the third tab

Edit 2

This must work on Java 1.5: this must work on countless MacOS 10.4 and MacOS 10.5 Macs that will never be equipped with Java 6 (some do, some won't: never, this is not my call)

Solution

Include jpprogressbar in JPanel and add the JPanel to jtabbedpane

Edit: from jtabbedpane Javadoc:

tabbedPane.addTab(null,myComponent); 
tabbedPane.setTabComponentAt(0,new JLabel("Tab"));

So you can simply replace the new jlabel ("tab") by referencing your jpprogressbar (although this jpprogressbar cannot be added to the tab itself) However, I don't think this method existed before Java 1.6

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>