java

Fixing flowlayout in Java

Hi I have created a GUI for my program in Java, and I have used flowlayout (didnt have much luck with borderlayout), but with flowlayout if the user resizes the program, everything goes out of alignment, so i'm wondering is there anyway to stop the frame of the program from being resized? if so how? Thank You ...

how to get the PageFormat from a Java.awt.print.PrinterJob

Hi, I'm trying to use the PageFormat information to modify my javax.swing based printout prior to printing it. I am stumped as to how I can get the PageFormat from the PrintJob (which is obtained using getPrinterJob() and printDialog()). I know there is the getPageFormat method, but I can't figure out how to get the PrintRequestAttribu...

using abstract keyword in interface

I know the difference between "public interface" and "public abstract interface", but when applied on methods are there differences? public interface IPluggableUi { abstract public JComponent getPanel(); abstract public void initUi(); } or public interface IPluggableUi { public JComponent getPanel(); public void initU...

Java Sorting object in ArrayList

Hi I have Card class... In another class I create an arrayList of Card objects. How would I go about sorting the arrayList based on the value of the card? The ace is the lowest card value and the king is the highest. A,2,3,4,5,6,7,8,9,T,J,Q,K public class Card { char rank, suit; public Card(char rank, char suit){ ...

Free C/C++ and Java implementations of PPP?

Are there free C/C++ and Java implementations of the point-to-point protocol (PPP) for use over a serial line? The C/C++ implementation will go into embedded hardware so portability is a concern. I'm not looking for a full TCP/IP stack, just something to provide a connection-oriented base to build on top of. ...

Java jogl applet paint not working?

My jogl applet screen is blank. I have this for my paint code: public void paint(Graphics g){ canvas.update(g); } if I add g.fillRect(0,0,50,50); to it it'll draw the filled rect, but still not the jogl stuff. ...

How to Use getViewableIterator in POI

I'm currently using POI to attempt to extract text out of a batch of Word documents and I need to be able to determine what entries a document contains. I've been able to get as far as pulling the document root and pulling the first entry but I want to be able to view all entries. the getEntries() method seems to provide this functiona...

cross-language configuration for java/.Net

I found this question, but didn't see a good answer. I'm interested specifically in configuration files, say in XML. Are there cross-language standard/tools for reading config files? XML itself is just a medium, but I want tools and libraries and standards, like those existing in .Net's ConfigurationSection class. My main targets are ja...

How can I have folds for C++/Java in Emacs?

I know the thread about having folds for LaTex. However, I want folds for C++/Java when I code. How can you have either automatic or manual folds in Emacs for C++/Java? ...

Java bytecode equivalents for ilasm / ildasm

For CIL / MSIL, I can write the code in a text editor and compile / decompile with ilasm / ildasm. I can use Reflector to see the CIL generated by a .NET class. In the Java world, javap -c shows the disassembled byte code. How do I compile Java bytecode? (i.e. the Java equivalent of ilasm / ildasm). Is there an IDE that supports Java...

What are the licence restrictions for the RxTx Library

I want to make an Application that uses RxTx version 2.2pre2 to work with Serial Ports. What are the Licence restrictions, since it is an "LGPL v 2.1 + Linking Over Controlled Interface" licenced library if I don't use the Sun's javax.comm.* interface, but the RxTx's own gnu.io.* when importing into Java Files? ...

Are there any alternatives to implementing Clone in Java?

In my Java project, I have a vector of various types of Traders. These different types of traders are subclasses of the Trader class. Right now, I have a method that takes a Trader as an argument and stores it 50 or so times in the vector. I am having problems because storing the same object 50 times is just storing 50 references of the ...

java thread terminating early and suspiciously

I have the following code in a Runnable that gets passed to a thread t: public void run() { logger.debug("Starting thread " + Thread.currentThread()); try { doStuff(); } catch (Exception e) { logger.debug("Exception in Thread " + Thread.currentThread()); } logger.debug("End...

XMPP Client incompabilities.

I'm currently working on a project that is building a java-based desktop application to interface with a website. We want to incorporate IM capabilities, so we decided to use XMPP. The problem is our application has other features, and anyone using another client to connect to our XMPP server will cause problems with our website (e.g. ...

Java Plugin Pattern

I am a Java beginner and I would appreciate it if someone here can explain how to implement Martin Fowler's plugin pattern in Java. Thanks in advance. ...

Getting the absolute path of a file within a JAR within an EAR?

I have a J2EE app deployed as an EAR file, which in turn contains a JAR file for the business layer code (including some EJBs) and a WAR file for the web layer code. The EAR file is deployed to JBoss 3.2.5, which unpacks the EAR and WAR files, but not the JAR file (this is not the problem, it's just FYI). One of the files within the JAR...

Background Thread for a Tomcat servlet app

I am not very familiar with Tomcat, in my head it is basically abstracted as a cgi server that saves the JVM between calls -- I know it can do a lot more than that, though. I am looking for a way to launch a background thread when a Tomcat server starts, which would periodically update the Server Context (in my particular case this is ...

How to execute system commands (linux/bsd) using Java

I am attempting to be cheap and execute a local system command ('uname -a') in Java. I am looking to grab the output from uname and store it in a String. What is the best way of doing this? Current code: public class lame { public static void main(String args[]) { try { Process p=Runtime.getRuntime().exec("uname -a"); p.waitFor(); ...

Why and how does ROUND_HALF_EVEN minimize cumulative error when applied repeatedly over a sequence of calculations?

Hi, I am told that ROUND_HALF_EVEN is the favored rounding mode for financial data calculations. I am curious to know why and how this rounding mode would reduce the cumulative error as stated in javadoc BigDecimal 1.4.2. Thanks, Dean ...

Adding Java GUI component on Mouse Event

Hey Stack Overflow folks, I have been trying to get code working where i can double click on an item in a JList and it creates a new JList on a different place on the Frame from scratch of all the object names of items that belong to that category (this is useless info i guess). But the problem is when i double click on the items in the...