Hi all,
I'm having some trouble looping over a HashMap to print out it's values to the screen. Could someone double check my code to see what I'm doing wrong. I can't seem to find anything wrong but there must be something.
In a servlet, I am adding the following to the request:
Map<String, String> facetValues = new HashMap<String, ...
Say I have two classes A and B, with B depending on A.
public class A {}
public class B {
public B(A a) {}
}
It's easy to resolve B in a single PicoContainer.
final MutablePicoContainer root = new PicoBuilder().build();
root.addComponent(new A());
root.addComponent(B.class, B.class);
System.out.println(root.getCo...
I wish to have an internal (non window) dialog to ask for member input. I would like the dialog to be placed centrally on an existing JPanel.
I have looked at layeredpanes and these seem unusable due to only having a single layout manager (or no layout manager) across all the panes. I guess I could try to override JLayeredPane and provi...
How to implement VB's Val() function using Java programming language or is there any API that has the same method?
...
I have a Java program running in command line mode.
I would like to display a progress bar, showing the percentage of job done.
The same kind of progress bar you would see using wget under unix.
Is there a library to make this possible ?
...
I have been given the task of modernizing my company's I5 based point of sale system. The main push is to create a friendlier interface/better data views without losing business logic.
Is there a good Java way of interacting with an interactive (non-command line) I5 program? Something alone the lines of what PHP provides with their 52...
Why doesn't func3 get executed in the program below? After func1, func2 doesn't need to get evaluated but for func3, shouldn't it?
if (func1() || func2() && func3()) {
System.out.println("true");
} else {
System.out.println("false");
}
}
public static boolean func1() {
System.out.println("func1");
return...
I'm trying to get a handle on how to implement threading in a Java application that uses Spring for transaction management. I've found the TaskExecutor section in the Spring documentation, and ThreadPoolTaskExecutor looks like it would fit my needs;
ThreadPoolTaskExecutor
This implementation can only be used in a Java 5 environm...
I know how to set the Java heap size in Tomcat and Eclipse. My question is why? Was there an arbitrary limit set on the initial heap back when Java was first introduced so the VM wouldn't grow over a certain size? It seems with most machines today with large memory space available this isn't something we should have to deal with.
Than...
Can someone please provide an example of creating a Java ArrayList and HashMap on the fly? So instead of doing an add() or put(), actually supplying the seed data for the array/hash at the class instantiation?
To provide an example, something similar to PHP for instance:
$array = array (3, 1, 2);
$assoc_array = array( 'key' => 'value'...
Somewhat to my surprise, the following code prints out "Close" twice. Running through the debugger, it seems MyPrintStream.close() calls super.close(), which ends up calling MyPrintStream.close() again.
import java.io.*;
public class PrintTest
{
static class MyPrintStream extends PrintStream
{
MyPrintStream(OutputStre...
new Date("05-MAY-09 03.55.50")
is any thing wrong with this ? i am getting illegalArgumentException
...
Hi all,
I'm try to write a basic server-client java application. However, I alway got a message of "socket bind on 10 for port 13244 failed: Address already in use (errno=98)" error no matter what port I'm using.
I have attach a source code of my application, just wondering is there very stupid mistake I'm making.
Many Thanks!
Cheers...
I'm trying to expose a REST-full service (hosted by Tomcat) and can't figure out what is the required configuration for Spring 3 (M3).
This is how (example) the service looks like:
@Controller
@Scope("prototype")
public class UsersController
{
@RequestMapping(value="/users/hello", method=RequestMethod.GET)
public String hello()...
I like to 'guess' attribute names from getter methods. So 'getSomeAttribute' shall be converted to 'someAttribute'.
Usually I do something like
String attributeName = Character.toLowerCase(methodName.indexOf(3))
+ methodName.substring(4);
Pretty ugly, right? I usually hide it in a method, but does anybody know...
I have a JTable that is within a JScrollPane. Rows are added to the table at runtime based on events that happen in my application. I want to have the scoll pane scroll to the bottom of the table when a new row is added to the table.
For JLists There is the ensureIndexIsVisible() that forces a particular index in the list to be visible....
I'd like to collect all WYSIWYG text editors for Java here.
Some rules for entries:
There must be a link to the project/product
You must state whether it's open source or commercial
Is it possible to extend the editor (add new features like a "violet centered sudoku")? Is that simple or complex?
Does it come with lots of features (fan...
How can I map a Map in JPA without using Hibernate's classes?
Thanks in advance.
...
Hi,
Is there a way to make a lazy loading with Swing JList ?
Cheers,
...
Hi, does anyone know a library that makes it possible to create a cabinet file in pure Java?
...