Please provide your method of laying out and resizing `JPanel`s in a frame The 2019 Stack Overflow Developer Survey Results Are InWhy doesn't JUnit provide assertNotEquals methods?Swing Panel QuestionReplacing JPanel with JPanel in a JFrameHow to overlay, resize and centre a component on a JPanel?JPanel doesn't update when adding Component in another classJava Swing API - GroupLayout Not Resizing All Component JPanels CorrectlySwitching JPanelsLearning Java GUIs -JScrollPane not appearing on JTextAreaI've added JPanel to JFrame and it still isn't showing

What is the meaning of Triage in Cybersec world?

Is there a symbol for a right arrow with a square in the middle?

Which Sci-Fi work first showed weapon of galactic-scale mass destruction?

Is flight data recorder erased after every flight?

Loose spokes after only a few rides

Can someone be penalized for an "unlawful" act if no penalty is specified?

Why did Acorn's A3000 have red function keys?

One word riddle: Vowel in the middle

Earliest use of the term "Galois extension"?

What tool would a Roman-age civilization have for the breaking of silver and other metals into dust?

Identify boardgame from Big movie

Is "plugging out" electronic devices an American expression?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

What did it mean to "align" a radio?

Does a dangling wire really electrocute me if I'm standing in water?

Do these rules for Critical Successes and Critical Failures seem Fair?

Is a "Democratic" Oligarchy-Style System Possible?

Output the Arecibo Message

Button changing it's text & action. Good or terrible?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Falsification in Math vs Science

Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?

Why do some words that are not inflected have an umlaut?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?



Please provide your method of laying out and resizing `JPanel`s in a frame



The 2019 Stack Overflow Developer Survey Results Are InWhy doesn't JUnit provide assertNotEquals methods?Swing Panel QuestionReplacing JPanel with JPanel in a JFrameHow to overlay, resize and centre a component on a JPanel?JPanel doesn't update when adding Component in another classJava Swing API - GroupLayout Not Resizing All Component JPanels CorrectlySwitching JPanelsLearning Java GUIs -JScrollPane not appearing on JTextAreaI've added JPanel to JFrame and it still isn't showing



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-2















Panel Alignment Practice



Panel alignment practice. Each panel is a color. I haven't been able to resize using new Dimension() or flexibly manipulate the panels. I've tried frm.setLayout(null) with setBounds() and GridBagConstraints.



 frm = new JFrame();

frmLayout = new BorderLayout();
frmLayout.layoutContainer(frm.getContentPane());


mainPnl = new MainPanel();
sP = new SecondPanel();
tP = new ThirdPanel();

getContentPane().add(mainPnl, BorderLayout.WEST);
getContentPane().add(sP, BorderLayout.EAST);
getContentPane().add(tP, BorderLayout.SOUTH);









