java

What Java Swing event can be used to know when application has finished starting?

I'm looking for a place to hook some code to programmatically create, size and position a JPanel after the application has finished loading. I'm just starting with Java. I'm using NetBeans 6.5.1 with jdk1.6.0_13. I've used the new project wizard to create a basic Java/Swing desktop application. This is a SingleFrameApplication that uses...

JPanel flipping out, FlowLayout not working as intended

Hi, The other day this code was working. I changed some things and re-ran it and now it doesn't work as intended. Obviously something I changed altered the behaviour, but I have gone back and reverted all of those changes and it still doesn't work. Disregarding that bit of information (to start), why the hell does this code not place a ...

How does Terracotta work in this situation?

So lets say I have an N sized server array set up like so: I have a simple JavaBean/POJO: package example; public class Person { private OtherObject obj; public void setObj(OtherObject theObj) { synchronized (this) { obj = theObj; } } public OtherObject getObj() { synchronized (this) { return obj; ...

What are some Open Source Java projects with good, fine-grained unit test coverage?

I'm working on a Java decompiler with correctness(*) as a primary design goal. To test it, I'm looking for some Java Open Source projects with fine-grained unit test coverage. These projects can be large or small, but test should exist which cover individual classes or methods. I plan to compile these projects with various compilers/s...

How to know which classes inside a .jar file are referenced?

I need to deploy only the referenced classes in a very limited environment as A data carousel for Interactive TV. Bandwidth is expensive and .jar files are not supported. ...

How can I play a WAV file using Java?

I send WAV files using a client and server, but I want to play the WAV when it received. I try this method but it did not work: Runtime.getRuntime().exec("C:\\Documents and Settings\\Administratore\\Desktop\\gradpro\\test1\\s1.wav") ; This the exception that I get: "Error! It didn't work! java.io.IOException: Cannot run progr...

Google App Engine Java development on IntelliJ?

Annoyingly, Google App Engine has become another one of those projects where they only release plugins for Eclipse (like Spring Webflow) and I just much prefer IntelliJ. Can you run the local test environment successfully with IntelliJ? And debug/deploy a local or live application? If so, are there any features missing that are in the Ec...

Dom4j rule does not match all expected nodes

I'm using dom4j's rules api to fire an action if the predefined pattern //authorize matches an element in the following xml snippet. <authorize role_required="admin"> <node title="node which is visible only to admin" path="" > <authorize role_required="admin"> <node title="node which is visible only to admin" path=""/> ...

retrieve matlab result in java

Hi I use matlab in my project and I want to retrieve the result of matlab in java. Just I want the result. I want to retrive result of file that I make it in matlab in the java. I use this code but it give me the result in matlab windo and I want only to retrive the result in java only. this is the code public class matlab { priva...

How do I use MiG Layout with Eclipse?

I've been Googling and checking on Stack Overflow and nothing has helped... hopefully someone can. I usually just write my code by hand, but I'm working on a Java project that has a GUI aspect and I like what MiG Layout has to offer so I want to use it. I've downloaded the .jar file from the website, but I can't seem to be able to acces...

Cannot use class in client package with GWT!

I am trying to use the myType class declared in the package com.mycompany.myproject in a class that lives in com.mycompany.myproject.client but I am getting the following errors when compiling: [ERROR] Line [X]: The import com.mycompany.myproject.myType cannot be resolved If I try to run the hosted browser I get: [ERROR] Line [X]: No ...

How do I resolve ambiguous methods caused by intersection types in Java generics?

I just recently discovered that you can specify multiple types in a single type parameter bound (see example). Like any new tool, I've been trying to explore the possibilities of how this can be used (and misused). I crafted this example to help illustrate. On the sample below, the compiler is giving me an error dispatch(new Alphab...

Java True False Questions

My teacher gave out a practice exam on java recently and I'm curious to see how I did on the true/false part. I'm least confident about number one, so any explanation there would help a lot. In Java, a class can extend any number of abstract classes. false. I don't quite understand why, is it just because in an inheriting class the...

Advanced GUI Possible in Java?

Perhaps a philosophical question. I’ve seen some interesting visuals lately in GUIs, mostly on native platform APIs. I know that “it’s just software” and that likely, with enough work, anything can be done with pixels. The question is (finally!), is Java really an option for doing fancy things with a GUI. Seems like a silly thing I g...

Graph database for .NET

I've been designing an application, based on .NET/Mono framework, which should make an heavy use of the shortest-path in a graph theories and I would like to use a native solution to traverse the nodes of the graph, instead of implementing surrogate solutions which would be hardly maintainable and would massively affect performances. I'...

What HTML templating options are there in Java as an alternative to doing HTML output from your servlet code?

Given the following Hello World servlet, how could you transfer the Hello World output out of the servlet code and put it in some kind of HTML templating format? I would like to simply call the template from the servlet and have it render the Java variables I refer to in the template - perhaps by referring to the "Hello World" string as ...

String's Maximum length in Java - calling length() method

Hi people. My question is very basic, but I didn't find an answer on a Google search. In Java, ¿what is the maximum size a String object may have, referring to the length() method call? I know that length() return the size of a String as a char [ ] ...

How can I use listeners to access other elements?

I'm setting up a GUI where I need to take information inputted from form elements and manipulate the information. This requires me to use some elements to access others. For example, I have an input box (JTextField) and a button (JButton) beside it. When the button is pressed, I need to be able to manipulate the text entered into the in...

Circle functions not behaving as expected in Java Class

so i made a circle class that sets the radius, and should output the radius, circumference and area however, if i input the radius, the radius, circumference, area wont output back, it just shows as 0.0 heres my Circle.java public class Circle { private double radius; private double PI = 3.14159; public void setRadius(doubl...

How to include custom panel with NetBeans GUI Builder?

I have written a class that extends JPanel. Is it possible to use this in the NetBeans GUI Builder and have it survive all of the automatic code generation? I have used the customised code option in the GUI builder to instantiate the object as the new class, but it seems like the declaration can't be changed from JPanel, so only method...