@@ -164,6 +164,7 @@ private final class LogWindowImpl extends Control {
164164
165165 private final ListView <Log > listView = new JFXListView <>();
166166 private final BooleanProperty autoScroll = new SimpleBooleanProperty ();
167+ private final BooleanProperty wrapText = new SimpleBooleanProperty (true );
167168 private final StringProperty [] buttonText = new StringProperty [LEVELS .length ];
168169 private final BooleanProperty [] showLevel = new BooleanProperty [LEVELS .length ];
169170 private final JFXButton btnAlwaysOnTop = FXUtils .newToggleButton4 (SVG .KEEP , 20 );
@@ -174,7 +175,6 @@ private final class LogWindowImpl extends Control {
174175 LogWindowImpl () {
175176 getStyleClass ().add ("log-window" );
176177
177- listView .getStyleClass ().add ("no-horizontal-scrollbar" );
178178 listView .getProperties ().put ("no-smooth-scrolling" , true );
179179 listView .setItems (FXCollections .observableList (new CircularArrayList <>(logs .size ())));
180180
@@ -331,11 +331,26 @@ private static final class LogWindowSkin extends SkinBase<LogWindowImpl> {
331331 getStyleClass ().add ("log-window-list-cell" );
332332 Region clippedContainer = (Region ) listView .lookup (".clipped-container" );
333333 if (clippedContainer != null ) {
334- maxWidthProperty ().bind (clippedContainer .widthProperty ());
335- prefWidthProperty ().bind (clippedContainer .widthProperty ());
334+ wrapTextProperty ().addListener ((obs , oldWrap , nowWrap ) -> {
335+ if (nowWrap ) {
336+ maxWidthProperty ().bind (clippedContainer .widthProperty ());
337+ prefWidthProperty ().bind (clippedContainer .widthProperty ());
338+ listView .getStyleClass ().add ("no-horizontal-scrollbar" );
339+ } else {
340+ maxWidthProperty ().unbind ();
341+ prefWidthProperty ().unbind ();
342+
343+ setMaxWidth (Region .USE_PREF_SIZE );
344+ setPrefWidth (Region .USE_COMPUTED_SIZE );
345+ listView .getStyleClass ().remove ("no-horizontal-scrollbar" );
346+ }
347+
348+ // only for horizontal scrollbar
349+ listView .requestLayout ();
350+ });
336351 }
337352 setPadding (new Insets (2 ));
338- setWrapText ( true );
353+ wrapTextProperty (). bind ( control . wrapText );
339354 setGraphic (null );
340355 }
341356
@@ -395,6 +410,10 @@ protected void updateItem(Log item, boolean empty) {
395410 autoScrollCheckBox .setSelected (true );
396411 control .autoScroll .bind (autoScrollCheckBox .selectedProperty ());
397412
413+ JFXCheckBox wrapTextCheckBox = new JFXCheckBox (i18n ("logwindow.wrap_text" ));
414+ wrapTextCheckBox .setSelected (true );
415+ control .wrapText .bind (wrapTextCheckBox .selectedProperty ());
416+
398417 JFXButton exportLogsButton = new JFXButton (i18n ("button.export" ));
399418 exportLogsButton .setOnAction (e -> getSkinnable ().onExportLogs ());
400419
@@ -414,7 +433,7 @@ protected void updateItem(Log item, boolean empty) {
414433
415434 JFXButton clearButton = new JFXButton (i18n ("button.clear" ));
416435 clearButton .setOnAction (e -> getSkinnable ().onClear ());
417- hBox .getChildren ().setAll (autoScrollCheckBox , exportLogsButton , terminateButton , exportDumpPane , clearButton );
436+ hBox .getChildren ().setAll (autoScrollCheckBox , wrapTextCheckBox , exportLogsButton , terminateButton , exportDumpPane , clearButton );
418437
419438 control .getGameProcess ().getProcess ()
420439 .onExit ()
0 commit comments