auto abbreviating JLabel
Hi all, Anyone written a JLabel (extension/util/??) that automatically abbreviates the contents depending on it's preferred/visible size? much appreciated. ...
Hi all, Anyone written a JLabel (extension/util/??) that automatically abbreviates the contents depending on it's preferred/visible size? much appreciated. ...
Hi, I want to upload a file using HTTPClient jar. Where i can mention the target path in the destination server to which the file should be uploade. In HTTPClient 3.1 the target path can be mentioned in MultiPartPost constructor method but in HTTPCLient 4 this class is removed. Thanks SHyam ...
Preface: I know that there are high quality graph APIs available. I'm interested in writing my own for self-improvement. This is my function to add nodes: public void addNode(Vertex v, Collection<Edge> neighbors) { int originalSize = size(); if (head == null) { head = v; } else { Collection<Edge> i...
Hi All, I have some HTML code that I store in a Java.lang.String variable. I write that variable to a file and set the encoding to UTF-8 when writing the contents of the string variable to the file on the filesystem. I open up that file and everything looks great e.g. shows up as a right arrow. However, if the same String (containing ...
I am working on a solitaire game in Java, and i need to implement sound when the desk is shuffled, card flipped, etc. I used the following sites as reference to try and get it to work, but i am getting Null Pointer Exceptions or mishandled URL exception (depending on what i tweak). here Also, i am using netbeans 6.7.1 as my IDE. I will ...
I have a game built in a java environment and I use JVM. I have 4 cores @ 2.4Ghz and my server is only using one of those cores... I've tried and searched and I still have no guides to setup multiple cores to run the game like, say 1 core for running the character saving + loading, and 1 core for the server itself, and 1 core for a hel...
Does singleton/session scopes of Spring beans require that access to all its fields must be synchronized? Say through "synchronized" keyword or using some classes from package "java.util.concurrent". As example, is this code not thread safe? (copy/pased from here): @Component @SessionScoped public class ShoppingCart { private List<...
Hi all, I've been working with computers for nearly 30 years (started out coding BASIC on a PET, then 6502 onto 68000 and C). I later gained a CompSci Degree and continued programming, moving into databases (DBA) and I've spent the last 10 years to present day as a Unix Sys Admin. I spent the last couple of years writing java for a ...
Here's my problem: My program is getting XML files as its input. These files may or may not have an xml declaration, doctype declaration, or entity declaration, but they all conform to the same schema. When my program gets a new file, it needs to inspect it, and make sure it has declarations like this: <?xml version="1.0" encoding="U...
Our J2EE Application is deployed to JBoss and sometimes to OC4J . Can I know which one is being used? I hope there is a method returning the container information on runtime. ...
In our system we have separate API to build query where we need to pass each column and table name separately like below: dw.setCOLUMN("Column1"); dw.setCOLUMN("Column2"); dw.setTABLE("TableName"); If I would get chance I will remove this API and go with simple SQL query execution (like many Java application does) but due to the exist...
I'm playing around a bit with JPA(Eclipselink to be specific). The below entity have a timestamp that's supposed to reflect whenever that entity was last updated. What are the strategies for making JPA update that timestamp automatically every time this entity is changed ? How would I go about if I also want a 'creation' timestamp, on...
I dont get the error when I use the following line FileItemIterator it = servletFileUpload.getItemIterator(request); I get it when I use following line List fileItemsList = servletFileUpload.parseRequest(request); How are they different and How is rmi related to servletFileUpload.parseRequest(request);? Error: Caused b...
I'm trying to iterate through all nodes, so I can print them out for graphviz. What is the best way to do that using the JGraphT library? public static void main(String[] args) { UndirectedGraph<String, DefaultEdge> g = new SimpleWeightedGraph<String, DefaultEdge>(DefaultEdge.class); String odp = "ODP"; String cck = "CCK"; String m...
What is the most efficient class to use to read from and write to console in Java? ...
I have a class that i use to do downloads. The class is observable and i use it as a swing UI model object too. However it is too slow, both to start (from the http handshaking i presume so not much i can do about it probably) and from synchronized access. The interface of the class is: public File getDownloadedFile() public String get...
I'm hoping that an extension of some kind is available that does this (although I suppose that my hope is foolishly optimistic). /** * <p> * Gets the {@link ResultObject} given the identifier. The following * fields are not available for some users and will contain a null value: * </p> * * <ul> * <...
I want to use a PriorityQueue to do a topological sort on a graph. For brevity, I'd like to use an anonymous inner class for the comparator. However, I need access to the graph g in order to determine the in degree of the nodes I'm looking at. Is this possible? /** * topological sort * @param g must be a dag */ public static Queue<...
Hi Guys. I am trying to find an elegant framework to arrange all of my server components. The server: 1. Receives a request, as a XML string, from the client. 2. Validates the messages ( !null && !empty mainly). 3. Unmarshalls the message into a Request object. 4. Validates the internals of the Request object (ensures all the requi...
We're providing a client jar for other internal apps to connect to our app's REST API. Our API depends on a few standard Jakarta libraries. Is it a best practice to include those JAR files within our client jar file? Or do you just document the dependencies and it's up to the clients to ensure they have those jars on their classpath? ...