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

The Archive Base Latest Questions

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

I want to create a window with Java Swing. The window will have a

  • 0

I want to create a window with Java Swing. The window will have a menu bar with a File->Open button from where the user can select a file from hid hard drive. The File menu should also have a list of the most recent opened items, like many other applications show. Does anyone know what is the best approach?

  • 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-15T07:07:29+00:00Added an answer on May 15, 2026 at 7:07 am

    I would suggest using the Preferences class to persist the most recently opened items. That way, if the user restarts the application the items will still be available.

    Note that on Windows the Preferences class stores data in the registry, which is how many native Windows applications store and retrieve recently open file names.

    Also, note that the Preferences class simply acts as an API for storing and retrieving (key, value) pairs. You will still need to decide how you wish to store the information, and be responsible for dynamically building / updating the JMenu when a new file is accessed. To accomplish this I would suggest implementing a Action (extend AbstractAction) to deal with when the user attempts to open a file. When the Action runs it should persist the newly accessed file’s name to the Preferences class and dynamically rebuild the File JMenu (in addition to opening the file).

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

Sidebar

Related Questions

Hi i want to create a generic style for pin button. <Window x:Class=TooglePinButtonStyle.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
I want to create java program that can pause / play the vlc video
How do I create a window which looks like this in Java: I want
I want to create a class in Java from a classname and an variable
I want to create popup window in sun java wireless toolkit when pressing numeric
I have a simple Java Swing GUI Form with a browse button. The browse
I want to create a tabbed window. with 3 tabs, Blue , Green and
I want to create and display a self designed window on current webpage instead
I want to create an application which main window has canvas (or something where
I want to create a separate thread that runs its own window. Frankly, the

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.