How can I replace a JavaFX GridPane with another one? I try and I get a duplication errorJavaFX Glass Detected - How to run code away from GUI Javafxprogram that shuffles cards, when i hit the shuffle button the cards dissappear on the GUI windowsPostgresql PSQL Exception in Inserting to database using JavaGetting NullPointerException while changing file using fileChooser in media-playerload images dynamically in JavaFX to AnchorpaneConvert from java.util.Date to java.sql.Dateswitching between two Anchor PanesHow to send a “Put” request with a JSON object to a JSONPlaceHolder REST API in JavaGetting error while sending message to SocketServer server from socket client [JAVA]Java EOFException issue ObjectInputStream

How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?

Why is so much work done on numerical verification of the Riemann Hypothesis?

Delete multiple columns using awk or sed

Microchip documentation does not label CAN buss pins on micro controller pinout diagram

Is it necessary to use pronouns with the verb "essere"?

Is there any evidence that Cleopatra and Caesarion considered fleeing to India to escape the Romans?

Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?

What kind of floor tile is this?

What is going on with gets(stdin) on the site coderbyte?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

Can I turn my anal-retentiveness into a career?

Can I cause damage to electrical appliances by unplugging them when they are turned on?

What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?

Can I say "fingers" when referring to toes?

C++ copy constructor called at return

Mimic lecturing on blackboard, facing audience

Does "he squandered his car on drink" sound natural?

How to explain what's wrong with this application of the chain rule?

What is Cash Advance APR?

Is my low blitz game drawing rate at www.chess.com an indicator that I am weak in chess?

How to preserve electronics (computers, iPads and phones) for hundreds of years

When were female captains banned from Starfleet?

Can you use Vicious Mockery to win an argument or gain favours?

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?



How can I replace a JavaFX GridPane with another one? I try and I get a duplication error


JavaFX Glass Detected - How to run code away from GUI Javafxprogram that shuffles cards, when i hit the shuffle button the cards dissappear on the GUI windowsPostgresql PSQL Exception in Inserting to database using JavaGetting NullPointerException while changing file using fileChooser in media-playerload images dynamically in JavaFX to AnchorpaneConvert from java.util.Date to java.sql.Dateswitching between two Anchor PanesHow to send a “Put” request with a JSON object to a JSONPlaceHolder REST API in JavaGetting error while sending message to SocketServer server from socket client [JAVA]Java EOFException issue ObjectInputStream













0















Let's say I have two of the GridPane and a menu bar up top



// buttons
buttonLaunchOne = new Button("one");
buttonLaunchTwo = new Button("two")

// menu
GridPane menuLayout = new GridPane();
menuLayout.setMinSize(500, 500 );
menuLayout.setAlignment(Pos.TOP_CENTER);
menuLayout.add(buttonLaunchOne, 0, 0);
menuLayout.add(buttonLaunchTwo, 2, 0);

// one
GridPane twoLayout = new GridPane();
resultsLayout.add(buttonOne, 1, 1);

// two
GridPane oneLayout = new GridPane();
profileLayout.add(buttonTwo, 0, 1);


Then I have two action events



buttonLaunchOne.setOnAction(e -> 
menuLayout.add(firstLayout, 0, 1);
mainWindow.setTitle("Admin Portal: One");
);
buttonLaunchTwo.setOnAction(e ->
menuLayout.add(secondLayout, 0, 1);
mainWindow.setTitle("Admin Portal: Two");
);


here is the error



Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = Grid hgap=0.0, vgap=0.0, alignment=TOP_CENTER
at javafx.scene.Parent$2.onProposedChange(Parent.java:454)
at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
at javafx.scene.layout.GridPane.add(GridPane.java:965)
at sample.Main.lambda$start$1(Main.java:67)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)


I have tried this with a remove statement before adding the layouts and still get the error.
I just want to replace where one layout is with another one when a button is clicked.
I am not sure if what I want to do is really even possible, I just need insight. Thank you and if you need more of the code I have just ask, and I will do so! Thank you!










