Java - Multi-colored text

I would like to have some text but have each character have more colors. Here is an example, please ignore the eggs for o's, those are just part of my logo. The first image was created with Photoshop and the second with Word. <img src="https://i.stack.imgur.com/EVpuK.png" alt="enter image description here">

But instead of that showing, this is shown instead: <img src="https://i.stack.imgur.com/JW3IB.png" alt="enter image description here">

This does make sense because it is a font and the font has no color in it whatsoever but I want to know if there is a way to make the text colored and shaded differently like the 'N' appears in TYCOON. This would be displayed in a JLabel. Any help is appreciated!


It's going to be pretty hard to convert text into a fancy logo... Instead use images.

Put your text into photoshop and export it as an image (like you did). Then use the image in place of the text.


First, you need to create an image for each character containing the (fancy) color you need (e.g. in PhotoShop or whatever other application you use to create images for your game).

Next, you need to use these images to draw the texts, instead of using regular fonts and the JLabel. So that requires (slightly) more work...

As you do not provide any details on the Java components/libraries you use, I can only provide some pseudo-code as an example:

String text = "My colorful text"; int x = START_X; //< x-coordinate of next char int y = START_y; //< y-coordinate of next char for (int i = 0; i < text.length(); i++) { char c = text.charAt(i)); switch(c) { case ' ': //Space, increase x-coordinate x += SPACE_WIDTH; break; case '\n': // New line, reset x-coordinate and increase y-coordinate x = START_X; y += LINE_HEIGHT; default: // Draw character at x, y and increase x-coordinate charImage = getImage(c); drawCharacter(x, y, charImage); x += charImage.getWidth(); } }

This (pseudo-code) example assumes you have

    <li>a method that finds the correct image for a given character: getImage()</li> <li>a method to draw the image: drawCharcter()</li> <li>a method to find the width of an image: getWidth()</li> </ul>

    Furthermore, you probably need some extra checks/case-statements to handle other special characters you might encounter. But the example should help you setup the code to tackle your problem.


  • Make UIView and subviews translucent as one layer, not individually
  • How to use the Photoshop PSD design file in your xCode?
  • Possible to replace cursor with my own custom image?
  • Photoshop like Magic Wand for selecting pixels of a similar color, but in VB.NET
  • Is it really necessary to provide all the different app icon sizes for an iOS app?
  • How to center this rotating image (CSS animation)
  • how convert RGB or CMYK color to percentage CMYK - javascript
  • Deploying pre-encrypted configuration files to a production environment
  • Instanciate service on startup in Angular2
  • get passwords from chrome
  • C# - Most efficient way to iterate through multiple arrays/list
  • How to access meteor package name inside package?
  • netsh acl setting (need alternative method - registry settings?)
  • How to get latest version of a artifact on Bintray using JSONP
  • Tell Git to stop prompting me for conflicts when none really exist?
  • Excel's Macro-Recorder usage
  • Remove final comma from string in vb.net
  • How to use carriage return with multiple line?
  • HTTP/2 streams vs HTTP/1.1 connections
  • Custom Tabgroup Appcelerator
  • Java: can you cast Class into a specific interface?
  • Syntax for setting draggablecursor property in google maps api
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Different response to non-authenticated users and AJAX calls
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • Weird JavaScript statement, what does it mean?
  • GridView Sorting works once only
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Comma separated Values
  • How to get icons for entities from eclipse?
  • python regex in pyparsing
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • need help with bizarre java.net.HttpURLConnection behavior
  • Observable and ngFor in Angular 2