java

Can you set a permanent size for a JPanel inside of a JFrame?

Hey everyone, My current problem is that I have a JFrame with a 2x2 GridLayout. And inside one of the squares, I have a JPanel that is to display a grid. I am having a field day with the java swing library... take a look http://img114.imageshack.us/img114/9683/frameow2.jpg Java is automatically expanding each JLabel to fit the screen....

MP3 Encoding in Java

I need an OpenSource API in Java, which can encode *.wav and *.au formats to MP3, and vice-versa. Have evaluated Java Sound API, and LameOnJ, but they dont meet the requirements and aint stable, respectively. Please suggest one that is free, and platform independent. ...

Disabling 'paste' in a jTextfield

Hi I have an app that is written in Swing, awt. I want to prevent users from pasting values into the textfields. is there any way to do this without using action listeners? ...

How can I extract java exe to jar

I have an exe that I know was written in java. I understand that java programs can be made into an exe and there are tools to convert jar files to exe but is it possible to convert back? AFAIK jar files can be run on any platform that can run java and I would like to use a windows compiled java program on mac without using any extra virt...

How to launch multiple Java programs with one configuration on separate consoles (with Eclipse)

I'm working with a Java program that has multiple components (with Eclipse & Ant at the moment). Is there some way to start multiple programs with one launch configuration? I have an Ant target that does the job (launches multiple programs) but there are things I would like to do: I would like to debug the programs with Eclipse, hen...

Using font resources for graphical languages in Java 1.4

I have the following issue using java 1.4 I try to display a very simple HTML document in a JTextPane that contains chinese characters. If the locale used when launching the java virtual machine is user.language=zh and user.country=CN the graphical characters are rendered correctly. For any other locale, the characters are rendered as...

IPC between .NET and Java client applications

Dear all, I must get two different client application talk without any kind of broker or server. What is the best method for IPC beween two process, Java and .NET? It must able to be work in multi-user termainl server, so no socket please. I wish that it is lightweight and simple, something plug and run, so no RMI/WS please. I'm now t...

Axis2 WSDL2Java : missing no-arg operation in generated stub

Hi, I've got in my webservice a simple public boolean isAlive() service. I defined it in my WSDL : <wsdl:types> <xsd:element name="isAliveResponse" type="xsd:boolean"> </xsd:element> </wsdl:types> <wsdl:message name="isAliveResponse"> <wsdl:part element="ns:isAliveResponse" name="parameters"/> </wsdl:message> <wsdl:portType ...

What is the best format to use when creating a mail list for use in a Word 2007?

I'm writing a web app (Java) which allows users to select contacts. The contacts details can be downloaded (currently in CSV format) and used to perform a mail merge in Word 2007. I would like to use a format which is a bit more 'robust' than CSV. Those of you in non-English areas will know the comma/semicolon problems! Which format wo...

Mix of Arabic and English causes problems in JTextArea (Java)

I have a JTextArea which displays HTML of an Arabic web page. So it's essentially a mix of English and Arabic. In the JTextArea, with columns set to 30, certain text just disappears instead of wrapping properly. The weird thing is that if I copy the invisible text and paste it into Notepad, then I can see it in Notepad. If I change the n...

How can I assemble bits into a long to create a unique ID?

I would like to write a utility that will provide me with a relatively unique ID in Java. Something pretty simple, like x bits from timestamp + y bits from random number. So, how would I implement the following method: long getUniqueID() { long timestamp = System.currentTimeMillis(); long random = some random long ... ...

Java: Code Refactoring/Optimization

Please enlighten me: Which one do you prefer? Why? [Readability? Memory concern? Some other issues?] 1. String strSomething1 = someObject.getSomeProperties1(); strSomething1 = doSomeValidation(strSomething1); String strSomething2 = someObject.getSomeProperties2(); strSomething2 = doSomeValidation(strSomething2); String strSomeResult ...

inject property value into Spring bean

Hi, I have a bunch of Spring beans which are picked up from the classpath via annotations, e.g. @Repository("personDao") public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao { // Implementation omitted } In the Spring XML file, there's a PropertyPlaceholderConfigurer defined: <bean id="propertyConfigurer" clas...

how to find words within a range in a TreeSet<String> using regular expressions (java)

I am iterating though a TreeSet and printing it out: while (it.hasNext()) { System.out.println(it.next()); } output: after explorers giant hoping internet into . . . virtual world However, I would like to only print out those strings who's first character is within the range m-z. I have been playing around with java.util.regex, ...

Why are there no byte or short literals in Java?

I can create a literal long by appending an L to the value; why can't I create a literal short or byte in some similar way? Why do I need to use an int literal with a cast? And if the answer is "Because there was no short literal in C", then why are there no short literals in C? This doesn't actually affect my life in any meaningful wa...

Polymorphic factory / getInstance() in Java

I'm aiming to create a set of objects, each of which has a unique identifier. If an object already exists with that identifier, I want to use the existing object. Otherwise I want to create a new one. I'm trying not to use the word Singleton, because I know it's a dirty word here... I can use a factory method: // A map of existing ...

Is JCE needed if you have LDAP?

Do you need to have JCE embedded in your java application when you already have LDAP authentication in place. ...

ActiveMQ web console doesn't work with embedded broker

I have an embedded broker completely configured through java code (no deployable xml files). When I point my browser to the web console I just get a 404, and an lsof shows that nothing is listening on 8161. Is it possible to use the web console with only java code? I'm fine with using the webserver that comes with ActiveMQ, and I'm fine ...

How do I search in files (for example in Java files) in Vista?

Is there a way or tool for Vista I can use to search for content in Java files? (I do not have an Eclipse project set up for it) I used to be able to do it easily in the windows search tool when I had Windows 2000. Edit: I have already enabled "search file contents" and added additional file types as recommended by xsl and Grant Wagne...

How should I cast for Java generic with multiple bounds?

Is it possible to cast an object in Java to a combined generic type? I have a method like: public static <T extends Foo & Bar> void doSomething(T object) { //do stuff } Calling this method is no problem if I have a class that implements both interfaces (Foo & Bar). The problem is when I need to call this method the object I need...