java

Drag&Drop Java/.NET

Hi everybody, I need to implement a drag&drop mechanism between a C++ .NET application and a Java GUI, in both directions. Is it possible with some standard API or do I need some custom library? ...

Overloaded constructor ambiguity

I'm trying to use an overloaded constructor in Java that can accept either an int[] or a String. I'm getting a compile error, which seems to be indicating that in this constructor call would be ambiguous if the variable were a null string, or a null array. Is there an easy way around this? ...

Make function of this repetitive piece of java code

I've got this piece of java code: int maxDigit = 4; for(int a = 0; a <= maxDigit; a++) { for(int b = 0; b <= maxDigit; b++) { if(b != a){ for(int c = 0; c <= maxDigit; c++) { if(c != a && c != b) { for(int d = 0; d <= maxDigit; d++) { if(d != a && d != b && d != c) ...

How can I separate tokens in Java when there are some null tokens

i have line in .csv file as abc,bcc, i have to separate it into three tokens as abc bcc and null first i had try stringTokenizer but it will not return null token so after that i try string.split(",") but it will not return the last null string it will return string which has null in between but not at last so please help me tha...

compare hexadecimal values java

Duplicate: http://stackoverflow.com/questions/713162/compare-hexadecimal-values-with-decimal-in-java hi, i'm implementing x-modem protocol in java,i'm reading serialport and storing in byte array of size 1024. then i have converted data to string i'm getting 133 bytes in a packet,problem is i'm not enable to compare hexadecimal value in...

Best Practice: License enforcement for Java Desktop application

What is the best way to implement license enforcement in a Java application, so that the application cannot be "distributed" and used without the user purchasing the license? ...

Problems Deploy Webservices in oracle Weblogic 10.01

i am using jwsc to build my webservices application. This produces a war file with a weblogic.xml like the following: <?xml version='1.0' encoding='UTF-8'?> <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/...

How can I fix a Java-GUI-program (swing), that it works with awesome-wm?

The swing-UI of Java-programs doesn't work perfectly together with the awesome-wm. awesome is a window-manager for UNIX, that automatically resizes program-windows, and the Swing-UI doesn't recognize these resizes correctly. I don't care if awesome or Java is guilty, what I wanna know if I can change my Java-programs in a way, that they ...

JFreeChart Datetickunit question

Hi, I'm trying to plot a weekly XY plot with irregular spacing between data point. That means the first data point and second data points might not be spaced 7 days apart, although the rest of the data points will be evenly spaced. How do I plot the chart so that all the data points are labelled on the x-axis? (I've used DateTickUnit c...

Advice on handling multiple ear deployments into jBoss

We have a typical J2EE application: ear war A war B domain jar datasource config ejb.jar EJBs JPA config We use jBoss as our J2EE container. The same application must be deployed multiple times into the same container (in order to support different independent customers). This is proving to be a troublesome and error prone task s...

How to check if a Java character is a currency symbol

I have to perform a check on a character variable to see whether or not it is a currency symbol. I have discovered the Character.UnicodeBlock.CURRENCY_SYMBOLS constant however I am unsure of how to use this to determine whether or not the character is in that block. If anyone has done this before help would be much appreciated. Thanks ...

Use reflection to iterate over class members

I have a class with numerous parameters of various types. I want to iterate over all type A members , and run a specific functions ( A.doSomething() ) This doesn't even compile: The conversion from field to XPathDataElement is illegal Field[] fields = this.getClass().getDeclaredFields(); for (Field field : fields) { if (field. g...

Programming with Java for beginners

I am a registered Student at a university in Switzerland, thus I know that programming is part of Electrotechnik (electrical engineering), the field I am going to take. How can I learn programming with Java with easiest way, and without help by others? I tried it through learning books, but I found it not easy, especially to do it alo...

How do I draw a dotted line from the paint method on a JComponent?

Hey I have to draw a dotted or dashed line In a JComponent. How do I do that? ...

POI: Importing CSV data.

How can I efficiently import CSV data with Apache POI? If I have a very large CSV file that I would like to store in my Excel spreadsheet, then I don't imagine that going cell-by-cell is the best way to import...? ...

How can I save a PNG with a tEXt or iTXt chunk from Java?

I am currently using javax.imageio.ImageIO to write a PNG file. I would like to include a tEXt chunk (and indeed any of the chunks listed here), but can see no means of doing so. By the looks of com.sun.imageio.plugins.png.PNGMetadata it should be possible. I should be most grateful for any clues or answers. M. ...

How to avoid stale MySQL/Hibernate connections (MySQLNonTransientConnectionException)

Hi, I have a Java webapp using Hibernate and MySQL. If the site isn't used for a few days, the MySQL connection goes stale, and I am met with the following exception: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state. From experience using...

Why does my J2ME DateField not display the correct date?

I am storing values and date values in a record store. I have my date field set up like this: StartDate = new DateField("Start Date ", DateField.DATE); cal1 = Calendar.getInstance(); cal1.set(Calendar.YEAR, 2009); cal1.set(Calendar.MONTH, 0); cal1.set(Calendar.DAY_OF_MONTH...

the right way to select monospaced fonts in Swing

I'm messing around with DefaultStyledDocument and am trying to figure out the right way to set a style to the proper monospaced font. By "proper" I mean that the font selected is: A monospaced font that exists on the user's machine A font specified by the user's preferences (is there a standard way to do this in Java?) If there is no s...

BlackBerry Data Usage

Using the RIM APIs. is there an accurate way of collecting the amount of data coming in and out of a service provider (Not including WiFi/Bluetooth data). ...