java

[SWT, Java] Date time picker control

I look for date time picker control which look like this: All controls which I found don't use system layout. It would be great if this control use system style and layout. ...

Need recommendatins on a Java open source project for an academic study

I'm looking for a Java open source project for an academic study on test cases. I need a project with 20-40 KLOC and at least a 100 JUnit tests. A project that was developed using TDD methodology is prefered. Something that I can drop in eclipse and run all the tests with minimal overhead for setups. Any recommendations? ...

Java: Syntax highlighting component keyevents

Hello, I just met the lib BeanShell. And now I'm making a Java Editor with a run-button who runs the code without compiling. For the texteditor-component, I use the open-source jEdit Syntax Package. Here is a link with a demo: link. Now I wrote code that adds every time the user pressed enter automaticly added the same number of tabs ...

Java: What does ~ mean

In source code I found this line: if ((modifiers & ~KeyEvent.SHIFT_MASK) != 0) .... Does somebody know what the ~ means? Thanks ...

java isEmpty() undefined for string

I'm working on a school project in eclipse, and when I try and use the isEmpty() method on a String, Eclipse shows up the following error: "The method isEmpty() is undefined for the type String" I've run the Java updates, but am still getting it. Is any reason why this method would be undefined? ...

Restrictions on what an unsigned Java applet can do?

I'm trying to compile a complete list of all restrictions placed on unsigned Java applets (defined as things a normal Java application can do, but an unsigned Java applet cannot). This is the list I've compiled so far: An unsigned Java applet ... Cannot access the local filesystem. Cannot access the system clipboard. Cannot initiate ...

Java Mac ZoneInfoMapping error

Hi, I've just updated to jre 1.6, and I'm not sure if this is a result of upgrading or not, but I'm getting this error whenever I run my app: ZoneInfo: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/zi/ZoneInfoMappings (No such file or directory) I tried going back to 1.5, but the error is still there, and after a ...

state design pattern from Java to Ruby

Hello, I have a working solution in java using a classic state design pattern and facing some difficulties translating it to ruby. I am new in ruby, but the diffuclty I believe lies in the differences on how patterns can be implemented in dynamic languages. My interface is describing the actions the model can execute in every state: p...

Unit testing a Java multi-threaded network app

I am writing a Java multi-threaded network application and having real difficulty coming up with a way to unit test the object which sends and receives communication from network clients. The object sends out a message to a number of clients and then waits for responses from the clients. As each client responds, a dashboard-style GUI i...

Problem with the ArrayList class in Java

Hi, I have a problem with the following code. I obtain the error message Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.set(ArrayList.java:364) at Test.main(Test.java:17) and I don't understand why. I have a lis...

Plugin inside Sametime with Lotus Notes Classess - The Whole Story

It's gonna be a long read so Thanks for being patient :). I have been trying to develop a plugin to be executed inside Lotus Sametime. The idea of this plugin is to extract the calendar entries for a given date and then display it in sametime. Simple isn't it, i thought so too. Apparently I was wrong and grossly misunderstood the JVM ve...

Resource ... is not available.

If i try to use this action (test2) it always returns "The requested resource (/WebApplication4/newFolder/test2.jsp) is not available." Running tomcat6 and netbeans 6.7.1 config.xml (it is included in struts.xml): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuratio...

java rmi exceptions

I'm writing an rmi application. Everything works perfectly fine when i put the all classes in one directory. However, when i try to split the server part and the client part, it raises java.lang.ClassNotFoundException.myclasses It seems to be the Registry can't find that class on its CLASSPATH. I'm wondering how to I solve this problem? ...

Transmit value between servlets

Hi, I've written a html form to retrieve password and user name from users: <form action="prueba-registro" method=get enctype=multipart/form-data> <h3> User information </h3> User name: <INPUT TYPE=TEXT NAME="realname"><BR> Password: <INPUT TYPE=PASSWORD NAME="mypassword"> <P><INPUT TYPE=SUBMIT VALUE="Register"> </form> This informati...

mouse moved -crosshair cursor

I developed a program to draw polygon triangles. The triangles were drawn using mouse drag. The coordinate of the triangles were stored in array list. Every times the mouse cursor, mouse over on the existing drawn triangles(within the area of triangle), the mouse cursor should turns to "CROSSHAIR_CURSOR", however this were not happened. ...

Creating objects makes the VM faster?

Look at this piece of code: MessageParser parser = new MessageParser(); for (int i = 0; i < 10000; i++) { parser.parse(plainMessage, user); } For some reason, it runs SLOWER (by about 100ms) than for (int i = 0; i < 10000; i++) { MessageParser parser = new MessageParser(); parser.parse(plainMessage, user); } Any ideas ...

Java: Max/min value in an array?

It's trivial to write a function to determine the min/max value in an array, such as: /** * * @param chars * @return the max value in the array of chars */ private static int maxValue(char[] chars) { int max = chars[0]; for (int ktr = 0; ktr < chars.length; ktr++) { if (chars[ktr] > max) { max = chars[ktr]; } } return ma...

Where to put potentially re-useable helper functions?

This is language agnostic, but I'm working with Java currently. I have a class Odp that does stuff. It has two private helper methods, one of which determines the max value in an int[][], and the other returns the occurrences of a character in a String. These aren't directly related to the task at hand, and seem like they could be reus...

Why are variables declared with their interface name in Java?

This is a real beginner question (I'm still learning the Java basics). I can (sort of) understand why methods would return a List<String> rather than an ArrayList<String>, or why they would accept a List parameter rather than an ArrayList. If it makes no difference to the method (i.e., if no special methods from ArrayList are required),...

ejb-jar.xml : Allowed Methods for container-transaction tag

Hi, Are we allowed to specify a method name with an access modifier of 'protected' or 'private' inside the <container-transaction><method></method></contaner-transaction> tag ? Below is a sample of the ejb-jar.xml: <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"> ...