|
Java will execute the code in the exact same order as you write it. So if you have the calls to those two functions below one and other like:
<br />
{<br />
functionshow_print_preview();<br />
functionflush_table_and_refresh();<br />
}<br />
then they will be called in the following order:
- functionshow_print_preview
- functionflush_table_and_refresh
The only thing I can think of is that you start a seperate thread somewhere within either of these two functions causing them to be executed out of sync.
|
|
|
|
|
see that is the problem , i know it has to be this way but priview shows as a blank jtable as the number 2 executes while first is in middle of execution (taking the jtable data of mainframe), any solution??......
|
|
|
|
|
you're right - and not right.
The methods are called in this order, but the printer job takes some more time. In the meanwhile the table is deleted.
@ Alok
try to return a value from the print job, a signal to mark when the job is done. Set up a loop (or use another thread) which interrupts the code as long as the print job takes.
regards
Torsten
I never finish anyth...
|
|
|
|
|
|
hi
I have a text file with large content in it .
how i can find specified word in this text file and replace it word with another word in entire file ?
please help me
modified on Saturday, February 12, 2011 4:15 AM
|
|
|
|
|
Most likely the replacement string will not be exactly the same size as the search string. In that case you need to create a copy of the original file replacing the search text everytime it occurs.
I am assuming you are talking properly large as in > 25% of the machine memory. If it is not too large then, laod the file into a StringBuilder and use indexOf to find the text and replace to replace it.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
|
|
|
|
|
hi frnds
can anyone there help me out for placing an audio instead of text in an image plz help me out
|
|
|
|
|
Try using Liquid Nitrogen
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
|
|
|
|
|
Hi,
the correct term is steganography. Google knows about it, and CodeProject hosts several articles about it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I am not Much sure about it but suggesting you to navigate this link[^] to know abut stenography in details
|
|
|
|
|
import java.awt.*;
public class NewClass2 {
public static void main(String args[]){
Image image = Toolkit.getDefaultToolkit().getImage("file:///D:/usage/a.JPG") ;
int width = image.getWidth(null);
int height = image.getHeight(null);
System.out.println("height"+height);
System.out.println("width"+width);
}
}
while executing this code we doesn't get any error, but we cant get the image
Instead we get the width and height is -1;
|
|
|
|
|
Please use code block tags for your code.
|
|
|
|
|
import java.awt.Image;
import java.awt.Toolkit;
public class NewClass2 {
public static void main(String args[]){
Image image = Toolkit.getDefaultToolkit().getImage("D:/usage/a.JPG") ;
int width = image.getWidth(null);
int height = image.getHeight(null);
System.out.println("height"+height);
System.out.println("width"+width);
}
}
...simlpy because the image is not found. I have changed the path String.
Image java.awt.Toolkit.getImage(String filename)
getImage
public abstract Image getImage(String filename)
Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG. The underlying toolkit attempts to resolve multiple requests with the same filename to the same returned Image.
Since the mechanism required to facilitate this sharing of Image objects may continue to hold onto images that are no longer in use for an indefinite period of time, developers are encouraged to implement their own caching of images by using the createImage variant wherever available. If the image data contained in the specified file changes, the Image object returned from this method may still contain stale information which was loaded from the file after a prior call. Previously loaded image data can be manually discarded by calling the flush method on the returned Image.
This method first checks if there is a security manager installed. If so, the method calls the security manager's checkRead method with the file specified to ensure that the access to the image is allowed.
Parameters:
filename - the name of a file containing pixel data in a recognized file format.
Returns:
an image which gets its pixel data from the specified file.
Throws:
SecurityException - if a security manager exists and its checkRead method doesn't allow the operation.
See Also:
createImage(java.lang.String)
--------------------------------------------------------------------------------
int java.awt.Image.getWidth(ImageObserver observer)
getWidth
public abstract int getWidth(ImageObserver observer)
Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the width of this image, or -1 if the width is not yet known.
See Also:
getHeight(java.awt.image.ImageObserver), ImageObserver
regards
Torsten
I never finish anyth...
|
|
|
|
|
How to use GATE (http://gate.ac.uk) for the article in the address, the address of the form:
'Christopher De Forest
8042 NE Rim Trl
Wilmington, DE 19878
(302) 921--2362 ',
or there is no similar Class Code implement the function?
Thank you!
|
|
|
|
|
Since you know the website that supports this product, that would be the best place to ask for help.
I must get a clever new signature for 2011.
|
|
|
|
|
|
i was looking for my java project classes(compiles .class file), and out of curosity i clicked on my connection class,
and was shocked to see that the connection was visible in that, i mean any other coder can clearly see that and break my DB security..... so how can i encrypt this connection string key, any suggestions...
Regards
Alok sharma
Rome was not built in a day...
|
|
|
|
|
encrypt/decryt the String - or add some obfuscation[^] to the complete code - that's probably the best solution.
regards
Torsten
I never finish anyth...
|
|
|
|
|
encrypt string will do fine but how to achieve it in java code, i am more .net friendly then java.
Regards
Alok sharma
|
|
|
|
|
|
I am not sure how much information you have in your code but from your comments it would suggest it includes a password. In such cases you should not include this information in the classs but add it at run time from input by the user.
I must get a clever new signature for 2011.
|
|
|
|
|
yes actually the password/user name is there in my .class file for dbconnection thats what i want to hide.
Regards
Alok sharma
modified on Friday, February 4, 2011 7:48 AM
|
|
|
|
|
This is still he wrong way to do it since anyone can then run your program and get access. As I said before you should obtain this information from the user and then add it to the string to connect to the database; so if the user does not know the password then access to your code will be of no use.
I must get a clever new signature for 2011.
|
|
|
|
|
Alok sharma ji wrote: any suggestions...
You start by actually defining the problem domain.
For example is this a server application or a client app?
Is the server app installed on a server that isn't secure?
If it is secure then what is your concern about access to the server app?
What happens if I get on the machine running this and reverse your class and then replace it with one of my own. So after you unencrypt it my class writes it out to the hard drive for me?
What database do you use? MS SQL Server has a user authentication mode - no password. Pretty sure Oracle does as well.
|
|
|
|
|
what about small client apps with ms-access or mysql, also i have obfuscated my code but still an encryption will be good, although there is no guaranty of 100% security of code, i still wants to manage as much as i can.
Regards
Alok sharma
|
|
|
|