Adding emoji reaction by unicode not working - java

Currently, I am making a music discord bot and I want it to display the list of songs it is currently playing.
The user should be able to interact with the list by moving to each page with a left arrow and right arrow emoji.
The problem is that, when I try to react to the message via a unicode, it does not seems to work as follows:
message.addReaction("U+2B05").queue();
message.addReaction("U+2B07").queue();
it throws an error saying that the Emoji is not found during runtime, even though that is the respective unicode for the emoji I wanted to sent.
I have tried to use 2B05 or Left Arrow in the string and it does not work too.

Encountered the same issue before, though one of the answers from this question helped me.
Specifically, one of the answer was:
I understood how to do it. Just need to add this line
e.getChannel().sendMessage(embedBuilder.build()).complete().addReaction("✔").queue();
Apparently adding the emoji directly into the string works.
Do this instead:
message.addReaction("➡").queue();
message.addReaction("⬅").queue();

Related

Text not displaying properly in LWJGL (2D over 3D)

I have a problem with the text not displaying properly on my screen, It appears as a blank rectangle with the same text color, Just no text...
Everything else works fine though, Menus and crosshair and other 2D stuff renders fine. I'm using this tutorial: http://www.lwjgl.org/wiki/index.php?title=Slick-Util_Library_-_Part_3_-_TrueType_Fonts_for_LWJGL
getting this result:
EDIT: I managed to fix that issue, But now I have another problem, Text is displaying with a black background, Like this guys issue: http://www.java-gaming.org/index.php?topic=26944.0
but his fix which is disabling depth test does not work for me...
You might need to change the order in which your objects are rendered.To make sure it works correctly they should be rendered in back to front order. See here
Are you enabling GL_BLEND? If so, try setting glDepthMask(false); after the glDisable(GL_DEPTH_TEST).

Display 2D text on screen simply

I have been looking through forum posts, blogs, videos, and various other websites for the past hour trying to figure out how to display text on the screen. From what I have seen this is not very simple to do. (Maybe it is once you know how to actually do it)
I decided (with a bit of regret) to post this question here. I am sorry if this question has already been asked a million times, but I am just not understanding how to get this to work. All of the code I have tried so far has not worked.
I would just like to know how I can display text on the screen. I do not want to use my own font or anything fancy. I would just like to know the simplest way to display text on the screen.
The simplest way would be to use Slick. Here's a link to the page specifically about loading and using fonts within your LWJGL program:
Slick-Util (Part 3) - TrueType Fonts for LWJGL
I am learning java currently and I love the newbostin, he makes simple fast tutorials but to display text I'm pretty sure u need to
1: have eclipse
2: make the base of it (the main string, idk how actually)
3. The actual code to do it is println("text here")
I'm not completely sure so you should check out the newBoston he is awesome at explaining.

Unicode character ("\u232B") does not display on button

I'm building the keyboard of a calculator application for Android.
I'm using the unicode but the application did not display the button "erase to left"
static String[][] screen2L ={{"sin","asin","sinh","asinh","sind","asind","\u232B","AC"},
{"cos","acos","cosh","acosh","cosd","acosd","log2","gamma"},
{"tan","atan","tanh","atanh","tand","atand","log10","ln"}};
thanks
Unicode characters are not supported in all fonts. Check here to see the supported fonts for \u232B
Instead of using the character, make an image of the character and set it as the buttons background. A post that can help with that has already been answered here: How to make button with custom background image...
Also, as for using strings in java to print in your GUI, it's better practice to use xml for this. The buttons individual values would be stored to the app instead of having to assign them every time the app is run. I would write out instructions on how this is done, but the android developers guide that can be found here gives much better instructions than I could.

java swing jtextfiled unicode sinhala

***************************UPDATED***********************************************************************
i have found a similar question :
here : same question by another user
this one is with little details , but i still cant get it to work !
any help would be glad fully accepted !
I want to type Sinhalese words in (J2SE)swing textfileds , but they don't appear correctly in Java , same text in notepad shows correct word. how can i fix this ?
notepad picture:
http://imageupper.com/i/?S0200010080011O13734602521426968
java picture :
http://imageupper.com/i/?A0300010070011I13734604591427932
The same letters are in both images, so it's not problem of encoding.
The problem is that you have to set a proper font to the textfield. You can create the font if you don't have it, check this setting custom font
#AndrewThompson answer :)
Edit: That other user with the same question that you have mentioned is me. :)
As I found out, the char data type is not enough to render letters like "ශ්‍ර" because it needs 3 8bit characters. And the Java language isn't going to change the size of char data type just because we Sri Lankans want to render our characters. I had the similar question previously and I am the user you mentioned in your question.
"ශ්‍ ර" is shown with 2 8bit characters for each character and that's all we got till now. You might want to checout SWT because it shows characters pretty damn well in my experience.

Display a scrolling message that can be updates by another webpage

I'm looking for a solution to this and I have searched the web for an answer with nothing. I need a scrolling message on my webpage that can be updated by the same website but on a different page. (e.g www.webpage.com <-- has the scrolling message on it, www.webpage.com/settings <-- has a form in which you can change/update the scrolling message)
I'm pretty sure this is achievable with Java, but my knowledge on Java is slim and all my efforts have come to a fail. I have managed to get a scrolling message on my webpage and I'm sure if I could read a text file (with the message in) then assign that to a 'var', I could make that scroll but I don't know how to do that.
If you know a completely different method of doing this I am happy to change mine.
Thanks in advance,
Tom.
I would recommend javascript instead of java, since java is not really conventional anymore and looks ugly too (and requires a special plugin).
It depends on how fast you want to update the scrolling text how you want to do this. I would say save the text to a .txt or database from settings, and then have your page get it.
You can then use php to read the value from the .txt file or database to display it on your website.
If you want it to be extremely up to date you can let javasript call a little .php file that reads the file and gives you the content.
To make your text scroll you don't really need anything other than html, like so:
<marquee behavior="scroll" direction="left">Your scrolling text goes here</marquee>
You can read more about that here: http://www.quackit.com/html/codes/scrolling_text.cfm

Categories