473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

User change of curve shapes

PA
Hi,
I want to implement the following in an applet:

^
|
| + + + + + +H
| +
| +
| H
| +
| +
| +
| H+++++++H
|
|
|-------------------------------------->

Given this chart the user can change the shape of the curve
by dragging the handles H up/down or left/right.

Have you seen this before?
And can you give me with some tips / hints or even API's
that can help me?

TIA,

-- pa
Jul 17 '05 #1
2 2236
SPG
Have a look at the JHotDraw package.
Really powerful drawing api.

Good luck!

"PA" <Pa***@hotmail.com> wrote in message
news:Ne********************@newsb.telia.net...
Hi,
I want to implement the following in an applet:

^
|
| + + + + + +H
| +
| +
| H
| +
| +
| +
| H+++++++H
|
|
|-------------------------------------->

Given this chart the user can change the shape of the curve
by dragging the handles H up/down or left/right.

Have you seen this before?
And can you give me with some tips / hints or even API's
that can help me?

TIA,

-- pa

Jul 17 '05 #2
PA <Pa***@hotmail.com> wrote in message news:<Ne********************@newsb.telia.net>...
Hi,
I want to implement the following in an applet:

^
|
| + + + + + +H
| +
| +
| H
| +
| +
| +
| H+++++++H
|
|
|-------------------------------------->

Given this chart the user can change the shape of the curve
by dragging the handles H up/down or left/right.


Try java.awt.geom.Shape
Say you're drawing on p, an instance of some subclass of JComponent
that you're writing. Then p.getGraphics() returns g, a Graphics
object. But g is actually of class java.awt.Graphics2D, and you can
cast it to that class. Then override the paintComponent method in p's
class to use draw(Shape).

public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.draw(myShape1);
g2.draw(myShape2);
// etc.
}

One Shape that gives straight lines is java.awt.geom.Line2D.Float.

If the thing on the right is a parabolic or elliptical segment with an
H in the middle, then try java.awt.geom.Quad2D.Float. Quad2D has a
"control point" which is related to the midpoint of the arc, though it
hovers a certain distance away from that midpoint.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kate | last post by:
Hi: Well, I finally jumped into User Controls and am immediately over my head. I have gone through the Help file pages and tutorials completely, getting a vague feeling what I want to do is...
2
by: Rom | last post by:
I need to create a utility that presents the user with a "canvas" and allows them to add geometric shapes, including lines and circles. These must be drag-able (that is, once they're on the canvas,...
5
by: Rob T | last post by:
I'm having problem pasting a user defined object that's put into the clipboard.... Here's a crude example of what I'm trying to get done. Dim fromShapes as Shapes 'shapes is my custom object...
2
by: Dursun | last post by:
Collegues, is it possible to do the foloowing: Let end user draw specific shapes (a circle that has a number within it and a connector that points to a specific area on the background image)...
1
by: Anthony Sox | last post by:
anyone know a good book or online resource on user control design in windows forms. thanks
4
by: RedHair | last post by:
I developed a Win form with VS.NET 2005 + .NET 2.0 in C# There are some application settings are "User" scope and stored in xxx.settings, I can access them via Settings class and changethem with...
1
by: panki | last post by:
Hi friends, I am having a little problem. I want to change the shapes of form and buttons in vb.net. Please tell me how I can do this. Replay fast please.
1
by: johnson.bj | last post by:
I have a relatively minor problem that has been bugging me for a long time. I have created a user control which consists of a few panels and labels. What I want to do with this user control is to...
15
by: Sunny | last post by:
Hi, I can change the lement opacity in IE using. abc.style.filter = 'alpha(opacity=' + 10 + ')'; But this dont work in firefox, In firefox it throws error. How I can change the opacity of an...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.