If I create classes, that are used at the moment only in a single thread, should I make them thread-safe, even if I don't need that at the moment? It could be happen, that I later use this class in multiple threads, and at that time I could get race conditions and may have a hard time to find them if I didn't made the class thread-safe i...
Hi guys,
I want to load up a window using the java swing, something like this
However I want to be able to use it for text input also not just to dump data into it..
any idea how to do it?
...
I would like to use Class.newInstance() but the class I am instantiating does not have a nullary constructor. Therefore I need to be able to pass in constructor arguments. Is there a way to do this?
...
I am looking into building a smallish Java rpg. I haven't found any good examples of a RPG engine that would be the most powerful yet most stable for an experienced Java programmer.
Any and all types. I just want to learn as much as possible about what is out there.
2d, 3d, or Isometric
Thanks in advance everyone.
...
I am looking for an Applet with similar functionality to the Oracle/Stellent OutsideIn ActiveX control or the Autonomy KeyView technology that act as a browser plug-in allowing the rendering/display of a large number of file formats (Word processing, spreadhseet, graphics, etc.) I currently use the Stellent solution, but due to some rest...
I was loading an image resource with the following code and it works fine from my dev environment (netbeans) but threw an exception as soon as it ran from the desktop.
new ImageIcon(Images.class.getResource("images/highlighter24.gif"));
I traced it down to my file having different case than in the code.
Fine, my bad, but why the inco...
I am trying to insert about 50,000 objects (and therefore 50,000 keys) into a java.util.HashMap<java.awt.Point, Segment>. However, I keep getting an OutOfMemory exception. (Segment is my own class - very light weight - one String field, and 3 int fields).
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java...
Can a JApplet use a JFileChooser so that the user can select a file on his hard-drive? Or would this violate Java applet security? (I'm assuming that the default security settings are being used. I don't want to ask my users to grant me extra permissions.)
...
I've been getting some OutOfMemory errors lately in my application. Is it possible to detect ahead of time when the virtual machine is running low on memory? In other words to preemptively deal with OutOfMemory errors before they actually occur?
...
I was looking through a thread dump of a java process, and notice some threads blocked by signal dispatcher.
What is signal dispatcher? What does it do?
...
How, in Java, to quickly (or generically) convert one class that implements an interface into another class that implements the same interface?
I mean, if they're a POJO one class setters should take the other class getters as arguments.
Is there a Pattern for this situation?
...
Somebody asked about .NET-based forum software here:
http://stackoverflow.com/questions/11046/forum-software-recommandations-net
Now I have a similar question but I prefer Java. I'm interested in building a community site so I'd like to know my options. It doesn't have to be free but it needs to be something a normal engineer can affor...
I want a Java IDE with a compiler for Linux and that does not require a a big amount of RAM.
I have 256 MB of ram, so my options are limited
...
Hi,
I am facing this peculiar problem. My webapp, works fine on my localhost. Its a JSP/Struts-Tomcat-MySQL app. However, when I host it on hostjava.net (shared tomcat), it is unable to connect to the database.
After some debugging, I have identified the problem, to be with JNDI lookup for datasource. If you want, you can take a look a...
Is it good practice to let abstract classes define instance variables?
public abstract class ExternalScript extends Script {
String source;
public abstract void setSource(String file);
public abstract String getSource();
}
The sub class, ExternalJavaScript.class, would then automatically get the source variable but I fe...
I'm not sure if the title is very clear, but basically what I have to do is read a line of text from a file and split it up into 8 different string variables. Each line will have the same 8 chunks in the same order (title, author, price, etc). So for each line of text, I want to end up with 8 strings.
The first problem is that the last ...
Given a large API (an in particular, the Java or J2EE standard libraries), is there a tool or search engine or other resource that can tells me which methods, classes, or even packages people in general tend to use the most?
I am annotating (see below) APIs and would like to focus my attention on popular areas.
The only thing I can think...
I have a method that creates a MessageDigest (a hash) from a file, and I need to do this to a lot of files (>= 100,000). How big should I make the buffer used to read from the files to maximize performance?
Most everyone is familiar with the basic code (which I'll repeat here just in case):
MessageDigest md = MessageDigest.getInstance(...
Does a print version of the Java >= 1.5 API exist? Where can I buy it online? Preferably in Canada, but just a title is great.
...
I'm using a JFrame in which the CENTER portion of the BorderLayout is occupied by a JScrollPane that wraps around a JPanel. What I'm finding is that when I initiate the action that actually causes the JPanel to be displayed, the display doesn't change. But when I resize the JFrame, the new JScrollPane has now magically appeared.
So wh...