share|improve this question



















  • 1





    Please provide a Minimal, Complete, and Verifiable example that demonstrates the issue. The code snippets you posted refer to several elements whose code you've not included. Also, post the exact error messages you're getting.

    – Zephyr
    Mar 7 at 5:04











  • I have already added the error code, I edited it before I saw this comment. My bad. This is the only thing that has anything to do with what I need. I will try and add more.

    – I'm A Decent Programmer I Hope
    Mar 7 at 5:10











  • did you try getchildren().clear instead of remove?

    – ivaylo
    Mar 7 at 6:15















0















Let's say I have two of the GridPane and a menu bar up top



// buttons
buttonLaunchOne = new Button("one");
buttonLaunchTwo = new Button("two")

// menu
GridPane menuLayout = new GridPane();
menuLayout.setMinSize(500, 500 );
menuLayout.setAlignment(Pos.TOP_CENTER);
menuLayout.add(buttonLaunchOne, 0, 0);
menuLayout.add(buttonLaunchTwo, 2, 0);

// one
GridPane twoLayout = new GridPane();
resultsLayout.add(buttonOne, 1, 1);

// two
GridPane oneLayout = new GridPane();
profileLayout.add(buttonTwo, 0, 1);


Then I have two action events



buttonLaunchOne.setOnAction(e -> 
menuLayout.add(firstLayout, 0, 1);
mainWindow.setTitle("Admin Portal: One");
);
buttonLaunchTwo.setOnAction(e ->
menuLayout.add(secondLayout, 0, 1);
mainWindow.setTitle("Admin Portal: Two");
);


here is the error



Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = Grid hgap=0.0, vgap=0.0, alignment=TOP_CENTER
at javafx.scene.Parent$2.onProposedChange(Parent.java:454)
at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
at javafx.scene.layout.GridPane.add(GridPane.java:965)
at sample.Main.lambda$start$1(Main.java:67)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)


I have tried this with a remove statement before adding the layouts and still get the error.
I just want to replace where one layout is with another one when a button is clicked.
I am not sure if what I want to do is really even possible, I just need insight. Thank you and if you need more of the code I have just ask, and I will do so! Thank you!










share|improve this question



















  • 1





    Please provide a Minimal, Complete, and Verifiable example that demonstrates the issue. The code snippets you posted refer to several elements whose code you've not included. Also, post the exact error messages you're getting.

    – Zephyr
    Mar 7 at 5:04











  • I have already added the error code, I edited it before I saw this comment. My bad. This is the only thing that has anything to do with what I need. I will try and add more.

    – I'm A Decent Programmer I Hope
    Mar 7 at 5:10











  • did you try getchildren().clear instead of remove?

    – ivaylo
    Mar 7 at 6:15













0












0








0








Let's say I have two of the GridPane and a menu bar up top



// buttons
buttonLaunchOne = new Button("one");
buttonLaunchTwo = new Button("two")

// menu
GridPane menuLayout = new GridPane();
menuLayout.setMinSize(500, 500 );
menuLayout.setAlignment(Pos.TOP_CENTER);
menuLayout.add(buttonLaunchOne, 0, 0);
menuLayout.add(buttonLaunchTwo, 2, 0);

// one
GridPane twoLayout = new GridPane();
resultsLayout.add(buttonOne, 1, 1);

// two
GridPane oneLayout = new GridPane();
profileLayout.add(buttonTwo, 0, 1);


Then I have two action events



buttonLaunchOne.setOnAction(e -> 
menuLayout.add(firstLayout, 0, 1);
mainWindow.setTitle("Admin Portal: One");
);
buttonLaunchTwo.setOnAction(e ->
menuLayout.add(secondLayout, 0, 1);
mainWindow.setTitle("Admin Portal: Two");
);


here is the error



Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = Grid hgap=0.0, vgap=0.0, alignment=TOP_CENTER
at javafx.scene.Parent$2.onProposedChange(Parent.java:454)
at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
at javafx.scene.layout.GridPane.add(GridPane.java:965)
at sample.Main.lambda$start$1(Main.java:67)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)


I have tried this with a remove statement before adding the layouts and still get the error.
I just want to replace where one layout is with another one when a button is clicked.
I am not sure if what I want to do is really even possible, I just need insight. Thank you and if you need more of the code I have just ask, and I will do so! Thank you!










share|improve this question
















Let's say I have two of the GridPane and a menu bar up top



