java

MIDP application, blocked by Connector.Open(..)

Hi all i've been having the worst time of my life trying to understand why this is happening, any input would be greatly appriciated. The code in question runs in a diffrent thread then the midlet, although the thread starts after the connection is made, I've tried the other way around and i end up at the same spot.. when executing thi...

how can I display a bufferedimage in a jFrame?

I want to display variations of the same image in the same jframe, for example display an image in jframe, then replace it with gray scale of the same image ...

Controling the Volume of an Audio Clip in Java 1.4

I would have thought that this would be an easy thing to do, but no amount of googling around has turned up any solutions. I have written an application for a client that runs in full screen and allows the user to page through educational books in order to help teach kids to read. So far so good. Some phrases from the displayed material...

Hibernate unidirectional one-to-many.i'm a bit confused

Hello guys sorry if the question looks stupid to you. i have 3 tables currency (id | name) language (id| name | description) transaction (id|amount|languageId | currencyid) so i want to insert into the transaction but making sure that it doesn't insert unknown language or currency (meaning it shouldn't insert to messagetemplate if there...

Java Enums: List enumerated values from a Class<? extends Enum>

I've got the class object for an enum (I have a Class<? extends Enum>) and I need to get a list of the enumerated values represented by this enum. The values static function has what I need, but I'm not sure how to get access to it from the class object. ...

Continuously sending data through Java socket

Hi all What is the best way to send a series of data (float array) from a server to a client continuously through Java socket? For example, I have a server that produces float data every 1ms, and I would like to send this data to a client. My plan is to put this process in a thread (server side) and send it to the client continuously. I...

How to set AUTO-SCROLLING of JTEXTAREA in Java GUI?

I have embedded a JTextArea on a JScrollPane and am using that JTextArea for output. I want that whenever the ouput goes beyond the size of the JTextArea, the JTextArea scrolls automatically so that user don't have to do manual scroll down to see the recent output. How can I do that? I have already set the autoscroll property of both ...

How to add multi-line label on a Java GUI ?

I have made a java swing GUI. Now I want to display a static message on that but the message is multi-line and the JLabel is single line. How can I display that message? Is there any property of JLabel which we can set to display the multiple line message? Will I have to use several JLabels for multiple lines? Is there any other way ...

BlazeDS and Java class in WAR file

Hi I have a java class which has been deployed as WAR web application in a BlazeDS/Spring server sitting on JBOSS. Apart from the Flex application which will access the WAR file, I also need to start some server side process's which will initiate BlazeDS "pushes" to the Flex client via AMF messaging. What is the best way to implement t...

java nested while loop using readline

I'm confused. I'm trying to loop though 2 files looking at the first token in every line of the first file and comparing it to the third token of every line of the second file. Here is the logical structure in the form of a nested while loop: BufferedReader reader1 = new BufferedReader(new InputStreamReader(new FileInputStream(fromFile1...

How to set up maven for two separate projects that depend on the same jar.

If this is answered somewhere else, kindly smack me and point me in the right direction. I'm brand new to Maven and trying to wrap my head around how to use it with my projects. I've got two top level projects, one a Swing app, the other is a set of Web Services. They both depend on the same in-house jar. What are good ways to set up...

Java SSH Tools: SftpClient error: The remote computer disconnected: Protocol error: packet too long: 65580

I am receiving "INFO: The remote computer disconnected: Protocol error: packet too long: 65580" error, when I trying to execute: sUpload("server.host.com", "username", "/home/localuser/.ssh/id_rsa", "filename", ""); The file does not get transferred to SFTP server (only zero-byte gets created on the other side). When SFTPing manually ...

Java generics to enforce return type of abstract method.

I have the following situation : abstract class X { abstract X someMethod (...) {...} }. Now I want to constrain any implementation of X to have its 'someMethod' method return that particular implementation type, not just X : class X1 extends X { X1 someMethod (...) {...} }. class X1 extends X { X someMethod (...) {...} }. //want th...

How to invoke a method with a superclass.

I'm trying to invoke a method that takes a super class as a parameter with subclasses in the instance. public String methodtobeinvoked(Collection<String> collection); Now if invoke via List<String> list = new ArrayList(); String methodName = "methodtobeinvoked"; ... method = someObject.getMethod(methodName,new Object[]{list}); It w...

Java: How to communicate between an annotation processor and another project?

Hello everyone! I have an own annotation processor (let's call it MyProcessor) and a project (let's call it MyProject) which uses the processor by passing -processor to javac. Now I need MyProcessor to produce some output and make it available for MyProject. I have following options (and problems): Let MyProcessor write a file to th...

Swing: Alignment Problem

Hi everyone, I have a question about laying out some swing components. Say, I have a JPanel which contains a JLabel and a JTextField. I want JLabel to be drawn on the left-most side of JPanel, and JTextField to be drawn on the right-most side of JPanel. I tried using BoxLayout and Horizontal Glues, but I couldn't make it work. Can someb...

Polygon Intersection fails, collision "size" too big

OK, so I'm trying to make a simple asteroids clone. Everything works fine, except for the collision detection. I have two different versions, the first one uses java.awt.geom.Area: // polygon is a java.awt.Polygon and p is the other one final Area intersect = new Area(); intersect.add(new Area(polygon)); intersect.intersect(new Area(p....

ClassCastException When Casting HashMap Iterator to a Concrete Type

I am very new to processing.org and Java. I am trying to store objects in a HashMap, and then iterate over the values of the HashMap, calling methods on the stored objects. In order to do that, I assume I need to downcast the iterator to the type of my class, but this throws a ClassCastException ("java.util.HashMap$ValueIterator cannot b...

Microsoft SSRS consuming JAX-WS Web Service problem

I have developed a Web Service using JAX-WS (v2.1.3 - Sun JDK 1.6.0_05) that works just fine when I use a Java client or SoapUI or other Web Services testing tools. I need to consume this service using 2005 Microsoft SQL Server Reporting Services and I get the following error <?xml version='1.0' encoding='UTF-8'?> <S:Envelope xmlns:S="...

Stateless session bean with instance variables

I have a stateless session bean that contains one public method, several private methods, and some instance level variables. Below is a pseudo code example. private int instanceLevelVar public void methodA(int x) { this.instanceLevelVar = x; methodB(); } private void methodB() { System.out.println(instanceLevelVar); } What I'...