
Signature
Michele
http://brunocremer.com/
> I would like to adapt an old code. I use Sun Studio Creator 2. I
> succeeded in part of the deprecated code but I got stuck about the mouse
[quoted text clipped - 4 lines]
> --------------
> public boolean mousedown(Event event, int i, int j) {
There is no mousedown() method in the whole of Java SE. If you mean
mouseDown(), java.awt.Component has one (you could at least have had the
courtesy to post real code and mention which class you are talking about).
> I found out that mouse_pressed should be used instead of mousedown
If you talk about Component.mouseDown(), the API documentation will tell
you it has been replaced by Component.processMouseEvent(MouseEvent).
There is no mouse_pressed method or constant in Java. There is an int
constant MOUSE_PRESSED in MouseEvent. You are supposed to check the
event ID against that constant to figure out which type of event you got.
However, you apparently use the old 1.0 event model. That one has been
replaced in Java 1.1 - almost ten years ago. You should consider
rewriting that stuff to use the "new" 1.1 event model.
And you should recognize that Java is a language where case matters.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Michele - 03 Mar 2006 14:04 GMT
Thomas Weidenfeller a utilisé son clavier pour écrire :
>> I would like to adapt an old code. I use Sun Studio Creator 2. I succeeded
>> in part of the deprecated code but I got stuck about the mouse events
[quoted text clipped - 7 lines]
> mouseDown(), java.awt.Component has one (you could at least have had the
> courtesy to post real code and mention which class you are talking about).
I told in my title that I am a beginner and I mean a begginer, I didn't
know that case matters in java.
I thought that using a simple sample could help.
It's not a matter of courtesy as you say, I wrote what I thought was
important.
>> I found out that mouse_pressed should be used instead of mousedown
>
> If you talk about Component.mouseDown(), the API documentation will tell you
> it has been replaced by Component.processMouseEvent(MouseEvent).
This I saw but there are not a lot of info about how to use this
component, no complete sample and it's what I need.
> However, you apparently use the old 1.0 event model. That one has been
> replaced in Java 1.1 - almost ten years ago. You should consider rewriting
> that stuff to use the "new" 1.1 event model.
The java file is dated of 2001, I didn't thought it was 10 years old.
Sorry
> And you should recognize that Java is a language where case matters.
>
> /Thomas
Thanks anyway for answering but please treat begginers as beginners and
not as if they wrote mistakes on purpose.

Signature
Michele
http://brunocremer.com/
http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=clk&sub=fun
http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=mev&sub=fun
http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=rcl&sub=gui
will show you how.
--------------------
Paul Hamaker, SEMM, teaching ICT since 1987
http://javalessons.com
Michele - 03 Mar 2006 14:05 GMT
Paul Hamaker avait énoncé :
> http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=clk&sub=fun
> http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=mev&sub=fun
[quoted text clipped - 3 lines]
> Paul Hamaker, SEMM, teaching ICT since 1987
> http://javalessons.com
Thanks, this is a useful site I didn't know

Signature
Michele
http://brunocremer.com/
Hi Michele,
An internet search for "Deprecated API " shows options from Sun
a starting point might be
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html
and there are various Deprecated API lists depending on the platform
that you have.
B
Michele,
The Sun tutorial is a good place to look at examples, also.
The Swing (user interface) part of the tutorial is at:
http://java.sun.com/docs/books/tutorial/uiswing/index.html
The specific part you want is on writing listeners:
http://java.sun.com/docs/books/tutorial/uiswing/events/index.html
And within that look at MouseListener (for the press, release and click
events) and MouseMotionListener if you need to drag or track movement of the
mouse rather than discrete presses.
As a beginner porting an old application to Swing, you will need to
understand first how GUI's are programmed in general (the generic idea of
handling events rather than a procedural mindset of: first I do this, then I
do this...) From there you can pick up the Swing event model where your GUI
generates events (button presses, mouse clicks, etc) and you write event
handlers for those events (what should I do if the user clicks the mouse?).
In Swing they just happen to call those handlers "listeners".
It will be a little bit of a leap, since as a beginner, you will need to
figure out how to write classes, implement interfaces and write the code
that actually handles the functionality. The Sun tutorial has a lot of good
examples of all this stuff and it is free!
Hope this helps a little...
Bob
> Hi all,
>
[quoted text clipped - 23 lines]
>
> What would be the correct code? Thanks a lot.
On Fri, 03 Mar 2006 13:52:44 +0100, "Michele"
<icimimi$$$$$$$$$$$$$$$$$@wanadoo.fr> wrote, quoted or indirectly
quoted someone who said :
>I would like to adapt an old code. I use Sun Studio Creator 2. I
>succeeded in part of the deprecated code but I got stuck about the
>mouse events
see http://mindprod.com/jgloss/event10.htm to learn how they used to
work. and http://mindprod.com/jgloss/event11.html to learn how they
work now.
I converted the Unicode app over from 1.0 to 1.1 events a few months
back. It is pretty mechanical once you do one handler.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.