java

How do I add components to a JPanel at runtime

Hej I have a JPanel that I want to add some components. in particular JButtons to at runtime based on the content of a user supplied file. I can add compontents to panel if I call it from the constructor of the JFrame derived form class, even after everything else have been constructed, but If I read the file first and then add compone...

Is it good to place System.out.println into a separate method?

I am working with a piece of code that I find kinda strange. The code I am working on is part of an import utility that takes a CSV file and imports the data into the database. Inside the code, I see: ImportUtils.printf("Validation started"); When I look into this method, it is simply calling System.out.println: public static void ...

Throwing an Exception Not Defined in the Interface

What is the best practice to follow when you need to throw an exception which was not defined in an interface that you are implementing? Here is an example: public interface Reader { public abstract void read() throws IOException; } public class CarrotReader implements Reader { public void read() throws IOException {} } publi...

JTree with checkboxes

I need to add checkboxes to a JTree. A custom TreeCellRenderer/TreeCellEditor seems like the right approach. So far I used the CheckBoxNodeRenderer approach in this webpage. It works OK except for two things: there's additional whitespace above + below the checkbox; I'd like to keep it the same as a regular JTree. I would like to disti...

Using xmlbeans bindings for cxf wsdl2java

I am getting started with using apache CXF 2.1.5 and xmlbeans to generate a web service client. The FAQ page shows how to use jaxb bindings to have java.util.Date binding for xsd:dateTime: <jaxws:bindings wsdlLocation="YOUR_WSDL_LOCATION" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:xs="http://www.w3.org/20...

How to get the next term out of a Lucene index?

I'm starting from a Lucene index which someone else created. I'd like to find all of the words that follow a given word. I've extracted the term (org.apache.lucene.index.Term) of interest from the index, and I can find the documents which contain that term: segmentTermDocs = segmentReader.termDocs(term); while (segmentTermDocs.next) {...

Coming back to Java after a long absence; good Java game dev resources?

Hi, all. I've just gotten a new job and will be focusing a lot more on Java development. I figure I'll do my business stuff (Web) during the day, and then do a bit of playing after hours (Game Dev). It's been forever since I've been active in any sort of Java game development community; is there a good central source for such inform...

How to have a @OneToMany relationship with its own entity?

I have items that can contain further items, therefore I need a @OneToMany relationship with the same Entity. I have configured my field like this: @ManyToOne(targetEntity=PersistentItem.class, fetch=FetchType.EAGER) @JoinColumn(name="ID_CHILDREN", nullable=false) HashSet<PersistentItem> children=new HashSet<PersistentItem>(); However...

java.lang.UnsatisfiedLinkError: Native Library {____.dll} already loaded in another classloader

I'm using a JAR file of my own, which uses a Java library (JHDF5), that in turn uses a dll through JNI. When I use my own JAR file in MATLAB, and then have to rebuild it while debugging, I get this error when I try to use it again, after calling clear java and creating a new object from my JAR file: java.lang.UnsatisfiedLinkError: Nati...

using Java enums or public static fields in MATLAB

I'm wondering how in MATLAB you can get a reference to a Java enum or static public field. In MATLAB, if you are trying to use Java objects/methods, there are equivalents to Java object creation / method call / etc.: Java: new com.example.test.Foo(); MATLAB: javaObject('com.example.test.Foo'); Java: com.example.test.Foo.staticMethod...

Can OpenCms be integrated, or used, with an IDE?

I'm starting with a new project where we'll be using OpenCms. Can the workplace be integrated to an IDE, and which one is it ? Can you suggest me any tutorial or ebook by the way? ...

Google data (gdata) in eclipse with app engine, java

Ive had a similar question as this one before, and when that solved this came. So here we go again. The content of doGet pretty much works but when I try it as a part of a servlet that eclipse created for me I get errors. Its looks a bit like I don't have the appropriate files referenced in the library, but I think I do. The java code ...

Combine multiple images into a single image for later painting, with alpha blending

I have a graphics system for Java which allows objects to be "wallpapered" by specifying multiple images, which can have (relatively) complex alignment and resizing options applied. In order to perform adequately (esp. on very low powered devices), I do the image painting to an internal image when the wallpaper is first painted, and the...

How to deploy web service through oracle enterprise manager

Hello all, I have been developing simple web services and clients using JBoss but now I need to deploy a web service in Oracle Enterprise Manager. I tried deploying a test web service but an axis error shows when I try to access it, saying the axis version number is wrong. I have also noticed that my web service doesn't show under "We...

Mocking inside a Java class

So I have this GWT code that handles RPC requests maintain states(ready, waiting, error etc). And I would like to check if the class change its states correctly after each call, set response variables etc. Now how should I proceed to test that without making actual requests to the server(that could run into errors in the server it self)...

How to make my GUI work

Can anyone tell me on how the swing components drawn from the palette and put into the Jfame can work together? For example If a button pressed can the result show on the textArea, Or Can I drag some listed objects from the Jlist in my JFrame onto the JtextArea/JTabpanel? Thank you! ...

How do I add time-stamp information to Maven artifacts?

I am upgrading a large build-system to use Maven2 instead of Ant, and we have two related requirements that I'm stuck on: We need to generate a time-stamped artifact, so a part of the package phase (or wherever), instead of building project-1.0-SNAPSHOT.jar we should be building project-1.0-20090803125803.jar (where the 2009080...

Processing / .NET interop?

I'd like to call into a .NET assembly for some data and library functions from a Processing user interface. What's the best way to achieve this? Expose a web service? A RESTful API? Some godforsaken processing/Silverlight monstrosity? Good ideas are welcome. ...

Checked or Unchecked Exception

Possible Duplicate: When to choose checked and unchecked exceptions Hello! So, I'm still getting comfortable regarding when to throw a checked or unchecked exception. I would like to know what others think is the most appropriate in this case: class Correlation<T> { private final T object1, object2; private final doub...

Component that can serve as an editor pane

Thanks for your answers to my questions some minutes ago! Can anyone tell me which swing component can perform same function as the editor pane of Eclipe or netbean when drag into the Jframe? For example, a swing component on which I can write/display codes and the same time can display some design when the button is pressed. ...