// buttons
buttonLaunchOne = new Button("one");
buttonLaunchTwo = new Button("two")

// menu
GridPane menuLayout = new GridPane();
menuLayout.setMinSize(500, 500 );
menuLayout.setAlignment(Pos.TOP_CENTER);
menuLayout.add(buttonLaunchOne, 0, 0);
menuLayout.add(buttonLaunchTwo, 2, 0);

// one
GridPane twoLayout = new GridPane();
resultsLayout.add(buttonOne, 1, 1);

// two
GridPane oneLayout = new GridPane();
profileLayout.add(buttonTwo, 0, 1);


Then I have two action events



buttonLaunchOne.setOnAction(e -> 
menuLayout.add(firstLayout, 0, 1);
mainWindow.setTitle("Admin Portal: One");
);
buttonLaunchTwo.setOnAction(e ->
menuLayout.add(secondLayout, 0, 1);
mainWindow.setTitle("Admin Portal: Two");
);


here is the error



Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Children: duplicate children added: parent = Grid hgap=0.0, vgap=0.0, alignment=TOP_CENTER
at javafx.scene.Parent$2.onProposedChange(Parent.java:454)
at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
at javafx.scene.layout.GridPane.add(GridPane.java:965)
at sample.Main.lambda$start$1(Main.java:67)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)


I have tried this with a remove statement before adding the layouts and still get the error.
I just want to replace where one layout is with another one when a button is clicked.
I am not sure if what I want to do is really even possible, I just need insight. Thank you and if you need more of the code I have just ask, and I will do so! Thank you!







java user-interface javafx children






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 5:12







I'm A Decent Programmer I Hope

















asked Mar 7 at 5:01









I'm A Decent Programmer I HopeI'm A Decent Programmer I Hope

256




256







  • 1





    Please provide a Minimal, Complete, and Verifiable example that demonstrates the issue. The code snippets you posted refer to several elements whose code you've not included. Also, post the exact error messages you're getting.

    – Zephyr
    Mar 7 at 5:04











  • I have already added the error code, I edited it before I saw this comment. My bad. This is the only thing that has anything to do with what I need. I will try and add more.

    – I'm A Decent Programmer I Hope
    Mar 7 at 5:10











  • did you try getchildren().clear instead of remove?

    – ivaylo
    Mar 7 at 6:15












  • 1





    Please provide a Minimal, Complete, and Verifiable example that demonstrates the issue. The code snippets you posted refer to several elements whose code you've not included. Also, post the exact error messages you're getting.

    – Zephyr
    Mar 7 at 5:04











  • I have already added the error code, I edited it before I saw this comment. My bad. This is the only thing that has anything to do with what I need. I will try and add more.

    – I'm A Decent Programmer I Hope
    Mar 7 at 5:10











  • did you try getchildren().clear instead of remove?

    – ivaylo
    Mar 7 at 6:15







1




1





Please provide a Minimal, Complete, and Verifiable example that demonstrates the issue. The code snippets you posted refer to several elements whose code you've not included. Also, post the exact error messages you're getting.

– Zephyr
Mar 7 at 5:04





Please provide a Minimal, Complete, and Verifiable example that demonstrates the issue. The code snippets you posted refer to several elements whose code you've not included. Also, post the exact error messages you're getting.

– Zephyr
Mar 7 at 5:04













I have already added the error code, I edited it before I saw this comment. My bad. This is the only thing that has anything to do with what I need. I will try and add more.

– I'm A Decent Programmer I Hope
Mar 7 at 5:10





I have already added the error code, I edited it before I saw this comment. My bad. This is the only thing that has anything to do with what I need. I will try and add more.

– I'm A Decent Programmer I Hope
Mar 7 at 5:10













did you try getchildren().clear instead of remove?

– ivaylo
Mar 7 at 6:15





did you try getchildren().clear instead of remove?

– ivaylo
Mar 7 at 6:15












0






active

oldest

votes











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%2f55036404%2fhow-can-i-replace-a-javafx-gridpane-with-another-one-i-try-and-i-get-a-duplicat%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f55036404%2fhow-can-i-replace-a-javafx-gridpane-with-another-one-i-try-and-i-get-a-duplicat%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

1928 у кіно

Захаров Федір Захарович

Ель Греко