Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Rohit Kumar

Ranch Hand
+ Follow
since Sep 20, 2007
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 Rohit Kumar

Hi,

I am new to JSP.

I want to know, how to call javascript function which is present in say "one.jsp", from another jsp's (say "two.jsp") javascript function.

thanks in advance.
I am simply creating ImageWriter as,

(ImageWriter) ImageIO.getImageWritersBySuffix("png").next();

And then create ImageWriterParam as,

writer.getDefaultWriteParam();

But it gives exception as "Compression not supported" on statement,

param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
11 years ago
Is it possible to get format or mime type (eg. PNG or JPG) of a buffered image?
11 years ago
Hi,

I have a jepg image. (39 KB size)
First I create a bufferedImage using ImageIO.read().
Then from the buffered image i create again jepg file (71 kb size).

why the size of new image is almost double? How to prevent it, and get back image with same size?

I simply used,

BufferedImage buffImg = ImageIO.read(originalFile); //create buffered imaeg from jepg file


ImageIO.write(buffImg, "jpg", newFile); //create jepg file from buffered image
11 years ago
Hi,

I have a big string buffer, which has data in xml format.
I wann to change a particular small stings from the String buffer.
I don't think String's find/replace policy, or even xml parsing is good option here.

What would be best option in this senarieo?

Thnaks.
11 years ago
Hi,

I was preparing and planning to give SCDJWS 4. But now i have come to know that SCDJWS 5 is comming. (beta in jan 09 i guess).

I have sun certification voicher which is expiring in jan 09 end.

I am confused abt, should i give SCDJWS 4 or not. (Or to go for other sun exam.)

Is it possible to give SCDJWS 4 now and to go for only new topics from SCDJWS 5?

Please let me knwo your comments.

Thanks in advance.
Hi,

I want a file chooser in html to choose a folder.
I tried with <input="file"...., but it only selects file(not folder).
Is there any way?

If not then, is there any way to add a java component say, JFileChooser in javascript.

Thanks.
Is it possible to get height and width of an image without loading it in memory?

Thanks.
11 years ago
I have a JPanel on which a JFileChooser is added.
Now the focus (cursor) is always set to TextBox, which contains the file we choose from file chooser.

Now the problem is, I have to capture a key on this panel.
But as the cursor always on the text box of JFileChooser, the key pressed event is not fired.
If i remove the JFileChooser, the keyPressed event is fired.

How to fire a keyPressed event when JFileChooser is there on the panel, and i press a key.

Is there any way to remove focus from the text box?
11 years ago
Well if check box from the dialog is not set, then there is no any connnection of key and dialog.

The key event comes into the picture only if the check box is already set.

If the check box is already set, then normal procedure is not to show the dialog and procede further.

But if check box is set, and user want to see the dialog, he can see by pressing a particular key.

therefore,

a) if check box is not already set, dialog will always appear
b) if check box is set, dialog will not appear
c) if check box is set, and user still want to see dialog, he can get it by pressing a particular key.

So i am checking whether key is set or not as a condition before displaying dialog. But key event is fired after control comes to this key check condition.

So i was looking for new thread.
11 years ago
The senario is something like this.
User gets a dialog box, and if he selects check box, he will not get this dialog box further.

Now suppose he has already selected the check box (so will not get dialog box), but want to get dialog back, so he can get it back by pressing a particular key.

Now while if user already selected 'not to show dialog' while showing dialog i check whether the key is pressed or not(so dialog can be show again).
But this condition is cheked first and then keyPressed event is fired (if pressed key).

Certanly i can't do this condition checking in keyPressed.
So i thought of another thread.

Any clue?
11 years ago
Hi,

I have a class which implements KeyListener and in keyPressed() chek whether a a particular key pressed or not?

In same class i have to take a decision on the basis of whether that particular key is pressed or not?

But i found that control comes to keyPressed() after the decision is taken.

I used sleep(), but still the control comes later at keyPRessed().

How to do it in differnt Thred, so that keyPressed() will execute first and then that decision?
11 years ago
Well i am creating array of pixels from image.
Now i want to create image back from that array of pixels.
I want to remove few pixels from it, so i can reduce the size of the image.

Actually i want to reduce either the size (disk size) of image or resolution (height and width) of image.

I used different ways to do it like compressionQuality etc.
But with different apis i foudn that when i just read image and save back the "disk size" of the resultant image is very less than source image.

any help on,
1) creating image from array of pixels (the resultant image shoud look same like original)

2) creating new image from an image with same disk size.
11 years ago
How to create image from array of pixels?

We can get pixels of an image from PixelGrabber.
Is there any API which does reverse?
Create an image from array of pixels?
11 years ago