aspose file tools
The moose likes Applets and the fly likes calculator problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "calculator problem" Watch "calculator problem" New topic
Author

calculator problem

siddharth paul
Greenhorn

Joined: Apr 30, 2008
Posts: 20
I have created a calculator in applet using awt. I got a problem in textfield as when you type, textfield displays from left to right but calculator displays from right to left. So what should i do so that textfield should print from right.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35220
    
    7
You can pad whatever you want to display with spaces on the left side. If you use a monospaced font (like Courier) then the width taken up by a space character is the same as the width of any digit. So if you want to display a 5-digit number, you'd prepend 20 spaces to it (assuming your TextField is 25 characters wide).


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: calculator problem
 
Similar Threads
How do I make a text appear from the right in JTextWindow ?
about Textfield( simple isn't that)
Synchronization is not working as expected
How can I replace the standard Java icon?
Help to align Right :eek: