java

Take a screenshot of a web page in Java

Is there a free tool that can read given webpage and take a screenshot of it? ...

how to use composite-id class element ?

when should you use the class element of the composite-id ? for example, consider this snippet : <composite-id name="id" ***class="OrderLineId"***> <key-property name="lineId"/> <key-property name="orderId"/> <key-property name="customerId"/> </composite-id> <property name="name"/> <many-to-one name="order" class="Order...

Converting from a text field to an numeric in Android

If I have an EditText component on my screen that I have specified inputType="decimal" for (i.e. a numeric/decimal field), what is the best way to convert it to an decimal value in the application code? Google recommends avoiding floats, and avoiding creating objects unnecessarily (and I assume any auto-unboxing code is bad too), so I...

Java SGML to XML conversion?

Hi, Does anyone know of a method, or library, to convert SGML into XML? EDIT: For clarification, I have to do the conversion in Java, and I cannot use the SP parser or the related SX tool. ...

java override during object creation

in the following java code a JButton is created but at the same time one of it's methods in overridden. Qestion: is there a name for overriding in this way, while creating the object? the code: JButton myButton; myButton = new JButton ("ok"){ @Override public void setText(String text) { super.set...

Netbeans + servlet

In my J2EE application I use a servlet, but Netbeans doesn't appears to recongnice the libraries javax.servlet.http.HttpServlet, javax.servlet.http.HttpServletRequest, or javax.servlet.http.HttpServletResponse, is valid to mention that I use Netbena 6.7...how can I fix the problem?????? ...

Java Memory Leak Issue with JPanels

Java Memory Leak private boolean refreshResponseWindow(MessageObject message) { this.responsePanel.removeAll(); this.responsePanel.add(message.buildGUI()); this.responsePanel.validate(); message = null; return true; } The problem that is occurring is as I receive more and more messages my Java program's memory usage continu...

jdbc + large postgresql query give out of memory

I'm trying to execute a postgresql query which returns a large result: connection.setAutoCommit(false); st = connection.createStatement( ResultSet.CONCUR_READ_ONLY, ResultSet.TYPE_FORWARD_ONLY ); st.setFetchSize(100); logMemory(); System.out.println("start query "); rs = st.executeQuery(queryString); System.out.println("done query "...

What relevant differences are there between anonymous and predefined classes in Java?

I have a large tree-like data structure of objects which behave mostly identical but differ in one or two methods that calculate some keys used to navigate through the structure. The divergent behaviour depends on where the objects are in the structure. I was starting out with an abstract base class and have several subclasses that impl...

Creating a DOM that is thread safe for read operations

My application composes a webpage model from a number of xml sources. These sources are being parsed into memory as DOM objects with the normal Xerces parser. Unfortunately, Xerces DOM objects are not thread safe for read-only operations. I would like to be able to reuse the parsed DOM for read. Does anyone know of another parser or ...

How use hibernate criteria for a left outer join without direct link into the two tables

I'm trying to translate a SQL quest into Hibernate criteria. My quest is working in SQL : select * from objective left outer join conditionstate on objective.conditionid = conditionstate.conditionid and conditionstate.personid = XXXX where objective.toto_id = YYYYY The objective is not directly mapped t...

Eclipse: Java, see where class is used

Is there a way in Eclipse to select a Java class, and then bring up a list of all Java files where that class is used within a project? ...

Whats the replacement of For-Each loop for filtering?

Though for-each loop has many advantages but the problem is ,it doesn't work when you want to Filter(Filtering means removing element from List) a List,Can you please any replacement as even traversing through Index is not a good option.. ...

If FileAppender fails, revert to ConsoleAppender

With log4j, I'd like to revert to a ConsoleAppender if the FileAppender has problems writing to the specified log file. This means catching a FileNotFoundException or an IOException and switching to a ConsoleAppender. Has this been done before or will I have to create a new appender - something along the lines of: private WriterAppend...

Java class whose fields are only accessible to its subclasses (without getters/setters)?

What I really want is a class with a generic constructor, and when a subclass' identical constructor is invoked, the subclass will have access to the same fields. Here is an example of what I would like to do: public abstract class Command{ private Mediator m public Command(Mediator med){ m = med; } abstract vo...

Java: High-quality soundpackage

Hello, Does anyone know a good lib for playing wav, mp3 (and ogg) where I can: Play Pause Play faster (Slow down) Play backward (mp3!! or ogg!!) Edit volume I want to adjust these things while playing. Thanks ...

Wrong timezone being used in Java web service

I have a JAX-B java web service which I'm using to update a database. Each row in the table that I'm updating is represented by an object similar to below: - public class Item { private String id; private Date startDate; private Date endDate; public Item() { } ... } This class is being instantiated in a separate...

Java or Python for an intermediate PHP guy. Career advice.

I'm an intermediate PHP developer looking to take up a new language. I'm completely torn as to where to go at this point. There's so many languages related to web development and programming in general. I had might as well add Ruby to the question. Java, Python, or stick with PHP and try to really master it? For those of you program...

What is the meaning of the Java's Enum declaration?

Hi all, Surfing on the source code of Java, I found the following declaration: public abstract class Enum<E extends Enum<E>> How should it be interpreted? I'm stuck with it... Thank you. ...

SWT/JFace or Eclipse RCP?

Which are the reasons to choose the Eclipse Rich Client Platform as the base of my application, instead of just using SWT/JFace? ...