java

How to check the status of checkbox in java GUI?

I have around 200 hundred checkboxes in a Java GUI. Now I want to have the list of all checkboxes that have been checked by the user. I can do it in one way like this: jCheckBox1.isSelected(); But I don't want to write this line for 200 checkboxes. Is there any way to do this through a for loop. all the checkboxes have the name like...

PHP Localization Mechanism

What's the best way to localize a PHP page? We have several PHP pages that need to be deployed to other countries. They are hard-coded in English now. I am looking for a mechanism to externalize the text and localize it. Something like ResourceBundle in Java would be great. We don't use any frameworks. ...

What are some practical examples of abstract classes in java?

When and why should abstract classes be used? I would like to see some practical examples of their uses. Also, what is the difference between abstract classes and interfaces? ...

What's the correct way to include an email within Javadoc?

I like to put my email address within @author tags and would like them to be clickable mailto: links in the generated Javadoc. How should I go about doing this correctly? /** * I currently do the following, but would like to have my name * displayed as the link rather than the email itself. * * @author {@link "mailto:my_email@emai...

Are addBatch() and executeBatch() thread-safe?

Can i call executeBacth from a thread while another one keeps calling addBatch() on the same Statement ( or PreparedStatement ) object? Update: Does anyone have exprerience with this issue? 'cause i get incorrect results. Not all updates i added to the the batch is executed. ...

Signed applets having certificate denied sporadically over HTTPS

We self-sign some java applets that we put on our web application, which usually runs across HTTPS. Sporadically we get exceptions in the java console: load: class <our class name> not found. java.lang.ClassNotFoundException: <our class name> at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLo...

Serve dynamic generated images using restlet

I have searched online for a while and almost all the questions regarding image serving using restlet are about static images. What I want to do is to serve dynamic generated image from restlet. I have tried serving static images using restlet, it's working. Also, I can successfully generate a dynamic image and store them in a local fo...

Java Syntax: Shortcuts in Method Declarations?

Quickie pseudo-aesthetics question: For field declarations, the following is allowed: int i, j, k; providing three variables for integers. Does anything similar exist for method declarations, ala: public int getI() {/* ... */}, getJ() {/* ... */}, getK() {/* ... */}; so that the method accessibility, return type, etc don't have t...

Getting around Type Erasure in Java

So, the group I work with has reduced the amount of code we have to type for certain things. In this case, a Spring web page that displays a list using the DisplayTag libraries. The way it's done is with a class using generics extending the Controller object, and then a subclass of that for each page it should work on. This controller...

Why is an "L" getting added to my Java path?

I have a jar loaded in my classpath (in iReport if it matters) that I am certain has the desired method yet when I try to test the connection, thus calling the jar, I get a java.lang.NoSuchMethodError, saying it is referencing the class Lorg/springframework/web/context/WebApplicationContext I'm not sure if this is related to the probl...

Is there an event for collapsing a rich:tree node?

I've finally managed to receive events if the user expands a node of my client side handled tree using the following method: public void processExpansion(NodeExpandedEvent event) throws AbortProcessingException { if (event != null && event.getSource() != null && event.getSource() instanceof HtmlTree) { this.expandedNodes.add(((UITree...

Probable overuse of java interfaces in my implementation of Ms. Pac-Man

I have been a Java programmer for the last 6 years, and since the beginning of this year I got interested in game programming. So, I thought it was a good idea to start with a popular game and I implemented the game Ms. Pac-Man in Java. I can say that my implementation looks about 90% similar to the original game, and I tried to used as ...

using JUnitEE with JBoss-IDE

Can anyone provide me with a tutorial on how to use JUnitEE with JBoss-IDE ? thanks. ...

How to Use Grizzly Embedded Server for Mule as Well as Jersey

I'm currently using JerseyTest w/ Grizzly embedded server to test some code. I do some very simple configuration to point it to the proper resources: Map<String, String> initParams = new HashMap<String, String>(); initParams.put("com.sun.jersey.config.property.packages", "com.sample.service"); ApplicationDescriptor appDescriptor = new A...

Using generics causes unchecked conversion warning

I have the following code String innerText = null; innerText = this.getException(detail.getChildElements()); causing this warning Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator The referenced method is private String getException(Iterator<OMElementImpl> iterator) { ... } The...

Where to store application data (non-user specific) on Linux

In my OSGi-based Java app I am developing a bundle to provide the rest of the system with access to the file system. In addition to providing access to the user home directory, I also wish to provide access to a non-user specific area. Exactly what this area will be used for is as yet undetermined, but it will not be for preferences (h...

How to configure query timeout threshhold for c3p0/hibernate

I have an application that is using Hibernate 3, c3p0, and spring 2.5.6. We have a datasource that is configured to speak with a postgres database. Everything was working great until a firewall was introduced between the application server and the database. We intermittently are getting java.net.SocketTimeoutException: Read Timed Out err...

Eclipse Java project folder organization

I am coming to Java and Eclipse from a C#/Visual Studio background. In the latter, I would normally organize a solution like so: \MyProjects\MyApp\MyAppsUtilities\LowerLevelStuff where MyApp would contain a project to build a .exe, MyAppsUtilities would make an assembly DLL called by the .exe, and LowerLevelStuff would probably build ...

Constants and annotation

This may be a silly question, due to missing some understanding of java but I have this code: @Stateless @WebService public class MLHRequesterBean implements MLHRequesterBeanRemote { private final static String sel = "MLHRequesterPU" + (isProduction()? " " : "-dev"); public static boolean isProduction(){ try { ...

Getting a directory tree with Jabaco?

Given that Jabaco is VB-alike on the surface but Java underneath, can any suggest how to get a directory tree? I think it's got something to do with DirSearch() but as I have no background in Java, I can't think how. ...