File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help with equation editor

 
Slawomir Wieczorek
Greenhorn
Posts: 20
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I've been asked to write an applet or an application that will create a simple equation (using basic signs like /*+-). At the moment I don't really know where to start. Especially how to render the equation after lets say typing it in a text field or something. Should I use JLabels or java graphics drawstring or maybe something else?
Preferably I would use an MVC. Any suggestions? Please help!
P.S. I don't want to use ready made frameworks. I need to write all on my own...
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12024
25
Chrome Java Linux
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many folks will tell you this: StopCoding

Read that VERY carefully and thoroughly. Then read it again.


Any time someone says "I want to use X", they are putting the cart before the horse. That's like going to a construction site and saying "I am going to use a saw" - when what may be needed is a tool to drive nails into wood.

You should not let the technology drive your design, but let your design drive the technology.
 
Slawomir Wieczorek
Greenhorn
Posts: 20
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay the idea is to make a model class that will break the string onto separate signs/variables. The view part will use JPanels of nested JLabel inside with a sign or a variable. But how to arrange such blocks? What layout should I use?
for example:
A/B*A/B=B+B

should give:
http://postimage.org/image/5psqkhmc1/
 
Winston Gutkowski
Bartender
Pie
Posts: 9501
50
Eclipse IDE Hibernate Ubuntu
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Slawomir Wieczorek wrote:Okay the idea is to make a model class that will break the string onto separate signs/variables. The view part will use JPanels of nested JLabel inside with a sign or a variable.

Whoa there. You haven't even described what the "break the string into separate signs/variables" part is supposed to do, and you're already deciding how you're going to display it?

This is precisely what Fred was talking about:
Describe your solution in English (or your native language), NOT in Java-ese. The second you start putting Java class names into a description, we know that you've leapt to an implementation far too soon, so DON'T DO IT.

But how to arrange such blocks? What layout should I use?

My advice: Don't worry about it for the moment.

Your problem appears to have two major parts:
1. Breaking up the String.
2. Displaying the result.
and neither one has anything much to do with the other.

Get part 1 working properly first, and then deal with part 2. And even then, keep them as separate as you possibly can.

HIH

Winston
 
Slawomir Wieczorek
Greenhorn
Posts: 20
Eclipse IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You were right. It's just sometimes noobs like me need to declare some focus and patience. Problem solved...
 
Winston Gutkowski
Bartender
Pie
Posts: 9501
50
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Slawomir Wieczorek wrote:You were right. It's just sometimes noobs like me need to declare some focus and patience. Problem solved...

Glad to hear it. Sometimes, the best way to solve a problem is to StopCoding.

Winston
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:StopCoding

*don't write more than 10 lines or so without compiling* . it varies people capacity though . I would say write 1000 lines ..even never worry about compiler..it is just language dependent ;-)
 
Winston Gutkowski
Bartender
Pie
Posts: 9501
50
Eclipse IDE Hibernate Ubuntu
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seetharaman Venkatasamy wrote:I would say write 1000 lines ..even never worry about compiler..it is just language dependent ;-)

You've obviously never run into compiler vomit. I wouldn't stake my life on it, but I'm pretty sure it increases quadratically with uncompiled content

Winston
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn’t matter whether compiler vomit increases quadratically or linearly. Once the lines of compiler errors are more than the scroll capacity of the terminal, you are really up the creek.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic