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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:12:08+00:00 2026-05-28T14:12:08+00:00

I made a small application to open a file and show the contents of

  • 0

I made a small application to open a file and show the contents of opened file in some JTextField and JLabels. I can get all the contents and fill in the TextFields and Labels but the problem is these JLabels and JTextFields are not shown untill and unless I resize(even a little) the windows. I want my contents to be shown straight away. What do I need to do for this.

WL

here is a piece of code to initialize the panel and adding it to scrollpane

        panel = new JPanel();

        scrollPane = new JScrollPane(panel);

In the actionlistener of open button I got the following code

            int returnVal = fc.showOpenDialog(FileReader.this);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                String filePath = file.getPath();
               // if(panel.isDisplayable()==true)panel.
                if(scrollPane != null){
                    //panel.removeAll();    
                this.remove(scrollPane);
              //  scrollPane.add(panel);
                    //panel.add(panel);
                    //panel.validate();
                //panel.repaint();

                }
                //pass the file to XMLparser
                xmlParsing = new XMLParsing(filePath); 

                panel = new JPanel();


                panel=fill();
                panel.revalidate();
                panel.repaint();

          scrollPane = new JScrollPane(panel);

                add(scrollPane, BorderLayout.CENTER);
                //add(buttonPanel, BorderLayout.SOUTH);
                saveButton.setEnabled(true);
                saveasButton.setEnabled(true);
  • 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-28T14:12:09+00:00Added an answer on May 28, 2026 at 2:12 pm

    After adding all the components call

    revalidate();
    repaint();
    

    of container

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

Sidebar

Related Questions

Hi i made one small application to show all sdcard images should display in
I made a small application using XCode. How can i create a application package
I made a small web application using Netbeans , it contains some JSP pages
I have made a small application in Java and I would like to make
I made a small winforms application to monitor a certain folder for new pdf
In upgrading my application from v1 to v2, I've made a few small changes
I've made a small application in C with Netbeans. I've ran the application in
Ok, i made a small application with a small ball bouncing on the screen.
I made a small application and I am ready to distribute it. I want
I have made a small windows application with visual studio 2008 ,its working properly

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.