java

Finding objects under mouse in a JSVGCanvas from Batik

I have a JSVGCanvas object from the Batik library from java. In my application, I am rendering several objects in a schematic. I require to know what component is below the mouse so I can render an appropiate tooltip and description that I am rendering from an external source. My question is, how can I determine what objects are below...

Java: JAXB and using char

Hello, I'm working on a project with JAXB but I run into a small problem with JAXB and the char datatype. char gender = 'M'; Translates after marshalling into: <gender>77</gender> So I think that char is mapped to integer, but I simply want to map it to a String. How can I do this? Is it even possible? ...

How to make Class.forName ignore lowercase/uppercase

For example when I have a class named; 'MonkeyBusiness' I know I can call it using Class.forName("MonkeyBusiness"); But when I call it using Class.forName("monkeyBusiness"); or Class.forName("monkeybusiness"); it gives me the exception; Exception in thread "main" java.lang.NoClassDefFoundError: monkeyBusiness (wrong name: ntx/gmd/se...

Java Scanner class reading strings

I got the following code: int nnames; String names[]; System.out.print("How many names are you going to save: "); Scanner in = new Scanner(System.in); nnames = in.nextInt(); names = new String[nnames]; for (int i = 0; i < names.length; i++){ System.out.print("Type a name: "); names[i] = in.next(); } System.out.printl...

where can i find an example of how to setup https on java where https is not supported

Hi, Does anyone have a good example of how to do https over http (or a socket)? The embedded java platform doesn't support https out of the box, but I'm sure it should be possible using some 3rd party libraries or source code snippets. If anyone can point me to the correct direction I'd be very grateful ...

Swing: how can I ignore deselection events?

My custom component is composed of three JTrees inside a JPanel. Only one JTree should be selected at a time, so I've added a TreeSelectionListener to each of them that calls clearSelection() on the previously selected JTree. (See here for more details). That works fine, but I need to prevent the TreeSelectionListeners to trigger when ...

Java JPA OneToMany - "Many" relationship not refreshing

I'm running into a strange problem using the Toplink implementation of JPA. I'm writing a stand-alone application to manage loans. I define a LOAN class that has a OneToMany (bi-directional) relationship with a NOTICE class. I created a GUI to display all the notices for a particular loan. In another part of my program I can send out...

JSF page initialization using GET

I need to be able to grab a user's information from a database and pre populate some fields on the page from this information, using args sent in a GET request in the database's query. What is the best way of performing this "on page load" type of functionality using standard JSF? Couple possibilities I have found so far: performing...

Unable to publish web app: SpringSource Tool Suite problem?

I have an existing, fully functional Spring web application based on Spring 2.5.6 - developed using SpringSource Tool Suite 2.1.0.SR1. Because I'd like to use REST I decided to upgrade to Spring 3.0.0.M4. After editing the dependencies in pom.xml and changing my code to reflect the API changes in Spring 3.0 I tried to publish my web app...

Dynamically changing the tooltip of a draw2d figure

We are currently using Eclipse Draw2D/GEF for an information page describing a process in our application. This basically consists of a matrix of large squares, each containing a matrix of smaller squares. We originally had all the squares as GEF objects, but because of the large volume of them being shown, we found that this did not sca...

Convert ANSI characters to UTF-8 in Java

Is there a way to convert an ANSI string to UTF using Java. I have a custom serializer that uses readUTF & writeUTF methods of the DataInputStream class to deserialize and serialze string. If i receive a string encoded in ANSI and is too long, ~100000 chars long i get the error; Caused by: java.io.UTFDataFormatException: encode...

JSP - Authentication and Authorization

I come from an ASP.NET background. In ASP.NET, there is built-in support for users and roles. My question is, does JSP have anything similar or is everything built from scratch? I have not been able to find a good resource to answer this application structure type of question. ...

How to set an image as a background for Frame in Swing GUI of java ?

Hello, I have created one GUI using Swing of Java. I have to now set one sample.jpeg image as a background to the frame on which I have put my components.How to do that ? ...

What is a TCP window update?

I'm making my own custom server software for a game in Java (the game and original server software were written with Java). There isn't any protocol documentation available, so I am having to read the packets with Wireshark. While a client is connecting the server sends it the level file in Gzip format. At about 94 packets into sending ...

Is possible to associate a text to a JTableHeader without a table?

Hi, I want to create a JTable with a header inside some cells. But I want to associate a text with this header. Is it possible? How to do? All my best! Leandro Lima ...

Java Scanner class reading strings

I got the following code: int nnames; String names[]; System.out.print("How many names are you going to save: "); Scanner in = new Scanner(System.in); nnames = in.nextInt(); names = new String[nnames]; for (int i = 0; i < names.length; i++){ System.out.print("Type a name: "); names[i] = ...

Google App engine external database

I've been searching and can't find an answer anywhere. I also haven't had time to try it out either. Is it possible, using java in the Google App Engine (GAE), to connect to a remote database. Whether it MySql, SQLServer, etc. Will it be allowed to make calls outside of it's domain? Is it possible to even use the required libraries ...

What does the class class [B represents in Java?

I am trying out a tool jhat here to test my java memory usage. It reads in a heap dump file and prints out information as html. However, the tables shows as follows: Class Instance Count Total Size class [B 36585 49323821 class [Lcom.sun.mail.imap.IMAPMessage; 790 16254336 class [C 124512 12832896 class [I 23080 11923504 ...

How to check whether the file is using/reading or not in JAVA?

I am using Java to develop an application, it needs to manage the file on the computer. The application have the ability/function to delete the file on the system. But I want to check whether the selected file is using/reading by another application or not first. Because I don't want to delete the file which is reading/using. How can I d...

How to force Javamail to clear its message cache?

I'm running a server that uses Javamail. It has a count listener with IMAP's IDLE, such that when a new mail comes in, certain piece of code is executed. The list of new message is given to my listener as a parameter. I read the information off it and be done with it. All is good except my server leaks a lot of memory!! I did a heap dump...