-
Simple question I DON'T know the answer to
Hello everyone. This is my first post also my first question. I just started using Java about three months ago. So far I've really only done the basics. Still trying to learn it. Anyway, on with the question.
For my java class I have built a simple program to genreate a random number and then display the number. NOW I am charged with the task of building a GUI interface for this small program. I have already built the interface but I cannot for the life of me figure out the syntax involved in calling my custom number class and displaying the result on a canvas in my GUI program.
Any help is GREATLY appreciated.
-
Hi, Myth. Welcome !
Could you be a bit more specific as to how you want to display the random number ? If your GUI has a TextField or JTextField, Label or JLabel you can easily display it there. Or were you looking at an alert-type of display ?
Joyous Monkey
-
The GUI interface contains a canvas. I was trying to display the output of the RandomNumber.Class ON the canvas itself. Is that even possible?
-
you might be able to write it with this (not sure if it works)
drawString("Number: " + varName , x, y);
though a text field would be better
¿Red Baron?
[code] /* dont forget code tags! */ [/code]
Come visit the Café!
-
Here's Sun's own page dealing with Canvas
http://java.sun.com/products/jdk/1.1...wt.Canvas.html
Hope it helps
JM
-
Thank you for the replies guys. From reading your posts I got the idea to use a text field instead of the canvas and now it works. It seems that its a LOT easier to use the text field than the canvas. Anyway Thanks again guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks