Questions tagged [jtabbedpane]

A Java Swing component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon.

A Java Swing component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon.

JTabbedPane may have tabs header along any of the four edges. Each tab header consists of the name and optional icon. Clicking on the tab header brings the associated tab to the top. The tab itself can any any single component (most often it is JPanel). Tab components are added to the tabbed pane like keys to the map:

tabbedPane.addTab("My tab", myComponent);

Duplicate tabs headers are possible but usually not used as they may be confusing. JTabbedPane also has methods to remove tabs and replace the tab header texts or icons.

For examples and information on using tabbed panes see How to Use Tabbed Panes.

824 questions
3
votes
1 answer

How to call an Action from a different class in Java

How would I call an Action from another class in Java? I got a CloseTabButton class online that allows a simple close tab button on each JTabbedPane, but when the tab is closed, I would like a dialog to pop up based on information (if file is not…
Vince
  • 2,596
  • 11
  • 43
  • 76
3
votes
3 answers

MouseEvents for a JTabbedPane Tab component are not bleeding through

I have a JTabbedPane with a custom tab component. That component contains a JLabel (To display the tab title) and a JButton (A close button). When I change the text in the JLabel the JLabel stops receiving mouse events and I can no longer select…
Sandro
  • 2,219
  • 4
  • 27
  • 41
3
votes
3 answers

JTabbedPane - set default border around tabs..?

I am using a JTabbedPane in my application. I have added two tabs which are instances of a custom class "ContentPanel". This extends JPanel and sets the background, border etc etc. Basically it means I dont have to set the properties of each JPanel…
ClarkeyBoy
  • 4,934
  • 12
  • 49
  • 64
3
votes
1 answer

Set JLabel in Tab of JTabbedPane (JAVA)

I am trying to put a JLabel in tab of JTabbedPane but it isn't showing... here is the code that i am using: ... public class FormulariosTabbedPane extends JTabbedPane implements IEventoListener { ... @Override public void…
kid_goth
  • 89
  • 12
3
votes
1 answer

How do we resize the JTabbedPane Buttons?

I am using a JTabbedPane with three buttons. The program is running fine except that the buttons remains small even if you resize the window. Is there a way of setPrefferedSize for them? Here is the code public final class JTabbedPaneDemo { …
CN1002
  • 1,115
  • 3
  • 20
  • 40
3
votes
5 answers

JTabbedPane: tab placement set to LEFT but icons are not aligned

I have a JTabbedPane with tab placement set to LEFT. The problem is that icons in each tab are not vertically aligned with one another. Consider this picture: As you can see the icon of "Editar Protocolo" (second tab) is not perfectly aligned with…
user2582318
  • 1,607
  • 5
  • 29
  • 47
3
votes
6 answers

Set the Background Color for JTabbedPane

I am using Nimbus Look and feel. I needs to change the Background color and foreground color of the tab in JTabbedPane but the color doesn't set in JTabbedPane. I tried setForeground(), setForegroundAt(), setBackground() and setBackgroundAt()…
Ram
  • 254
  • 1
  • 7
  • 20
3
votes
3 answers

Problem resizing JScrollPane and JTabbedPane

I have a problem with resizing some of my components in my java application. When I resize my main JFrame they keep their previous size instead of filling out the surrounding component. For example I have in my program a JTabbedPane within a tab of…
Snail
  • 467
  • 2
  • 7
  • 20
3
votes
1 answer

Java JTabbedPane align Title text to center

I am creating my own custom JTabbedPane object, with a simple little class that extends JTabbedPane. I have gotten a fair amount of this done, but recently found a problem, that being that the Title text for a tab does not auto align to the center…
tanishalfelven
  • 1,186
  • 2
  • 10
  • 21
3
votes
1 answer

How to Add a scroll bar to a JTabbedPane. Basically i have an admin panel which is attached further on a frame as a TAB(JTabbedPane)

//here admin is a panel located on a frame as 2nd TAB on which i want to add a Scroll bar. import java.awt.Color; import java.awt.Image; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollBar; import…
puprog
  • 55
  • 2
  • 10
3
votes
3 answers

How do you add Background Image in JPanel (NetBeans GUI Builder)

I have JTabbedPane with five tabs and each have Jpanel i want add different images for each panel in NetBeans IDE
Sanshayan
  • 39
  • 1
  • 1
  • 10
3
votes
1 answer

Get JTable from selected tab at JTabbedPane

I have JTabbedPane with many generated dynamically JPanels, that contains JTable. How can i get/set JTable from the selected JTabbedPane tab? Already tried to use JTabbedPane.getComponents(), but it doesn't contain any JTable components.
crzbt
  • 183
  • 4
  • 14
3
votes
1 answer

JTabbedPane why is there extra padding only when I have multiple tabs? (code and picture)

I have a JTabbed pane, which has a varying number of tabs. When the number of tabs is greater than 4, I get extra spacing/padding at the bottom of each tab panel. The picture below shows this (on the left you see the extra spacing, on the right…
Smitty
  • 403
  • 2
  • 11
3
votes
0 answers

How to dispose a tabbed pane component completely from a JTabbedPane

I have added a few tabs to a JTabbedPane. Each tab contains a JPanel. I now remove the tab by calling JTabbedPane.remove([tab index]). This removes the tab and everything is fine, except that when I profile the app, the JPanel added to the…
sethu
  • 8,181
  • 7
  • 39
  • 65
3
votes
2 answers

How to handle the height of the tab title in JTabbedPane

I am preparing a window with some horizontal tabs using JTabbedPane, Tabs And window are prepared properly. Now I need to setup these tabs in level basis, based on my requirement (My logic returns integer value based on that I need to setup levels…
Giri
  • 507
  • 6
  • 23