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
5
votes
1 answer

How to open fourth tab as first tab in JTabbedPane in netbeans

I have a tabbed pane including five tabs on it . This tabbed pane is on a JPanel I use a button on another JPanel to get fourth tab as leading tab . But when I click on the button first tab is still display and I have to move to the fourth one…
Terance Wijesuriya
  • 1,928
  • 9
  • 31
  • 61
5
votes
3 answers

JTabbedPane: Change Title from within Tab

I'm trying now for a couple of hours to optimize my user interface but I'm not getting any further right now. I got a JTabbedPane to show datasets. There is one textfield in there with should also represent the tabs title. Right now there is a…
datmw
  • 53
  • 1
  • 5
5
votes
2 answers

Remove huge gaps between check boxes on panel

Its pretty basic UI, but I cannot setup the JCheckBox buttons so that they are placed immediately after one another (vertically) without any spacing. How would I reduce the spacing seen below? JPanel debugDrawPanel = new JPanel(new…
bobbyrne01
  • 6,295
  • 19
  • 80
  • 150
5
votes
7 answers

Set cursor for jTabbedPane's tab in java

I have created a custom jTabbedPane class which extends BasicTabbedPaneUI and have successfully created my desired jTabbedPane but now the problem is that how can I set Hand cursor for each tab in my custom jTabbedPane? I tried to set cursor with…
Airy
  • 5,484
  • 7
  • 53
  • 78
5
votes
3 answers

How to make JTabbedPane autoresize to fit page dimensions?

I have only JTabbedPane inside JFrame. JTabbedPane sets its dimensions to biggest page width/height. As pages has different size is it possible to force JTabbedPane to change its dimensions when selecting other page? http://grab.by/3hIg Top one is…
teamon
  • 331
  • 1
  • 5
  • 14
5
votes
5 answers

change active tab color in JTabbedPane

How can I change the color of tab when is selected ? and its border ? in this case its Arbitros tab which is blue, how can i change this ? I'm using JTabbedPane inside JFrame I found this but its not working…
user3363537
  • 111
  • 1
  • 1
  • 8
5
votes
3 answers

How do I remove the blue border highlight that appears when selecting a tab in a JTabbedPane?

This is sort of a continuation of my previous question, but it addresses a specific concern that could be useful to someone else so I thought I would post it as a individual question. I have successfully created a JTabbedPane but there is an blue…
Kent Shikama
  • 3,910
  • 3
  • 22
  • 55
5
votes
2 answers

Aligning icon to the left in JTabbedPane in Nimbus Look and Feel

I was creating an application with JTabbedPane using Nimbus look and feel I have used this code to place tabs: pane.addTab("Welcome",new ImageIcon("resources\\1.png"),mainPanel,"Takes to the welcome page"); I want the icon to appear on the left and…
Gagan93
  • 1,826
  • 2
  • 25
  • 38
5
votes
1 answer

DragTabFrame closing inconsistently

The code below is supposed to work a little like the Multi-Document Interface (MDI) you might see in a browser like FF, IE or Chrome. It presents 'documents' (a black buffered image as spacer) in a tabbed pane such that they can be dragged from…
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
5
votes
2 answers

JTabbedPane: Actions performed before displaying selected tab

When one of the panels present in a JTabbedPane is clicked, I need to perform a few actions at the start. Say, for example, I need to check the username and password. Only if those match, the particular panel operations need to be performed. Can you…
Raji
4
votes
3 answers

Vertical orientation of JTabbedPane titles when the tab placement is set to LEFT

As you can see from the image below, the Java text is horizontal. What I would like to do is get a vertical orientation of the JTabbedPane Titles. While googling, I found that the only way is to add extra library. But I was wondering if this can be…
Adel Boutros
  • 10,205
  • 7
  • 55
  • 89
4
votes
4 answers

How to get coordinates of a tab header in the jTabbedPane?

I have a method that draws animated image on glass pane to simulate pulsing of an icon. It needs an image (i use icons of components) and bounds (of a button f.e.). I need this area: I know that button has getBounds(), does tabs have something…
bunnyjesse112
  • 747
  • 6
  • 27
  • 44
4
votes
2 answers

Can not click on tab when mouse listener has been added

I have been trying to add a pop up menu to the tab title of a JTabbedPane, which I have managed to do as follows: tabbedPane.setTabComponentAt(a+2, x); x.addMouseListener(new MouseListener() { @Override …
Michaelb88
  • 151
  • 2
  • 6
  • 14
4
votes
3 answers

How to set JTabbedPane Tab height width background foreground color (Both selected and Unselected Tab)

How to set the JTabbedPane Tab background and Foreground, Height and Width (Both selected and Unselected Tab)
Sathish Robert
  • 187
  • 3
  • 7
  • 12
4
votes
0 answers

IllegalComponentStateException When changing language in a jtextfield inside a jtabbedpane

Today while i was creating a JTabbedPane i noticed a weird (in my opinion) bug, which makes no sense...and since i am looking for this for more than 2 hours, can't find anything neither anything online. Take a look at this: import…
George Z.
  • 6,643
  • 4
  • 27
  • 47
1 2
3
54 55