java

JLabel on top of another JLabel

Is it possible to add a JLabel on top of another JLabel? Thanks. ...

--single-transaction --lock-tables options of mysqldump- what happens internally?

Hello, I did find other posts similar to this, but wanted a little extra information on these options of mysqldump. I have understood that the --single-transaction and --lock-tables are mutually exclusive operations. Following are my questions regarding these options. a) Suppose I have chosen to use --lock-tables option. In this case t...

JNI error on Mac OS X 10.4.11... dyld: Symbol not found: _objc_setProperty

I have a problem with some JNI code. I'm getting the following error printed in the console from a OS X 10.4.11 (PPC) machine (it works fine on newer versions of OS X 10.5+) dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty Referenced from: /Path/to/my/lib/libMylib32.jnilib Expected in: /usr/lib/libobjc.A.dylib ...

Get Today's Calendar Entries in Lotus Note using Java

I am trying to get the calendar entries for a given day. The code works without error however I am getting a wrong calendar date entry. I am sure the formula is correct but neverthless would appreciate any help on this. Here's the code. long startTime; long endTime; String searchFormula; DocumentColle...

How do I refer to the right Directory?

If my Java Class is in: ` package org.gamehost.flyingame.BookManagementServlet.ModelClass aka: BookManagementSoftwareServlet/org/gamehost/flyingame/BookManagementServlet/ModelClass and in that class, if I want to return a file from a directory, say an html file, after doing this: File newFile = new File("HTMLFile.html");...

Passing the values to the fraction class in java

If i was to make a new program and wanted to have a fraction class and what my book calls a driver class wich is a main class and i have code like this // Driver class import java.util.Scanner; public class DriverClass{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); Fraction c, d;...

Obtaining a JFrame from a JApplet

Given a JApplet, how do I obtain the JFrame object corresponding to this applet? JApplet applet = this; JRootPane rootPane = getRootPane(); Container contentPane = getContentPane(); JFrame jframe = ...; // How do I obtain the JFrame? ...

In JSF, what's the difference between from-view-id and from-tree-id?

In JSF, in a typical faces-config.xml configuration, what's exactly the difference between from-view-id and from-tree-id tag? And when was the best time to use either? Any example would be much appreciated. ...

Determining the physical location of a file and the device status in Java

Hello, I'm writing a program that has to mantain a large catalog of files. Those may be on different devices and I'd like to know what is the best way to do this in Java. I mean that I need to: Identify the device the file (or just a directory) is on and get a name or identifier for this device that will be consistent... Be able to u...

Java: How does the method scheduledExecutorService.scheduleAtFixedRate() ensures real-time execution?

Hi there! Because I'm executing a time critical task every second, I compared several methods to find the best way to ensure that my task is really executed in fixed time steps. After calculating the standard derivation of the error for all methods it seems like using the method scheduledExecutorService.scheduleAtFixedRate() leads to th...

Java - Why all fields in an interface are implicitly static and final?

I am just trying to understand why all fields defined in an Interface are implicitly static and final. The idea of keeping fields static makes sense to me as you can't have objects of an interface but why they are final (implicitly)? Any one knows why Java designers went with making the fields in an interface static and final? ...

Java date function which is not deprecated

I simply need to print the date of the day on the console in this format: Day.Month.Year. Example: 03.10.09 Code: GregorianCalendar c = new GregorianCalendar(); Date s = c.getTime(); System.out.println(s); The console prints: Sat Oct 03 13:33:36 CEST 2009 I could do it with a case statement, but I am sure there is something more...

Help with a Refactoring: Introduce Parameter Object?

I have some code which is the same except that a certain sequence of assignments happen in slightly different orders. It is easy to factor this out into a method parameter of type int[], which denotes the order. However, I find it isn't the clearest. Another option was to factor them out into a object of type AssignmentOrders. I c...

Looking for a CSS Parser in java

Hi, I'm looking for a CSS Parser in java. In particular my requirement is, for a given node/element in an HTML document, to be able to ask/get the css styles for that element from the Parser. I know there is the W3C SAC interface and one or 2 implementations based on this - but turorials/examples appear non-existant. Any help/points i...

How to upload and store an image with google app engine (java)

Hi, I am looking for the simplest way to upload and store an image (file) to the GAE (java). Googling for hours without any simple and clear result... : ( found this link: http://code.google.com/intl/fr/appengine/kb/java.html#fileforms but i still don't know how to store an image, and how to retrieve it... I am looking for simple servl...

Parse into HashMap using Commons Digester

I need to parse xml into a HashMap where the 'key' is the concatenation of two elements attributes. The xml looks like : <map> <parent key='p1'><child key='c1'> value1</child></parent> <parent key='p2'><child key='c2'> value1</child></parent> </map> In the 1st entry of map, I want to put 'p1.c1'as the map key while 'value1' as the...

EJB3 Getting at original JDBC Errors

Hi all, I am using EJB3 on Glassfish using the default TopLink persistance manager. Within a Session Bean, when the persistence manager catches a DB exception, it marks the transaction to be rolled back, and throws an EJBException, in turn wrapping a RollbackException. Now I was expecting to be able to get the original jdbc exception ou...

how to make autostart when the system restarts

I have created a form to login and password in java swing. I want this application automatically start when the system restart. Means if I restart my computer then my application must run. How to get this Thanks Sunil Kumar Sahoo ...

How to generate a Java class which implements Serializable interface from xsd using JAXB?

I would like to introduce caching into an existing Spring project which uses JAXB to expose WebServices. Caching will be done on the level of end points. In order to do that classes generated from XSD using JAXB need to implement Serializable interface and override Object's toString() method How to instruct the xjc tool using XSD to gen...

Java TGA loader

Hello, I am looking for a small and free TGA image loading class or library for java. Ideally the result is a BufferedImage. Yes, I have already googled, but most results are outdated, or are quite big libraries that contain a lot of other stuff i dont need. I am looking for something small and simple that reads just TGA images. Thanks...