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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:56:12+00:00 2026-05-22T19:56:12+00:00

I am creating a base class for the JFrames of my application. I would

  • 0

I am creating a base class for the JFrames of my application. I would like to inject a JXSearchField in the top right and corner of all frames that inherit from this class. I have a web background and know CSS fairly well. The effect I am going for is a float:right; or Fixed position, where other elements are not effected by the height of this component.

An example of what I am talking about would be a JFrame with a JTabbedPane aligned at the top. My tab pane only has three tabs but my frame is 800px wide. This gives me plenty of space for my top right aligned search box but my tabbedpane is reserving that space for additional tabs. I want to float in or fix position my searchbox to overlay that space.

  • 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-22T19:56:13+00:00Added an answer on May 22, 2026 at 7:56 pm

    if I understand correctly, you want to paint the TextField over the JTabbedPane beside the Tabs?

    There is no easy way in swing doing this. You can use a glassPane-Component which draw the TextField on top right. And set it to the Frame.

    UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
    
    JFrame frame = new JFrame();
    frame.setBounds( 50, 50, 800, 600 );
    frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    
    JPanel glasspane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    
    frame.setGlassPane( glasspane );
    
    glasspane.setOpaque( false );
    JTextField textField = new JTextField("Search");
    glasspane.add(textField);
    glasspane.setVisible( true );
    
    JTabbedPane tabs = new JTabbedPane();
    tabs.setBorder( BorderFactory.createEmptyBorder( 10, 5, 5, 5 ) );
    tabs.addTab( "Lorem", null );
    tabs.addTab( "Ipsum", null );
    tabs.addTab( "Dolor", null );
    frame.setContentPane( tabs );
    frame.setVisible( true );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a base class for a button that inherits from Control as opposed
I'm creating a base class that has an isDirty flag. It is set any
I would like to know the difference between two conventions: Creating an abstract base
I'm creating a base class Node that essentially wraps instances of another class from
What is the use of creating base class object using child class reference in
I'm working on creating a new base class for an asp.net app in order
I am creating a class that derives from the WPF RichTextBox control and I
If I'm creating an abstract base class, and the classes derived from it are
I'm creating a custom web page base class (not to be confused with web
I'm creating a list of classes for a program. However, the base class has

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.