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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:07:44+00:00 2026-06-08T02:07:44+00:00

I created a swing application on Windows OS. One of my JDialog (whose window

  • 0

I created a swing application on Windows OS. One of my JDialog (whose window is parentJFrame) shows a JOptionPane.
JOptionPane.showMessageDialog(parentJFrame, "I am a JOption"); .

At the run time, the parentJFrame setAlwaysOnTop(true) . Even though it has set alwaysOnTop-TRUE, the JOptionPane appeares on the parentJFrame on Windows OS. but When I ran it on Linux OS,JOptionPane displays behind the parentJFrame.(May be the reason is that parentJFrame alwyasOnTop is true, but how JRE runs the same application in different ways for diffrent OS s ?) How can I get it on the top of parentJFrame in Linux.? This is urgent please..
When a ‘alwaysOnTop-true’ component shows a JOptionPane, JOptionPane appears behind the component in Linux.. 🙁 . But this handled well in Windows OS. JOptionPane is showed on the top of the component which is set ‘alwaysOnTop-true’ . It seemed that, there is a conflict Showing components on the desktop screen in Linux OS.. I m not sure so. But I guess it.

  • Linux OS has Oracle JDK and JRE 7
  • 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-08T02:07:45+00:00Added an answer on June 8, 2026 at 2:07 am

    The behaviour you see on Linux is in accordance with the API specification. This is what it says for Window.setAlwaysOnTop():

    If there are multiple always-on-top windows, their relative order is unspecified and platform dependent.

    And also:

    All windows owned by an always-on-top window inherit this state and automatically become always-on-top.

    Which would explain why the JDialog that’s at the heart of JOptionPane also has “always on top” status. Seems that on Windows by chance it works as you expected, but really you’re asking Swing to do something impossible: To show the parent “always above other windows”, but also to show the dialog on top of it.

    Here’s a possible workaround: Place the dialog next to the parent, so that while it’s under it on the z-axis, the user will still see it:

    JDialog dialog = new JOptionPane("Message").createDialog(parent, "Title");
    Point dialogLoc = dialog.getLocation();
    Point parentLoc = parent.getLocation();
    dialog.setLocation(parentLoc.x + parent.getWidth(), dialogLoc.y);
    dialog.setVisible(true);
    

    Do note that there is no single “Linux OS”, especially when it comes to window management – there are lots of different desktop environments and window managers that behave in widely different ways when it comes to window ordering and visibility, often deliberately.

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

Sidebar

Related Questions

I'm using Netbeans 6.7.1 on Windows. I created a Java application using Swing. When
I have created in my Java Swing application a main window with a JButton.
I have created an executable java Swing .jar application. It works fine on Windows.
Some background: I've created a Swing application which uses the Substance LaF (Thanks again,
I have a Swing application in which I have multiple windows with different goals
Hi I have created a swing application using java 1.5 and i created a
Hi I made a java swing application. Also created jar of that file. Now
I have created a Swing Application- GUI containing fields like TextFields, Labels, CheckBoxes and
This method shows a new window in my application: public void ShowNewCustomerView() { if
I've created a swing application that will essentially use selenium to monitor field values

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.