java

Setup Java 6 annotation processing configuration for eclipse compiler with maven

What's the best way to setup the eclipse project compiler configuration for Java 6 annotation processors? My solution is to setup the org.eclipse.jdt.apt.core.prefs and factorypath files manually. This is a bit cumbersome: Reference the processor jar in the factorypath file Configure the eclipse annotation processor output directory (...

It is possible to set size of images in imagearray of javascript?

Hi, It is possible to set height and width of images in imagearray of javascript? imagearray: [ ["http://i26.tinypic.com/11l7ls0.jpg", "", "", "My Text"], ["http://i29.tinypic.com/xp3hns.jpg", "", "", "My Text"], ["http://i30.tinypic.com/531q3n.jpg"], ["http://i31.tinypic.com/119w28m.jpg", "", "", "My Text"] ], H...

mouse Drag and Draw

Hello, I have problem with displaying all the triangles. I draw a triangle using mouse drag. Everytimes I draw a new triangle, the previous triangle disappeared. How can I make the triangles stay, so there will be many triangles on the drawing panel? ..... private class PaintSurface extends JComponent { Point startDrag, endDrag, midP...

How to make pagination in Swing java.

Hello, I have created one GUI in Swing Java in which I have used JTable.Now I want to display next page information into it by using pagination. How should I do that ? ...

Forcing Garbage Collection in Java?

Hello there, Please anyone can tell me if I can force garbage collection in java anyway? Even it was tricky to do. I know about System.gc(); and Runtime.gc(); but they don't force, they suggest to do GC, but actually no force occurs. Please I need that horribly. Best Regards, Tarek, ...

How to work with database from eclipse

I have a MySQL database server installed on my local machine. I have connected it with eclipse data source explorer. can you please point me to tutorials on effectively working with the database from eclipse itself without using command line MySQL client ? thanks ...

abstract class with published Api but default access constructor

In the MIDP api there is a public abstract class Layer, this class has a javadoc published however it doesn't show a constructor in the javadoc. In the same api there are two other classes Sprite and TiledLayer. public class Sprite extends Layer public class TiledLayer extends Layer All these classes are in the package javax.microed...

Why Object class methods are available in interface ????

Following interface and classes are successfully compiled. Problem is mentioned in the output below : interface MyInterface{} class MyClass implements MyInterface{} class InterDoubt{ static MyInterface mi ;//= new MyClass() ; public static void main(String[] args){ System.out.println("X") ; try{ ...

When is it a poor design choice to use a factory instead of simply returning a bean?

Our application makes heavy use of factories to spit out objects, but I often wonder if they are always really necessary, and it wouldn't simply be better to create an instance of a "known object" as a bean. The argument is that developers are often customizing the implementation of these returned objects (which are returned with their i...

Drawing panel size

Hello, I have problem setting the size of drawing panel. I want a drawing panel with the size 0f 600,600.However I found that, the size of the drawing panel is smaller than 600,600. It seems that the frame size is 600,600 which make the drawing panel smaller. How can I set the drawing panel size 600,600 ? .... public class DrawingBoardW...

How to make a JFrame Modal in Swing java.

Hello, I have created one GUI in which I have used a JFrame. How should I make it Modal? ...

Generating Indexed Property Getters/Setters in Eclipse

By default, eclipse generates getters/setters according to JavaBeans regular properties style: * public void setName(String name) * public String getName() As of J2SE 5.0 JavaBeans specification allows IndexedPropertyChangeEvents which have a different getter/setter naming scheme for arrays: * public void setName(int index, String n...

Java Serializable, ObjectInputstream, Non-blocking I/O

I'm just starting out with Java serialization, and I'm not clear on how you are supposed to get objects from a source in a scenario with non-blocking I/O . All the documentation I can find suggests using ObjectInputStream is the proper way to read in serialized objects. However, as I mentioned I'm using java.nio and performing non-block...

Strange Clipping Issue in OpenGL

Hey all, I am very very new to OpenGL, so please bear with me. :) I'm working through NeHe's OpenGL tutorials, and I have developed my own version of Lesson 5, in which you rotate a 3D shape around the origin. I'm not sure what I did wrong, I copied the code nearly line-for-line, but I'm seeing strange overlaps in my surfaces. Does anyo...

James Server connection failure exception

Hi, I'm trying to connect Javamail application to James server, but I'm getting javax.mail.MessagingException: Could not connect to SMTP host:localhost, port:4555; nested exception is: java.net.SocketException: Invalid arguent: connect Here's the code, which is creating a little problem for me: import java.security.Security; import...

Better approximation of e with Java

I would like to approximate the value of e to any desired precision. What is the best way to do this? The most I've been able to get is e = 2.7182818284590455. Any examples on a modification of the following code would be appreciated. public static long fact(int x){ long prod = 1; for(int i = 1; i <= x; i++) prod = prod * i; retu...

Tomcat virtual host config not working for Struts actions

Hello, Initially I had a webapp called "admin" running fine, deployed inside the $CATALINA_HOME/webapps/ directory of tomcat 6. Now I tried setting up a vitual host to run this webapp. Step1: I added the following in $CATALINA_HOME/conf/server.xml <Host name="mysubdomain.domain.com" appBase="keshav"> </Host> Step2: I created a fol...

Technique or utility to minimize Java "warm-up" time?

I am supporting a Java messaging application that requires low latency (< 300 microseconds processing each message). However, our profiling shows that the Sun Java Virtual Machine runs slowly at first, and speeds up after the first 5,000 messages or so. The first 5,000 messages have latency of 1-4 milliseconds. After about the first 5,00...

Controller's life-cycle in Spring MVC

What is the lifecycle of a Controller in Spring MVC? When is the controller created, when destroyed? Is it shared among multiple threads? Can it be in use simultaneously by more than one request. ...

How to store data in MySql through multiple threads?

I have started five threads from main() function. I have written three funtions as follows: getConnectionToDatabase(); saveToDataBase(); closeConnection(); Now I want that main function should establish a connection to the database before starting those five threads by calling getConnectionToDataBase() so that each thread doesn't hav...