share|improve this question






















  • When using the BorderLayout (which is the default layout for a JFrame, the components will automatically resize. So know each of your child panels (mainPnl, sP and tP) need to use appropriate layout manager that will allow components to resize. Read the section from the Swing tutorial on Layout Managers for more information and working examples to get you started. The panels in your example will automatically resize as you add components to them.

    – camickr
    Mar 8 at 15:14












  • @camickr "The panels in your example will automatically resize as you add components to them." I had a feeling that was the case. I was just hoping there was a way to move the panels around as like a pre-arranging to plan components.

    – Anthony Goodwin
    Mar 9 at 9:07


















-2















Panel Alignment Practice



Panel alignment practice. Each panel is a color. I haven't been able to resize using new Dimension() or flexibly manipulate the panels. I've tried frm.setLayout(null) with setBounds() and GridBagConstraints.



 frm = new JFrame();

frmLayout = new BorderLayout();
frmLayout.layoutContainer(frm.getContentPane());


mainPnl = new MainPanel();
sP = new SecondPanel();
tP = new ThirdPanel();

getContentPane().add(mainPnl, BorderLayout.WEST);
getContentPane().add(sP, BorderLayout.EAST);
getContentPane().add(tP, BorderLayout.SOUTH);









share|improve this question






















  • When using the BorderLayout (which is the default layout for a JFrame, the components will automatically resize. So know each of your child panels (mainPnl, sP and tP) need to use appropriate layout manager that will allow components to resize. Read the section from the Swing tutorial on Layout Managers for more information and working examples to get you started. The panels in your example will automatically resize as you add components to them.

    – camickr
    Mar 8 at 15:14












  • @camickr "The panels in your example will automatically resize as you add components to them." I had a feeling that was the case. I was just hoping there was a way to move the panels around as like a pre-arranging to plan components.

    – Anthony Goodwin
    Mar 9 at 9:07














-2












-2








-2








Panel Alignment Practice



Panel alignment practice. Each panel is a color. I haven't been able to resize using new Dimension() or flexibly manipulate the panels. I've tried frm.setLayout(null) with setBounds() and GridBagConstraints.



 frm = new JFrame();

frmLayout = new BorderLayout();
frmLayout.layoutContainer(frm.getContentPane());


mainPnl = new MainPanel();
sP = new SecondPanel();
tP = new ThirdPanel();

getContentPane().add(mainPnl, BorderLayout.WEST);
getContentPane().add(sP, BorderLayout.EAST);
getContentPane().add(tP, BorderLayout.SOUTH);









share|improve this question














Panel Alignment Practice



Panel alignment practice. Each panel is a color. I haven't been able to resize using new Dimension() or flexibly manipulate the panels. I've tried frm.setLayout(null) with setBounds() and GridBagConstraints.



 frm = new JFrame();

frmLayout = new BorderLayout();
frmLayout.layoutContainer(frm.getContentPane());


mainPnl = new MainPanel();
sP = new SecondPanel();
tP = new ThirdPanel();

getContentPane().add(mainPnl, BorderLayout.WEST);
getContentPane().add(sP, BorderLayout.EAST);
getContentPane().add(tP, BorderLayout.SOUTH);






java swing containers panel frame






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 9:45









Anthony GoodwinAnthony Goodwin

32




32












  • When using the BorderLayout (which is the default layout for a JFrame, the components will automatically resize. So know each of your child panels (mainPnl, sP and tP) need to use appropriate layout manager that will allow components to resize. Read the section from the Swing tutorial on Layout Managers for more information and working examples to get you started. The panels in your example will automatically resize as you add components to them.

    – camickr
    Mar 8 at 15:14












  • @camickr "The panels in your example will automatically resize as you add components to them." I had a feeling that was the case. I was just hoping there was a way to move the panels around as like a pre-arranging to plan components.

    – Anthony Goodwin
    Mar 9 at 9:07


















  • When using the BorderLayout (which is the default layout for a JFrame, the components will automatically resize. So know each of your child panels (mainPnl, sP and tP) need to use appropriate layout manager that will allow components to resize. Read the section from the Swing tutorial on Layout Managers for more information and working examples to get you started. The panels in your example will automatically resize as you add components to them.

    – camickr
    Mar 8 at 15:14












  • @camickr "The panels in your example will automatically resize as you add components to them." I had a feeling that was the case. I was just hoping there was a way to move the panels around as like a pre-arranging to plan components.

    – Anthony Goodwin
    Mar 9 at 9:07

















When using the BorderLayout (which is the default layout for a JFrame, the components will automatically resize. So know each of your child panels (mainPnl, sP and tP) need to use appropriate layout manager that will allow components to resize. Read the section from the Swing tutorial on Layout Managers for more information and working examples to get you started. The panels in your example will automatically resize as you add components to them.

– camickr
Mar 8 at 15:14






When using the BorderLayout (which is the default layout for a JFrame, the components will automatically resize. So know each of your child panels (mainPnl, sP and tP) need to use appropriate layout manager that will allow components to resize. Read the section from the Swing tutorial on Layout Managers for more information and working examples to get you started. The panels in your example will automatically resize as you add components to them.

– camickr
Mar 8 at 15:14














@camickr "The panels in your example will automatically resize as you add components to them." I had a feeling that was the case. I was just hoping there was a way to move the panels around as like a pre-arranging to plan components.

– Anthony Goodwin
Mar 9 at 9:07






@camickr "The panels in your example will automatically resize as you add components to them." I had a feeling that was the case. I was just hoping there was a way to move the panels around as like a pre-arranging to plan components.

– Anthony Goodwin
Mar 9 at 9:07













2 Answers
2






active

oldest

votes


















0














To change the LayoutManager of a JPanel use :



frm.getContentPane().setLayout(frmLayout);


Don’t set it to null, a null-layout isn’t resized with the JFrame.






share|improve this answer






























    0














    I was able to arrange the panels.



    It seems if I add panels to a main panel setBounds() works. I'm probably violating all of your favorite swing conventions but hey, I'll learn just like you all at some point. Only issue with setBounds() so far is resizing the window. getWidth() or getHeight() cause the panel to disappear.



    public class MainPanel extends JPanel 

    SecondPanel sP;
    ThirdPanel tP;
    FourthPanel fP;

    public MainPanel()


    setBackground(Color.ORANGE);
    setLayout(null);
    sP = new SecondPanel();
    sP.setBounds(0, 0, 90, 90);
    tP = new ThirdPanel();
    tP.setBounds(90, 0, 410, 90);
    fP = new FourthPanel();
    fP.setBounds(0, 400, 500, 100);

    add(sP);
    add(tP);
    add(fP);









    share|improve this answer























    • I'll learn just like you all at some point. - the time to learn is now. Swing was designed to be used with layout managers (for too many reasons to list here). You should NOT be hardcoding numbers. With your code if you ever change the size of one component if will affect the location of another. This is a maintenance disaster. It is the job of the layout manager to set the size/location of the component automatically for you..

      – camickr
      Mar 9 at 15:28











    • @camickr I can agree with that, I guess I'm just not experienced enough to feel the flexibility of any of the layout managers.

      – Anthony Goodwin
      Mar 9 at 21:06











    • I'm just not experienced enough to feel the flexibility - the only way you get experience with anything in life is to do it. You don't gain experience by avoiding it. That is the benefit of a forums. You have a specific requirement you try to solve. If you have a problem then you ask a detailed question stating the requirement and generally somebody will be able to help you solve the problem. The real question with your code above, is why are some components 90 another 410 and another 500? Think of your web page. The size of components change as you change the size of the frame.

      – camickr
      Mar 9 at 23:17











    • You need to think more about the usage of the frame and less about the individual pixels. You need to think about when the frame size changes, which component or components change?

      – camickr
      Mar 9 at 23:19











    • @camickr I completely agree. Thank you for the kick in the @$$ .. This particular gui was just to see if I could move panels around, not to actually make anything. I'm now utilizing the default BorderLayout. However, I've now run into the issue that you cannot retrieve a panel's size parameters (width, height), to store them in a variable, and pass them as a width or height parameter for another method. I'm only seeing Listeners as a solution but I have the feeling there is something easier. Thanks for your help, for real.

      – Anthony Goodwin
      Mar 10 at 11:05











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55060526%2fplease-provide-your-method-of-laying-out-and-resizing-jpanels-in-a-frame%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    To change the LayoutManager of a JPanel use :



    frm.getContentPane().setLayout(frmLayout);


    Don’t set it to null, a null-layout isn’t resized with the JFrame.






    share|improve this answer



























      0














      To change the LayoutManager of a JPanel use :



      frm.getContentPane().setLayout(frmLayout);


      Don’t set it to null, a null-layout isn’t resized with the JFrame.






      share|improve this answer

























        0












        0








        0







        To change the LayoutManager of a JPanel use :



        frm.getContentPane().setLayout(frmLayout);


        Don’t set it to null, a null-layout isn’t resized with the JFrame.






        share|improve this answer













        To change the LayoutManager of a JPanel use :



        frm.getContentPane().setLayout(frmLayout);


        Don’t set it to null, a null-layout isn’t resized with the JFrame.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 12:27









        Snowy_1803Snowy_1803

        3492515




        3492515























            0














            I was able to arrange the panels.



            It seems if I add panels to a main panel setBounds() works. I'm probably violating all of your favorite swing conventions but hey, I'll learn just like you all at some point. Only issue with setBounds() so far is resizing the window. getWidth() or getHeight() cause the panel to disappear.



            public class MainPanel extends JPanel 

            SecondPanel sP;
            ThirdPanel tP;
            FourthPanel fP;

            public MainPanel()


            setBackground(Color.ORANGE);
            setLayout(null);
            sP = new SecondPanel();
            sP.setBounds(0, 0, 90, 90);
            tP = new ThirdPanel();
            tP.setBounds(90, 0, 410, 90);
            fP = new FourthPanel();
            fP.setBounds(0, 400, 500, 100);

            add(sP);
            add(tP);
            add(fP);









            share|improve this answer























            • I'll learn just like you all at some point. - the time to learn is now. Swing was designed to be used with layout managers (for too many reasons to list here). You should NOT be hardcoding numbers. With your code if you ever change the size of one component if will affect the location of another. This is a maintenance disaster. It is the job of the layout manager to set the size/location of the component automatically for you..

              – camickr
              Mar 9 at 15:28











            • @camickr I can agree with that, I guess I'm just not experienced enough to feel the flexibility of any of the layout managers.

              – Anthony Goodwin
              Mar 9 at 21:06











            • I'm just not experienced enough to feel the flexibility - the only way you get experience with anything in life is to do it. You don't gain experience by avoiding it. That is the benefit of a forums. You have a specific requirement you try to solve. If you have a problem then you ask a detailed question stating the requirement and generally somebody will be able to help you solve the problem. The real question with your code above, is why are some components 90 another 410 and another 500? Think of your web page. The size of components change as you change the size of the frame.

              – camickr
              Mar 9 at 23:17











            • You need to think more about the usage of the frame and less about the individual pixels. You need to think about when the frame size changes, which component or components change?

              – camickr
              Mar 9 at 23:19











            • @camickr I completely agree. Thank you for the kick in the @$$ .. This particular gui was just to see if I could move panels around, not to actually make anything. I'm now utilizing the default BorderLayout. However, I've now run into the issue that you cannot retrieve a panel's size parameters (width, height), to store them in a variable, and pass them as a width or height parameter for another method. I'm only seeing Listeners as a solution but I have the feeling there is something easier. Thanks for your help, for real.

              – Anthony Goodwin
              Mar 10 at 11:05















            0














            I was able to arrange the panels.



            It seems if I add panels to a main panel setBounds() works. I'm probably violating all of your favorite swing conventions but hey, I'll learn just like you all at some point. Only issue with setBounds() so far is resizing the window. getWidth() or getHeight() cause the panel to disappear.



            public class MainPanel extends JPanel 

            SecondPanel sP;
            ThirdPanel tP;
            FourthPanel fP;

            public MainPanel()


            setBackground(Color.ORANGE);
            setLayout(null);
            sP = new SecondPanel();
            sP.setBounds(0, 0, 90, 90);
            tP = new ThirdPanel();
            tP.setBounds(90, 0, 410, 90);
            fP = new FourthPanel();
            fP.setBounds(0, 400, 500, 100);

            add(sP);
            add(tP);
            add(fP);









            share|improve this answer























            • I'll learn just like you all at some point. - the time to learn is now. Swing was designed to be used with layout managers (for too many reasons to list here). You should NOT be hardcoding numbers. With your code if you ever change the size of one component if will affect the location of another. This is a maintenance disaster. It is the job of the layout manager to set the size/location of the component automatically for you..

              – camickr
              Mar 9 at 15:28











            • @camickr I can agree with that, I guess I'm just not experienced enough to feel the flexibility of any of the layout managers.

              – Anthony Goodwin
              Mar 9 at 21:06











            • I'm just not experienced enough to feel the flexibility - the only way you get experience with anything in life is to do it. You don't gain experience by avoiding it. That is the benefit of a forums. You have a specific requirement you try to solve. If you have a problem then you ask a detailed question stating the requirement and generally somebody will be able to help you solve the problem. The real question with your code above, is why are some components 90 another 410 and another 500? Think of your web page. The size of components change as you change the size of the frame.

              – camickr
              Mar 9 at 23:17











            • You need to think more about the usage of the frame and less about the individual pixels. You need to think about when the frame size changes, which component or components change?

              – camickr
              Mar 9 at 23:19











            • @camickr I completely agree. Thank you for the kick in the @$$ .. This particular gui was just to see if I could move panels around, not to actually make anything. I'm now utilizing the default BorderLayout. However, I've now run into the issue that you cannot retrieve a panel's size parameters (width, height), to store them in a variable, and pass them as a width or height parameter for another method. I'm only seeing Listeners as a solution but I have the feeling there is something easier. Thanks for your help, for real.

              – Anthony Goodwin
              Mar 10 at 11:05













            0












            0








            0







            I was able to arrange the panels.



            It seems if I add panels to a main panel setBounds() works. I'm probably violating all of your favorite swing conventions but hey, I'll learn just like you all at some point. Only issue with setBounds() so far is resizing the window. getWidth() or getHeight() cause the panel to disappear.



            public class MainPanel extends JPanel 

            SecondPanel sP;
            ThirdPanel tP;
            FourthPanel fP;

            public MainPanel()


            setBackground(Color.ORANGE);
            setLayout(null);
            sP = new SecondPanel();
            sP.setBounds(0, 0, 90, 90);
            tP = new ThirdPanel();
            tP.setBounds(90, 0, 410, 90);
            fP = new FourthPanel();
            fP.setBounds(0, 400, 500, 100);

            add(sP);
            add(tP);
            add(fP);









            share|improve this answer













            I was able to arrange the panels.



            It seems if I add panels to a main panel setBounds() works. I'm probably violating all of your favorite swing conventions but hey, I'll learn just like you all at some point. Only issue with setBounds() so far is resizing the window. getWidth() or getHeight() cause the panel to disappear.



            public class MainPanel extends JPanel 

            SecondPanel sP;
            ThirdPanel tP;
            FourthPanel fP;

            public MainPanel()


            setBackground(Color.ORANGE);
            setLayout(null);
            sP = new SecondPanel();
            sP.setBounds(0, 0, 90, 90);
            tP = new ThirdPanel();
            tP.setBounds(90, 0, 410, 90);
            fP = new FourthPanel();
            fP.setBounds(0, 400, 500, 100);

            add(sP);
            add(tP);
            add(fP);










            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 9 at 9:50









            Anthony GoodwinAnthony Goodwin

            32




            32












            • I'll learn just like you all at some point. - the time to learn is now. Swing was designed to be used with layout managers (for too many reasons to list here). You should NOT be hardcoding numbers. With your code if you ever change the size of one component if will affect the location of another. This is a maintenance disaster. It is the job of the layout manager to set the size/location of the component automatically for you..

              – camickr
              Mar 9 at 15:28











            • @camickr I can agree with that, I guess I'm just not experienced enough to feel the flexibility of any of the layout managers.

              – Anthony Goodwin
              Mar 9 at 21:06











            • I'm just not experienced enough to feel the flexibility - the only way you get experience with anything in life is to do it. You don't gain experience by avoiding it. That is the benefit of a forums. You have a specific requirement you try to solve. If you have a problem then you ask a detailed question stating the requirement and generally somebody will be able to help you solve the problem. The real question with your code above, is why are some components 90 another 410 and another 500? Think of your web page. The size of components change as you change the size of the frame.

              – camickr
              Mar 9 at 23:17











            • You need to think more about the usage of the frame and less about the individual pixels. You need to think about when the frame size changes, which component or components change?

              – camickr
              Mar 9 at 23:19











            • @camickr I completely agree. Thank you for the kick in the @$$ .. This particular gui was just to see if I could move panels around, not to actually make anything. I'm now utilizing the default BorderLayout. However, I've now run into the issue that you cannot retrieve a panel's size parameters (width, height), to store them in a variable, and pass them as a width or height parameter for another method. I'm only seeing Listeners as a solution but I have the feeling there is something easier. Thanks for your help, for real.

              – Anthony Goodwin
              Mar 10 at 11:05

















            • I'll learn just like you all at some point. - the time to learn is now. Swing was designed to be used with layout managers (for too many reasons to list here). You should NOT be hardcoding numbers. With your code if you ever change the size of one component if will affect the location of another. This is a maintenance disaster. It is the job of the layout manager to set the size/location of the component automatically for you..

              – camickr
              Mar 9 at 15:28











            • @camickr I can agree with that, I guess I'm just not experienced enough to feel the flexibility of any of the layout managers.

              – Anthony Goodwin
              Mar 9 at 21:06











            • I'm just not experienced enough to feel the flexibility - the only way you get experience with anything in life is to do it. You don't gain experience by avoiding it. That is the benefit of a forums. You have a specific requirement you try to solve. If you have a problem then you ask a detailed question stating the requirement and generally somebody will be able to help you solve the problem. The real question with your code above, is why are some components 90 another 410 and another 500? Think of your web page. The size of components change as you change the size of the frame.

              – camickr
              Mar 9 at 23:17











            • You need to think more about the usage of the frame and less about the individual pixels. You need to think about when the frame size changes, which component or components change?

              – camickr
              Mar 9 at 23:19











            • @camickr I completely agree. Thank you for the kick in the @$$ .. This particular gui was just to see if I could move panels around, not to actually make anything. I'm now utilizing the default BorderLayout. However, I've now run into the issue that you cannot retrieve a panel's size parameters (width, height), to store them in a variable, and pass them as a width or height parameter for another method. I'm only seeing Listeners as a solution but I have the feeling there is something easier. Thanks for your help, for real.

              – Anthony Goodwin
              Mar 10 at 11:05
















            I'll learn just like you all at some point. - the time to learn is now. Swing was designed to be used with layout managers (for too many reasons to list here). You should NOT be hardcoding numbers. With your code if you ever change the size of one component if will affect the location of another. This is a maintenance disaster. It is the job of the layout manager to set the size/location of the component automatically for you..

            – camickr
            Mar 9 at 15:28





            I'll learn just like you all at some point. - the time to learn is now. Swing was designed to be used with layout managers (for too many reasons to list here). You should NOT be hardcoding numbers. With your code if you ever change the size of one component if will affect the location of another. This is a maintenance disaster. It is the job of the layout manager to set the size/location of the component automatically for you..

            – camickr
            Mar 9 at 15:28













            @camickr I can agree with that, I guess I'm just not experienced enough to feel the flexibility of any of the layout managers.

            – Anthony Goodwin
            Mar 9 at 21:06





            @camickr I can agree with that, I guess I'm just not experienced enough to feel the flexibility of any of the layout managers.

            – Anthony Goodwin
            Mar 9 at 21:06













            I'm just not experienced enough to feel the flexibility - the only way you get experience with anything in life is to do it. You don't gain experience by avoiding it. That is the benefit of a forums. You have a specific requirement you try to solve. If you have a problem then you ask a detailed question stating the requirement and generally somebody will be able to help you solve the problem. The real question with your code above, is why are some components 90 another 410 and another 500? Think of your web page. The size of components change as you change the size of the frame.

            – camickr
            Mar 9 at 23:17





            I'm just not experienced enough to feel the flexibility - the only way you get experience with anything in life is to do it. You don't gain experience by avoiding it. That is the benefit of a forums. You have a specific requirement you try to solve. If you have a problem then you ask a detailed question stating the requirement and generally somebody will be able to help you solve the problem. The real question with your code above, is why are some components 90 another 410 and another 500? Think of your web page. The size of components change as you change the size of the frame.

            – camickr
            Mar 9 at 23:17













            You need to think more about the usage of the frame and less about the individual pixels. You need to think about when the frame size changes, which component or components change?

            – camickr
            Mar 9 at 23:19





            You need to think more about the usage of the frame and less about the individual pixels. You need to think about when the frame size changes, which component or components change?

            – camickr
            Mar 9 at 23:19













            @camickr I completely agree. Thank you for the kick in the @$$ .. This particular gui was just to see if I could move panels around, not to actually make anything. I'm now utilizing the default BorderLayout. However, I've now run into the issue that you cannot retrieve a panel's size parameters (width, height), to store them in a variable, and pass them as a width or height parameter for another method. I'm only seeing Listeners as a solution but I have the feeling there is something easier. Thanks for your help, for real.

            – Anthony Goodwin
            Mar 10 at 11:05





            @camickr I completely agree. Thank you for the kick in the @$$ .. This particular gui was just to see if I could move panels around, not to actually make anything. I'm now utilizing the default BorderLayout. However, I've now run into the issue that you cannot retrieve a panel's size parameters (width, height), to store them in a variable, and pass them as a width or height parameter for another method. I'm only seeing Listeners as a solution but I have the feeling there is something easier. Thanks for your help, for real.

            – Anthony Goodwin
            Mar 10 at 11:05

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55060526%2fplease-provide-your-method-of-laying-out-and-resizing-jpanels-in-a-frame%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved