Sunday, October 16, 2011

How to create a Closable Tabbed pane in java

Preamble

This article shows how to create a closable tabbed pane in java

JDK and eclipse compatibility 

JDK version 1.3 with eclipse 3.3 is the minimum requirement.

Project overview 

The downloadable zip file contains an eclipse project which has a MainFrame class for GUI. Clicking on the button will create a new tab in the tabbed pane. To close press the tab close button.

Unzip the downloadable and load in the eclipse project. Make a run configuration for MainFrame class and you are all set.

final CloseableTabbedPane tabbedPane = new CloseableTabbedPane();
frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
//to add a new tab

tabbedPane.addTab("New tab", new JComponent()); 


No comments:

Post a Comment