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.
Related
As a means to display information on a website developed mainly with GWT and EXT-GWT, i am using a HTMLLayoutContainer. So far, the information it is displayed correctly, but it is too harsh or rough to display this way, meaning rough, not nice to see.
So the question is : Is there any other and nicer way to display (print, draw) information with GWT?.
If so, how?
You need to work on CSS
GWT CSS Ref
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
I know this question has been asked before on S.O. and other websites but I haven't found a definite answer -- most of them say its not easily done but I wanted to make sure that was the final verdict.
Here's my situation:
I'm testing a website that is using Highcharts (http://www.highcharts.com) using Selenium WebDriver (Java).
I basically want to grab the information that is displayed in a small tooltip pop-up that appears when you hover your mouse over each datapoint on the Highchart's line graph.
Looking at the web page's HTML code, I noticed there is <g class="highcharts-tooltip".... I also noticed that, as you move your mouse, the (X,Y) values in ...transform="translate(X,Y)"> change, which then changes the information displayed in the tool tip.
Knowing this, my approach would be to somehow grab all the (X,Y) values and plug them into the transform fields and grab the tooltip data. But I don't know how to programmatically grab all the (X,Y) values through Selenium.
Has anyone tackles this issue in the past or has a better way to grab the necessary information?
I started creating a library to work with HighCharts, what I currently have is available here:
https://github.com/Ardesco/Powder-Monkey/tree/master/src/main/java/com/lazerycode/selenium/graphs
It's quite hard to provide a generic library that deals with HighCharts as the customisation options on the individual charts can modify the SVG markup quite a bit. Hopefully the above will help to a degree.
As I do more it will be updated.
The Line Charts have to have a background to work. If the chart is created with .setBackgroundColour(null), then the "rect" is not added to the html.
I was able to to add the background colour back in set to the body background colour. However I'll try and figure out a way of doing it without the "rect".
I'm trying to convert BB code to HTML in Java for an Android project. An example of the text in which the bb code is embedded looks like this:
[b]This[/b] is some [url="http://www.example.com"]example[/url] text
to display my problem.
There also might be several paragraphs [i]of[/i] text and normal URLs http://www.example.com.
What it needs to look like in the TextView:
This is some example text to display my problem.
There also might be several paragraphs of text and normal URLs http://www.example.com.
Unfortunatly I don't have any code to show you since i don't know how to go about doing this. The only thing i can come up with now is making alot of regular expressions but i´m not sure if that would be the best solution.
Eventually this will all be displayed in an Android TextView.
Any help is appreciated!
There are some java BB-code libraries out there. Check this question for information on them.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How do I write superscript word for checkbox text in java?
So I have this very simple program that basically consists of a GUI with a few text fields and a button.
The idea is that the user enters numbers into three fields and presses the button. Then what happens is a few mathematical procedures are carried out in the background, and the resuling answer is presented in a fourth text field.
Now, this does the job, but the formatting looks awful. At the very least, I would like to have part of the output superscripted. I have next to no experience with these things, but thought I would be able to get the hang of this on my own, but I'm stuck. I think I need to use AttributedString and possibly Font, but I can't get anything to work. And I've found no tutorials.
Does anyone have any quick pointers? That'd be most helpful!
Do you need the output field to be editable? If not, try using a JLabel with HTML code. Something like:
jLabel4.setText("<html>ax<sup>2</sup>+bx+c</html>");
You can add a border to that JLabel to make it look like a text field.
Why not use other swing components that support HTML to display the answer like JLabel. If you use a JLabel for instance you can use inline html to format your answer
The reasons you are having difficulty has to do with the lack of a default typsetting system. Font selection and such typically provides a very limited means to do proper math typesetting (which is a specialized subset of general typesetting).
I don't know of any math specific typesetting already built-in to the Java libraries, that said, perhaps you can integrate the ExTex project into your Java components or roll your own solution using the 2d API (look at baseline offsetting).
Other alternatives are to generate a graphic, and display it's rendered image. If the display is static, this might be a much easier choice.