java

Breakdown of Threads used by a JApplet

I've been spending a great deal of time trying to understand this. I created a JApplet that used Thread.sleep() in a loop to animate the applet. But when I tried to run the Applet the screen stayed blank. When I draw the animations in a separate thread and call repaint, the applet works perfectly. I've seen many explanations of why th...

adding an action listener to a JComboBox

I just want to print the selected option in the combo box, to a textfield. Please explain what's wrong because i have to complete it & explain it in class. Any help would be greatly appreciated. Thanks in advance. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class App3 extends JFrame implements ActionListen...

How to calculate line count for "Java Project"

How to calculate line count for "Java Project" ? I'm using Netbeans 6.9 Thanks in advance ...

How to retrieve height of application header?

Hi Is there a way to retrieve the height (in pixels) taken by the application title and the top bar (the one containing the clock, signal information etc...) Thanks ...

Approaching porting a (Java) library (to Objective-C): Methodology?

I am an iOS developer and I found a great library that handles all kinds of astronomy related calculations for me. The problem is that it's written in Java. Although I have enough experience with languages close to Java, I can't run Java on iOS. I'd like to port it, but being that I've never ported anything before. Like I said, I don't ...

Add MouseListener to JCheckBox

Hello friends, I wrote this code for alert message shown to user when they uncheck the checkbox. It only woks when I mouse key is realized with in the checkbox. If user click the checkbox and release out of the checkbox it allow user to uncheck the checkbox and doesn't shows alert message. How can I solve this bug? public void mouseC...

Are there any good APIs for maintaining an open connection between Flash <--> Java

I have a flash app which will send/receive a constant stream of data. the flash app should open a connection to the Java server, keep it open, and attempt to reconnect on socket failure. Are there any good APIs that offer this functionality? Smartfox Server is one option, but if I had my way I'd embed an API in my app rather than cont...

PKIX path building failed: unable to find valid certification path to requested target

Hi Guyz, I am calling some HTTPS web service which the following Client: import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.net.HttpURLConnection; import java.net.URL; import javax.net.ssl.Htt...

Does Java clients needs specific "Java" certificates when Handshaking with HTTPs servers?

Hi folks, I am writing some Java client to a web service. I am already have xxx_FX.crt and xxx_IE.crt certifications for FF and IE repsectively. I've putted them both in jdk/jre/lib/security but the client still throw the famous exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path buildi...

Swap if-statements

Hi, I am working on code minimization and enhancement. My question is: is it possible to swap the if statements above without destroying the logic of the code? int c1 = Integer.parseInt(args[0]) ; int c2 = Integer.parseInt(args[1]) ; int c3 = Integer.parseInt(args[2]) ; if (c2-c1==0) if ( c1 != c3 ) Since betwe...

Hibernate Session scope in JTA transactions vs Open-Session-In-View

Hi, Is it correct to say that using JTA Transactions with Hibernate contrasts using the Open-Session-In-View with regards to the session scope? From what I've been able to gather the Session scope in the JTA Transactions is a transaction (mainly based on this link) while in the Open-Session-In-View pattern the session's scope is the requ...

Is it possible to add @Secured or @PreAuthorized annotations on an entire class

It seems logical to secure an entire class of controllers rather than each method. Can I do this: @Controller @Secured("ROLE_USER") public class accountPages { //Controllers } ...

Reverse Proxy on Apache for SharePoint Foundation2010

We have an Apache (Redhat 4.6, Apache 2.0.52, libxml2 2.6.16) as a reverse proxy. Authentification and most of the functionality is o.k. But on SharePoint2010-side he has minor problems: - Pulldown menu doesn't work - List editings menu has errors There seems as Reverse proxy can't extract the hard coded of the SharePoint Server within ...

Insert variables to minimize code

Hi, I am facing a strange problem. if ( c2==c1){ c3 *= 2 ; System.out.println( c3 ) ; ..... } I want to insert c3*2 in the println statment. But if ( c2==c1){ System.out.println( c3*2 ) ; gives me a different result. Here is the whole code: public static void main(String [] args) { int c1 =...

A simple program to demonstrate memory leak in Java

I am looking for a simple program that can demonstrate memory leak in Java. Thanks. ...

How to make Eclipse display Japanese symbols (kanji) ?

Hi, I have a project in Eclipse 3.4.1 where i would like to use Japanese symbols (like 象形文字). The problem is that such symbols cannot be displayed correctly in Eclipse and i see black boxes instead of them. I am using "Utf-8" encoding for all files. Could anyone advise me how to fix this ? Thank you ...

Minimize code in reference to read/write operations

Hi, I started with the following code: class Vereinfache2_edit { public static void main(String[] args) { int c1 = Integer.parseInt(args[0]); int c2 = Integer.parseInt(args[1]); int c3 = Integer.parseInt(args[2]); /* 1 */if (c2 - c1 == 0) { /* 2 */if (c1 != c3) { c3 += ...

OpemMQ Configuration, Fatory creation and session handling in Tomcat+Atomikos

Hi, I'm currently using OpenMQ in my app and I need to support distributed transactions. I'm trying to understand what I need to change in the configuration (and where) and how will switching to a JTA change the way I'm currently obtaining my ConnectionFactory and handling my javax.jms.Connection. A quick code example of my usage is (...

Is this a date in Feburary or in March? cal.set(2010, 1, 10)

I have set this calendar in my app: Calendar cal = Calendar.getInstance(); cal.set(2010, 1, 10); I'm using this SimpleDateFormat to get the month as a word: SimpleDateFormat formatMonth = new SimpleDateFormat("MM"); In one class it comes out as February 10th, 2010. In another it comes out as March 10th, 2010. Which is correct? ...

how to stop adding tabbed panel within a tabbed panel in Netbean IDE 6.8.

how to stop adding tabbed panel within a tabbed panel in Netbean IDE 6.8. i want to add a frame in a tabbed panel but whenever i do, it creates another tabbed panel frame in that main tab. what should i do? plz help thanks. ...