Skip to content

Commit

Permalink
added FxLogWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
xzel23 committed Apr 22, 2024
1 parent e1abcfc commit 89d0602
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions fx-util/src/main/java/com/dua3/fx/util/FxLogWindow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.dua3.fx.util;

import com.dua3.utility.logging.LogBuffer;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
* The FxLogWindow class represents a JavaFX window that displays log entries in a table view.
* It extends the Stage class.
*/
public class FxLogWindow extends Stage {

private final LogBuffer logBuffer;
private final FxLogPane logPane;

/**
* Create a new FxLogWindow instance with a new {@link LogBuffer} using the default capacity;
*/
public FxLogWindow() {
this(new LogBuffer());
}

/**
* Constructs a new instance of {@code FxLogWindow} with the specified maximum number of lines.
*
* @param maxLines the maximum number of lines to display in the log window
*/
public FxLogWindow(int maxLines) {
this(new LogBuffer(maxLines));
}

/**
* Constructs a new instance of {@code FxLogWindow} using the provided {@link LogBuffer}.
*
* @param logBuffer the LogBuffer to use
*/
public FxLogWindow(LogBuffer logBuffer) {
this.logBuffer = logBuffer;
logPane = new FxLogPane(this.logBuffer);
Scene scene = new Scene(logPane, 800, 400);
setScene(scene);
setTitle("Log");
}
}

0 comments on commit 89d0602

Please sign in to comment.