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

JTabbedPane with GridBagLayout

I understood the concepts behind JTabbedPane and GridBagLayout. However, when I try to use both together I fail. That is, when I use GBLayout, my other tabs (each tab having different functionality) are not showing up. Please help. Thank You. Here…
Ankur Sinha
  • 6,473
  • 7
  • 42
  • 73
0
votes
2 answers

Adding a JTabbedPane to a JTabbedPane error

Getting this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Project.reportpane.addComponent(reportpane.java:69) I'm unable to add the rptinvestment tabbedPane to the panel tabinvestment public class reportpane…
0
votes
1 answer

A JtabbedPane within a JtabbedPane

I have written a small program for creating a simple gui with tabbed panes.Currently it has two tabs. In one of the tabs i have created a button and in another tabs i have created two buttons(based upon a string in a third class).What i am not…
user1939168
  • 547
  • 5
  • 20
0
votes
1 answer

How can I ensure that the contents of a JTabbedPane received a ComponentEvent (componentHidden) when the JTabbedPane is no longer visible

I have an application that uses a JTabbedPane to show several different tabs. One of these tabs has a thread running to display it's contents. I have already implemented a ComponentListener to stop the thread when the tab is not visible. I can see…
Stefan
  • 3
  • 2
0
votes
1 answer

Canvas repaint should be called by itself

I have an application with jTabbedPane. There are two tab (JPanel) in jTabbedPane. First tab includes canvas and second one includes simple JLabel. Button draws rectangle into canvas. Every thing is fine until then. However, when switching tabs,…
0
votes
1 answer

Java Swing: Add tabs into JPanels

I have a series of tabs, but I want to then add further tabs within the panel it displays, as if to replicate a ribbon menu. I roughly know what needs to be done (changing the return type of the makeTextPanel function) but don't know how to so any…
DorianD
  • 65
  • 1
  • 3
  • 8
0
votes
1 answer

JPanel comonents not updating without mouse click

I was just having a problem with this: public class Sales extends JPanel{ ArrayList panes; ArrayList tabs; JTabbedPane tp; public Sales(Dimension d){ setSize(d); setLayout(null); tp = new…
csga5000
  • 4,062
  • 4
  • 39
  • 52
0
votes
0 answers

adding different arraylists to different JLists located in JTabbedPane

I am coding a program that is a bit of a to do list, where the user creates tasks that he has to do, and adds them to a category, such as "Work" for example. i can´t post an image of my program, but it is basically a jtabbedpane, where each tab has…
manuFloyd
  • 3
  • 1
0
votes
1 answer

combobox in jtab

I'm trying to create a combobox in one tab while a button in another.. but the problem I'm facing is that i cant see the items of combobox..please help.. also tell me how to import image in another tab.. import java.awt.*; import…
kaps
  • 1
0
votes
3 answers

Switch component between tabs in JTabbedPane

Is there a way to switch components between tabs in JTabbedPane without creating new instances of these objects? Or any way to switch tabs? When component is removed from JTabbedPane via .remove(idx) or .removeTabAt(idx) methods, the component is…
0
votes
1 answer

After loading configuration file, open selected tab

I have a question in regards to a Java GUI I'm creating at the moment, it's an application that runs offsite backups. When the application initially loads you are presented with this screen: After loading the configuration file it fills out each…
Kane Charles
  • 379
  • 3
  • 10
  • 19
0
votes
2 answers

List iteration type mismatch

List holder = new List(); holder.add(new JTabbedPane()); holder.add(new JTabbedPane()); for(JTabbedPane tab : holder) { System.out.println(tab.toString()); } Why it is showing error on type mismatch in for-each loop?
varuog
  • 3,031
  • 5
  • 28
  • 56
0
votes
2 answers

JTabbedPane - keep order of tabs

This problem is not necessarily specific to JTabbedPane, but this is where I came across it. The idea is that you have a list of priorities Priority[] according to which you would like to see the output tabs to be rendered. Each tab can have many…
Bober02
  • 15,034
  • 31
  • 92
  • 178
0
votes
1 answer

unable to add two JTabbedPane

I'm expanding my program, which has no tabs at the moment. I've tried adding to tabs like so: I declared it: JTabbedPane mainTab = new JTabbedPane(); This is how I tried adding the two tabs: mainTab.addTab("Main Tab",…
Moe
  • 470
  • 1
  • 9
  • 26
0
votes
1 answer

Get current JEditorPane that is being displayed

I was wondering if there is a way or a method that allows me to get the current JEditorPane being displayed. For example I have a JFrame where I can create several tabs. Whenever a tab is created a new JEditorPane object is created and the content…
Kakalokia
  • 3,191
  • 3
  • 24
  • 42