This week's book giveaway is in the Raspberry Pi forum.
We're giving away four copies of Getting started with Java on the Raspberry Pi and have Frank DelPorte on-line!
See this thread for details.
Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!

seb petterson

Ranch Hand
+ Follow
since Mar 04, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by seb petterson

Bartek Myszkowski wrote:

seb petterson wrote:...I want to write a method that lets the user select an area of the screen to take a screen shot of, thus making use of mouse click coordinates


You can always get screenshot of whole screen and show it to user in full screen mode to let him select the area he wants.



Yes, something like that could work as a next best thing I guess. Thanks.
14 years ago

Darryl Burke wrote:Nothing strange about it. Everyone doesn't want to write spyware.



For your info, I want to write a method that lets the user select an area of the screen to take a screen shot of, thus making use of mouse click coordinates. There are a million other non spyware applications that could make use of this mouse info, so please be a bit more creative and stop assuming the worst of people.
14 years ago

Suraj Chandran wrote:I think with pure java it might not be possible.
You might need to fall down to JNI



Thanks. I am starting to think that you're right. I just think it's strange since it's easy to get the pointer location outside the window I thought it shouldn't be that hard to get mouse press information as well.
14 years ago
Hi,

I want to get the coordinate of a mouse click outside of the java application window. I know how to get the mouse movement info outside the window, with the AWT class MouseInfo.

But MouseInfo doesn't support anything to capture mouse clicks (that I've seen). Can someone direct me to information on how to get this kind of mouse information?

I am mostly interested on how to do this on windows.

Thanks!

14 years ago
Hey,

Has anyone done this already? Thought I'd check before I reinvent the weel.

That is: if we have the drop down list:

And the user enters the characters 'A','B','C','4' then the drop down box should jump to the second option.

Thanks in advance.
I am programming a feature in a web application that sends e-mails. I have no problem with the e-mail sending part. But now I want to attach files to the e-mails. Uploading files from a multipart form and attaching these works well. My problem is that I need to attach a java String as a file as well. How do I do this?
The code for attaching a regular file looks like this:


File file = (File) attachments.get(i);
DataSource source = new FileDataSource(file);
BodyPart attachmentBodyPart = new MimeBodyPart();
attachmentBodyPart.setDataHandler(new DataHandler(source));
attachmentBodyPart.setFileName(file.getName());
multipart.addBodyPart(attachmentBodyPart);



It would be nice if I could something similar but with a DataSource created from a simple String.

It should be simple. Does anyone know how to do this?

(I don't want to go through the hassle of saving it as a File or anything like that)

Thanks.
15 years ago

Originally posted by Rob Prime:



Thank you,

A few follow up questions:
Will this result in a POST request?
What makes it POST and not GET?
Is there a limit to the string length printed to the stream?

/Seb
15 years ago
Hi,

I need to download the content from a URL but with POST parameters added to the request.

I've managed to download the content by using java.net.URL. But now I need to add POST parameters in the request. Is this possible while using the URL class? Or is there another method?

Thanks,

Seb
15 years ago
Joe:
When you say that you use JSPs, do you mean that you pass http-request arguments with the java.net.URL and then fetch the html-content that is then converted to a PDF?

Peter:
I guess html e-mail can be unsafe. But if you block images an active content per default (which i hope most people do by default) I would think it's ok.

Anyway, the application I'm working on is only going to be used internally at the company I am on now so yes they will receive it. Also, it will contain no images or active content.

The layout of the e-mail will vary a lot depending on input parameters, a lot of dynamic table generation etc, that is why I think JSP would be a good approach.
15 years ago
Hi,

I'm developing a feature in a webapplication that generates emails. The email content will be an html document generated when the user uses this feature.

Usually the best way to dynamically generate a html-document is by creating it as a JSP-page. But as you can see, this situation is different in that the document isnt sent back to the browser, but generated server side and put in an e-mail.

Does anyone have a best practice for this?

Is there a way to make use of the JSP-approach even though it's not sent back to the browser?

Thanks

Seb
15 years ago

Originally posted by Bear Bibeault:
Because you are paraphrasing your code, I don't know how you are really invoking your handlers. Please post actual code.



the actual code is a bit messy, but this will generate an alert saying undefined:

put anywhere in the script section:


or

or

Originally posted by Bear Bibeault:
The target object is in the event instance.



and how do i access it?
I tried:


also tried:

[ September 13, 2007: Message edited by: seb petterson ]
I think I could achieve this if I can get the object that was clicked (the table cell, or the span element that lays in it and which contains the double clicked text). I have the x y coordinates from the window.event.[x|y] ...anyone knows how to get the object?

Seb
These are the events I am hooking handlers to:
onmouseclick, onmousedblclick and onselectstart.

What I want to achieve is that the user can select text in table cells by double clicking the text thus selecting one word. But not selecting a huge chunk by pressing the SHIFT or CTRL keys, since these keys select the content in a way handled by javascript and table row highlighting, and the standard selection/highlighting of text overcolors my highlighting of the tablecells.

So: only selection through doublecklick.

I thought it would work by something like this:


But it seems as the order of the event handlers being called is weird (to me), namely: 1. onclick, 2. onselectstart, 3. ondblclick. So I don't know how to tell the onselectstart handler that the selection is triggered by a dblclick. How do I achivie this???

Thanks,

Seb

edit: changed keywords to onclic_k... due to forum filter.
[ September 13, 2007: Message edited by: seb petterson ]

Originally posted by Eric Pascarello:
when you are dealing with style rules that have two words like border-color, when you code them in JavaScript they become camel case

style.borderColor

Eric



Thank you! ...Now, I realize I have another problem. The table in which I want to highlight one row at a time has border width = 0. And I can't seem to change the border width for just one tr object in a javascript. ...Or is it possible somehow? (I dont want to change the border on the whole table since it would move the content too much.)

Seb