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
4 answers

How to change the order of tabs in JTabbedPane in Netbeans?

This should hopefully be a very easy question. Within Netbeans, using the GUI Swing editor I have four panels within a JTabbedPane. Tab #4 I want to sit where Tab #1 is now, but I created it last so by default its at the end of the list. How to I…
Doug
  • 6,446
  • 9
  • 74
  • 107
3
votes
2 answers

How to check if a jframe is opened?

My code below create a new array and sends it to chat(jFrame). String info1[]=new String[3]; // username , userid , userid2 are variables info1[0]=username4; info1[1]=""+userid; info1[2]=""+userid2; chat.main(info1); But i need to modify…
Sarang
  • 83
  • 1
  • 3
  • 12
3
votes
2 answers

Remove space/border/margin of JTabbedPane

Image JtabbedPane http://img850.imageshack.us/img850/7339/immaginedya.png How can i remove the selected margin of a JTabbedPane? :(
SplitXor
  • 165
  • 1
  • 10
3
votes
2 answers

How to change selected JtabbedPane in Action Listener

I would like to change selected JTabbedPane "Calculation" after click on the button responsible for calculation with Action Listener to TabbedPane "Results".
Zimas
  • 286
  • 1
  • 9
3
votes
1 answer

Adding ChartPanel to JTabbedPane using JPanel

I want to add JFreeChart to JPanel and then add JPanel to JTabbedPane. I managed to display JFreeChart on JFrame, but I want to add JFreeChart as a 4th tab of JTabbedPane. Code to display Chart: public class Chart extends javax.swing.JPanel { …
amal
  • 3,470
  • 10
  • 29
  • 43
3
votes
2 answers

Tabed pane with a label on top

I need to add a JLabel/JPanel as shown in the image. When resizing the frame both the tabbed pane and the Label/panel should be resided. The label and the panel inside the Tabbed Pane are independent. How can I do that?
Abin
  • 540
  • 4
  • 15
3
votes
1 answer

JTabbedPane not showing other tabs added

I have been looking around about JTabbedPane's and can't seem to find any solution. I am using GridBagLayout as the manager as I am more comfortable with this (I am new to Java programming). I have made the the class, and extended it with JPanel,…
user2078802
  • 43
  • 1
  • 6
3
votes
2 answers

Tabs are collapsed

I am creating a GUI where the main window will contain a number of tabs. They should be positioned next to each other horizontally. Using this code makes a "collapsed" version, where I can toggle the tabs with the arrows. JTabbedPane tabs = new…
Patrick Reck
  • 303
  • 1
  • 10
  • 24
3
votes
5 answers

JTabbedPane in JPanel?

I have a simple problem when I want to add tabs in my jpanel. The alignment of the tabs get horizontal instead of vertical, wich looks like crap =/. It looks like this: If I discard the panel instead and add the tabbedPane directly to the frame,…
Thkru
  • 4,218
  • 2
  • 18
  • 37
3
votes
3 answers

Disabling or Intercepting a Drop Outside Of A Window

I've implemented a set of draggable tabs, following the form of this example: How to implement draggable tab using Java Swing? Everything appears to work as I desire, however,when I drag outside of the main panel, the desktop will become a valid…
Amish
  • 71
  • 1
  • 5
3
votes
1 answer

Java: Keybindings get consumed by other components

I'm working on a GUI. The Gui is constructed as follows: A JFrame containining a (custom) leftPanel and rightPanel. RightPanel is an extension of a tabbedpane and contains as one of the tabs, the class MainTab. Maintab has the following…
Sven
  • 1,133
  • 1
  • 11
  • 22
3
votes
1 answer

JTabbedPane Selected Component always null

getTabbedPane().addTab("Ground", pnlGround); public BufferedImage getSelectedImage() { return ((SpritePane) getTabbedPane().getSelectedComponent()).getSelectedImage(); } getTabbedPane().getSelectedComponent() is returning null. It is called…
3
votes
1 answer

set visibility of specific tabs in JTabbedPane

How can I set some of the tabs in a JTabbedPane invisible? I tried using JTabbedPane#getTabComponentAt(index).setVisible(false);, but it throws a NullPointerException. I can disable the tabs, but not make them invisible. SSCCE: import…
brimborium
  • 9,362
  • 9
  • 48
  • 76
3
votes
3 answers

How and where should I add the ActionListener in my code?

I have written the below code which has a text-field and a button. as soon as a character is entered and the button is pressed a tab is created with the title same as what is entered in the field. Several tabs can be create the same way.....now in…
msc87
  • 943
  • 3
  • 17
  • 39
3
votes
4 answers

Giving JTabbedPane Orders

I've reccently run into issues with indexing my tabs and though I'd give it some concrete ordering by using the setComponentAt method. Here's my code: public ContainerPane() { this.setLayout(new BorderLayout()); myPlayerManagerPane = new…
AncientSwordRage
  • 7,086
  • 19
  • 90
  • 173