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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:02:32+00:00 2026-05-23T12:02:32+00:00

I am creating an application which helps solving problems of an accounting book. The

  • 0

I am creating an application which helps solving problems of an accounting book. The application has 12 chapters. All chapters contains 15-20 problems. The problem is displayed in a JPanel containing various combo-boxes and formatted-text boxes. suppose i solved a problem half and want to save so that next time i can load that half solved question.

Saving should be done by clicking save from menubar. And loading by load from the menubar

All menubars and problem sheet are working but i am not able to save any thing. I was using jFilechooser…

Is their any way to do that?

How to save a panel with filled combo-boxes items and text-boxes. And is their any way to know that user has made any changes in any items so that on closing the problem i can again ask to save it first and then exit.

Thanks in advance.

Some of my codes:

private void openBtnMouseClicked(java.awt.event.MouseEvent evt) {
opening();
}
public void opening() {
        JFileChooser chooser=new JFileChooser();
        int choice=chooser.showOpenDialog(this);       
        javax.swing.JComboBox[] sourceALE = {aaCombo, baCombo, caCombo, daCombo, eaCombo, faCombo, gaCombo, haCombo, iaCombo, jaCombo, kaCombo,
                            alCombo, blCombo, clCombo, dlCombo, elCombo, flCombo, glCombo, hlCombo, ilCombo, jlCombo, klCombo,
                            aeCombo, beCombo, ceCombo, deCombo, eeCombo, feCombo, geCombo, heCombo, ieCombo, jeCombo, keCombo};
                            javax.swing.JTextField[] sourceP = {aeval1, beval, ceval, deval, eeval, feval, geval, heval, ieval, jeval, keval};
                           String [] comboboxes={"aaCombo", "baCombo", "caCombo", "daCombo", "eaCombo", "faCombo", "gaCombo", "haCombo", "iaCombo", "jaCombo", "kaCombo","alCombo", "blCombo", "clCombo", "dlCombo", "elCombo", "flCombo", "glCombo", "hlCombo", "ilCombo", "jlCombo","klCombo","aeCombo", "beCombo", "ceCombo", "deCombo", "eeCombo", "feCombo", "geCombo", "heCombo", "ieCombo", "jeCombo", "keCombo"};
        if(choice==JFileChooser.APPROVE_OPTION) {

            File file = chooser.getSelectedFile();
            try {
                System.out.println("Hey");
                Scanner scanner = new Scanner(new FileReader(file));
                while ( scanner.hasNextLine() ){
                    Scanner scan = new Scanner(scanner.nextLine());
                    scan.useDelimiter("=");
                    if ( scan.hasNext() ){
                        String item=scan.next();
                        int value=scan.nextInt();
                        String color=scan.next();
                        for(int g=0;g<comboboxes.length;g++){
                            if(item.equals(comboboxes[g])) {
                                if(value<3)
                                sourceALE[g].setSelectedIndex(value);
                                if(color.equals("red"))
                                sourceALE[g].setForeground(red);
                                if(color.equals("green"))
                                sourceALE[g].setForeground(green);
                                if(color.equals("blah"))
                                sourceALE[g].setForeground(blah);
                            }
                        }
                    }
                    scan.close();
                }
                scanner.close();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(q1.class.getName()).log(Level.SEVERE, null, ex);
            }
                }
                public void opening() {
        JFileChooser chooser=new JFileChooser();
        int choice=chooser.showOpenDialog(this);       
        javax.swing.JComboBox[] sourceALE = {aaCombo, baCombo, caCombo, daCombo, eaCombo, faCombo, gaCombo, haCombo, iaCombo, jaCombo, kaCombo,
                            alCombo, blCombo, clCombo, dlCombo, elCombo, flCombo, glCombo, hlCombo, ilCombo, jlCombo, klCombo,
                            aeCombo, beCombo, ceCombo, deCombo, eeCombo, feCombo, geCombo, heCombo, ieCombo, jeCombo, keCombo};
                            javax.swing.JTextField[] sourceP = {aeval1, beval, ceval, deval, eeval, feval, geval, heval, ieval, jeval, keval};
                           String [] comboboxes={"aaCombo", "baCombo", "caCombo", "daCombo", "eaCombo", "faCombo", "gaCombo", "haCombo", "iaCombo", "jaCombo", "kaCombo","alCombo", "blCombo", "clCombo", "dlCombo", "elCombo", "flCombo", "glCombo", "hlCombo", "ilCombo", "jlCombo","klCombo","aeCombo", "beCombo", "ceCombo", "deCombo", "eeCombo", "feCombo", "geCombo", "heCombo", "ieCombo", "jeCombo", "keCombo"};
        if(choice==JFileChooser.APPROVE_OPTION) {

            File file = chooser.getSelectedFile();
            try {
                System.out.println("Hey");
                Scanner scanner = new Scanner(new FileReader(file));
                while ( scanner.hasNextLine() ){
                    Scanner scan = new Scanner(scanner.nextLine());
                    scan.useDelimiter("=");
                    if ( scan.hasNext() ){
                        String item=scan.next();
                        int value=scan.nextInt();
                        String color=scan.next();
                        for(int g=0;g<comboboxes.length;g++){
                            if(item.equals(comboboxes[g])) {
                                if(value<3)
                                sourceALE[g].setSelectedIndex(value);
                                if(color.equals("red"))
                                sourceALE[g].setForeground(red);
                                if(color.equals("green"))
                                sourceALE[g].setForeground(green);
                                if(color.equals("blah"))
                                sourceALE[g].setForeground(blah);
                            }
                        }
                    }
                    scan.close();
                }
                scanner.close();
            } catch (FileNotFoundException ex) {
                Logger.getLogger(q1.class.getName()).log(Level.SEVERE, null, ex);
            }
                }
        System.out.println("OUT");
            }
            }
  • 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-23T12:02:33+00:00Added an answer on May 23, 2026 at 12:02 pm

    1) It is good design to separate your data from the presentation. Are you doing this already? What I mean is you should be looking to store answers in an object outside of the jPanel class. (As ‘Hovercraft Full Of Eels’ suggested)

    2) Consider making the data objects Serializable objects. If you’re not planning on storing the data across a network or anything complicated/peculiar this should work out for you as it will facilitate save/load operations

    3) Once you have your data separate from the GUI a check for changes becomes very easy. Assume that on any operation that takes you away from the page it “saves” its state. If the current state is different from the saved state then prompt the user to save (if it doesn’t by default)

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

Sidebar

Related Questions

I am creating a web application which has a few management screens, where a
Possible Duplicate: iPhone - file properties Hi all. i m creating an application which
I am creating a music application which has more than 12 songs made of
I'm creating an application which communicates with the device via FT2232H USB/RS232 converter. For
I am creating an application which tracks the users location using GPS, stores the
I am creating an application which involves so many web-service calls. I am using
I am creating Facebook application which get insights for user's page for multiple metric.
I am creating an application which produces some files/directories in my WebContent folder and
I am creating a Silverlight application which will be heavily javascripted against. To enable
I am creating small django application which holds some few questions (and answers for

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.