java

Android application transparency and window sizing at root level

Is it possible to create an application with a transparent background on the root task such that you can see the task running beneath it when it is part of a separate stack? Alternatively, is it possible to run an application so the window of the root task is only a portion of the screen instead of the whole screen? I understand how the...

Java Design Pattern Help

Hello I am trying to build a framework of IAction objects that will execute in a sequence. Each IAction implementation will execute its processAction() method as it was implemented for. This method returns a IAction, which in most cases is itself, but in some cases may be a pointer to another IAction in the List. The IActionIterator...

reading from input stream of socket without busy waiting in JAVA

i want to read from input stream when i connect to a server socket. but there may exist some delays between messages how can i read from input stream without busy loop ? string mes = socketReader.readLine(); above line returns null when no input provided in socket input stream. i want to be notified somehow when a message is ready in ...

I need a function to convert lower case to upper case in Java

Hi, I'd like to know how to convert to upper case the input from the keyboard either if they are letters or numbers (only). I'm learning to program and I'd like to do it in the Java language. I have to remove the accents if the input has it and convert the input in the upper case letter. I have an idea of this but I'd really appreciat...

How do I format a long integer as a string without separator in Java?

Simple question, but I'll bet that asking on here will probably be more straight forward than trying to understand the documentation for MessageFormat: long foo = 12345; String s = MessageFormat.format("{0}", foo); Observed value is "12,345". Desired value is "12345". ...

Good way to have a Collection Listener ?

Is there a better way to have a listener on a java collection than wrap it in a class implementing the observer pattern ? ...

Update a single object across multiple process in java

A couple of Relational DB tables are managed by a single object cache that resides in a process. When the cache is committed the tables are updated. The DB relational tables are updated by regular SQL queries and not anything more fancier like hibernate. Eventually, other processes got into the business of modifying this object without ...

android Toast and View help

I am trying to create a Helper class to display Toasts in my android app, as follows. public class ToastHelper{ final static Toast toastAlert(String msg) { LayoutInflater inflater = LayoutInflater.from(Main.self.getApplicationContext()); View layout = inflater.inflate(R.layout.toast_layout, (ViewGroup) findViewById(R.id.toast_layout_...

How could I implement new JFrame functionality.

I am trying to remove the drag bar across the top of the JFrame. I would like to keep the minimize maximize and close options that appear on this bar available. What I was thinking was to remove the bar (and icons). Then add the icons as embedded images, that implement the JFrame actionlistener. It would also be necessary for this to wor...

String class internals - caching character offset to byte relationship if using UTF-8

When writing a custom string class that stores UTF-8 internally (to save memory) rather than UTF-16 from scratch is it feasible to some extent cache the relationship between byte offset and character offset to increase performance when applications use the class with random access? Does Perl do this kind of caching of character offset t...

How to playback asx files/streams with java

Hello all, I am trying to play a asx file with Java SE. I have read a lot of documentation of frameworks and libraries but I am unable to find a solution. Is it at all possible to playback ASX files. If so, with what framework or librarie? Thanks in advance, Stefan NLD ...

Accentuated literals in Java

I tried to type char literals for accentuated vowels in Java, but the compilers says something like: unclosed character literal This is what I'm trying to do: char [] a = {'à', 'á', 'â', 'ä' }; I've tried using Unicode '\u00E0' but for some reason they don't match with my code: for( char c : string.toCharArray() ) { if( c == ...

Android: what does "setTextFilterEnabled" method do?

What does the setTextFilterEnabled() method do? ...

Get generic type of java.util.List

I have; List<String> stringList = new ArrayList<String>(); List<Integer> integerList = new ArrayList<Integer>(); Is there a (easy) way to retrieve the generic type of the list? ...

Java class with only static fields and methods - bad or good practice?

I have a Java class that only consists of static member variables and static methods. It is basically serving as a utility class. Is this a bad practice to have a class that only consists of static member variables and static methods? Thanks Steve ...

How to change cursor when dropping into Java application

Hello fellow programmers! I'm having some problems I just can't figure out... I'm writing a Swing Java application with a JList that accepts drag-and-drops. I want to change the cursor while dragging a file or folder from my system over the Java application. I've spent hours searching google but I've found nothing useful so far. Maybe...

Error when running Rhino

I have downloaded and compiled the newest version of Rhino by going ant compile ant jar When I run it like so I get the following error java -jar js.jar Rhino 1.7 release 2 2009 05 12 Exception in thread "main" java.lang.NullPointerException at org.mozilla.javascript.Kit.classOrNull(Kit.java:92) at org.mozilla...

Equivalent of #define in Java?

I'm writing a library that needs to have some code if a particular library is included. Since this code is scattered all around the project, it would be nice if users didn't have to comment/uncomment everything themselves. In C, this would be easy enough with a #define in a header, and then code blocks surrounded with #ifdefs. Of cours...

Java references

Is there any way to find all references to an object (in Java)? I have a cache of objects, and would like to periodically scan it to see if removing the object will cause it to be destroyed. ...

C# response object contains null when calling Java Web Service

I've been sent the following wsdl. I generated the C# proxy using wsdl.exe and also created my c# web page. Using Fiddler I have looked at the SOAP response and it contains data. Any guidance on what modification is needed in order to get the C# program to accept the SOAP response. Please excuse the formatting of the wsdl I was uncer...