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

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

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

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Tech Answered Logo Tech Answered Logo
Sign InSign Up

Tech Answered

Tech Answered Navigation

  • Home
  • Tutorials
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us
Home / Questions /Q 720
Next
In Process
shree
shree

shree

  • India
  • 138 Questions
  • 69 Answers
  • 2 Best Answers
  • 200 Points
View Profile
  • 0
shree
Asked: September 8, 20202020-09-08T10:38:37+05:30 2020-09-08T10:38:37+05:30In: Java

exception in thread awt-eventqueue-0” java awt awterror boxlayout can t be shared

  • 0

I faced the following java error “exception in thread awt-eventqueue-0” java awt awterror boxlayout can t be shared”

 

  1. Exception in thread “AWT-EventQueue-0” java.awt.AWTError: BoxLayout can’t be shared
    at javax.swing.BoxLayout.checkContainer(Unknown Source)
    at javax.swing.BoxLayout.invalidateLayout(Unknown Source)
    at javax.swing.BoxLayout.addLayoutComponent(Unknown Source)
    at java.awt.Container.addImpl(Unknown Source)
    at java.awt.Container.add(Unknown Source)
    at javax.swing.JFrame.addImpl(Unknown Source)
    at java.awt.Container.add(Unknown Source)
    at GUI.run(GUI.java:64)

I used import of box layout at program.
import javax.swing.BoxLayout;

awt awterror boxlayout can t be shared solvedfix awt-eventqueue-0'' java errorhow to fix awt-eventqueue-0'' java awt awterror boxlayout can t be sharedjava errorsjava exception
  • 1
  • 1,992
  • 0
  • 0
Answer
Share
  • Facebook

    Related Questions

    • How to resolve the issue java.lang.OutOfMemoryError: Java heap space?
    • e java.lang.noclassdeffounderror javax/xml/bind/jaxbexception
    • java equals int cannot be dereferenced how to fix
    • java error code 1603 how to fix
    • java error: could not find or load main class how to fix
    • java error boolean cannot be dereferenced
    • How to solve null pointers should not be dereferenced sonar fix

    1 Answer

    1. simple ram
      2020-09-08T10:46:31+05:30Added an answer on September 8, 2020 at 10:46 am

      Maybe you want to program box layout in java,and the exception in thread awt-eventqueue-0” java awt awterror boxlayout can t be shared error maybe because you missed creating a reference object for box layout.

      For rich GUI elements in java,these layouts are useful.java awt awterror can be fixed if you can create a reference object first.

      creation of box layout,so the above error maybe due to that you missed creation of box layout. You can just create a box layout object first ,like as i shown in the below code and than you can call with “window.add(boxlayoutpane);”

      // this is initial creation of box layout
      JPanel boxlayoutpane = new JPanel();
      boxlayoutpane.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
      window.setContentPane(boxlayoutpane);

      when you want to use the created box layout object

      //calling the box layout object…

      boxlayoutpane.add(display); // boxlayoutpane is the reference object for box layout
      boxlayoutpane.add(action1);
      boxlayoutpane.add(action2);
      boxlayoutpane.add(action3);
      window.add(boxlayoutpane);

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    More Questions

    • dynamicapps5

      how to solve error illegal start of expression in java

    • sita

      write a program to calculate the electricity bill in java

    • Himasree

      How to insert data in java through database?

    • Swathi

      How to run java code in eclipse

    • Swathi

      What is null pointer exception in java?

    • kiran kumar85

      javascript validation client side and submitting to database using webspring

    • Rashika

      When to use volatile variable in Java?

    • Aniya

      how to fix java error in tlauncher authentication

    Stats

    • Questions 1,991
    • Answers 2,102
    • Posts 12
    • Best Answers 73

    Related Questions

    • Rashika

      How to resolve the issue java.lang.OutOfMemoryError: Java heap space?

    • Mingle tap

      e java.lang.noclassdeffounderror javax/xml/bind/jaxbexception

    • Aniya

      java equals int cannot be dereferenced how to fix

    • Aniya

      java error code 1603 how to fix

    • shree

      java error: could not find or load main class how to fix

    • shree

      java error boolean cannot be dereferenced

    • Aniya

      How to solve null pointers should not be dereferenced sonar fix

    • Mingle tap

      Exception get java.lang.NullPointerException when setting up c/c++ build 2020

    Explore

    • Home
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help

    Footer

    Recent Comments

    • muller on how to solve export problem in kinemaster
    • muller on how to solve export problem in kinemaster
    • muller on how to solve export problem in kinemaster
    • AaronBlackburn on why can’t i find my message requests on instagram
    • shree on How to use philips citrus press juicer 25 watts Demo
    Ask A Question

    Archives

    Tags

    laptop buying guide (1) limit google news notifications (1) printer buying guide (1) stop google news notifications (1) turn off google news notifications (1)

    Social media

    © 2023 @ Techanswered.com.
    Terms, Privacy policy & Sitemap.

    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.