the title already describes my problem. I want to color single letters or sequences of letters in a JFX Button but not the whole text. I found a solution for swing components Is it possible to change the text color in a string to multiple colors in Java? but not for javafx yet. Can anyone help me plz?
Color Single Letters in JavaFX Buttontexts
1.5k Views Asked by gimba At
2
There are 2 best solutions below
0
tomorrow
On
This is just the FXML form of Uluk Biy's answer:
<Button>
<graphic>
<HBox spacing="0.0">
<Label text="Colors " style="-fx-text-fill: yellow; -fx-background-color: #1156cf;" />
<Label text="are " style="-fx-text-fill: red; -fx-background-color: #11cf56;" />
<Label text="cool!" style="-fx-text-fill: blue; -fx-background-color: #cf1156;" />
</HBox>
</graphic>
</Button>
...and yes, I love answering 7 years old questions. ;-)
Related Questions in BUTTON
- change content button with trigger
- PHP like button(counter) inside a table
- How can I make a button who draws a line
- Scrollable webpage navigation
- Two checkbuttons to toggle sound not working right
- HTML Button Link to Website from Text
- Unity - Gui Button issues (Android)
- I can't click the finish button it seemed to be like disabled or something
- Button Visibility in WPF at startup
- Changing background of button every second
- How do I convert point to local coordinates?
- Flash CS3: Text appears on button mouse over or text mouse over
- Android : Unable to change width of dynamic button
- Change button background with an action
- Android how am I supposed to get text using button
Related Questions in JAVAFX-2
- Black Screen - Default Gluon Project
- java awt color chooser does't show in proper way in JavaFx
- Getting Java javafx.fxml.LoadException: in IntelliJ and JavaFX scene builder
- Comparing 2 dates javafx
- Why cant I input data into the <input type="text"> inside InfoWindow (Google Map)
- How to populate data in table view with user input on button click in javaFX
- Javafx: TableView change row color based on column value
- How to analyze incoming message (JavaFX on Android)
- How to store data in SqlLite database (JavaFX on Android)
- JavaFx:What if I want to do something after initialize(),before the scene show,how can I achieve this?
- javafx : Scroll Pane bounds and its visible content bounds are not matching even when the scroll Vvalue = 0
- I need to select or read only .config files via file chooser in java fx can any one help me
- JavaFX Stage wont show in Android
- JavaFX: Load scene from FXML but add label from code
- javafx get width and height of a scaled Pane to resize canvas and redraw inside canvas
Related Questions in LETTERS
- Python not detecting a single letter, but detects two letters fine
- German unicode letters don't show up in app
- Modify compareTo in Android
- Letters stored as integers
- In a Java Memory game, how do I trigger that 2 unknown has been discovered, and make them stay revealed for the rest of the game?
- CSS make every letter in a text of a different colour
- Batch file to allow encrypt and decrypt capital letters for this code
- DOMPDF does not support Cyrillic characters. Easy fix?
- Calculating the letter frequency, also involving double letters
- Trouble with Python excersice - Convert letters to numbers in order (using ord and chr)
- Combining two strings into one string which eliminates the same letters in C
- Generating characters randomly with proper frequencies
- Convert Letters & Numbers in a Phone Number to all Numbers (Java)
- How to convert Cyrillic letters to English latin in Java String?
- captcha modify six letters
Related Questions in TEXT-COLORING
- knitr kable: Text color in PDF from RNW is grey
- Richer Coloring and Typesetting in DDoc Output
- How to colour methods and functions in Qt Creator's text editor?
- Change text color in header in TCPDF
- h5 style does not show color effect
- How to parse commands and color it?
- Defining new keywords with font-lock-add-keywords breaks/overrides variable-name coloring (emacs)
- Change the color of an inputdlg field name
- Reset the console color to its default in c++ for linux console
- Invoke grc terminal colorizer on ALL commands implicitly
- how to stop text color function under conio.h in C to align the output to right??is there any way to reset text attributes to normal in C
- Color Single Letters in JavaFX Buttontexts
- Two TextBlocks with same Color (Opacity) and diffrent Fontsizes appear diffrently
- Why won't ">> " print at the end of my printf statement?
- Highlight tab-separated values based on a couple of rules
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Check this out
Output