I want to completely change the look of a scollbar but overriding JScrollBar and the paintComponent method doesn't work, the track and thumb are painted but the left and right arrows stay the same.
I am also using them inside a JScrollPane and using
setHorizontalScrollBar( new CustomScrollBar() ) to set the scroll bars to my custom scrol...
I have a scene written in Java 3d, where the user's viewing position is set to some coordinate using the following code:
ViewingPlatform vp = simpleUniverse.getViewingPlatform();
TransformGroup steerTG = vp.getViewPlatformTransform();
Transform3D t3d = new Transform3D();
steerTG.getTransform(t3d);
t3d.lookAt(
new Point3d(-5, 1...
I have a generic class which bundles an Object and an order:
public class OrderedObject<T> {
private int order;
private T object;
public OrderedObject(int order, T object) {
this.order = order;
this.object = object;
}
public int getOrder() {
return order;
}
public T getObject() {
...
I started a little contract job that requires me to use Java. I was given a Java book by the project manager, but it covers Java 1.3 and I understand that Java is now around 1.6. I would like to know if there are any major core additions to the language that I can read up to after getting the basics down with this book?
...
This is a lab I am working for for a CSE 201. The program is supposed to read information about students and their scores from a file, and output the name of each student with all his/her scores and the total score, plus the average score of the class, and the name and total score of the students with the highest and lowest total score.
...
Hi,
I've got the following code:
import java.util.*;
public class Group {
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<Integer>();
}
}
Eclipse (3.0.0) complains about the ArrayList declaration: syntax error on token "(", on both tokens "<", and then on token "=". I'm using java 1.5.0_0...
I'm running Spring and Hibernate's implementation of JPA on Sun's GlassFish Enterprise Server with MySQL.
When I try to delete stuff from the database:
Query q = entityManager.createQuery("DELETE FROM SomeEntity e");
q.executeUpdate();
I get the error:
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: java.l...
What is the best way in Java to print a gif given as byte[] or ByteArrayInputStream on a paper with a size of 4x6 inches?
This:
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new MediaSize(4, 6, Size2DSyntax.INCH));
aset.add(new Copies(1));
PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(...
I have following java object
Obj:
----
String id;
List<A>;
A:
--
String A_ID;
String A_PROPERTY;
What I am looking for is to be able to search in a given object. ex: search in a list where A.A_ID = 123
I need to dynamically pass
A_ID = 123
and it would give me
A_Property
I know I could search through a list through iterator, ...
The last week I've been trying to figure out why some stream decoding my newly adopted application is doing was giving me some major encoding problems. Finally I figured out that the problem was that the JARs/WAR being built with Ant and deployed to the server were being compiled with the javac task using the encoding UTF-8 instead of th...
I have some unit tests (yes, perhaps more integration-ey tests !) that I would like to spin up another jvm, and then run the test code from that "other" JVM (and wait for it to finish, collecting the results).
Am interested if there is an easy/reliable way of doing that with junit (eg inherit the classpath of what is needed etc...)
Any...
I have a Solr schema that has a "url" field:
<fieldType name="url" class="solr.TextField"
positionIncrementGap="100">
</fieldType>
<fields>
<field name="id" type="string" stored="true" indexed="true"/>
<field name="url" type="url" stored="true" indexed="false"/>
<field name="chunkNum" type="long...
try {
String data = "<a><b c='d' e='f'>0.15</b></a>";
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory
.newDocumentBuilder();
InputSource is = new InputSource();
is.set...
I try to describe an image through HTML tag as follow :
http://www.exampledepot.com/egs/javax.swing/checkbox_AddIcon.html
If I use the following HTML tag, it works
<html><table cellpadding=0><tr><td><img src=file:C:\user\network-transmit-receive.png/></td><td width=3><td>Hello World</td></tr></table></html>
However, when I use the f...
I have populated my jTable with the following Code. It has two columns, the first has variable name and the second is a list of its dependencies. The user can change the dependencies by selecting them from the list in the jTable.
When the user changes a value, I want to row to be added to another jTable (which would be no user editable....
I'm trying to start JETTY from a shell script (previously we used Maven), and I'm coying over some dependent libraries into the JETTY_HOME/lib directory which appears to be causing Classpath conflicts, I'm trying to sort out where the proper LogFacotry.class exists, here's the exception I'm getting on startup.
2009-08-17 22:00:40.661::W...
My current project has the coding convention that instance variables are never referred to with the this. prefix and that parameters should never hide instance variables.
This results in setters that look like:
public void setFoo(final Foo aFoo)
{
foo = aFoo;
}
Unfortunately eclipse won't generate that for me by default.
I've found...
Check out this code.
// Print object and recurse if iterable
private static void deep_print(Object o) {
System.out.println(o.getClass().toString() + ", " + o.toString());
boolean iter = false;
Iterable<?> i1 = null;
Object[] i2 = null;
if (o instanceof Iterable<?>) {
iter = true;
i1 = (Iterable<?>) o;
} else if (o ...
I need to populate jcombobox with ArrayList is there is any way to do this.
Abdul Khaliq
...
What is the difference between using the wrapped class, SynchronizedMap, on a HashMap and ConcurrentHashMap?
Is it just being able to modify the hashmap while iterating it (ConcurrentHashMap)?
...