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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:23:52+00:00 2026-06-05T00:23:52+00:00

I have a simple (not?) problem with getting a focus on an JInternalFrame after

  • 0

I have a simple (not?) problem with getting a focus on an JInternalFrame after disposing of JTable.

//I created a table, set it to visible, gave it focus.
list.dispose(); //I did what I wanted with the table and I dispose of it
screen.setVisible(true); //The screen is already visible. this isn't really needed
//After I closed table, I want the focus return to the screen (JInternalFrame)
screen.setFocusable(true); 
screen.requestFocus();
screen.requestFocusInWindow();
screen.requestFocus(true);
desktopPane.setSelectedFrame(screen);

So what’s happening is this: The screen DOES get focus, in a sense that when I check for which component has focus – it does return me – screen. BUT the bar (not sure of proper terminology here) the bar on the top, that contains the icon, title, X thingy, is gray and not blue.

Any idea how I can make the JInternalFrame LOOK active, not just behave active?

Example: http://nexrem.com/projects/FocusDemo.rar I made this quickly in NetBeans and what you do is:

Click to open screen1. It opens and is focused. Click to open JTable. It opens and has focus. Screen1 lost focus. Hit Esc to close the JInternalFrame. It closes, but screen1 doesn’t seem to have focus (visually at least). I am suspecting it may have something to do with focus cycling, since it is between 2 JInternalFrames…

  • 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-05T00:23:54+00:00Added an answer on June 5, 2026 at 12:23 am

    You are looking for screen.setSelected(true); (I just tried it on your code and it works now).

    As for @HFOE suggestion what he meant was to do something like this:

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            screen.requestFocus();
            screen.requestFocusInWindow();
            screen.requestFocus(true);
        }
    });
    

    but I am not sure this will improve your situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cant find best solution for very simple problem(or not very) Have classical set
I have a simple problem but I am not sure how to solve it.
I have got a simple MySQL table and primary index (id) is not numbered
This is I think a simple problem but not getting the solution yet. I
My problem is simple not so lengthy as looking like. I have 7 textboxes
I have a simple data set, a few collections, not more than 20 documents
I have a simple problem. I am tracking an object and getting its position
I have a simple file-system-ed-login (not mysql) just to track number of users who
I have a simple challenge with a background not animating. I have used this
I have this simple textarea. When it's not selected, I want it to look

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.