Skip to content

Commit cfc1374

Browse files
author
HackusatePvP
committed
Added help functions for Window.
1 parent a603f16 commit cfc1374

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/main/java/me/piitex/renjava/gui/Window.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,18 @@ public Stage getStage() {
355355
public Scene getScene() {
356356
return scene;
357357
}
358-
359358
public Pane getRoot() {
360359
return root;
361360
}
362361

362+
public int getWidth() {
363+
return width;
364+
}
365+
366+
public int getHeight() {
367+
return height;
368+
}
369+
363370
public boolean hasCaptureInput() {
364371
return captureInput;
365372
}
@@ -406,6 +413,24 @@ public void setContainers(LinkedList<Container> containers) {
406413
this.containers = containers;
407414
}
408415

416+
public void replaceContainer(Container oldContainer, Container newContainer) {
417+
if (containers.contains(oldContainer)) {
418+
int index = containers.indexOf(oldContainer);
419+
containers.remove(oldContainer);
420+
containers.add(index, newContainer);
421+
render();
422+
} else {
423+
RenLogger.LOGGER.warn("Could not find value to replace.");
424+
}
425+
}
426+
427+
public void replaceContainer(int index, Container container) {
428+
// Remove current index
429+
containers.remove(index);
430+
containers.add(index, container);
431+
render();
432+
}
433+
409434
public void removeContainer(Container container) {
410435
this.containers.remove(container);
411436
}
@@ -454,6 +479,16 @@ public void close() {
454479
}
455480
}
456481

482+
public void resetStage() {
483+
root.getChildren().clear();
484+
stage = new Stage();
485+
stage.hide();
486+
}
487+
488+
public void hide() {
489+
stage.show();
490+
}
491+
457492
public void buildAndRender() {
458493
buildStage();
459494
render();

0 commit comments

Comments
 (0)