java

JButton is a quitButton

I have a coded a program GUI phone book. It has textfields such as name, address, city,..etc. I also have three buttons. Add, clear, quit. My program is serializable using a thread to write to my disk file every 2 sec. a new address. How do I code the quit button to quit running and writing to the disk? ...

Convert jlist selection into a string

I am trying to figure out how to get the program to create a text string based on which item in a jlist is selected. At first I tried ListModel custTypetxt = custType.getModel(); System.out.println(custTypetxt); but that just gave me.. customerInfoUI$3@1820dda ...

Run Jar in Console

Hey y'all.. So I'm a .Net developer. I know that you java devs are gonna die laughing at this one. I am writing a java applicaiton that outputs strings via System.out and I just want to know how to run this application outside my IDE. I have an executable jar. What does one do to see this output in a console. Thanks in advance.. -Nic...

Mysql syntax exception from jdbc

I'm trying to move the data from one table to another based on names which end with "@localhost", but while moving the data I'm getting an exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n...

"Cannot get the revision information from the scm repository"

I get maven error : "Cannot get the revision information from the scm repository" Any idea how to solve this ? Thanks. ...

How do I populate a jcombobox with information from a mySQL database?

Title says it all.. Basically the program takes customer information and dumps it in a database. In order to change information I want the user to be able to pick a customer name from a combobox, so the system can then call all the info out of the database on that customer. Accessing the database is fine, putting info in and changing it...

Java inputevents not firing for some period in linux (java/xorg issue??)

I'm writing a 2D game in Java and I have a problem with input events (mouse, keyboard) not firing when they should. It works as expected in win2k & xp. As it's a game, I have a main loop which Coalesces input events (various listeners populating buffered state) Advances the scene Renders the scene Waits if necessary to maintain stable...

How to get text indent (tabs) from some text input?

For example, suppose I'm editing following text (\t is for tabs, it's not text) '\t\t\tSome text...' and my input keyboard position is right before 'S' (there is no selected text) and I want to get number of tabs before 'S' (in this case it's 3) So how to get that number of tabs using Win32 API? p.s. Maybe some function to get whole cu...

Bulk entity delete in Google App Engine

I'm trying to delete some unwanted data from my datastore with Java and found some code using the DatastoreService that I modified to delete as many entries as possible in 10 seconds: DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Query query = new Query("PostalCodes"); long starttime = (new Date()).getTime(...

What are "typing models"?

In Beyond Java(Section 2.2.9), Brute Tate claims that "typing model" is one of the problems of C++. What does that mean? ...

where can I get the latest JRE / JDK as a zip file, I mean, no exe installer

You may call me a maniac, but I like to be sure that just by copying the contents of the java folder and setting the environment variables, everything will work fine. So I usually run the installer in a virtual machine, zip the \java folder contents, go back to a snapshot of the virtual machine, and then unzip the compressed file. I co...

How can I draw a portion of my Java2D simulation that doesn't change to an image/buffer so I don't have to redraw it's primitives each time?

How can I draw a portion of my Java2D simulation that doesn't change to an image/buffer so I don't have to redraw it's primitives each time? I have a portion of my Java2D simulation that requires me to draw thousands of small lines. However, this portion of the app doesn't change once drawn so it doesn't make sense to re-draw thousands...

Is Struts2 still a good choice of web framework for new projects?

Once upon a time, Struts was the default choice for a Java web framework. I have no data on this, but I imagine that Struts2 is currently widely used for legacy reasons, only because former Struts projects have been migrated to it. Is Struts 2 really the best choice for a new project? What other web frameworks out there are most popula...

NOClassDefFound error while running a simple java program

This code is compile fine, but whenever I try to run, it gives an error says NoClassDefFound. What is the possible reason and solution, please explain. package myPack; public class PasswordVerification { public boolean verify(String usrId, String pass) { if(usrId.equals("pranjut")&&pass.equals("password")) { ...

getting null on request.getParameter() on submit of form in java code?

IN JAVA CODE IN JSP as below i m getting null value for field"noOfRecords". if (request.getMethod().equalsIgnoreCase("POST")) { try { noOfRecords=Integer.parseInt(request.getParameter("noOfRecords").trim()); } catch(NumberFormatException e) { throw new Exception("No of records Field should be nume...

Removing Padding

Hi all, I am developing a project in C# and my receiver front end is implemented in java.i have big problem because c# has padding facilities but java not have facilities to identify these padding, ...

How can I implement a multi-threaded PID controller in Java?

I'm kinda new to Java, so haven't yet fully grasped the concept of multithreading.I would like to create a PIDController class that allows me to do this: ControllerMethods methods = new ControllerMethods() { public long getError(long setpoint) { ...

captureView + jsf

hello i want to get view content as String value i used ViewHandler but no response? Thank you. ...

Keep JFrame on top of others.

I am in a situation where i create FrameB from my main frame FrameA. When the user is working on FrameB i would like it to be on top of FrameA even when user accidentally clicks on FrameA? ...

AsyncTask and Android threading: how to get it right ?

I am firing off an AsyncTask to fetch images via HttpClient. Via DDMS in eclipse, the view shows that the AsyncTask runs and then hangs around. This is a screenshot of the DDMS threads view. Should the AsyncTask #1 thread disappear or is it benign ? What does the status wait mean anyway ? ...