Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7561849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:15:55+00:00 2026-05-30T13:15:55+00:00

I have an application using JtabbedPane. Each tab is a JPanel. I wrote a

  • 0

I have an application using JtabbedPane. Each tab is a JPanel. I wrote a function that should set certain tabs enabled to false in certain cases. Here is the code but I don’t know why it doesn’t work.

public boolean DBEnabledTabs(int zakladki)
{

    ResultSet rs;
    ResultSet rs2;
    error_code = NO_ERROR;
    try
    {
        switch(zakladki)
        {
            case SQL_TAB_ADD :
                 rs =  stat.executeQuery("select 1 from tblCykle;");
                return (!rs.isClosed() ? rs.getString(1).equals("1") : false);
            case SQL_TAB_EDIT :
                 rs =  stat.executeQuery("select 1 from tblPracownicy;");
                 return (!rs.isClosed() ? rs.getString(1).equals("1") : false);
            case SQL_TAB_HARM :
                 rs =  stat.executeQuery("select 1 from tblPracownicy where cykl_id = null");
                 return (!rs.isClosed() ? !rs.getString(1).equals("1") : true);
            case SQL_TAB_ABSE :
                 rs =  stat.executeQuery("select 1 from tblPracownicy;");
                 rs2 = stat.executeQuery("select 1 from tblPowody;");
                 return (!rs.isClosed() && !rs2.isClosed() ? rs.getString(1).equals("1") && rs2.getString(1).equals("1") : false);
            case SQL_TAB_CZAS :
                 rs =  stat.executeQuery("select 1 from tblHarmonogramy where zatwierdzonyPlan = 1 and zatwierdzoneWykonanie = 0;");
                 return (!rs.isClosed() ? rs.getString(1).equals("1") : false);
        }
    }catch(SQLException e)
    {
        error_code = e.getMessage();
        return false;
    }catch(Exception e)
    {
        error_code = e.getMessage();
        return false;
    }
    error_code = "Błędny parametr funkcji";
    return false;
}

here is the function that calls the one above

 public void updatesTabsEnabled()
{
    DBAdapter db = new DBAdapter();
    db.DBConnect();
    boolean tabIsOK = db.DBEnabledTabs(db.SQL_TAB_ADD);
    if(!db.error_code.equals(db.NO_ERROR))
    {
        String ec = db.error_code;
        db.DBDisconnect();
        startError(ec);            
    }
    addUser.setEnabled(tabIsOK);

    tabIsOK = db.DBEnabledTabs(db.SQL_TAB_EDIT);
    if(!db.error_code.equals(db.NO_ERROR))
    {
        String ec = db.error_code;
        db.DBDisconnect();
        startError(ec);            
    }
    editUser.setEnabled(tabIsOK);

    tabIsOK = db.DBEnabledTabs(db.SQL_TAB_HARM);
    if(!db.error_code.equals(db.NO_ERROR))
    {
        String ec = db.error_code;
        db.DBDisconnect();
        startError(ec);            
    }
    harmonogramy.setEnabled(tabIsOK);

    tabIsOK = db.DBEnabledTabs(db.SQL_TAB_ABSE);
    if(!db.error_code.equals(db.NO_ERROR))
    {
        String ec = db.error_code;
        db.DBDisconnect();
        startError(ec);            
    }
    absencje.setEnabled(tabIsOK);

    tabIsOK = db.DBEnabledTabs(db.SQL_TAB_CZAS);
    if(!db.error_code.equals(db.NO_ERROR))
    {
        String ec = db.error_code;
        db.DBDisconnect();
        startError(ec);            
    }
    czasPracy.setEnabled(tabIsOK);

    db.DBDisconnect();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:15:56+00:00Added an answer on May 30, 2026 at 1:15 pm

    The method setEnabledAt() works with the example here.

    pane.setEnabledAt(0, false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a JTabbedPane in my application. I have added two tabs which
I have an application using Bing Maps that draws polygons on a map. For
I have developed an application using J9 that runs in windows mobile. but now
I have an application that interacts with another application using SendMessage (among other things).
I have an application using Jquery's UI Tabs for an overall menu, and they're
Assume that I have an application using tabbarcontroller with 10 UIViewControllers, once the UIViewController
I have my application using jQuery heavily. The problem is that we started with
I have an application using discovery that may be deployed locally on the same
I have an application using Core Data and bindings. I want to have an
We have an application using the IBM Informix driver. Whenever we try to open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.