Coder Social home page Coder Social logo

Comments (6)

Jugen avatar Jugen commented on June 15, 2024

It may be that the CodeArea has focus, you will see the cursor flash, then the placeholder will not show.
The placeholder only shows if there is no text and it does not have focus.

from richtextfx.

ljy1058318852 avatar ljy1058318852 commented on June 15, 2024

It may be that the CodeArea has focus, you will see the cursor flash, then the placeholder will not show. The placeholder only shows if there is no text and it does not have focus.

Thank you very much for your reply, but in fact, I have created multiple CodeAreas, and I have confirmed that none of them have obtained focus or entered a cursor.

from richtextfx.

Jugen avatar Jugen commented on June 15, 2024

Could you then provide a small test program that demonstrates the problem, as it works for me ?

from richtextfx.

ljy1058318852 avatar ljy1058318852 commented on June 15, 2024

This is fxml:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.StackPane?>
<?import org.fxmisc.richtext.CodeArea?>
<?import javafx.scene.layout.HBox?>

<StackPane fx:id="sPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.potato.potatotool.controller.PaneWebshellDecode">
   <HBox spacing="10">
      <CodeArea fx:id="result1" prefWidth="300" prefHeight="300" style="-fx-background-color: red"/>
      <CodeArea fx:id="result2" prefWidth="300" prefHeight="300"/>
      <CodeArea fx:id="result3" prefWidth="300" prefHeight="300" style="-fx-background-color: blue"/>
   </HBox>
</StackPane>

This is Controller:

package com.potato.potatotool.controller;

import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import org.fxmisc.richtext.CodeArea;

import java.io.IOException;

public class PaneWebshellDecode {
    @FXML
    private CodeArea result1;
    @FXML
    private CodeArea result2;
    @FXML
    private CodeArea result3;

    @FXML
    void initialize() throws IOException {
        TextFlow placeholder = new TextFlow (new Text("myText"));
        result1.setPlaceholder(placeholder, Pos.CENTER);
        result2.setPlaceholder(placeholder, Pos.CENTER);
        result3.setPlaceholder(placeholder, Pos.CENTER);
    }

}

richtextfx v0.10.8 java11.0.12

I'm very sorry, it may be due to network reasons that we are unable to upload the rendering. In fact, three CodeAreas did not appear as placeholder strings.

from richtextfx.

Jugen avatar Jugen commented on June 15, 2024

Ok, have found a bug and will submit a fix .....

By the way:

  1. The same placeholder cannot be used on multiple areas at the same time, as a Node may only occur once in the scene graph.
  2. And Text does not have to be wrapped in a TextFlow, just do: area.setPlaceholder( new Text("myText") );

from richtextfx.

ljy1058318852 avatar ljy1058318852 commented on June 15, 2024

Thank you for the quick fix! Appreciate it. 👍

from richtextfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.