java

Is there a way to get all the classes that implement a certain method?

The title speaks for itself. The language is Java. ...

HSSFCellStyle to HTML CSS style

Hi, i am trying to convert an excel workbook to HTML page. The plan is to make the HTML as close possible replica of the excel sheet as possible. For this, i need to migrate the style settings for each Cell (HSSFCellStyle) to CSS. The first thing that came to my naive mind is that if there is a library avaiable to do this conversion, m...

Java Generics GetThis Trick Explanation

I am reading about Java Generics and I came across this topic where I am a bit confused. From : http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ205 public abstract class Node <N extends Node<N>> { private final List<N> children = new ArrayList<N>(); private final N parent; protected Node(N par...

JYAML: Serialize/deserialize nested/inner classes

First of all, Merry Christmas to everyone! Now to my question: Let's say I have the class Outer with some inner class Inner. As a field in Outer, I have a List<Inner>, which i then want to dump to a YAML file. I do this like so: Outer o = new Outer(); o.innerList = new ArrayList<Inner>(); o.innerList.add(new o.Inner()); ... Yaml.dump(o...

Why can't I give different name to class than the file name?

When i want to create a java class it is generating automatically a file with the same name of class. But when it generate a class, it can change the file name different than class name.. Am i missing something? ...

Multiple Thread Variable Access inside a function

I have a function that launches a couple of threads (it's a test function) and one of the threads mutates the state of a variable. Since local variables cannot be marked volatile, I would assume that multiple threads in that method will always have the updated state of the variable. Is this correct? Here is the sample code public void s...

Does Java recognize infinite loops?

Given the following code sample: public class WeirdStuff { public static int doSomething() { while(true); } public static void main(String[] args) { doSomething(); } } This is a valid Java program, although the method doSomething() should return an int but never does. If you run it, it will end in an infinite loop. If you pu...

Picture/article which describes JSF lifecycle in detail

I've already seen some examples, like the one below: That's nice description in theory, but I'd like to see also more JSF-related picture, with FacesServlet, PhaseListeners and other stuff to understand their role and sequence of calls in all these phases of lifecycle. ...

What is Double Brace initialization in Java?

What is Double Brace initialization syntax in Java? ...

Unable to resize JButton

I'm Stuck with how to resize the third button to became the same size like the other two and place it on the bottom. class ControlFrame extends JFrame implements Runnable { JButton jb_inc = new JButton(); JButton jb_zero = new JButton(); JButton jb_dec = new JButton(); ControlFrame() { super("Control Frame"...

how can you make sure that your applet isn't being used outside a specific page url?

I have a java applet, I want to make sure that nobody use it outside a specific url. How can I achieve that? The applet connects to a Java server for data exchange. I want to check on the server side the page url that contains the applet. Is that possible? ...

How to call an Oracle procedure with Date input from Java-based webservice?

Right now I have an Oracle stored procedure with IN and OUT params. The IN params are simple types and collections (customType as table of customObject). The OUT params are a REFCURSOR and some varchars. The thing is: when I send some data-formatted strings to Date IN params, it throws at me this: java.lang.IllegalArgumentException: Tim...

Java glazedlists: how to update a table row

I'm missing something obvious here. I have a glazedlists EventList<X> where X is my custom class. This list contains a bunch of values. When I update one of the values, how do I make sure the GUI updates its display for that row? ...

Java web development, what skills do I need?

I want to learn, at least at a basic level, how to build java web applications (coming from a .net background). Meaning, I would like to be able to build, deploy a simple cms type application from the ground up. What exactly do I need to learn? Tomcat seems to be a good web server for Java. What options are there for the web? I kn...

JOptionPane call stacks

Hello, I got a little problem with a JOptionPane which I use to warn user if wrong input is found. It works correct first time. But when I close down the JFrame which calls for that JOptionPane, and open it again it will this time call for it twice. And it will stack for every close down I do. I have tried to look for the problem withou...

OO Design Issue with IDs

Say as an example I have a Player class that has a race via a Race class. These races are fixed in number and are loaded into an array which can be accessed statically. My question is whether the Player class should have an index ID number which would then need to call the static function getRaceByID(int) to retrieve the Race class to ...

Invoke method on property of each bean in collection

Suppose I have a class A with property b Class A { public int b; } There is a collection that containes instances of class A ArrayList col How can I get an array of all values of property b from col? Is there a way more elegant than iteration through col and getting property of each object and then passign values of b to array? ...

Storing AES keys

Hi. Is there a good way to ship AES keys together with the application, but still make them safe enough? I don't quite fond regarding the idea of hard-coding the keys (as the app can be de-compiled), but other alternative, saving them on remote server, looks quite dangerous to me in case the server goes down or the network cuts off. I...

Java generic function: how to return Generic type

Here's a Java generic pattern: public <T> T getResultData(Class<T> resultClass, other_args) { ... return resultClass.cast(T-thing); } A typical call looks like: DoubleBuffer buffer; buffer = thing.getResultData(DoubleBuffer.class, args); I've never been able to figure out how to use this pattern cleanly when the desire...

Similarties of ASP.NET and Java web application

I would like to know what are the equivilents of these features of C# asp.net compared to a similar java built web application. Would a java based web application still be created in this fashion: web.site html files, javascripts, css web.business business logic, rules, etc. web.entities person, account, cart.... web.data...