Parth Bhatt

Ranch Hand
+ Follow
since Oct 19, 2005
Merit badge: grant badges
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 Parth Bhatt

Hi Ranchers,

I have a problem with IP Address resolution in my lan. The following is the code that i used :



The above code fails to resolver the IP Address. I am using RedHat Linux 9. If i try


i get the Hostname, as expected. Can anyone help me as to why fails to IAddr.getHostName() return the hostame.
Sorry, for being a little less specific...

Actually, I was referring to the OpenSource project that i started :
GNUSnap

It Presents a very simple GUI that lets the user to capture the screen shot(for now, the snap shot is only of the complete screen) @ the click of a button.

What i wish to add to this is that the user can set an appropriate timeout(say of n secs) and click the button to take the screen shot. After n seconds my app would capture the shot of the Window that is the Active Window(this need not be a window launched my My App, it could be any window belonging to any process in the system).

For Example : Assume i am using Windows. I could configure my app to take a snap shot of the Active Window after 5 secs, minimize the app and launch Notepad. After 5 secs My App would take the snapshot of Notepad(and not the whole screen).

Similarly, if i am on Linux, i would be able to do the same.

If anyone has any idea regarding this, please put it forth...
16 years ago
Exactly Ulf... but is there a way to get the rectangle of the active window.

Specifically, do we have APIs provided by either jdk or other lib that would return the rectangle for the active window...?
16 years ago
Hi Ranchers,

I am working on a simple application to capture the screen shot of the entire screen and save it in a Disk File. This is what the screen capturing code looks like :



Now i need to add a feature that would capture the screen shot of only the Active Window (& not the entire screen).

Do we have such APIs in java, which my application can use directly ? If not, what could be the ways in which this can be implemented ?
16 years ago
Thanks Ulf...!!

JConfig seems to be great...

Since my requirement is only to find out if a file is a SoftLink or not, i wrote a /* bit lame */ piece of code, which works as follows :



17 years ago
Hi Ranchers,

I am looking for a way to identify if a disk file, represented by an object of the File class, is a softlink or not.

Basically, I am working on a File Search utility that recursively browses the file structure on a unix machine to find a file with a particular name. The Problem that i am facing is with softlinks. i.e. my prog enters into an infinite loop when it encounters a softlink. For e.g. if a softlink /root/.openoffice/user/work points to /root directory, my program would enter into an infinite loop as everytime it encoulters /root/.openoffice/user/work it sould actually get into /root directory.

If some one can provide a solution or a web-link that throws some ligt on this issue... Thanks is advance...

Regards,
Parth Bhatt
17 years ago
Hi Guys,

I am working on a Swing App which deals with a JTable. I Have written the following code and it works fine for me, The only problem is that all rows in the table are editable by default. I want to change them to "Not Editable".

Apart from this, the code works absolutely fine for me. So, unless unavoidable, i do not wish to write a custom class inheriting AbstractTableModel.

Can someone suggest a way thru which i could make each cell in the table Not Editable, preferably without writing my own TableModel class ? i.e. is there a method in JTable or DefaultTableModel which will allow me to make each cell not editable...?


Here's my code...

17 years ago
Yes RPM file is an installation file for Linux. And Linux does come with a tool called rpmbuild, that can be used to create rpms. However, i could not find documentation to create rpms for a s/w written in java(neither on linux nor on the net).

But, it makes sense that i post this particular question in a Linux Forum...
Thanks anyways...
17 years ago
Hi Ranchers...

I have created a simple Java Application using Swing. I Need to Package it in an RPM file so that it can be installed properly. The generated rpm file will only place my jar file and some other files in appripriate places( & do nothing else).

Can someone help me out with how to do this.

I Do realise that this is not a typical java ralated problem, But i believe some of the fellow ranchers would have come across this problem and might be able to help... However, i apologize, if this is not the right place to post this problem...

Thanks in advance...

Regards,
Parth
17 years ago
Hi Everyone,

I wanted to understand the way SwingWorker is used. All i know is that it is used to perform some task in the background thread so that the GUI does not Freeze. i want to know HOW-TO actually use the SwingWorker class.

To make my question a little more clear i will put forth a simple application where SwingWorker can be used (Correct me if this is not the right place to use SwingWorker). I Designed a Simple swing application that captures the screenshot & saves it in a jpg file on the Hard-Drive. The GUI freezes for a couple of seconds while the file is being written to the disk. To avoid this problem i can create a Thread which just does the task of writing the jpg-file on the disk in the background.

It would be great help, if any of the fellow-ranchers could throw some light on this issue.

Thanks in advance...
17 years ago
Thanks prashant... That solves my problem...
17 years ago
Hi,

The value that you read from the textfield will always be a string. And to increment the value read you will always need an int.

So in this case The obvious solution would be : Whenever you want to increment the contents of the text field,

1)read it into a string


2)Convert it into an int


3)Put the new incremented value into the textfield


NOTE : In step (2) if the contents of the textfield is not integer, it will throw a NumberFormatException. So beter handle it.
17 years ago
Hi guys,

I have a frame that has a JTabbedPane(with 2 tabs) & a JButton. As is obvious, at a time contents of only one tab can be seen, and that of the other are hidden...

My problem is at the click of the button, focus ahould be set to the tab whose contents are not seen and thus its contents should become visible.

I am looking only for code that can set the focus to the hidden tab when the JButton is clicked. i.e. the code that can be placed inside the actionPerformed(ActionEvent) method.

Any help provided regarding this would be greately appreciated...
17 years ago
You're very close Mahesh... This is, possibly, the closest solution to this problem...

Actually for the string "abc", your program produces the following o/p :


whereas it should produce


i.e. all possible combinations(or probably "permutations" is a better word) of "a", "b" & "c" should be generated.

The sequence in which these strings are generated does not matter; but all of them should be generated...
[ November 15, 2006: Message edited by: Parth Bhatt ]
17 years ago
You're very close Mahesh...

Actually for the string "abc", your program produces the following o/p


whereas it should produce

The sequence is in which these strings are generated does not matter; but all of them should be generated...
17 years ago