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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:12:57+00:00 2026-06-09T17:12:57+00:00

I would like to create a JscrollPane jsp in my panel panneau . But

  • 0

I would like to create a JscrollPane jsp in my panel panneau. But This JscroolPane doesn’t appear. I think the trouble is that I use setLayout to null.

The code might produce a layout like this, the number of rows & columns of text fields are variable (in constructor):

layout

That’s my code :

public class Cadre_fenetreA3 extends JFrame 
{
    JButton boutonOK = new JButton ("OK");
    public Cadre_fenetreA3 (String nom,int X, int Y, int lo, int la, int nbligne,int nbcolonne,String[] nomGrpGen, int Na, File file, boolean dernier)      
    {

        super(nom);                     
        setBounds(X,Y,500,500);     
        setVisible(true);   
        setFocusable(true);

        JLabel phrase = new JLabel("<html>Veuillez indiquer l'appartenance ou non d'un attribut <br> a un groupe d'attribut du Niveau :</html>"+Na);
        JTextField[][] allField = new JTextField [nbligne][nbcolonne];
        JLabel phrases[] = new JLabel [nbligne];
        JPanel panneau = new JPanel();
        JScrollPane jsp = new JScrollPane(panneau);

        jsp.createVerticalScrollBar(); 
        jsp.createHorizontalScrollBar(); 
            jsp.setBounds(20,20, 20, 20);
        panneau.setLayout(null);

        for(int i = 0;i < nbligne;i++)
        {
            for(int j = 0;j<nbcolonne;j++)
            {
                int random = (int)(Math.random()*2);
                 allField[i][j] = new JTextField(String.valueOf(random));
                 allField[i][j].setBounds(150+j * 30, 75 + i * 30, 20, 20);
                 panneau.add(allField[i][j]);
            }

           phrases[i] = new JLabel(nomGrpGen[i]);
           phrases[i].setBounds(5, 75+ i * 30, 200, 20);

          panneau.add( phrases[i]);
        }
        phrase.setBounds(0,0,1000,50);
         panneau.add(phrase);

        boutonOK.setBounds(lo-90,la-110,60,60);
        boutonOK.addActionListener(new ecout(nbligne,nbcolonne,allField, file, dernier));
         panneau.add(boutonOK);
         add(jsp);
    }
  • 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-09T17:12:59+00:00Added an answer on June 9, 2026 at 5:12 pm

    that’s because you’re adding panneau at the end – you should be adding jsp 😉

    Also, don’t set the LayoutManager to null because that will cause problems (unless you know what you’re doing). For your requirements, everything you need can be found in the Visual Guide to Layout Managers.

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

Sidebar

Related Questions

I would like to create this shape using just css. I am pretty sure
I would like to create a c++ type that mimic the build-in type exactly.
I would like to create a class that runs something (a runnable) at regular
I would like to create a virtual host in apache2, but I want it
I would like create same as on stackoverflow - orange comunnicates, but i have
I would like create an inner shadow on my UIView on iPad like that
would like to create a function that generates graphs using ggplot. For the sake
I would like to create multiple objects/instances in a loop. how to do this?
I would like to create a function that keeps a record of every print
I would like to create some logic with in my Rails app that is

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.