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

  • Home
  • SEARCH
  • 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 1067165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:07:15+00:00 2026-05-16T20:07:15+00:00

I have a problem with a java gui and opening a document. My problem

  • 0

I have a problem with a java gui and opening a document. My problem is the complete gui hangs until the document is open, but I already threaded the action…

I have this action listener:

    this.EditButton.addActionListener(new ActionListener(){
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String path = (String)DocumentsTable.getValueAt(DocumentsTable.getSelectedRow(), 2);
            openDocument(path);
            System.out.println("foo");
        }
    });

the action which is performed just opens the given path

private void openDocument(final String path){
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try{
                Desktop.getDesktop().open(new File(path));
            }
            catch(Exception e){
                JOptionPane.showMessageDialog(null, "Das Dokument konnte nicht geöffnet werden...\n"+e.toString());
                e.printStackTrace();
            }
        }
    });
}

If I run my program I immediately see “foo” on console but the gui completly hangs up and the button is in pressed state…
Does anyone have an idea what I did wrong? My other action listeners work the same and I don’t have the problem there…

  • 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-16T20:07:15+00:00Added an answer on May 16, 2026 at 8:07 pm

    SwingUtilities.invokeLater() schedules the runnable to be run on the EDT, as is stated in the javadoc. Perhaps you should be using a SwingWorker to open the doc?

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

Sidebar

Related Questions

Possible Duplicate: Java GUI repaint() problem? I write a Java code, but I have
I have a GUI problem that I would like to get sorted out, but
I have simple problem as I am not much familiar with Java GUI. I
So I have a problem where Java is telling me that the following line
Good evening ladies and gentlemen, I have a problem with Java Swing that I
I have a problem with my Java progam suddenly exiting, without any exception thrown
I have problem with google map Loading and making center in my java script
I recently have a problem that my java code works perfectly ok on my
I am new to Java. I have problem to understand the relation between anonymous
Possible Duplicate: Java - Regex problem I have list of URLs of types: http://www.example.com/pk/etc

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.