Total members 11890 |It is currently Wed Apr 24, 2024 5:26 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





This example show how to run different scenario based on the selected Tab using getSelectedIndex() function of JTabbedPane class.
java code
// Add Button.
AddBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{


switch(Tabbed.getSelectedIndex())
{
case 0:((new VisitorPanel(conn,myMother))).show();break;
case 1:(new BookPanel(conn,myMother)).show();break;
case 2:(new AuthorPanel(conn,myMother)).show();break;
case 3:(new PublisherPanel(conn,myMother)).show();break;
case 4:(new BookStorePanel(conn,myMother)).show();break;

default :break;
}

}
});
// Search Button
SearchBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {


switch(Tabbed.getSelectedIndex())
{
case 0:(new VisitorSearch(conn,myMother)).show();break;
case 1:(new BookSearch(conn,myMother)).show();break;
case 2:(new AuthorSearch(conn,myMother)).show();break;
case 3:(new PublisherSearch(conn,myMother)).show();break;
case 4:(new BookStoreSearch(conn,myMother)).show();break;

default :break;
}


}
});
// Edit Button
ModifyBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {



switch(Tabbed.getSelectedIndex())
{
case 0:(new VisitorModifyPanel(conn,myMother)).show();break;
case 1:(new BookModifyPanel(conn,myMother)).show();break;
case 2:(new AuthorModifyPanel(conn,myMother)).show();break;
case 3:(new PublisherModifyPanel(conn,myMother)).show();break;
case 4:(new BookStoreModifyPanel(conn,myMother)).show();break;

default :break;
}

}
});




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Run different function based on the selected Tab JTabbedPane
 JTabbedPane usage example     -  
 Dropdown list in ASP.NET - How to get value selected     -  
 The selected attachment does not exist anymore     -  
 Reading selected data from a source file     -  
 Cookie based login in php     -  
 Takes a string apart based on a delimiter     -  
 prapose me a web based mini project     -  
 Home Based Research Jobs.     -  
 what is the query to retrieve to student data based on least     -  
 Simple Text-Based RPG Java Project Help!     -  



Topic Tags

Java Swing
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com