Graphics object won't draw the arrow chars from CharSet IBM437
I'm overriding a JPanel and trying to draw text with Graphics.drawChars.
I can print the same exact char to the console right after it's drawn by drawChars and it correctly prints as the arrow.
It has the same behavior for all 4 arrows, chars 24 to 27.
I create the original string like this:
And that string also prints fine to the console.
Thanks
16 Replies
⌛ This post has been reserved for your question.
Hey @adamfh! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
this is likely due to the fact that the
Font in the Graphics context you're using does not have glyphs for the arrow characters you're trying to print. have you made sure to choose a font that supports IBM437? if your console is able to display them, try that font first. I assume it will be the same font as your IDE uses. having said that, if you copy the arrows from the console into your ide, do they display? if so you can check you IDEs font and use that in you JPanel to see if that fixes the issue...I don't use an IDE really. I switched to unicode. I am using Monospaced for the font family.
'Consolas' is what my console uses, and that doesn't seem to work.
They print directly in the console. I can't copy them from the JPanel.
Thanks for the suggestions. I guess I'll stick with Unicode for now.
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
i'm sorry my suggestion didn't work but just out of curiosity how are you coding in Java and creating a JFrame if not in an IDE?
with code, in sublime 3
ahh, and you're running it from the terminal! gotcha
Im doing scala and running it from the sbt prompt
i mean you could still try copying them from the terminal into sublime.
ah
never mind then ahha
good luck 🙂
mm ill try that
That did work, except the left arrow doesn't print on the terminal.
if you haven't changed the default Sublime faont, it'll either be
monospace, Consolas or Menlo-Regular. you can find out in Preferences → Settings—User
ah
so it does seem that the font being used in your JFrame does not support IBM437ill just use unicode, it';s working now. i don't need to recreate this thing using actual IBM437 anyway
ah all the better then, have fun!
thanks
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@876309130879598592>.