java

Sending a Text Box control to the Printer?

I cannot seem to figure out how to send a text box control to print in Java. The Program creates word search puzzles, now I would like to print them. I simply want to print the text Box control as it is... But I had to try other methods as follows. My first problem is when I attempt to send it txtEasy.getText() it attempts to prin...

How do I pass a reference to the outer class to a method in an inner class? ( Or how do I pass "this" to an inner class? )

I have a class as follows: private class LanePair { public int cameraNumber; public Nest nest1, nest2; public LanePairStatus status = LanePairStatus.TIMER_OFF; Timer timer = new Timer(); public LanePair(int cameraNunber, Nest nest1, Nest nest2) { this.cameraNumber = cameraNumber; this.nest1 = nest1; this.nest2 = nest2; } ...

java: Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value?

In Java is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? The idea is simple With a data set ala... A B B C C C I'd like to add each line of text to a Set-like object. Each time that a non-unique text is added to the set I'd like to ...

How to kill deadlocked threads in Java?

I'd like to kill threads that are stuck in deadlock state. First, we can detect thread ids in deadlock state using the findDeadlockedThreads() method of the ThreadMXBean class in java.lang.management. Then, I'd like to kill the threads by thread ids, and thus I have two related questions: (1) How to get the control of a thread by threa...

Why is JVM creating a copy of an object when passing it to a method?

I encountered a strange problem today: i had a method that took two Date objects as arguments. The calling method passed reference to the very same object as both of them (the method in question was EqualsBuilder.append). The first parameter got passed fine, but the second one not. It was a new Date object that was different from the fir...

Hibernate: find duplicates

Hi, Assume I have the following Groovy class (or the equivalent in Java) class User { Long id String name } I would like to write a Hibernate query (either HQL or Criteria) which returns all the users that have at least one other user with the same name. Update The following query has been suggested select min(user.id), u...

Can a Wicket application trigger a restart of itself without a manager password?

I'm new to Wicket and would like to maintain a web application from inside itself using some sort of maintenance admin page for running clean-up, DB updates, recovery and so on. Since I plan to use Hibernate or similar for data binding I would like to trigger a complete reboot of the application from inside itself without giving everybod...

getting javadoc to work with netbeans

Hello I'm trying to make it so I can look at the javadoc with autocomplete in netbeans 6.7.1 but it tells me "javadoc not found". I tried adding it with the platform manager (I added c:/sun/SDK/docs/api) but it still doesn't work? What should I do? ...

Element not recognized on page until a manual click on the page occurs

I am searching for an element on a webpage by using its xpath. The xpath is correct and can find the element ONLY if I manually perform a click anywhere on the page first. If I do not do this before the statement runs it will not find the element. I have tried many different attempts to allow focus on the page: selenium.selectWindo...

Memory effects of synchronization in Java

JSR-133 FAQ says: But there is more to synchronization than mutual exclusion. Synchronization ensures that memory writes by a thread before or during a synchronized block are made visible in a predictable manner to other threads which synchronize on the same monitor. After we exit a synchronized block, we release the ...

Building Reports with Java

I am building a j2ee web application with a MySQL db. I need to whip up some reports, and slice and dice the data in various ways. Is it best to tackle each report requirement, write the code to serve up the data? Or, is there a framework I should look into? ...

Any tools or techniques for validating constraints programmatically between databases?

If you had two databases, that had two tables between them that would normally implement a one to one (or many to many) constraint but cannot since they are separate databases, how would you validate this relationship in an application or test? Is there a simple way to do this? For example, a tool or technique that can, given a constrai...

IllegalMonitorStateException

When running our program we get an exception of type java.lang.IllegalMonitorStateException. On Java6 API website, it says there is a constructor that gives a details about the exception: IllegalMonitorStateException(String s) How can we use this to get a better idea of where the bug is in our code? Is there anything else we can do (...

BlackBerry OAuth Alternative

Hi everyone, I am starting to think that there are no OAuth libraries that I can use with BlackBerry mobile devices. The only possibility I have found is the following, which I have yet to look into with detail: http://github.com/fireeagle/j2me-oauth So, my question is (assuming there are no other libraries), what is a work around fo...

How do I use XMLUnit to compare only certain parts of files?

How do I use XMLUnit to compare 2 or more nodes (of the same name) in 2 different files? I have 2 XML files that look like this: <SearchResults> <result type="header"> ...ignore this.... </result> <result type="secondheader">...ignore this....</result> <result>....data1....</result> <result>....data2....</result> <result>.......

adding Scrollbar listener to JOGL project

As the title suggests I am trying to add an event listener to a JOGL project to no avail. Any help would be much appreciated ...

Binary tree search algorithm errors

I have a binary tree that I need to search through. I'm not searching for one specific node of the tree, but rather over every node of the tree to gain information about them. I have a simple recursive search right now, but every time it runs I get a stack overflow error. It's a full binary tree of depth 7... if (curDepth < 6 && !search...

External program blocks when run by Runtime exec

Hi I'm attempting to launch an instance of the VideoLAN program from within a java application. One of the ways I've tried to do this is shown here: Process p = Runtime.getRuntime().exec("\"C:\\Program Files\\VideoLAN\\VLC\\vlc.exe\" \"http://www.dr.dk/Forms/Published/PlaylistGen.aspx?qid=1316859&amp;odp=true\" :sout=#std{access=udp,mu...

De-Duplication API in Java

Are there any De-Duplication API in Java? I want to eliminate redundant items (for e.g. duplicate fingerprints) from the database, how is it possible through Java programming? ...

Pylucene eclipse plugin

Is there a Pylucene eclipse plugin? or am I missing something? I want it for Auto complete. Is the import structure same as java lucene ...