java

Property list GUI component in Swing

How do you make a "property list" component in Swing? I mean the kind as in this or this image. Is it just a customized JTable component, or a custom component altogether? ...

Delete Email on Server using javax.mail

Hi all, i am receiving emails from the server using the IMAP protocol like it is described here. This is working very fine and i can store the emails and attachments on the disk. Question: Do i have the possibility to delete files from the Server, so that they are no longer available, when a client tries to receive all emails? if so, p...

Serializing a very large list

Hi, I'm gettint a large amount of data from a database query and I'm making objects of them. I finally have a list of these objects (about 1M of them) and I want to serialize that to disk for later use. Problem is that it barely fits in memory and won't fit in the future, so I need some system to serialize say the first 100k, the next 10...

Increasing Cell Height with multiline,without Scrollbar in Jtable

Hai I am developing a standalone application using Java in which I am using a JTable.The problem is when I enter a multiline text,the entire text is not displayed in the cell while I am typing.I get a scroll when I type a multiline text.How can I get my whole text to be visible while I type.i.e How can I increase my Cell width in JTable...

How to upload and save file in java servlet without using apache?

out.println("<tr><td><FORM ENCTYPE='multipart/form-data'"+ "method='POST' action='ProcessUpload' ></td>"+ "<td><INPUT TYPE='file' NAME='mptest'></td>"+ "<td><INPUT TYPE='submit' VALUE='upload'></td>"+ "</FORM></tr>"); This codes can ...

Sending data from service to activity

Hi, I am having issue for sending data from service to Activity through notification , I click a notification a activity get invoked but when i try to add some parameters through bundle i am not able to get the parameters in that called intent , I have gone through the link http://stackoverflow.com/questions/1198558/how-to-send-para...

Generic return value (java)

This works nicely: // Return all objects with code 'code'. static List<? extends ICode> getObjects(String code, List<? extends ICode> list) { <ICode> retValue = new ArrayList<ICode>(); for (ICode item : list) { if (item.getCode().equals(code)) { retValue.add(item); } } return retValue; } The 'singular' v...

Head start JavaServer Faces

I have a couple of probably common thoughts on JavaServer Faces (JSF) which I want to clear up. Is it possible to just add a Java Class and Call methods inside it from a JSF (x) Page? I can't see how this even could be an issue knowing to do when you program Java and develop webapplications. However, I can't seem to find a concrete a...

DefaultAnnotationHandlerMapping via ContextLoaderListener instead of DispatcherServlet on Spring 3

Hi guys, When I use DispatcherServlet, I get a java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? error when I use a DelegatingFilterProxy filter. Therefore I've removed the DispatcherServlet and now I use a ContextLoaderListener instead, and my Spring application loads fine. However, ...

How to validate data restriction using regex in java

Hi I want to validate a string which donot have numeric characters. If my string is "javaABC" then it must be validated If my string is "java1" then it must not be validated I want to restrict all the integers. So how can I restrict using regex in java Thanks Sunil Kumar Sahoo ...

In java, how to append string ignoring duplicates

I have string say "ABC,D" , now I wish to write a method append(initialStr, currStr ) which appends currStr to initailStr only if currstr is not already present in initialStr. I tried a method which splits with comma, but since my string contains comma so that method doesn't works for me. Any help will be greatly appreciated. ...

AOP based object injection fails for class name starting with lower case.

I am doing object injection using AOP. There exists a class which starts with samllcase (testClass) wherein the object is not getting injected. I converted the file name (legacy class) so that it starts with capital case (TestClass) and updated references in AOP.xml and spring-beans.xml containing the bean definitions and it it started ...

java scheduler

Which is the best way to run a process in scheduler. I can either do it crontab or Spring-Batch. Any other better option? ...

Testing string equality using hashCode()

Is there any reason why a Java string cannot be tested for equality using it's hashCode method? So basically, instead of.... "hello".equals("hello") You could use... "hello".hashCode() == "hello".hashCode() This would be useful because once a string has calculated it's hashcode then comparing a string would be as efficient as comp...

How to decrease the perceived loading time of Java Swing forms?

In my Swing application I have the problem that when creating a new instance of a Swing form for the first time, it takes several hundreds of milliseconds. That's not really long but the subjective impression of getting slowed down is really annoying. It happens with all forms, even a JOptionPane message or other trivial forms. (Of cou...

Adding static attributes to JAX-B generated elements

Suppose I have a JAXB element like this: @XmlElement private double value; this will generate XML like this: <value>3.14159</value> Now, how do I modify my declaration (or customize JAXB marshalling) to generate XML like this instead: <value type="double">3.14159</value> The type attribute will always have the same value, i.e. "...

How to use jarjar from the command-line?

I'm having trouble using jarjar from the command-line to combine a simple Scala program with the scala runtime-library. jarjar correctly detects the dependency: $ java -jar ~/Desktop/saug/jarjar-1.0.jar find jar BCT.jar scala-library.jar /home/schani/Work/scala/bct/BCT.jar -> /home/schani/Work/scala/bct/scala-library.jar Combining th...

Spring - How to load a new hierarchical context?

Hello, Has anyone tried loading multiple hierarchical contexts (parent/child) using Spring? Could you explain how to do that as I could not locate enough documentation on this? Thanks in advance. ...

The canonical Java way to "resend-if-not-got-ACK"-scenario

As the topic depicts, I'm interested in the canonical java way to resend a message if the destination doesn't send an acknowledement message within a specific time frame. I could come up with a couple of alternatives, but im not sure i like them. E.g. (pseudo code/describition) start a new Thread and check some "external condition" if...

How do I turn this HQL into a filter query?

I have this query: sess.createQuery("from Box b join b.items bi order by bi.name").list() It works fine. However, I have a hibernate's Collection boxes and want to filter is. Naive tries: sess.createFilter(boxes, "join this.items bi order by bi.name").list() sess.createFilter(boxes, "from this join this.items bi order by bi.name")....