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 9174453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:45:33+00:00 2026-06-17T16:45:33+00:00

I have Tabbed Pane with three tabs. How to hide the header of these

  • 0

I have Tabbed Pane with three tabs.
How to hide the header of these tabs to prevent the user from pressing on them?

I used to do it in c# by creating a class inherited from tab component class and then override the method to hide the tabs, but recently i switch to java and i searched a lot without reaching any result.

  • 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-06-17T16:45:33+00:00Added an answer on June 17, 2026 at 4:45 pm

    try this

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Testing
    {
      public void buildGUI()
      {
        JTabbedPane tp = new JTabbedPane();
        tp.addTab("A",getPanel("A"));
        tp.addTab("B",getPanel("B"));
        tp.addTab("C",getPanel("C"));
        //Control Header space area..
        final boolean showTabsHeader = false;
        tp.setUI(new javax.swing.plaf.metal.MetalTabbedPaneUI(){
            @Override
            protected int calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight) {
                if (showTabsHeader) {
                    return super.calculateTabAreaHeight(tabPlacement, horizRunCount, maxTabHeight);
                } else {
                    return 0;
                }
            }
          protected void paintTabArea(Graphics g,int tabPlacement,int selectedIndex){}
        });
    
        JFrame f = new JFrame();
        f.getContentPane().add(tp);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      }
      public JPanel getPanel(String tabText)
      {
        JPanel p = new JPanel();
        p.add(new JLabel(tabText));
        return p;
      }
      public static void main(String[] args)
      {
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
          }
        });
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a tabbed pane for the amount of rooms that I have
Basically I have a tabbed Panel I'm creating. When the user click on a
I have a tabbed pane, i want to resize the tabs...... not the entire
I have a Tabbed Activity, which contains three tabs, which are initialized as follows:
I have a menu-bar and a tabbed pane in a frame, and i want
I have designed a tabbed page. I'm able to load forms in the tabs
What i have is a tabbed page with 12 tabs (every tab is a
I have Tabbed Application with 5 tabs. App starts on tab with index 0
I have a tabbedpanel with two tabs, when the user clicks submit on the
I have an application with a tabbed pane and different components in it. I

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.