java

Can I store the generics attribute into an object's field

Assuming the following class stub: public class Foo<T> { private Class<T> type; public Foo<T> () {} } Can I store the generic type T into the field type in the constructor, without changing the constructor's signature to "public Foo<T> (Class<T> type)"? If yes, how? If no, why? "type = T" doesn't seem to work. ...

How can I validate parameters without creating a separate dialog?

I'm going to make an application (in Swing) that uses a tree to visualize a data structure (JTree). A tree will be on the left side of a window. The user will be able to browse a tree. The parameters of every tree node will be displayed on the right side of the window. The example windows will be looking like this ===================...

What is JDBC?

What is JDBC and where can I start learning about? I know it's a way to access databases with Java, but what problems does it solve? Is it an ORM (or does it try to be)? Does it abstract away differences between databases, at the syntax level? What does it do? and what does it not do? ...

Is there a free (LGPL, BSD, etc) implementation of XML editor swing component.

I need a JComponent thad enables editing xml documents so I can embed it in my application. It doesnt need to bee fancy. Plain text editing and highlighting would bee enough. Thank in advance ...

Is there a free (LGPL< BSD, etc. ) RDF editor component for swing ?

I look for a JComponenet based RDF editor which I could embed in my application? It does'n need to be fancy . Thanks in advance. ...

Encode and Decode rfc2396 URLs

What is the best way to encode URL strings such that they are rfc2396 compliant and to decode a rfc2396 compliant string such that for example %20 is replaced with a space character? edit: URLEncoder and URLDecoder classes do not encode/decode rfc2396 compliant URLs, they encode to a MIME type of application/x-www-form-urlencoded which ...

What are good docking frameworks for Java/Swing?

I'm looking for a good lightweight Java docking framework. I know that Netbeans and Eclipse can be used as RCP, but I'm looking for something a little bit more lightweight. ...

JFileChooser hangs sometimes

I am running into the problem of the "hanging JFileChooser" as described in the following threads: http://forums.sun.com/thread.jspa?threadID=5309960 http://forums.sun.com/thread.jspa?threadID=724817 http://x86.sun.com/thread.jspa?threadID=5275999&amp;messageID=10156541 I am using JVM 1.6.0_07-b06. It happens on Windows XP as well as...

Reading source code

If you read other people's source code, how do you approach the code? What patterns are you looking for (datatypes, loops, use of control flow, ... )? How long can you read other people's code without getting bored? What is the most exciting patterns that you have discovered so far? ...

Setter Methods

Is it necessary for setter methods to have one argument? Usually setter methods accept one argument as the value of a certain property of an Object. What if I want to test first the validity which depends on another argument which is a boolean, if true, validate first, else just set the value. I am getting the values from clients throug...

Which is the best Maven Eclipse plugin ?

There is two available Eclipse plugins for Maven : Eclipse IAM (old name is Q4E) m2eclipse m2eclipse seems to be the oldest but the more robust. Is there any key differences between the two ? Which one should be chosen for a project starting today and why ? ...

The Spring AOP Proxy that isn't.

I have two Spring proxies set up: <bean id="simpleBean" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"> <ref local="simpleBeanTarget"/> </property> <property name="interceptorNames"> <list> <value>cacheInterceptor</value> </list> </property> </bea...

Servlet containers and class path

To what is the class path of a servlet container set to? As per my understanding there are three components involved. The jars in the lib folder of the servlet container and then the classes in the WEB-INF/classes and jars in the WEB-INF/lib folder. The classes in lib folder of the servlet container are added to the system class path a...

How do I retrieve an image using iText when the URL has redirects?

I am using iText to generate PDF invoices for a J2EE web application and included on the page is an image read from a URL constructed from the request URL. In the development and test environments this works fine, but in production I get a java.io.IOException: is not a recognized imageformat. If I paste the url into my browser then the...

is there a merged iterator implementation?

Is there an Iterator implementation that merges multiple iterators? class MergedIterator<T> implements Iterator<T> { MergedIterator(Iterator<T>... iters) .... } And the next method should move on to iters[1] when !iters[0].hasNext() etc ...

JPA/Hibernate in Java SE 6, Best Practices for data access

I am starting a normal Java SE project and i am planning to use JPA/Hibernate. I was wondering if anyone could enlighten me as to what is considered the best way to interact with Hibernate in this environment (data access layers)? ...

"Automatic updates" of java (desktop) application

What system do you recommend for implementing "automatic updates" for some java (desktop) application? I'd also want to have module/plugin installation and update. Think Eclipse and Firefox. I'm aware of Eclipse RCP's OSGi stuff, and also NetBeans RCP has something here. Do one have to buy wholly into their respective RCP stuff to use t...

How to disable a container and its children in Swing

I cannot figure out a way to disable a container AND its children in Swing. Is Swing really missing this basic feature? If I do setEnabled(false) on a container, its children are still enabled. My GUI structure is pretty complex, and doing a traversion of all elements below the container is not an option. Neither is a GlassPane on top ...

Convert PNG to bitonal TIFF

-Edit- FYI.. I am converting b&w documents scanned in as greyscale or color. 1)The first solution worked, it just reversed black & white (black background, white text). It also took nearly 10 minutes. 2)The JAI solution in the 2nd answer didn't work for me. I tried it before posting here. Has anyone worked with other libraries free ...

compiling an Eclipse project into a jar.

I reference another eclipse project from the current project I am working on. Everything is working fine except when I try to jar up the referenced project and use the jar instead of the eclipse project my project doesn't run properly. I know this is a bit vague but is there something I might be doing wrong in jaring up the referenced ...