AllExperts > Java 
Search      
Java
Volunteer
Answers to thousands of questions
 Home · More Java Questions · Question Library  · Free Encyclopedia ·
More Java Answers
Question Library

Ask a question about Java
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
About Artemus Harper
(Top Expert on this page)

Expertise
I have a BS in computer science and am working towards a Masters degree.

Experience
I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection. knowledge of Java bytecode and annotations. Basics in c++ and c#

Education/Credentials
BS in Computer Science at Central Washington University

   

You are here:  Experts > Computing/Technology > Focus on Java > Java

Questions Answered By Expert  Artemus Harper 
In Category  Java

SubjectDate Asked

Max integer value11/20/2009
  Q: I need to know how to do dynamic program on collatz conjecture. i.e for x = 1 to maxofinteger ...
  A: You can use long (instead of int), which has twice as many bits and a much bigger value (big enough ...
Java Fundementals Book program 5-411/19/2009
  Q: hey the porgram problem i have is this, my AP CS teacher aasked us to try and write a program like ...
  A: You need a class Dice. That class has a single field current, it should be private. Add a method to ...
Displaying Bitmaps11/19/2009
  Q: I just ran into this previous answer you gave: http://en.allexperts.com/q/Java-1046/java-swing-2.htm ...
  A: Its pretty easy to implement your own zoom. You can simply: float scale = ...; Point scaleCenter = ...
SCJP11/18/2009
  Q: This program will not compile. Cannot find symbol: variable passengers. /* A program that uses the ...
  A: You have: class Vehicle2 { int passengers; // number of passengers int fuelcap; // fuel ...
Java Palindrome No.11/18/2009
  Q: please assist me in making a java prog. for checking a palindrome no......and please tell me if the ...
  A: To 'peel' off a digit from a number you can: int num = ...; int remaining = num; while(remaining != ...
SCJP11/17/2009
  Q: This program will not compile. Cannot find symbol: variable passengers. /* A program that uses the ...
  A: You are creating a new instance of Vehicle, not Vehicle2 as you have declared above. The compiler is ...
java or C++ security comparison11/17/2009
  Q: I want ot know when it comes to security, that is securing your applications and softwares and ...
  A: Java will be a better choice as one of the primary focuses of Java is security. Most exploits in ...
Java Programming11/17/2009
  Q: Well I have question than I am curious about. I want to know if it is possible to write a method ...
  A: To determine if a number is a power of 2 you can use the trick: if((n & -n) == n) { //power of 2 ...
Java DesktopPane11/15/2009
  Q: Sir i m develping desktop application in netbean. first problem is that of ApplicationView ...
  A: 1. I'm not sure what the ApplicationView class is. It is not a class in the standard Java API, so I ...
Easy Counting Program?11/14/2009
  Q: I need some hints on how to proceed to write the program, specifically on how to set up the ...
  A: The first thing you should notice is that if some set is not valid, than all super sets of that set ...
Logic circuit11/8/2009
  Q: Sir, plz am jus a beginer in java, i want to write a program using swing gui to build logic circuits ...
  A: This problem is best solved by simply doing your own drawing. Nothing in swing will help you much ...
Compare two .CSV11/7/2009
  Q: I Want to compare two .csv file and check..if the entries are equal Well not exactly.equal..with 3% ...
  A: This is pretty simple: First create a Reader to read text in: BufferedReader reader1 = new ...
javac11/6/2009
  Q: Im currently teaching myself java from different tutorils on the internet. verytime I try compiling ...
  A: when you install the Java SDK it does not add the compiler to the PATH, only things on the PATH and ...
Big O Notation problem11/2/2009
  Q: I wanted to evaluate an algorithm and my adviser told me to use the Big O notation. I really don't ...
  A: Your processor can probably help you better than I can. The Big O of an algorithm is a calculation ...
which language to use for developing apps10/31/2009
  Q: I've a strong attitude towards programming, software engineering. I want to develop some cool apps ...
  A: I use Java since it runs pretty fast without having many of the pitfalls of c++. The language you ...
JLabel in JTable10/30/2009
  Q: Harper I m Nirav Raval Frm India. At now i m develop one Windowbased Application in java ...
  A: Set the default renderer (for the Object class) in your JTable (using setDefaultRenderer) to a ...
Array assignment10/28/2009
  Q: i am in a beginning level Programming class and we were assigned to basically, from my ...
  A: The array classes don't have any special implementation of toString(), you can use: ...
socket programming10/28/2009
  Q: I ran simple example of socket programming in Java that caught it from www.sun.com (KnockKnockServer ...
  A: You can either debug the application in an IDE (such as eclipse or netbeans) and hit the suspend ...
Exception handing10/28/2009
  Q: i've to know what is the difference between PrintStackTrace and Exception and getMessage in ...
  A: printStackTrace method prints the message and the stack of the current thread when the exception was ...
about database driver connection10/24/2009
  Q: heyy im tryin to connect the database by java program and retrieve the table details but im not able ...
  A: You are getting an exception because the version of javac you are using is newer than the version of ...
file io10/22/2009
  Q: I was looking at some examples on basic file IO in java, but what i notice is that there are many ...
  A: There are various levels of efficiency (hence there are many ways of reading/writing a file). For ...
memory efficiency10/21/2009
  Q: let's say I wanna use an object, say an arraylist, several times would this be memory efficient?: ...
  A: This depends if you expect the arraylist to have about the same number of elements each time. When ...
socket programming10/19/2009
  Q: How can i start socket programing in Java? I must write one program that some devices send and ...
  A: Create a ServerSocket object that listens to incoming traffic on the initial receiver of the data, ...
Java RTE in IE810/17/2009
  Q: In the Java Control Panel (in Vista Control Panel) in the Advanced tab, the fourth setting down is ...
  A: You are running the Java control panel as a regular user, therefore you cannot disable Java for ...
javascript popup10/16/2009
  Q: I have a problem with a script, I downloaded this script and I'm trying to use it on my website: ...
  A: Just have the address for the hyperlink be the code that opens up the box: e.g. <a ...
Java RTE in IE810/15/2009
  Q: In the Java Control Panel (in Vista Control Panel) in the Advanced tab, the fourth setting down is ...
  A: Java has nothing to do with Flash. If you are having problems installing Flash you are looking in ...
palindrome in java10/15/2009
  Q: import java.io.* public static void main(String arg[]) { String a; System.out.println("Enter your ...
  A: You should explicitly state yourHow do I reverse a String? Answer: ... CharSequence reverseString = ...
Print top 2 scores10/14/2009
  Q: I was looking through the program on this website and I have a question .....how can u change the ...
  A: You could keep track of the highest score and second highest score as all the names are being ...
or statements10/10/2009
  Q: For my programming assignment I have to make a game that is similar to Yahtzee, so the player will ...
  A: For a small set of dice you have, not really. The order of the dice doesn't matter, so you could ...
swing component10/8/2009
  Q: advantages of using JTabbedpane and JScrollPane in designing GUI? what is plugable look and feel? ...
  A: The JTabbedPane allows multiple windows to be grouped into a single window, selectable with a tab. ...
Decimals in numbers10/6/2009
  Q: import javax.swing.JOptionPane; public class Ljw02mathIoGui { public static void main (String ...
  A: First, you need to do floating point division instead of integer division. You can do this by ...
java10/6/2009
  Q: Artemus I've finished some programs using netbeans ide in java it is supposed to be a battleship ...
  A: The possible problems are: 1. when you double click on a jar, by default the command that runs is ...
J2me10/4/2009
  Q: i am at the 5th year in the informatic faculty i am thinking about graduation project i am thinking ...
  A: Doing face reconnection can be a processor intensive task (provided you can interface with the ...
need ur help10/3/2009
  Q: what is difference between implicit type casting and explicit type casting?
  A: Implicit type casting happens when you assign a value to a variable of a super type. E.g. String s = ...
Java, but not sure what you'd classify this question as.10/2/2009
  Q: Ok, I'm a Computer Programming student (my advisor talked me into changing my major from hardware to ...
  A: Typically the way animation is done is by using a Timer (in javax.swing, not java.util), that ...
java10/1/2009
  Q: Artemus I've finished some programs using netbeans ide in java it is supposed to be a battleship ...
  A: What you want to do is export your project as a jar file. Once it is a jar file, you should (and ...
editing a specific line in a Table10/1/2009
  Q: Hey Artemus, Hows it going.. im experiencing a problem trying to use the update method in results ...
  A: The primary reason this would not work is, that there is no entry with Client_ID=idNo already in the ...
Java programming in grid10/1/2009
  Q: I want to display LAN connected PCs which are in the grid environment.How to display LAN connected ...
  A: Getting a list of computers on the LAN is an operating system dependent function. A windows network ...
Classpath Problem9/30/2009
  Q: I was trying to create a new package. My java is saved in C:\Program Files\Java\jdk1.6.0_11. I just ...
  A: You should not put your java file in the jdk directory, create another directory somewhere else for ...
block hardware9/29/2009
  Q: I am searching a code in java for disable and enable the MOUSE ,KEYBOARD,CD-ROM ,USBPORT. but i ...
  A: These operations are operating system dependent (and would require administrator privs). Why would ...
Communicating two servers9/29/2009
  Q: I need to telnet a destination ip from a source ip through a java program and both the ip are remote ...
  A: Using sockets is seprate from telnet. A telnet library will set up and sockets and everything for ...
java,awt.Graphics class error9/29/2009
  Q: I am in the process to create a Game . I want to know , how do we make images move dynamically ...
  A: Use the javax.swing.Timer class. You can set up an action that happens every so often. In your ...
Opening a specific page of a .pdf file by click of button in java9/29/2009
  Q: Could you please provide me a method to open a particualr page in a .pdf file. Scenario : I have a ...
  A: You can't really do it the way you are trying, since you are basically asking adobe acrobat (or ...
reversing a number using a while loop9/27/2009
  Q: How do I reverse a number using a while loop ? can you help me write the code (not necessarily the ...
  A: By using the mod (%) and div (/) operators you can peel off the digits of the number, then you ...
editing a specific line in a Table9/26/2009
  Q: Hey Artemus, Hows it going.. im experiencing a problem trying to use the update method in results ...
  A: You can use an update query, provided that WO_Number is unique: PreparedStatement query = ...
Help Please Sir/Madam9/25/2009
  Q: Sir i have a small problem (i guess for you all out there) i have a class as shown below... from ...
  A: I'm not sure how the data you get is translated into text. Some of it may be text, but some of it ...
java9/24/2009
  Q: Well so far I have the following code: however I want my program to only print the numbers that when ...
  A: In your case, since you are only going up to 10000 you only need primes up to 36 (9999 adds up to ...
interactive website9/22/2009
  Q: How are you? Thanks for taking questions. I would like to write a photo webiste where a user could ...
  A: You will probably need to know both Java (for the backend) and Javascript (for the frontend). It is ...
String transformation9/19/2009
  Q: There is a program where I have to put the following in a dat file. Sample Input: 3 ...
  A: You can use a StringBuilder to make a modifiable string. First create a BufferedReader that wraps ...
Java Programming9/15/2009
  Q: I was just wondering how to make a program that will input an array of strings, using permutation ...
  A: First you would put the words into an array. Then you will need to create another array that ...
Java Printing of JFform9/14/2009
  Q: I am working on a java application which allows the user to prepare and print invoice sheets and ...
  A: When you implement the setValueAt, and once a value for both the quantity and unit price is entered ...
Java Printing of JFform9/12/2009
  Q: I am working on a java application which allows the user to prepare and print invoice sheets and ...
  A: You can use the print() method of JTable to simply print that. Printing something else, will require ...
Java9/12/2009
  Q: I have a question on how to write a program can you help me. I have to write a program that will ...
  A: What you have will generate random characters, but it is not optimal for doing so as a String is ...
Testing Efficiency9/11/2009
  Q: I'm trying to re-learn programming, but was wondering what are some ways of testing efficiency & ...
  A: effciency and speed are often the last things you test in a program, and you only do that if these ...
Solution for a Java Problem9/10/2009
  Q: Respected Sir, Instead of doing: HSSFRow row1 = sheet.createRow((short) 1); HSSFRow ...
  A: I think you want to do something like: HSSFRow[] rows = new HSSFRow[4]; for(int r = 0; r < ...
JAVA9/10/2009
  Q: Sir, I am developint one window base application in java and I am using JInternal frame in this ...
  A: There are many ways to do this. You need to have some common class that keeps a reference to both ...
Need a solution for coding in Java9/9/2009
  Q: Respected Sir, I have a Java program which reads the cell contents of Ms Excel.I am ...
  A: You will have to get an external library if your data really is in Excel format. If possible, you ...
Java9/8/2009
  Q: I am trying to design a program in Java that would block a site and redirect it to a page displaying ...
  A: Java is a poor language choice for any application that interacts directly with the operating system ...
encoding in client /server using steganography9/3/2009
  Q: could u send me good algorithm codes on java to establish the connection
  A: since steganography generally requires some other form of communication to piggy back on, you will ...
Sql Time problem9/1/2009
  Q: I'm experiencing a problem with the toString() method in the java.sql.Time class.. There seems to be ...
  A: This is most probably caused due to t1 being null. If t1 is null, then attempting to call toString() ...
advantage of becoming a SCJP8/31/2009
  Q: I am currently studying in BITS Pilani,Pilani campus. I want to know whether i should give SCJP(Sun ...
  A: I have not taken the SCJP, nor can I tell you what fees there are in India. What I can tell you is ...
Java troubleshoot8/30/2009
  Q: I recently downloaded the latest JDK, which is version 1.6.0_16. The software is stored at C:Program ...
  A: You first need to compile the program, the compiler javac is located at c:\program ...
Netbeans 6.0 Java- Installation File Making8/26/2009
  Q: I have just completed a window based java project in Netbeans IDE 6.0. Now I want to distribute this ...
  A: JRE is standard software, it is common for computers to have it, and you can get Java installers ...
Java- Reports8/24/2009
  Q: I am developing a window based paryroll System in Netbeans IDE 6.0 for a firm. In this project I ...
  A: You can use a JTable to display the results of a query. Simply create your own TableModel for the ...
JTable using vectors or arrays?8/21/2009
  Q: I am currently trying to make a Table displaying inputted information in the table cells containing ...
  A: You should use the DefaultTableModel. Simply create a DefaultTableModel, then create the JTable ...
java8/18/2009
  Q: how does a class accomplish data hiding?
  A: Data hiding is done by making a field non-public. When a field is non-public only some code can ...
java8/18/2009
  Q: Why is Java known as plateform-neutral language and How is java more secured than other language?
  A: Java programs operate under a virtual machine. The virtual machine acts as an intermediary between ...
java8/18/2009
  Q: How are Data and Methods organized in an object-oriented Program ?
  A: When an instance of a class is created its memory is usually laid out as: fields0 //All the fields ...
check the string is intigerformate8/18/2009
  Q: sir,i have one string, String s1="2009081814421284371053060060"; now i have to check inside of s1 ...
  A: Integer characters start at '0' and end at '9' Simply do: if(ch < '0' || ch > '9') { //invalid ch ...
JDBC date entry error8/17/2009
  Q: I am experiencing a problem with my code, I am trying to enter data into an access database called ...
  A: It is possible you are using a reserved word in access. You can avoid this problem by wrapping these ...
problem in the outuput of an applet using thread8/16/2009
  Q: import java.applet.*; import java.awt.*; /*<applet code=horse width=200 height=200> </applet>*/ ...
  A: The Thread.sleep method is a static method. When you call it only the calling thread pauses. As a ...
JDBC date entry error8/15/2009
  Q: I am experiencing a problem with my code, I am trying to enter data into an access database called ...
  A: Sorry for the confusion; the date parameter is a java.sql.Date rather than a java.util.Date. You ...
JDBC date entry error8/13/2009
  Q: I am experiencing a problem with my code, I am trying to enter data into an access database called ...
  A: It is possible that the database doesn't like the date format. To avoid many of these issues you ...
Mac Id using Java8/12/2009
  Q: Sir i want to use mac id in java. prog. for providing security. Can u give me the code. for getting ...
  A: You can use the java.net.NetworkInterface to access the mac address. First you need to get the ...
java8/7/2009
  Q: what is the function of 'this' keyword? in the command: b.addActionListener(this) what does 'this' ...
  A: super is the same as this, except that it is used to call methods in the parent class that have been ...
JAVA Media File8/7/2009
  Q: Sir. I want to make a media file in java. SO please tell me how I can i play a songs in java ...
  A: This generally depends on what the format of the songs are. For mp3s you will need to get a an extra ...
java8/7/2009
  Q: what is the function of 'this' keyword? in the command: b.addActionListener(this) what does 'this' ...
  A: I'll assume that b is a JButton. In which case, JButton's class looks like: public class JButton ...
java GUI that stimulates ATM8/4/2009
  Q: i need to creat 1 JAVA applet as ATM GUI. Need to put username and pin. Then user balance is ...
  A: This depends a lot on how you want your GUI to look. Does it look just like an ATM, or do you assume ...
MS DOS8/1/2009
  Q: how can i make a program using ms dos which you need to enter a letter ,if i type small letter a-z ...
  A: In Java you can't just ask for 1 character at a time (not without using code from C/C++). You can ...
distributed computing query7/31/2009
  Q: sir,i want to make a project on distributed computing such that i have a large set of data and if i ...
  A: Distributed computing is a very large field, there are many ways to implement such a solution. One ...
function that returns7/26/2009
  Q: sir, I like to know the function and the object that I need to use to get my present ip ...
  A: It is possible that the IP address you are looking at might be in the IPv6 form: x:x:x:x:x:x:x:x ...
function that returns "my ip"?7/23/2009
  Q: sir, I like to know the function and the object that I need to use to get my present ip ...
  A: What you have works pretty well, provided that the computer is connected to the internet and is not ...
Widgets toolkits in java7/22/2009
  Q: I am currently making a GUI using the Swing package but i am looking for a way to make my windows ...
  A: First if you aren't using the native look and feel try that, it is a decent substitution of the ...
Report Development7/22/2009
  Q: Harper, I am developing a window based software in Netbeans 6.0 IDE in Java. Now in ...
  A: There are various examples on the web that explain how to do this. e.g. ...
JDK 67/22/2009
  Q: I'm currently studying Java from http://www.cs.princeton.edu/introcs/home/ I stumbled upon this ...
  A: Chances are you have a java (or class) file located in your Java directory called Integer.java which ...
java WebcCawler7/21/2009
  Q: did you ever solve the problem at http://en.allexperts.com/q/Java-1046/2008/3/Java-WebCrawler.htm ? ...
  A: I think the answer I provided: guessContentTypeFromStream is a best guess about the content type and ...
"clear screen" how in java and java script?7/21/2009
  Q: sir, I like to know the Command used(if not the way) to clear screen when program is running in ...
  A: Java doesn't have support for advanced console functions like clear screen. If you need to do ...
Java7/16/2009
  Q: I am curious, is it possible to inject client side code into a server side Java Web Application? If ...
  A: In general no, although this depends on how the Java server was coded. You can put security holes ...
need help imediatly7/16/2009
  Q: heh mate, well i am working on project in which i want that the events fired by internet explorer ...
  A: Java components can react to key events and mouse events when the mouse or keys are pressed when the ...
project7/15/2009
  Q: i have project(made in java)but i can't know how to open the project because there are no. of class ...
  A: class files are compiled files, the source files are java files. The 'project' file depends on the ...
upload my pdf partially on my server7/15/2009
  Q: sir ,please tell me how can i partially upload my pdf file on my server so before fully upload first ...
  A: I don't know how your server operates, but if you have an open stream from the client while ...
upload Zip file7/14/2009
  Q: sir, In my web appliaction i want to upload only pdf file.but if i have EXE or TEXT File its also ...
  A: When you have your InputStream for a zip file, just feed it into a ZipInputStream and read from that ...
upload pdf file7/13/2009
  Q: sir, In my web appliaction i want to upload only pdf file.but if i have EXE or TEXT File its also ...
  A: You have to allow at least a partial pdf upload, as you will have to look inside the file to ...
JAVA7/1/2009
  Q: I want to create a java program using a JFile Chooser.Actually I wanted a JFrame containing a JMenu ...
  A: If you just want the file names of those in the chosen directory, then you can use String[] ...
JAVA6/25/2009
  Q: I am trying to convert a java program into a standalone application.please help with the code of the ...
  A: If you want it to run as an Applet you can package your classes in a jar and distribute an html file ...
Code of compiling a .java to .class file6/24/2009
  Q: I received the code: Process javacProcess = Runtime.getRuntime().exec("java -cp <location to ...
  A: tools.jar has been around for quite a while. If your using windows, you can find it in c:\program ...
JAVA6/24/2009
  Q: I am trying to convert a java program into a standalone application.please help with the code of the ...
  A: What you need to do is change the extends Applet to extends JFrame (you could just use a normal ...
Compile a .java file to .class within a java application.6/23/2009
  Q: I have a java application that creates a jar file, the manifest file, but doesn't compile to .java ...
  A: To do this you need to include the tools.jar in your application. tools.jar is usually located in ...
JAVA6/22/2009
  Q: I want to zoom in & zoom out an image in a JFrame using 2 Jbuttons "+" & "-" respectively.Please ...
  A: I think I have a better understanding of what you are trying to do now. Here is a sample piece of ...
Help me6/22/2009
  Q: Java Script is better than other scripting languages for web design ???? plz give me anwer in detail ...
  A: For client side scripting you really don't have much choice, as Javascript is the most widely ...
JAVA6/22/2009
  Q: I want to zoom in & zoom out an image in a JFrame using 2 Jbuttons "+" & "-" respectively.Please ...
  A: What you will need is two variables, one to store the transform, and another to store your zoom ...
JAVA6/19/2009
  Q: I want to zoom in & zoom out an image in a JFrame using 2 Jbuttons "+" & "-" respectively.Please ...
  A: Use the Graphics2D.drawImage(Image,AffineTransform,ImageObserver) method. For the AffineTransform ...
Java Graphics6/18/2009
  Q: I want to be able to change an image's (gif or jpg) background and foreground color. I also want to ...
  A: I'm not sure what you are trying to accomplish. An image such as gif or jpg doesn't have a ...
HTTP POST6/17/2009
  Q: What is the best way for sending a ZIP file over HTTP POST from one servlet which just collects it ...
  A: Sure you can. See: http://www.theserverside.com/tt/articles/article.tss?l=HttpClient_FileUpload Its ...
the frame does not show6/17/2009
  Q: the given code does not show any runtime or compile timne errors.however it only shows a plane frame ...
  A: You have a size set for the frame, not a preferred size for the cirarc1 component. I would: 1. ...
How can I see big values defined as BigDecimal6/13/2009
  Q: Let x = 2 to power 20000 Let y = 2 to power 3209 Then z = x multiply y = 2 to power 23309. I ...
  A: Chances are that the operation failed, possibly due to running out of memory (are you sure no ...
sockets and thread6/12/2009
  Q: can we have a socket in a class that is not a thread? i want the socket to continually receive ...
  A: There is nothing really special with the main thread, you can do anything on any thread. However, ...
stack overflow error5/29/2009
  Q: I am on a course to learn Java and as homework I have too modify an subclass of Account(a bank ...
  A: A stack overflow error generally means you have one method calling itself (or one method calling ...
Java5/26/2009
  Q: I have Windows XP and every once in a while a Java Update pops up when I activate my laptop. It's ...
  A: You can go into the Java control panel and under the update tab disable automatically checking for ...
java swing gridbaglayout5/23/2009
  Q: In GridBagLayout can i assign more then one button in one grid cell??
  A: Yes, you could increase the gridwidth or gridheight for the the buttons so they take up multiple ...
Arrays as Instance Variables in Java5/21/2009
  Q: I need to store and later use an array in different functions of a class body in Java. In C/C++, I ...
  A: All Objects in Java (including arrays) are passed by reference. When one method changes the array, ...
electronics-Boolean logical truth tables5/19/2009
  Q: I am studying java programming as a hobby. I indirectly need the answer of this question. What is ...
  A: When you distribute NOT over a group you put NOT on each element and change AND to OR and OR to AND. ...
Java- JAR File5/17/2009
  Q: Harper I've just completed my project in java. And now i want to make executable JAR file. ...
  A: You can try exporting with the generic jar option instead of the executable jar, this will give you ...
Java will not start under Vista Home Premium5/16/2009
  Q: I have installed Java (jre6-u13) on a new laptop (Acer Aspire 5520G with AMD Turion dual processor ...
  A: Either something is screwed up in the installation, or there is some kind of conflicting component. ...
getting keys from a multimap if the value is specified5/15/2009
  Q: I have a multimap of this format... Code: import java.util.ArrayList; import java.util.HashMap; ...
  A: A map is designed to map keys to values. You can iterate over the entrySet in the map and determine ...
Using the break statement in a while loop5/14/2009
  Q: Since using the break statement is considered bad code except for in swithch statements, how could ...
  A: One way would be: int i; for(i = 0; i < names.length && !names[i].equals(searchName); i++) ; ...
How to create an executable file for a Java program?5/13/2009
  Q: I have written a Java program using NetBeans IDE and want to send it to my friend such that he can ...
  A: Just make sure when you export your program to a jar file you do not export the java files. This is ...
java queue5/11/2009
  Q: ..but it doesnt seem to be working at all ..could you please help me and see what the problem is? ...
  A: There are a few problems with this code: 1. emptyQ should check if last is -1, not if the buffer ...
Animated GIF image in Buffered Image5/4/2009
  Q: I want to read an Animated GIF from a file into BufferedImage and then write on a Jlabel in JFrame. ...
  A: You can't load all of an animated gif into a buffered image as BufferedImage only supports static ...
java method5/4/2009
  Q: public class Customer { // Instance Variables (you fill in) private Time24Hour arrival; ...
  A: I have no idea what Time24Hour class is. You generally don't store the difference in time in a Time ...
java constructor5/2/2009
  Q: i am just wondering, what is the problem with these codes i had? public class Queue { // ...
  A: The reason your code doesn't compile is that you are assigning an index of an array which is a Queue ...
User InterfaceDemo4/29/2009
  Q: I am a graduate level computer student. i want to do a online live security project in Java(using ...
  A: This may be difficult to do as you probably don't want the camera to trigger on small changes ...
Bigram count4/28/2009
  Q: I am writing a java program that is suppose to read a text and return the 15 most common bigram (th, ...
  A: In your while loop you want to keep track of the previous character, then check that and the current ...
Counter/tickers4/27/2009
  Q: I am looking into adding a feature to my website that adds a number by 1 every 11 minutes 7 seconds. ...
  A: I'm not an expert on javascript, rather I'm an expert in Java. But to try and answer your question, ...
Help me with static variable4/26/2009
  Q: I need help. Ill go straight to the point: I have 3 classes: [QUOTE][B]public class AssembledPart ...
  A: The primary problem is that getAvailForAssembly is static. The only way you can make this non-static ...
Java programming4/25/2009
  Q: First of all is Java the best and most latest programming language? And secondly I'd like to know if ...
  A: First of all is Java the best and most latest programming language? There is no best programming ...
java hangman4/21/2009
  Q: I am trying to write a java hangman game but i am very confused. I think the way i need to do it is ...
  A: I really don't understand what you mean by which letter is 'shown' first. You can use the Random ...
Question regarding permutations of functions--contd4/17/2009
  Q: Regarding my previous question...I have to use Java Reflection for invoking the functions. "I have ...
  A: I would look at the java reflection tutorial: ...
java hangman4/16/2009
  Q: I am trying to write a java hangman game but i am very confused. I think the way i need to do it is ...
  A: You can do it with arrays. You will also need a second array that masks what characters you show and ...
Huffman Question4/15/2009
  Q: Hope you are fine and in good health, My questions are: 1. can we make a wizard to a java program, ...
  A: Generally the bits are simply ignored you can set them to 0. Note that you do need an EOF symbol ...
Java Swings4/15/2009
  Q: How to dynamically populate the values from the database into JComboBox. Thanks and Regards Vinod
  A: If you are repopulating data, first make sure you call removeAllItems() from the JComboBox to start ...
color of buttons4/14/2009
  Q: i'm using CodeWarrior and i'm using applets... i have made buttons but i wish to change the color of ...
  A: If you simply want to change the color, you can set the background color of the button to something ...
image4/14/2009
  Q: Can we get an image as output when we give its pixel values as input...please give me the java code ...
  A: This somewhat depends on the format of the input, the kind of image you want (e.g. do you need ...
Array4/13/2009
  Q: so I have written a program which reads from a file and does pay,update and info transactions. The ...
  A: You are searching though the array, but you are not making sure you don't go outside the bounds of ...
Setup wizards, and registers4/12/2009
  Q: Hope you are fine and in good health, My questions are: 1. can we make a wizard to a java program, ...
  A: You can have java do stuff like this by executing native operating system commands. However, by ...
modifying an existing file in java.4/9/2009
  Q: I'm rather new to java and wanna know how to modify an existing file. I have this text file called ...
  A: Generally text files have to be rewritten from scratch when changed, simply overwrite the document ...
Java Graphics API4/6/2009
  Q: Hola! I'm making a virtual tour program of our school. I plan to make 3d models of the buildings ...
  A: I haven't used wrl files, but it seems that ...
clear screen applet4/2/2009
  Q: sorry i m not specify .. now... when ever click on clear button then it clear the applet screen and ...
  A: You should only be using the command prompt in applets for debugging information. If you want, you ...
Java4/2/2009
  Q: need help creating the below java program: Read in an integer and output it in one or more ...
  A: Reading in a number is easy, just use: int num = Integer.parseInt(numStr); Writing a number in a ...
Encrypt and Decrypt codes4/1/2009
  Q: I just need to ask a question about encryption and decryption. How could you improve the codes to ...
  A: You can store the random instance as a static variable. Or you could create a new random instance ...
Encrypt and Decrypt codes3/31/2009
  Q: I just need to ask a question about encryption and decryption. How could you improve the codes to ...
  A: I'm not sure I understand your question. You can use the BigInteger to store very large numbers. ...
allign the string output3/30/2009
  Q: Could you help me with the following please? I am printing(outputting) from a string linkedList both ...
  A: You could use tab, which will work fine if you import the text file into a spread sheet program like ...
comparing 2 text files3/24/2009
  Q: Could you provide me with some examples and codes (links or tutorials)on how to compare 2 text ...
  A: If you just want to check to see if the files are exactly identical, you can read each file byte by ...
java3/19/2009
  Q: explain java is compile or interpreter language?
  A: Java source code is compiled into an intermediate language (bytecode) that is easily translatable ...
JSP login screen3/15/2009
  Q: .can you teach me on how to create login page, when the login is successful, it will redirect to ...
  A: Although I don't know much about JSP, you can take some of the code from: ...
Java arrays3/11/2009
  Q: I'm in an algorithm analysis class and in order to show the efficiency of the algorithm that I am ...
  A: The maximum value of an int (which is the max value of an array) is 2,147,483,647. If you are using ...
readLine() java3/11/2009
  Q: May I ask what your thesis is for your masters? I am studying CS as well. I can't wait to start my ...
  A: Just as you can read in each line of a file you can write it in a similar way you read it. For ...
Mouse clicks3/9/2009
  Q: we are making a hexagon minesweeper game in a java applet, and we wondering how to differentiate ...
  A: You can use e.getButton() to determine the button. MouseEvent.BUTTON1 is the left mouse button, ...
Button Shapes3/6/2009
  Q: I was wondering how i can make hexagon shape buttons in java applets, we are using this to make a ...
  A: You can't use a JButton for this, as they are square, and even though you can paint less than a ...
Putting pictures into java3/5/2009
  Q: when i put two pictures in java they have white backgrounds even when i take the background out in ...
  A: It might be possible that the format you are saving the image in doesn't support transparency, or ...
incomparable types Error!3/2/2009
  Q: I could really use your help :) if you look at the code here: http://rafb.net/p/jkrJXP28.html At ...
  A: You can't intermix Strings and chars. You probably just need to change your Stack from having chars ...
incomparable types Error!3/2/2009
  Q: I could really use your help :) if you look at the code here: http://rafb.net/p/jkrJXP28.html At ...
  A: You can only use constant values in case statements. You either have to change your switch statement ...
if condition problem2/27/2009
  Q: I have a problem with my code: this code will serve as one of our assignment in our school Pls ...
  A: You mean there is no compile time error... You shouldn't use == with Strings or any non-primitive ...
Regarding writing to CSV using Java.io.FileWriter2/26/2009
  Q: I can successfullu write to a CSV File using Java.io.FileWriter using some code that you had posted ...
  A: You can use the DecimalFormat class ...
Splash Screen in Swing2/26/2009
  Q: Harper, Thanx for giving answer of my privious question. Now,I want to ask u about to ...
  A: When you run the java command you can specify a splash screen (can also be included as an option in ...
Button Click sound2/25/2009
  Q: Harper, I've been working on a swing based project. In which i need ur help. I want to put ...
  A: The java sound API is quite advanced and allows for many complex operations. Assuming you want to ...
Java2/22/2009
  Q: I tried to use Trend Houscall to scan my machine, however, it said Java was not installed or ...
  A: You probably need to open the Java control panel and ensure that Java is properly associated with ...
report in java2/18/2009
  Q: I want create software like Notepad Or text Editor in java how can i do it it will be nice if you ...
  A: If you are displaying the information to the user in a JTable then you can simply call print() on ...
bachelor of computer science2/17/2009
  Q: Artemus I'm halfway towards my bachelor of computer science degree. I just got a question for you ...
  A: A general degree leads to a more rounded career which will make it easier to switch professions. A ...
Fill web form - JAVA2/14/2009
  Q: i m Sherzod Hakimov. studying Computer science . i saw ur post in the site filling web form with ...
  A: captchas are designed to thwart automatic registration exactly like you are trying. There are ...
Stack2/13/2009
  Q: I'm new to Java. I was wondering if you know some good links or examples on stacks? something like ...
  A: As I said you can look at the source code of these for inspiration. I also explained how to ...
Stack2/13/2009
  Q: I'm new to Java. I was wondering if you know some good links or examples on stacks? something like ...
  A: The LinkedList class is a good class that can simulate a stack. The push operation is addLast, and ...
Developing SWT Games2/10/2009
  Q: I need help in developing SWT games in java, but I really didin't find a reference for developing ...
  A: This depends on what kind of game you are developing. Many games use their own custom interface and ...
detect firewall in the client system while running the web page2/10/2009
  Q: When i am opening the web page, find firewall in the client system whether firewall installed or ...
  A: Nearly every computer now days has a firewall installed. That firewall may or may not interrupt with ...
Notpad2/7/2009
  Q: I want create software like Notepad Or text Editor in java how can i do it it will be nice if you ...
  A: I'm not sure what process you took to create the exe, but simply telling me it isn't working gives ...
Java - spliting numbers2/5/2009
  Q: I wannna know how to split numbers using java. For example 234 is split into 200,30,4...can you ...
  A: You can use the mod operator (%) for this. int n = 234; //input value int d = 10; //start at the 1s ...
Java2/3/2009
  Q: I have created a download manager in java. Now i want to integrate it with web browser.How can i do ...
  A: You first have to decide if you want to use applets or java web start. Java web start runs in a ...
Array of Objects2/2/2009
  Q: what would I put in each constructor? MyArray () MyArray (int initCapacity) MyArray (Object[] a) ...
  A: You need two data members, an array, and a count that determines how much of the array is in use. ...
Array of Objects2/2/2009
  Q: what would I put in each constructor? MyArray () MyArray (int initCapacity) MyArray (Object[] a) ...
  A: What you are trying to do is emulate a class that already exists in Java, java.util.ArrayList. ...
Java1/28/2009
  Q: I have a very general question for you. I have a background in design and am pretty adept at ...
  A: Although I haven't used Flash I cannot tell you what shortcomings Flash has. But with Java, its ...
java swing1/25/2009
  Q: The image is in the panel.how to save that image in the file using savedialogbox
  A: Step 1: Get the location to save from the save dialog box E.g. JFileChooser fileChooser = new ...
Java1/17/2009
  Q: How to accept input using stream readers in java?
  A: Something like this: import java.io.*; ... try { InputStream in = new ...
is it possible1/13/2009
  Q: hai I am running a java application and want to give the focus to a Microsoft word application ...
  A: This is difficult since java has very few operations that interact directly with other running ...
Java and JavaScript1/9/2009
  Q: I am learning about Java and JavaScript and kinda understand a little about them. I am just not ...
  A: Java is a compiled language like C or C++. It is 'safe' in that it manages computer resources and ...
interpreter & compiler1/7/2009
  Q: i think this is a very basic question.... JVM is an interpreter. Interpreter shows error step by ...
  A: I think you are confusing javascript with java. Javascript uses an interpreter to run, while java ...
interpreter & compiler1/6/2009
  Q: i think this is a very basic question.... JVM is an interpreter. Interpreter shows error step by ...
  A: The JVM doesn't always run in interpreted mode, it can also run in compiled mode, or mixed. By ...
Graphical simulation, Threads, CPU usage1/1/2009
  Q: Java Problem: Basically my ball collision simulator hogs CPU usage. Description: My class extends ...
  A: Don't rely on paint if you want to do continuous updates. Instead start a new thread, put its ...
core java-package12/25/2008
  Q: package mypack; class Balance { String name; double bal; Balance(String n,double b) { name=n; ...
  A: You should create a directory and put the source code in there. Then compile from the base ...
Design patterns12/24/2008
  Q: I hope you are fine and in good health, please, I need your help in design patterns, I searched ...
  A: There are many design patterns for various purposes. If you were more precise on what you were ...
Applet in Opera12/23/2008
  Q: I developed a Java Applet using Swing. It runs correctly in IE & Firefox. But When it runs in Opera, ...
  A: If tooltips are not working for you, you have a few options: 1. You can use Java web start instead ...
Ask about java12/21/2008
  Q: Java is Application Programs or not?
  A: Java can be used to design applications that run directly on an end user's computer. Java programs ...
Creating GUI using different classes12/14/2008
  Q: In my java application, I intend to create my GUI, actually an output frame, step by step by adding ...
  A: This depends on how reusable you want your components to be. Simply passing your main class as a ...
Notpad12/14/2008
  Q: I want create software like Notepad Or text Editor in java how can i do it it will be nice if you ...
  A: Here is an example of a simple text editor. There are various text components, JTextArea is easy to ...
Dragging Vector-made pictures around the Panel12/10/2008
  Q: Im a member of a small team that struggles to write a simulator of a train modell. So far we have 4 ...
  A: Although I don't have all your code (missing Punkt and Formeln classes), what you probably want to ...
Math.random()12/8/2008
  Q: I need to dispay a frame that contains 9 lebles which may dispay a cross image icon, a not image ...
  A: A simple way to generate a random number between 0 and 2 is: int n = (int) (Math.random() * 3); ...
doubly linked list from C++ to Java11/27/2008
  Q: I have done 1 and a half year in CS and then quit and started working. I'm now continuing where I ...
  A: When you install the java SDK, you will find src.zip folder in the install directory. For Windows ...
Java Random Array Numbers Ascending11/23/2008
  Q: You responded saying that you dont answer Homework questions. I am sorry I was not asking for the ...
  A: If you can't use the sort method, then you could iterate though the array finding the smallest ...
doubly linked list from C++ to Java11/23/2008
  Q: I have done 1 and a half year in CS and then quit and started working. I'm now continuing where I ...
  A: Java already has a linked list class: java.util.LinkedList, you can look at the source code for that ...
Array out of Bounds11/21/2008
  Q: I was wondering if you could help me, I always get an ArrayINdexOutofBounds:0 error and i don't know ...
  A: If you get an array index out of bounds 0, it means you have an array of size 0, as you can only ...
Low level rendering11/21/2008
  Q: i wanted to know how rendering works, and if it's not too difficult, i want to build a very ...
  A: If you are using Java, you have to use Java classes since many of them access the underlining ...
Database update using a timer11/17/2008
  Q: I need help for the following subject. I have to make an application that saves information in SQL ...
  A: Look at the Timer tutorial: http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html In ...
Downloading Notepad file from Internet11/15/2008
  Q: How can I download a notepad file from internet by using Java code? Can you give me the java code ...
  A: Here is a simple tutorial on using URLs: ...
java Snake Game11/14/2008
  Q: I've recently been asked to create a java program that is very similar to the classic mobile phone ...
  A: Java has limited functions for using the console, it is not recommended you try to emulate a ...
Thread execution order11/13/2008
  Q: I have a doubt in Threads section. How run() execute when start() invokes ,When we use Runnable ...
  A: The details on how start() works is platform dependent. In many cases, start() will return and the ...
new operator11/11/2008
  Q: I am having a hard time understanding why I need to use the new operator in the following code: ...
  A: You can't. This is not c++, all objects are allocated on the heap. In actually, the compiler would ...
new operator11/11/2008
  Q: I am having a hard time understanding why I need to use the new operator in the following code: ...
  A: The Scanner class is a wrapper around a stream (in this case System.in) that provides additional ...
random()11/9/2008
  Q: how can you get one character at random from a string.is that possible or just random method work ...
  A: To get a random character from a String, you simply need to pick a random integer up to the length ...
random method11/6/2008
  Q: how can you generate 6 numbers on range 1 to 49. by using Random nun = new Random() and using ...
  A: The nextInt(n) method in Random will return an int at least 0, and less than n. E.g. nun.nextInt(10) ...
How run() execute when start() invokes ,When we use Runnable interface ?11/6/2008
  Q: I have a doubt in Threads section. How run() execute when start() invokes ,When we use Runnable ...
  A: The easiest way to do this is to subclass Thread and override the run() method. After that, create ...
multithreading11/5/2008
  Q: does the instances of same thread have different copies of variables and methods?
  A: Each thread has its own copy of local variables. Each thread may keep its own copy of fields, and ...
Java code Hyperlink11/4/2008
  Q: I am dessperatly trying to find out how to make a button go to a website in java. It for a chool ...
  A: If you make a JButton do this, it will only work on Operating Systems that use Windows. There are a ...
array11/3/2008
  Q: "/*INPUT TWO STRING ARRAYS AND SORT THEM i need to accept two arrays as parameters and sort them ...
  A: The reason that line does not work is that your sort method returns a String, but you are assigning ...
How to read finger prints in java11/3/2008
  Q: I want to read finger printing form Nitgen FP devices in my web application
  A: This depends on what API there is available to use the device. Chances are the API has a c++ ...
I want to be a good programmer10/28/2008
  Q: I will like to be a good programmer as i have just finished from the University here in Nigeria as a ...
  A: You can look at sun's tutorial: http://java.sun.com/docs/books/tutorial/ That will help you get ...
Decryption problem10/27/2008
  Q: I have a problem with a project, I am building a file encryption and decryption application in ...
  A: The variable you are talking is never used. You decrypted the data, but you are not doing anything ...
Simulating multiple mice within a drawing application?10/27/2008
  Q: Scenario: 1 - System Mouse 1..9 - Simulated Mice Simulated mice input will be provided by our ...
  A: The current system will work fine. Generate synthetic mouse events from the extra devices. This ...
Zip to Exe10/23/2008
  Q: I'm trying to write a program in java that will convert a zip file into a self extracting exe, with ...
  A: The primary problem is creating an exe with java. You can look at various free libraries that ...
Prime numbers10/14/2008
  Q: My daughter is 13 and needs to know "Why are Prime Numbers important" Many Thanks
  A: they don't seem to have any pattern, but they are easily understood. Today, prime numbers are used ...
Core Java10/14/2008
  Q: How to compare elements of type Long within two HashMaps and Delete the unique elements, in ...
  A: There are various ways of doing this. One way is to dump all the elements from the first list into ...
Core Java10/13/2008
  Q: How to compare elements of type Long within two HashMaps and Delete the unique elements, in ...
  A: A HashMap is a mapping between two elements. If the Long is a key in the map you can use keySet() ...
Basic If/else statements10/10/2008
  Q: The question I'm asked is: Write a program that asks the user to enter a month (1=January, ...
  A: The problem is that getDays method should return the number of days, not print them out. Your main ...
calculate sum in jtable10/9/2008
  Q: i want to ask.Can you teach me how to calculate sum in jtable?For example i got rows of qty,price ...
  A: You would do something like this: What you actually do once you get the value that was changed ...
FirePropertyChange10/6/2008
  Q: .. i would like to ask 1. what is the importance of firePropertyChange and the ...
  A: 1. firePropertyChange allows listeners to be notified when a property change occurs so that they may ...
binary system10/4/2008
  Q: why binary system is used in data representation in computer?
  A: Binary is used in digital computers because under the hood computers are simply a large number of ...
loading images in java10/3/2008
  Q: Artemus Probably the subject says it all. How can I load a .JPEG image in java?? Just the simplest ...
  A: The easiest way depends on what you want to do with it. If you just want to display it on the screen ...
enlarge java heapMemory10/3/2008
  Q: and i tried to enlarge the heap by Java -Xmx but it wasn't useful is there other solution to enlarge ...
  A: Java will only allow you to allocate as much memory as you have ram. An int is 4 bytes, so ...
regarding threads in java in client-server program based on udp potocal9/30/2008
  Q: server program:import java.io.*; import java.net.*; import java.lang.*; class UServer extends ...
  A: This depends on what you mean by access. When you create your thread class you can pass any data ...
java event handling9/15/2008
  Q: I am using netbeans ide.how to focus next text field by pressing enter key in swing programming?
  A: See the focus subsystem tutorial: http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html ...
jdbc9/5/2008
  Q: Artemus i would like to insert into my database a date in the format DD-MON-YYYY so far, i have ...
  A: You can use the SimpleDateFormat class (java.text.SimpleDateFormat ) E.g. SimpleDateFormat format = ...
creating an object from Class variable9/4/2008
  Q: artemus I have the following code inside my main method /* code begins here Class personclass = ...
  A: You can use (if you are linking with the person class): Person person = (Person) ...
set CLASSPATH8/25/2008
  Q: artemus i'm learning about packages in java i dont get the purpose of set CLASSPATH what is its ...
  A: You put your classpath at the base of your working directory, where your package is located. javac ...
set CLASSPATH8/25/2008
  Q: artemus i'm learning about packages in java i dont get the purpose of set CLASSPATH what is its ...
  A: The classpath is a list of locations to find java libraries. When you compile with javac you can ...
Opening ,AVI Files From Java8/24/2008
  Q: Hei, I am wondering is there any command or algorithm to open .AVI or any other not txt file Type ...
  A: You can have Java launch external programs to handle these types of files. To do this on windows ...
Video recording8/20/2008
  Q: I am from kerala,india. I really like java. Now i want help from you to record video from USB port ...
  A: You will have to get the Java Media framework library. Once you have it, you can use ...
JAVA File Save8/17/2008
  Q: Thanx for last answer. Now My Problem is "I want to let users to save the some txt content from a ...
  A: You can use the getSelectedFile from the file chooser to get the file the user choose. From there ...
JAVA Image8/14/2008
  Q: I m Nirav from India doing MCA. I m working on a project in Netbeans 6.0. I want to hide one ...
  A: You could hide an image in a jpg by adding it as meta data. In order to do this the hidden image ...
java8/13/2008
  Q: I am shukle parnash from Gujarat in India. I am student of MCA(Master In Computer Application) I am ...
  A: This depends on what you mean by join. Do you mean append one audio file after another? or Have ...
JAVA FILE OPEN8/5/2008
  Q: Thanx for previous answers. Now I use JFilechooser to open a file from Hard Disk. Here I want to let ...
  A: import javax.swing.*; import javax.swing.filechooser.*; import java.io.*; ... JFileChooser ...
java warning messages8/2/2008
  Q: Artemus I use the LinkedList class from java.util.* package in order to create a list of objects ...
  A: LinkedList is a generic class and should be typed for the kind of elements you will have in the ...
JAVA Problems7/31/2008
  Q: how can i open a file from file chooser and edit and save it..? ANSWER: Getting the file from the ...
  A: In notepad, or in a notepad like interface? To do this in notepad you would (and this only works in ...
file IO in java7/30/2008
  Q: Artemus what is the most common way of reading a file (.txt file) and writing to a file in java?? ...
  A: You can see the tutorial on reading text files in Java at: ...
JAVA Problems7/27/2008
  Q: how can i open a file from file chooser and edit and save it..?
  A: Getting the file from the file chooser is as simple as: JFileChooser chooser = new JFileChooser(); ...
exit in java7/25/2008
  Q: Artemus I've written a try catch block of code if the catch executes, I want the program to ...
  A: You can use: System.exit(0) to terminate the program at any time (assuming you are running an ...
java -> SOAP -> COM7/24/2008
  Q: I'm trying to gauge what's involved in calling a COM object from java via SOAP. I can probably ...
  A: I'm not sure if there is any good way to do what you want. What I would do is write a COM wrapper ...
Please!Please! help me to write this program7/18/2008
  Q: write a program to input the values of three coefficients of a quadratic equation ...
  A: Just use the Quadratic equation (http://en.wikipedia.org/wiki/Quadratic_equation) Have a test in ...
Custom Java cursor on Linux7/15/2008
  Q: I'm creating a custom cursor using png 16x16 images. The images are rendered perfect as a cursor on ...
  A: Thats hard to say as I don't have Linux and it might be an issue with your distro or the version of ...
PDF to jar7/14/2008
  Q: is there a way that i can convert PDF files to Jar? so that i can share my ebooks with my friends ...
  A: You would need to include a PDF reader in the jar then. If you can find one with an open API then ...
java problem (urgent)7/14/2008
  Q: i want to update my database using JTable in swings and jdbc to it... iam using prepared statement ...
  A: You could use the default table model, but it is probably more complex as you would have to add ...
passing enums as parameters in Java7/13/2008
  Q: My question is about enum types. Is it possible to pass them as parameters in methods and ...
  A: In order to import anything it cannot be in the default package. packages are like namespaces, and ...
passing enums as parameters in Java7/12/2008
  Q: My question is about enum types. Is it possible to pass them as parameters in methods and ...
  A: Enums are classes but with a set of predefined values. As such you must both declare the enum and ...
javaw7/11/2008
  Q: One of my application use Javaw , server OS is windows 2003. I am facing a strange problem from last ...
  A: javaw is the executable that many java programs use when they do not have a command prompt. If you ...
information7/9/2008
  Q: i m nilesh megha, i m doing mca in india, i have to develop websearch engine in core java so please ...
  A: You can start by indexing pages. See: ...
java problem (urgent)7/9/2008
  Q: i want to update my database using JTable in swings and jdbc to it... iam using prepared statement ...
  A: The query you have is fine, but does not work with your current database. This generally happens ...
THIS IS SO IMPORTANT7/8/2008
  Q: I was wondering would you please tell me: is it important to update the java for the internet? ...
  A: Newer versions of Java may be more secure, faster, and support applets that use the newer ...
updating JTable(URGENT)7/7/2008
  Q: i want to edit the cells in JTable which takes its data from a MS-Access database and those edits ...
  A: For your first question, I can't really help with that since I don't have your database (or even ...
Random Ovals7/6/2008
  Q: What I am trying to do is draw ovals to "erase" the graphic. The ovals should appear randomly when ...
  A: You are getting a blob since you are painting 20 ovals, all of which are really close to each other ...
updating JTable(URGENT)7/5/2008
  Q: i want to edit the cells in JTable which takes its data from a MS-Access database and those edits ...
  A: Not having too much skill with databases, I've made up a simple example of what you want... you can ...
updating JTable(URGENT)7/2/2008
  Q: i want to edit the cells in JTable which takes its data from a MS-Access database and those edits ...
  A: In your Connection object (assuming you are using the java.sql package) you would first turn off ...
If Else statements and ; expected7/1/2008
  Q: I am using If Else statements in a form of repeating Else If statements. If (calculated = 10); { ...
  A: The compiler is very confused on what you are trying to do since this has many problems. The ...
JNI6/26/2008
  Q: Sir , I want to Access Windows Core (Kernel) DLL's in java program please help with a complete ...
  A: You have a couple of options... Java only supports calling native code if the name of the function ...
unicode6/22/2008
  Q: i would like to display an Arabic (Unicode) String of characters (enter by user in Jtextarea) from ...
  A: In the pre init code of the component you can set the orientation to left to right overriding the ...
passing arguments between frames6/21/2008
  Q: I am trying to write a code in java to do the following: i got an interface for the user, it ...
  A: When they hit submit you can either hide or dispose of the frame (depending if you plan to use it ...
java problem6/21/2008
  Q: i am trying to do internet transaction but when it loads the login page of the bank website i get ...
  A: There is a problem with the applet loading. You can open the Java console (under the tools menu) and ...
Tomcat error6/16/2008
  Q: I am facing this error and as i am quite new to java i am not sure what error is this. if ...
  A: Although I don't have experience with servlets, the error indicates that you are missing a library ...
printing a panel6/14/2008
  Q: I am currently writing a piece of software, a sort of database type thing. I have a form which ...
  A: I tried your PrintUtilties class with some sample code below: import javax.swing.*; import ...
64bit Windows2003 filtering the entries of regedit when invoking by Runtime.exec()6/11/2008
  Q: I am creating a process and with that process am invoking a batch file. Content of Java program: ...
  A: The output of the batch file (and by extension regedit) is not automatically redirected to standard ...
progress bar6/5/2008
  Q: i am working on a project called web spider where i am displaying all the hyperlinks of a web ...
  A: When you have a URL, you can use getConnection to get a URLConnection. From there you can call ...
gui6/5/2008
  Q: my project has an interface, so whenever i execute my program i get that interface itself...but i ...
  A: The difficulty of this depends on how you are doing loading. In order to show a progress bar there ...
Applet notinited6/4/2008
  Q: I need help over here I made one simulation applet using the NetBeans IDE. When I run my simulation ...
  A: Some exception was probably thrown in the init, possibly a security issue or a missing resource. In ...
difference between jdbc and ADO6/2/2008
  Q: what is the difference between jdbc and ADO(Active Data Object) . Please explain me in detail.
  A: jdbc is generally what java programmers use to access a database, while ado is generally what ...
Images6/2/2008
  Q: I am trying to add an image to a swing panel, with the following code... String location = (String) ...
  A: If you don't give the proper path of an image no error is thrown, you will simply not get an image. ...
Java5/31/2008
  Q: I am writing a program in NetBeans. I need to use the "or" operand and I can't figure out how to ...
  A: If you are using a standard American keyboard, you would press SHIFT=\ which should be |. On many ...
draw arc5/30/2008
  Q: . i have problem to draw a arc in java.. i want draw a arch from pixel to pixel but not use method ...
  A: If you have the coordinates in this format, you can use Path2D.Float (or GeneralPath if you aren't ...
string variable, user input5/26/2008
  Q: I'm supposed to ask the user for the manufacturer, model, etc... of an aircraft. The answers to the ...
  A: Yes, you can do the same for a model. Then you want to create a class that can keep all of these ...
saving in a folder5/25/2008
  Q: I am working on a project web spider. i am storing the web pages selected by user so that user can ...
  A: Unless your program is running, there is no way to delete a file after a set period of time. When ...
.bat file5/25/2008
  Q: i want to create a .bat file for my project so that i can double click on it and execute it. i tried ...
  A: You might have the classpath configured incorrectly, or the batch file is not opening in the correct ...
Wont print credit card number5/25/2008
  Q: I am having problems printing the content of my objects that are in my arrayList. What I have now ...
  A: You mispelled creditcard in your constructor's paramters, as a result when you assign the value, you ...
string variable, user input5/24/2008
  Q: I'm supposed to ask the user for the manufacturer, model, etc... of an aircraft. The answers to the ...
  A: When you save something numerically, it is converted from a string to some other kind of data. ...
Printing objects from an arrayList5/22/2008
  Q: I am having problems printing the content of my objects that are in my arrayList. What I have now ...
  A: If its just printing the customer's address, then you will need to fix the toString() method in the ...
.bat file5/21/2008
  Q: i want to create a .bat file for my project so that i can double click on it and execute it. i tried ...
  A: The java command does not take the name of the source program as you have suggested, but rather the ...
JAVA5/20/2008
  Q: I am shukle parnash from Gujarat in India. I am student of MCA(Master In Computer Application) I am ...
  A: I am still not sure what you are trying to accomplish here. The FileLock API is not designed to ...
hello5/20/2008
  Q: can you please explain me recursion. also please give me hint to make a program to convert the ...
  A: You can find information about recursion on wikipedia: ...
Sending a download request through local internet proxy5/18/2008
  Q: My project is about downloading files from internet by specifying direct url. E.g. ...
  A: You can define a subclass of ProxySelector and implement the select method that gives a proxy based ...
Extract Text With XML5/17/2008
  Q: Harper My question is: I have a .txt file and I would extract some words from this file. To ...
  A: If you like using xpath, the class exists in the javax.xml.xpath package. Or if you perfer to ...
saving in a folder5/17/2008
  Q: I am working on a project web spider. i am storing the web pages selected by user so that user can ...
  A: Simply create a File object that points to the file you want to delete and call delete(). If this is ...
saving in a folder5/16/2008
  Q: I am working on a project web spider. i am storing the web pages selected by user so that user can ...
  A: Instead of using new FileOutputStream(localFileName)); use: new ...
Java5/16/2008
  Q: Sir, I want to create a circular progressbar in my Project.Please provide me the source code for ...
  A: There are various exe wrappers available, you can search for them based on your needs. Note that ...
Encryption/Decrypt;ion in C via JNI5/15/2008
  Q: I am using openssl des algorithm for encryption and decryption.I have a java program which will send ...
  A: Hard to say what is happening. I would suggest that you run java with -Xcheck:jni to enable jni ...
java gui5/14/2008
  Q: I have a question about how java GUIs and all GUIs are able to layout objects. I just got into GUIs ...
  A: The idea is to swap each card with another card later in the deck (including itself), effectively ...
Java Frame5/14/2008
  Q: Sir, Thanks a lot for providing me the answer of my previous question.Now I can easly access the ...
  A: It sounds like you are adding components after you display the frame. Make sure that you don't set ...
Java5/14/2008
  Q: I am trying to open a PDF file with the dialog box open/save/cancel. The code which i have written ...
  A: Stating that you have an attachment is not enough you actually have to upload it. E.g. ...
GUI5/12/2008
  Q: I have developed a DAC(download accelerator) ! now , i want a borderless frame containing only an ...
  A: If you just want an image you can start java with -splash:<imagepath> to show that image. You can ...
JAVA5/11/2008
  Q: First of all thank you very much sir that you are solving my queries thank you very much I am ...
  A: The lock is reentrant. Just like other locks, locking on the same thread more than once won't block. ...
Execute Java File5/6/2008
  Q: Harper When I execute a Java file into Netbeans IDE, it shows the following message compile: ...
  A: It looks like you are running a program as part of the build step. So, in order to run it correctly ...
Java program to check drive capacity !4/27/2008
  Q: I am working on a "Download Accelerator" project. "I have to somehow figure out a way to check my ...
  A: If you are using Java 1.6 you can use: getUsableSpace() and getTotalSpace() which are both methods ...
accessing file in subfolder4/25/2008
  Q: well I know the name of the file while I'm in the main method, but it exists in a sub folder of ...
  A: You can either put a / or a \ between the name of the directory and the file name. E.g. File file = ...
TimeZone related problem4/24/2008
  Q: Hope you are doing good. I have a very basic java question related to Timezone apis. When we call ...
  A: You could probably get a good matchup by using a combination of getting the system property ...
splitting an image4/23/2008
  Q: am marla from brunei. Basically, am a student in computing and currently am doing jigsaw puzzle ...
  A: If you have the image as a BufferedImage you can call getSubimage(int x,int y, int width, int ...
Reflection api4/22/2008
  Q: Easy way to find what classes are is specified package (in runtime)
  A: Simple answer: You can't. The class loader works as a discovery process and classes are not located ...
java swings4/12/2008
  Q: how to pass values from one frame to another.consider that a student provides his reg.no in form1 ...
  A: how to pass values from one frame to another.consider that a student provides his reg.no in form1 ...
Deriving a list of Prime numbers4/9/2008
  Q: i already created my list of prime numbers which is the one bellow public class PrimeNumber { // ...
  A: > I'm a bit confused about creating a list of empty prime numbers in an ArrayList. You can create ...
Dice Simulation4/5/2008
  Q: My programming teacher gave me thisWrite a program that will simulate the result of throwing of a ...
  A: Math.random() will return a double between 0 and 1 (not including 1). So if you want a value between ...
java and java script3/30/2008
  Q: what is java and java script?
  A: Short answer: Java is a programming language similar to C that allows the developement of advanced ...
urgent need " display data in JTable"3/29/2008
  Q: and I work on project which is to display many data "Vector "from diferent source in one Jtable ...
  A: I can understand you are having some trouble with JTable, but unless you can state your exact ...
get the output of a background process3/28/2008
  Q: I'm trying to use the output of a background process but I just have problem , the file result.txt ...
  A: The > operator doesn't work with the exec method, you can only use that to actually execute ...
Chat RMI using Java3/27/2008
  Q: hye, i am doing the java RMI chat program and been asking NZ all this while, but somehow she on ...
  A: For some reason there was a security policy installed that prevented you from attempting to make ...
java3/26/2008
  Q: Hai. Am new to java. I need a java program to search and download video files from local system. Can ...
  A: You can use the File API to find out about files on your local system and determine what the ...
image processing in java3/24/2008
  Q: can i read images of 600 Mega byte and display them in a window using java.can i also perform some ...
  A: If you simply want to display an image you can use the ImageIcon class. Here is a simple piece of ...
java.io.BufferedReader3/24/2008
  Q: How do BufferedReader and FileInputStream help in downloading files(txt,audio,video) from internet ? ...
  A: If you look at the example code I provided earlier, you will see that you can use it to download any ...
about javax package3/24/2008
  Q: actually I,m a student. I,m doing some basic programs in java but I,m facing the problems reguarding ...
  A: There is no javax package, there is however javax.swing which is part of the JDK. If you are missing ...
image processing in java3/23/2008
  Q: can i read images of 600 Mega byte and display them in a window using java.can i also perform some ...
  A: Sure you can, provided you have enough ram on your computer. If you are planning to do use heavy ...
Socket Programming: Threading to Listen on Multiple Ports3/22/2008
  Q: I am in the process of writing a server side application that would allow listening on multiple ...
  A: The problem is that you have multiple threads going at each port so you could get multiple ...
java.io.BufferedReader3/21/2008
  Q: How do BufferedReader and FileInputStream help in downloading files(txt,audio,video) from internet ? ...
  A: If you just want to display an image on the net you can use: Image im = ...
java.io.BufferedReader3/20/2008
  Q: How do BufferedReader and FileInputStream help in downloading files(txt,audio,video) from internet ? ...
  A: FileInputStream will not help in downloads (since its only for local files). The BufferedReader is ...
Socket Programming: Threading to Listen on Multiple Ports3/18/2008
  Q: I am in the process of writing a server side application that would allow listening on multiple ...
  A: The simplest way of doing this would be to change: String port1024 = ss1.portListen(1024); ...
Java WebCrawler3/17/2008
  Q: I have downloaded the code for the webcrawler from the Java website. I have it running except for ...
  A: guessContentTypeFromStream is a best guess about the content type and should only be used if ...
Manipulating BMP in JAVA3/17/2008
  Q: I am doing a project on Fingerprint recognition..for that i need 2 retreive pixel values from a ...
  A: Assuming you have the image in a BufferedImage (ImageIO class gives various ways to load an image ...
Hello3/16/2008
  Q: how r u? i hope u r fine, i want to ask how to draw a chess board in the console not GUI and please ...
  A: You could draw a chess board like this: ---------------- |R|N|B|K|Q|B|N|R| |P|P|P|P|P|P|P|P| | | | | ...
simple dictionary3/14/2008
  Q: could you please help me to make a code to program simple dictionary? please, because I still ...
  A: The HashMap class is a dictionary. You could build an implementation on top of that, to make your ...
java code3/14/2008
  Q: hai friend, we need java coding to http traffic generation. The program generate series of request ...
  A: You can use the URL class to create requests to the server. Once the URL is created you can use ...
Java exceptions...3/13/2008
  Q: Exception in thread "main" java.lang.NullPointerException at ...
  A: You commented out the initialization of the button: //b2 = new Button("Update"); Thus, b2 remains ...
JAVA3/8/2008
  Q: I am shukle parnash from Gujarat in India. I am student of MCA(Master In Computer Application) I am ...
  A: For any kind of mobile development you will want to use J2ME. I haven't used J2ME, so I would not ...
Lotus Notes session3/5/2008
  Q: Im writing app that connect to Lotus Notes database and retrieves some data.This database is ...
  A: You cannot directly connect JNI in .NET to Java code, since JNI methods must be exactly formed in a ...
use of finalize() destructor3/5/2008
  Q: I read an answer on how to create a destructor in Java where you said: "To add a destructor use: ...
  A: You don't call finalize; it is called for you automatically when the object is garbage collected. ...
Reading char from file3/4/2008
  Q: I am trying to read the char with the max frequency in a file but this code seams it doesnt ...
  A: Well this will only give the highest occurrence of a character that appeared with a line, not the ...
Creating multiple jvm in a single systems3/4/2008
  Q: Can any one give me a simple example for creating and running multiple jvm in a single machine. ...
  A: So, the bigger problem is seems to be: how do I attach a java program to an already running jvm. ...
Problem changing the color for items on a JComboBox3/2/2008
  Q: I'm trying to make a JComboBox with different colors for each item in the List both when the popup ...
  A: The problem is that the JComboBox UI sets the foreground according to the OS stand foreground ...
Cannot select JTable Row3/2/2008
  Q: I fill jtable with data from db.now the problem is i cannot select rows in the jtable.what is the ...
  A: Assuming that the data is filled in correctly there is no reason that it coming from a database ...
Problem changing the color for items on a JComboBox2/29/2008
  Q: I'm trying to make a JComboBox with different colors for each item in the List both when the popup ...
  A: Instead of returning your own JLabel, you are probably better off extending the ...
JComboBox Selection2/28/2008
  Q: I have added items like(Apple,Orange,Grapes,Banana) in JComboBox and displayed it.It works fine. But ...
  A: This is how combo boxes normally work. What happens if someone selects something in the middle? Then ...
permutations2/28/2008
  Q: I am not sure how to best do permutations. I have 5 functions (a - e). Every function does something ...
  A: Well, it is hard to avoid for loops, but you can limit it to 2. What you do is keep an integer that ...
adding binary2/28/2008
  Q: i want to add 2 binary numbers together mostly using string manipulation. i do NOT want to convert ...
  A: Well, the problem is that if you read them from left to right, you will need to see the next one, ...
append data2/26/2008
  Q: I want to append data to an already existing file.I dont want to lose any data. I did it using ...
  A: When you create the outputStream for the file (or filewriter) add a true as an extra parameter to ...
Need to generate unique transaction IDs2/25/2008
  Q: In my project I need to generate unique transaction Ids for each request.It has to be 6 digit ...
  A: The ID you would use depends on what format you want. If you don't really need random ones, you can ...
JAVA2/19/2008
  Q: I am shukle parnash from Gujarat in India. I am student of MCA(Master In Computer Application) I am ...
  A: You would only use J2ME if you plan on having the program run on mobile devices. Netbeans is just an ...
JTable2/19/2008
  Q: what is a model in jtable.where other swing components doesn't need to follow any model.and how can ...
  A: Most swing components use a model, you often use the default one, since it is good enough for what ...
about checked exception in anonymous classes2/18/2008
  Q: Please have a look on the following statment... "Initializer expressions in named classes and ...
  A: import java.io.*; public class Test { public void foo() throws FileNotFoundException { ...
edge detection, RGB, barcode2/15/2008
  Q: Can you or anyone please help me how to use or code of edge detection and also how to adjust the RGB ...
  A: If you are reading the barcode not at an angle (or not a large angle). You could start half way ...
edge detection, RGB, barcode2/14/2008
  Q: Can you or anyone please help me how to use or code of edge detection and also how to adjust the RGB ...
  A: If you have a BufferedImage of the barcode you can use the getRGB and setRGB methods to filter out ...
submit a button using swings2/13/2008
  Q: How can i submit my form in a database using submit button? By using java Swings
  A: Well... you would create an SQL query based on the input from the form data, open a connection to ...
How to read from MS Excell 2007(xlsx)2/12/2008
  Q: actually problem is that. HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) ...
  A: You can hook up your java code to C code. Read up on the JNI, or just have a MS application running ...
JAVA2/9/2008
  Q: I am shukle parnash from Gujarat in India. I am student of MCA(Master In Computer Application) I am ...
  A: You can use a FileInputStream to read bytes from a file. You can use a InputStreamReader to convert ...
search code in servlet for search keyword in given file2/7/2008
  Q: i wanna java code for searching particular keyword in given file of given folder. hints-suppose we ...
  A: You can use the File.listFiles() method to get a list of all the files. For each file you can use a: ...
Retrieve from database2/7/2008
  Q: I have some tables in database. How to retrive it and put it in Hashmap? For Ex: I have Tables like, ...
  A: This heavily depends on how your database is setup. For the most part you take your ResultSet that ...
Propblem with Runtime.exec()2/7/2008
  Q: I was trying to restore my database using java. I had a problem with backup also,that i have solved. ...
  A: You will need to manually pipe in the file. E.g. FileInputStream in = new ...
Question about random access files.2/6/2008
  Q: I want an extremely large array of extremely large numbers, so I have this in my code: long N = ...
  A: Yes, it will. An example of this would be: import java.io.*; ... File f = ...
is string mutable/immutable2/6/2008
  Q: import java.io.*; class string1 { String str; void content(String str) { this.str=str; } ...
  A: The class String is immutable, The classes you made called string and string1 are as mutable as you ...
long array size2/5/2008
  Q: I want an extremely large array of extremely large numbers, so I have this in my code: long N = ...
  A: You do realize that if you want the entire array in memory you will need almost 8 gigs of ram! If ...
Retrieve from database2/5/2008
  Q: I have some tables in database. How to retrive it and put it in Hashmap? For Ex: I have Tables like, ...
  A: What you can do is map the key values from the table of each entry as the key of the hashmap and the ...
SWT2/5/2008
  Q: how r u? i want to ask what is SWT in GUI and is there any book's which i can read about it thanx ...
  A: SWT is the standard widget toolkit. It is an advanced form of the AWT that uses OS GUI components ...
Hashmap2/3/2008
  Q: What is the use of Hashmap? Can we use Hashmap to construct a JTree like this.. Ntwk ++Node1 ...
  A: You could represent a tree with a HashMap (You could also use a TreeMap if you want to keep stuff ...
Plz Help me2/2/2008
  Q: how r u? i hope u r fine i want to ask a question not related to the programming but it's important ...
  A: Well it depends on what you mean by 'real' engineer. You could call yourself a software engineer, ...
java j2se 1.5 run time error2/2/2008
  Q: i worte a simple prog in java..it compiled but at run time it showed exception in thread "main" ...
  A: Chances are there is a problem with the classpath enviromental variable. Assuming you are not using ...
how java works1/30/2008
  Q: i wanted to know if there is any book or reference out that will teach how java is able to take a ...
  A: There are two parts to what you are asking: 1. Recognizing the syntax. This is the transformation ...
How to read from MS Excell 2007(xlsx)1/28/2008
  Q: actually problem is that. HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) ...
  A: Probably not any pure java implementations are available at this time. If you are willing to use JNI ...
question1/28/2008
  Q: why to introduce encapsulation in java?what is the use of encapsulation? ANSWER: You can find an ...
  A: Encapsulation doesn't have rules and regulations. Encapsulation simply hides data, possibly limiting ...
java1/24/2008
  Q: My name is Shukla Parnash. I want to know that how I can create jar file and exe file of the java ...
  A: To create a jar you can use the jar utility in the SDK, or if you are using an IDE such as Netbeans ...
hi1/22/2008
  Q: import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import ...
  A: Having not done any JSP code, I may not be able to help you on this. But I really would not have any ...
JAVA1/16/2008
  Q: I am developing the Data Encryption Software in java Netbeans 5.5. I want to know that how I open ...
  A: To read the text of the File you will want to use a Reader. E.g. to read plain text that has the ...
java1/14/2008
  Q: I'm a student and currently using netbeans IDE 6. Can i ask some codes how to communicate with my ...
  A: For this you will have to use JMF (see http://java.sun.com/products/java-media/jmf/index.jsp) I ...
help me with this exersice1/9/2008
  Q: hey thanks for ur reply.I want to ask u about an exersice in the book here it is with my code: ...
  A: The modifications to the loops are good, but you still need to fix the "if( eindex < 9)" line to be ...
help me with this exersice1/9/2008
  Q: hey thanks for ur reply.I want to ask u about an exersice in the book here it is with my code: ...
  A: There is a problem with the for loop since i is still incremented even if a seat is not assigned. ...
reply 4 previous answer1/9/2008
  Q: ya,a lot of expert says that its more easy to using hashmap, but my lecturer want me to using SQL to ...
  A: Well using SQL in java is not too difficult, easier than doing it in C, there are vaious tutorials ...
how to create a translator using java1/8/2008
  Q: good day sir. im a last year student in my college, and given a project to create a ...
  A: You could use SQL to do this, but with only 2000 words you could just as easily use one of Java's ...
Java1/6/2008
  Q: I have a computer with windows xp, i am unable to run games from POGO on this computer, it tells me ...
  A: If its your computer you probably are an administrator. If you are an administrator you can open the ...
Util.Date1/4/2008
  Q: how to find out number of sundays in a year through java program?
  A: One way (not the most efficient) using the Calendar class would be: int year = ...; Calendar c = ...
JAVA1/4/2008
  Q: What is JAVA and how does a computer technician use it. Please reply in simple language as I am ...
  A: Java can refer to 3 related things: 1. A programming language that allows programmers to write ...
Socket Programming1/3/2008
  Q: This may be a little long-winded but bare with me. I am trying to write a simple Client Server Java ...
  A: I don't know what the error is, but it might be with the parsing of the input into an integer... if ...
question12/28/2007
  Q: class Hello{ static { System.out.println("All Experts Group"); System.exit(0); } }
  A: No question here, but... Yes, this program will print out "All Experts Group" and then exit even ...
question12/27/2007
  Q: i want to find out number of occurance of each character in a given string for example --- Hello , ...
  A: This can be done with a simple HashMap: import java.util.*; ... String str = ...; ...
java -swings(JTable)12/26/2007
  Q: How to create JTable using Vector class. please give me the example for creating table using Vector ...
  A: Although I don't recomend using the JTable constructor using Vectors. All you need is a Vector of ...
Java visual program12/24/2007
  Q: I am in need of a program which takes a card design and adds customer input. The resultant card is ...
  A: Although I haven't used jsp that much... Lots of websites allow uploading images (e.g. forums to ...
Icon12/24/2007
  Q: if i have code like below, can i put an icon into a path. for example i have array 5*5, can i put an ...
  A: It depends on what the 'icon' is. If its an instance of the Icon interface then you can simply call ...
Regarding to Abstract classes in Java12/22/2007
  Q: An abstract class cannot be instantiated (why?)
  A: Abstract classes cannot be instantiated since they can contain abstract methods that do not have ...
Package in java????12/19/2007
  Q: What is package? Why are using package & Which purpose used to package? How are use to package in ...
  A: A package is like a namespace. It divides up classes and ensures that name collisions do not happen. ...
Interface????12/18/2007
  Q: What is interface? Why are use interface ? How are use interface ? Why multiple interface allowed ...
  A: See http://java.sun.com/docs/books/tutorial/java/concepts/interface.html Multiple inheritance is ...
how methods and arguments work12/16/2007
  Q: What is a method and how do arguments work? Like when you print System.out.print("Text") how does ...
  A: System.out.println is a bit complex: 'out' is a static field in the system class that is of type ...
args[0]12/16/2007
  Q: and i ve faced this problem, and hope to help me to solve it if you don't mind. this is my simple ...
  A: This code seems fine. Make sure when you are running the program you add the argument when you run ...
java12/15/2007
  Q: what is use of Abstract classes,polymorphism and interface. when we will use in these three aspects? ...
  A: The class AbstractList http://java.sun.com/javase/6/docs/api/java/util/AbstractList.html is an ...
asking a swing question12/13/2007
  Q: helllo i want a source code for rotating an image inside a thumbnail as like used in facebook.com ...
  A: I have not used facebook but, If you have a big enough area to draw the picture in, you can use the ...
doubt in SCJP 1.412/10/2007
  Q: Given: 1. public class ExceptionTest { 2. class TestException extends Exception {} 3. public void ...
  A: The answer is not B, it is A. Since test() calls runTest(), and runTest() throws an Exception that ...
String Inversion12/7/2007
  Q: i awnr to ask how to invert a string using recursion recursion is a must? example"Hello to ...
  A: Assuming you have String s = "Some interesting string" You can get the first word with: String ...
Oop Concept in Core Java12/4/2007
  Q: If we defined constructor(User define construct) in base class & derived class but not define ...
  A: There is no problem in doing this, just make sure you make a call to the constructor you want to ...
Java Network Traffic Generation12/3/2007
  Q: I want to develop a server program that upon request from client, sends TCP and UDP packets to ...
  A: You can probably use datagrams ...
BFS11/30/2007
  Q: here i have dfs and idfs code for 9 puzzle solving, but how to use BFS? can u help me to make the ...
  A: You cannot use recursion for a bfs. Instead you have to keep a FIFO queue of the puzzles (such as ...
overriding11/30/2007
  Q: how is method overriding experienced in java? for example there is no overriding if there are two ...
  A: Overriding occurs when one class inherits from another and the subclass defines a method that has ...
Exiting Aprogram11/29/2007
  Q: i want to kone how to exit a program if the conditions are not executed in but don't use ...
  A: A program can exit normally if all the non-deamon threads end. For example, if you simply have a ...
Use of inner classes11/29/2007
  Q: What is the use of "Inner classes". When we will use these classes. ANSWER: Inner classes allow you ...
  A: You can do everything you want without inner classes in java. They are there to help make organizing ...
Use of inner classes11/29/2007
  Q: What is the use of "Inner classes". When we will use these classes.
  A: Inner classes allow you to do several things. 1. Naming, if you have a class whose only purpose is ...
file streams11/21/2007
  Q: i want to ask how to (read) data from the console and save it in a txt file (write it) using ...
  A: If you want to use some other terminator e.g. user types in "END" you could add a check before ...
file streams11/21/2007
  Q: i want to ask how to (read) data from the console and save it in a txt file (write it) using ...
  A: Here is a simple example of reading from a stream, and writing it out to the file specified until ...
moving11/20/2007
  Q: How do you make a move random of the two dimension array with a 15 * 15 grid
  A: You can use the Random class to make random movements. If you are on the edge, you only have 3 ways ...
How to find a number a float o not11/19/2007
  Q: i want to knoew how we can know that a number is float or not? please without converting the number ...
  A: If you want to know if a number can be represented exactly as an integer you could: double myDouble ...
Menu popup with Dynamic Value11/15/2007
  Q: Hell Sir, Can we create menu popup with dynamic value. i.e. we require that user enter the value in ...
  A: Sure you can, just use setText on the JMenuItem to change the text of the menu item. You can also ...
files11/15/2007
  Q: is there any Statement like S.o.p in java to print into file
  A: I am not familiar with S.o.p Usually when a user wants to print to a file they select print and ...
connect algorithm11/13/2007
  Q: How are you? I'd like to ask for your opinion regarding a programming obstacle I have. I have a ...
  A: If the points are fairly clustered you could create a 2 dimensional array of linked nodes. The first ...
help11/7/2007
  Q: good morning ,I'm not well in English but I try to explain you my problem (excuse me) I'm a student ...
  A: It is possible (but not simple) to call VB functions from Java (or the other way). To do this you ...
puzzle11/6/2007
  Q: can u tell me why this code cannot work?? it said cannot find symbol. can u tell me what the ...
  A: You have a constructor that takes in an int[][]. In your main you have to supply that int[][]. ...
help11/4/2007
  Q: good morning ,I'm not well in English but I try to explain you my problem (excuse me) I'm a student ...
  A: There is no special Java package for Arbic. You do not need to do anything special to display ...
java doubt11/3/2007
  Q: I would like to create a textbox, a button and few other swing components and would like to ...
  A: For a dynamic UI as you have described the simplest solution would be to not use an IDE editor to ...
String11/1/2007
  Q: How can we make a user enter a String from the console as an input thanx Egypt CSD
  A: import java.io.*; ... BufferedReader inputReader = new BufferedReader(new ...
Help10/30/2007
  Q: 1.Write a program to produce the following form. 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 ...
  A: 1. There are various ways of doing this... here is a "clever" solution. You could also use a second ...
Notes initialization failure - err 42110/29/2007
  Q: im working on support tool for out team and I have to use Lotus Notes to send mails and fill ...
  A: Instead of changing the path variable, I would simply set the start directory to the location you ...
A Judagrali series10/26/2007
  Q: I'm the java student doing web development using servlets and JSP's can you please help me with this ...
  A: Yes, the ^ is the bitwise operator in java, but ^ is used as the power operator in many other ...
A Judagrali series10/25/2007
  Q: I'm the java student doing web development using servlets and JSP's can you please help me with this ...
  A: The requirement of P being prime here is not needed, since any prime in the form 2^p-1 will have p ...
java10/21/2007
  Q: i am going to make a simple DFS, from the coding below, is it right? and can u help me if i want to ...
  A: The program you have does not properly solve mazes, it will back up once, and assume the area below ...
how to access winamp controls(buttons like play etc ) through java program10/10/2007
  Q: sir t want to control winamp buttons through java program. e.g if any command like play is invoked ...
  A: Since winamp doesn't have a java interface, you would either need to make one yourself (very ...
java random character10/8/2007
  Q: hey! just wanna ask how will i randomize my set of questions? like if i have 3 sets of questions ...
  A: You can use the Random class in java.util to get random numbers... for 'shuffling' things what you ...
Polymorphism definition10/6/2007
  Q: Can you please give me a definition of polymorphism in Java ? I do have a vague idea but ...
  A: Polymorphism allows you to create a subclass of an existing class and redefine how a method works, ...
method overriding10/4/2007
  Q: For method overriding, whether the return types and the number of arguments in both super and sub ...
  A: The method parameters need to match in order to override the method. However (in java 5) the return ...
abt to start a project9/27/2007
  Q: sir i am abt to start my work upon a project which serves as a part of my college curriculam. but i ...
  A: There are various interesting projects you could start, but this largely depends on the amount of ...
java9/25/2007
  Q: what is the difference between hashcode and reference number in java?
  A: The hashcode for each java object can be overriden by the implementing class and may not be unique ...
Cloning9/20/2007
  Q: can u explain me a java program that uses clone
  A: The clone method (in object) will create a new instance of the class with all the values of the ...
getch() in JAVA9/12/2007
  Q: please could you tell me how to replace the c instruction getch() with something else in Java but ...
  A: For console input java doesn't have any equivalent to getch. If you really need that function you ...
write result set to diffrent format(csv,xml,pdf,html)9/11/2007
  Q: How to write jdbc result set in to diffrent formats based on user selection(csv,html,pdf,xml) and ...
  A: This depends on the data and must be done differently for each format. csv would be fairly simple ...
Java + Linux + Remote Boot = Focus problem9/6/2007
  Q: this is the first time I ask a question at AllExperts and looking at your profile I saw that you had ...
  A: My best guess would be that a component (possibly invisible) that is loaded post boot is taking ...
write into csv file8/29/2007
  Q: I want to write some data into a csv file fetched from the database using java. Can you please help ...
  A: import java.io.FileWriter; //add to import list import java.io.Writer; ... String fileName = ...
write into csv file8/29/2007
  Q: I want to write some data into a csv file fetched from the database using java. Can you please help ...
  A: Writing a csv file is very easy. e.g. import java.io.*; ... try { FileWriter writer = new ...
problem with swing delay8/28/2007
  Q: Im currently working on small tool which should help us in our work and I found very interesting ...
  A: If you are not updating the JList on the gui thread, updates may not happen properly. Use: ...
bit representation8/26/2007
  Q: PLease can you give me a detailed explanation about why range of byte datatype is -128 to 127. Since ...
  A: The first bit is used for the sign the other 7 are for the value. Languages that have a max value of ...
Host Access Class Library X Host Access Beans8/14/2007
  Q: autECLPS...) to do this. But package (the only I was able to found) com.ibm.eNetwork.ECL contains ...
  A: I haven't used this library myself. If the method is missing from the java library (trying looking ...
math in computer science7/21/2007
  Q: i would like to know why is math such an important subject in computer science i would like to know ...
  A: Computer science is used to solve problems using computers. Computers are not smart, you have to ...
Java messenger program7/20/2007
  Q: i am currently constructing a java messenger program that makes use of applets-servlets ...
  A: Yea, I don't think that there are much in the way of java IRC servlets, and if there were it would ...
Java messenger program7/20/2007
  Q: i am currently constructing a java messenger program that makes use of applets-servlets ...
  A: I would just use one of the IRC servers as the back end. There are plenty of IRC java clients (and ...
Servlet7/18/2007
  Q: I want the source code to upload a file using http post method using servlet. I want to post my file ...
  A: I don't have experience with servlets. If I were doing this with a simple standalone java ...
Java doesn't work7/12/2007
  Q: I downloaded the free version of Java, then went to Internet Options and under Advanced checked ...
  A: The java console is not necessary to run java, however if the option appears in your browser java is ...
java not working!!!!6/30/2007
  Q: ok now my java is not working ... as u can tell.. i have dowloaded several java .. applets .. i ...
  A: If you still can't uninstall the previous versions, you will simply have to live with the stale ...
java not working!!!!6/29/2007
  Q: ok now my java is not working ... as u can tell.. i have dowloaded several java .. applets .. i ...
  A: Seems like you have stale entries in the add remove programs. If you don't want java you can ...
Programming with sound input6/25/2007
  Q: I am interested in 'reinventing the wheel' of speech recognition. Would Java be an appropriate tool ...
  A: Java has the capabilities to read sound from a microphone, and output sound though a speaker. Java ...
Flash Frontend to Java App6/25/2007
  Q: I've written an application in Java, doesn't do much and interaction is limited to entering numbers ...
  A: If you use a client server model you can have Java on the back end while flash is on the front end. ...
not getting correct output6/20/2007
  Q: i m working on image processing. i have two classes GrayImage and Thresholdf. The problem is once ...
  A: This is the expected behavior. You are creating an image with a filter, any changes to the image ...
System Date6/12/2007
  Q: I want to write a Java program to capture the system date on everyday. I want to capture the system ...
  A: You can use System.currentTimeMillis() to get the current system time (as the number of miliseconds ...
JTree with Checkbox, separating node highligth and checkbox tick/untick operation6/9/2007
  Q: I want to make a JTree with checkboxes. The checkbox selection should be independent of the node ...
  A: Making a tree with check boxes has been done before and doing a web search will reveal several ...
removeAll java program6/7/2007
  Q: Can you assist with a problem I'm trying to solve; I have to write a removeAll java program that ...
  A: The length of the array parameter is really not needed since you can simply say: myArray.length to ...
Question6/6/2007
  Q: I am trying to make a java code (using TEXTPAD) and having some difficulty. Right now in the program ...
  A: When you receive the number the user enters, you get it as a String. So all you have to do is ...
GUI Program Assistance6/3/2007
  Q: can you pls help me with a project I'm workig on? I need help writting a GUI program that convert ...
  A: You cannot compile on the commandline like that. You first create a file Uppercase.java and save ...
GUI Program Assistance6/3/2007
  Q: can you pls help me with a project I'm workig on? I need help writting a GUI program that convert ...
  A: You need that in a method. If you want to display it you will also need to output it to the console. ...
convert urdu text to unicode6/3/2007
  Q: I could not find a converter, to translate urdu text to unicode. Could you please show me where is ...
  A: Unicode is an encoding. Urdu is a language. If the text is encoded in a non-unicode encoding that ...
Java5/30/2007
  Q: How can i pass result values from one page to other page when you click on hyperlink and the ...
  A: I can't help you with this too much since I am not not familiar with jsp. On a side note, do not ...
unicode block in java textbox5/29/2007
  Q: setInitialInputMode("UCB_GREEK");this is a method in java textbox.(1)please tell me what its ...
  A: I assume that method is used to provide a hint as to what input locale to use. Not all devices will ...
Javac and JDK--Elementary Question5/28/2007
  Q: I just began learning Java, and I am trying to use the "javac" compiler. I have downloaded three ...
  A: javac is in the bin folder of the sdk. On windows it is located at: c:\program files\java\<jdk ...
some automation5/28/2007
  Q: Can java help me do these things? posting a keyword into the query box of some forum(web-based) ...
  A: Java doesn't really support the manipulation of web controls. You could however bypass this by doing ...
highscores5/23/2007
  Q: Sir, I am new to java and i want a code for storing five scores usaing files and vector?
  A: A vector is just a data structure that works like a resizable array. If you are going to use exactly ...
Problem on retrieving Unicode Data5/23/2007
  Q: I have entered data in the following manner in the Database String Encoder = ...
  A: Data Type Mismatch means that the value entered in does not match the value type of the column. If ...
Replacing \\ with \5/22/2007
  Q: I want to replace the following string with single slash. String s = ...
  A: the single slash doesn't exist outside the java source code. It merely tells java to use the unicode ...
Unicode not transformed to Urdu5/22/2007
  Q: Its Tariq Again... :) I have not yet successfully transformed Unicode to Urdu in Swing's JTextArea. ...
  A: If you are having problems with using NVARCHAR, you could encode the string into UTF-8 before ...
Unicode not transforming5/18/2007
  Q: I have successfully generated the Unicode of my Local language(Urdu) and saved that in DB. But when ...
  A: What do you mean by it shows unicode? Unicode includes Urdu characters. You may want to check that ...
print in java5/15/2007
  Q: plese give me a solution to the following Question. How to print a bulk of data automatically in ...
  A: You should look at the printing tutorial: ...
JFrame and Urdu5/14/2007
  Q: I have a Unicode String. Its a Urdu name (USMAN) String text = "\u0639\u062b\u0645\u0627\u0646"; ...
  A: Assuming the database can handle the Unicode string it should work, assuming the font can handle it. ...
Urdu Language Display in Swing5/14/2007
  Q: I have developed a Swing application. Application is a Testing application which shows MCQs ...
  A: If the database is using a unicode string to store the questions you can easily retrieve them as ...
Urdu Language Display in Swing5/14/2007
  Q: I have developed a Swing application. Application is a Testing application which shows MCQs ...
  A: I guess I don't understand your problem. You can dynamically change the text in a JLabel by just ...
Question on overriding5/13/2007
  Q: as we all know that the legal path for overriding a method with a different access type: private -> ...
  A: When you access the method though a reference to the superclass you have to make sure the method is ...
Urdu Language Display in Swing5/11/2007
  Q: I have developed a Swing application. Application is a Testing application which shows MCQs ...
  A: This depends on how the application was implemented. Are you sure you want to display English and ...
images in javaswing5/8/2007
  Q: i want to diplay an image in JFRAMES,but i am unable to do it,can u plz help me
  A: The easiest way to display an image is to use a label that has no text, and uses an ImageIcon as its ...
java--edit the hour in a clock.4/23/2007
  Q: I am working with this program: http://users.erols.com/ziring/java-samp.html#clock ...
  A: What you need is a local variable to keep track of the time difference (keep it in the ClockLabel ...
java--edit the hour in a clock.4/22/2007
  Q: I am working with this program: http://users.erols.com/ziring/java-samp.html#clock ...
  A: Your current clock is a label that mirrors the current system time. What you could do is display an ...
reading multiple numbers from one line4/18/2007
  Q: I intend to paste data (non-int numbers, multiple columns) from excel to my text pane, and have the ...
  A: 1: String[] numbers = myString.split("\\t"); for(int i = 0; i < numbers.length; i++) { //add the ...
tables4/17/2007
  Q: for example, the lobbys in yahoo games there is a scrollable table with buttons and text and lines ...
  A: If you are using swing you can use JScrollPane to accomplish this. E.g. if you had: JFrame frame = ...
make java to be application file4/15/2007
  Q: i have a java file with class file..how can i convert all my file to be application file(.exe)?
  A: Before you do, you should consider that creating a jar will work just like an exe, in that clicking ...
java swing4/13/2007
  Q: I am new to java swing and GUI creation in general; can you tell me how I can "pass" along an event ...
  A: The easiest way to accomplish this is to simply have a reference in your login page to the main ...
core java4/7/2007
  Q: main method belongs to which package, or are we overriding main method in our class, and what is the ...
  A: main method can be in any package, in any named class. Main is a static method, there is no ...
Creation of Object4/6/2007
  Q: I m learning core java..and wanna ask u that EXCEPTION is an object..which always make at ...
  A: static methods and variables are independent of any object. Static methods cannot call instance ...
Package4/4/2007
  Q: .I m a beginner in java..And want to ask u that how to link several user made packages to one ...
  A: well if the source files are together or they are compiled in a jar, you can simply import them. ...
Creation of Object4/4/2007
  Q: I m learning core java..and wanna ask u that EXCEPTION is an object..which always make at ...
  A: There are no compile time exceptions. The ClassNotFoundException (and others) are thrown when you ...
does blue j support generics4/3/2007
  Q: 4 public class EqualityTest { public static < T extends Comparable<T>> isEqualTo(T x, T ...
  A: Hrm... the source switch for the compiler probably got set somehow. My bess guess is to check the ...
Java assignment3/30/2007
  Q: I am just writing to ask if you are familliar with arrays and methods. I have an assignment due, and ...
  A: you can declare arrays using the [] syntax. E.g. To create an array of 5 elements (all initially set ...
java3/28/2007
  Q: this is geeta. my question is 1. how to run java in linux operating system because i know only on ...
  A: 1. You can go to http://java.sun.com for the sdk and the runtime for the platform of your choice. ...
problem in xtremepc2 source code3/26/2007
  Q: i've read in one of your posts that you worked with xtremepc 2.0. the link to that page is : ...
  A: Well its probably only with one \ not two. Since in java strings you must escape out the \. e.g. ...
java help !!3/24/2007
  Q: Assume that there are two machines A and B where A will provide the public key for RSA (i.e. ...
  A: The easiest way of doing this is to use the isProbablePrime method in BigInteger. E.g. BigInteger ...
file matching3/23/2007
  Q: I created two files, one that contains account number and balance and the other account number and ...
  A: NullPointerException is a very common error that arrises when you try and call a method (or access a ...
monitoring system3/22/2007
  Q: .i hope u can help me..i am a new user java programming.so lot of thing that i still cant ...
  A: Once you got the proxy up and running, you just do a lookup into the data base when a connection to ...
Trying to write to text file but it just ends up erased.3/8/2007
  Q: My need is to update a text file by inserting a line of text at a line number determined at run ...
  A: The problem is there is no way to insert data into a file. You can append or overwrite, but if you ...
JNI & local references passed from native code to JVM3/6/2007
  Q: I'm trying to get clarification on what i've read about local references. I have some native code ...
  A: The jvm keeps track of all references, the JVM simply removes all local references when native code ...
JAVA RTE switches2/28/2007
  Q: I am running: jre-1_5_0_11- Windows i586-p-ifw-Xmx768M.exe by Sun Microsystems. Inc. version ...
  A: You can use 'java -help' to get a list of standard commands. You can use 'java -X' to get a list of ...
slidehow2/25/2007
  Q: I've been working on an image viewer/editor for the last couple weeks. Now I want to add a slide ...
  A: The problem is that you are trying to do a slide show on the event thread. Anything you do on the ...
java applet2/23/2007
  Q: How can i load the information shown by an applet on the browser into a text file??
  A: If the text file is located in the same place as the .clas file for the applet (or application) you ...
program languages and their use2/23/2007
  Q: i know that among the most popular computer languages there is C++ and java. i would like to know ...
  A: The biggest influnence when choosing a programming language for a product, is to determine what ...
arraylist2/20/2007
  Q: I need the following code to firstly look at a value that is stored within a combo box, take this ...
  A: 1. classes in java are case sensitive. You must use String not string. 2. You cannot reuse variable ...
components in swing1/7/2007
  Q: i have a simple question how do you remove a component (such as a button or even a panel) from ...
  A: just call remove(component) on the jframe/jpanel to remove a component. If a component is already ...
Java compile error package does not exist12/29/2006
  Q: This should be an easy error to fix but I must be doing something stupid. I am using the Java3D ...
  A: Chances are the Java3D library does not exist on the other person's computer. All extension ...
i really wanan hack runescape..12/24/2006
  Q: please can you teach me how to hack runescape (i havnt ever hacked a game before..) is it possible ...
  A: When I made a program way back in the day, I had 3 years of java experience, and it took me a couple ...
Generics in Java 1.512/17/2006
  Q: I've tried searching the web for 2 days without answer. I have a ApplicationHelper.java that ...
  A: Well the code itself would not case the problem. It is possible that when the jar is created some ...
SCJP12/8/2006
  Q: Question No 52 Exhibit: 1. public class test { 2. public static string output = “” 3. 4. public ...
  A: 52: If an exception is thrown in a try block and caught in a finally block, the rest of the try ...
SCJP12/8/2006
  Q: Exhibit: 1. interface foo { 2. int k = 0; 3. ] 4. 5. public class test implements Foo ( 6. public ...
  A: For the first one, the answer is not A. There are a lot of compiler errors. A is the only incorrect ...
runescape bot creation12/8/2006
  Q: i was wondering if you could tell me how to create a bot to increase all my stats in Runescape 2
  A: Creating a bot requires you are able to implement a program that gets past all the anti cheating ...
SCJP12/5/2006
  Q: QUESTION NO: 135 Given: 11. String a = “ABCD”; 12. String b = a.toLowerCase(); 13. b.replace(‘a’, ...
  A: The replace method in String does not modify the String, rather it returns a new string with those ...
SCJP12/5/2006
  Q: QUESTION NO: 124 Given: 1. public class Test { 2. private static int[] x; 3. public static void ...
  A: 124: x is never assigned a value so it is null. Trying to index a null value will result in a ...
SCJP12/5/2006
  Q: QUESTION NO: 117 Given: 1. public class X implements Runnable { 2. private int x; 3. private int y; ...
  A: B can be elimited since the increment of x and y are in a synchronized block, thus nothing can ...
SCJP12/4/2006
  Q: QUESTION NO: 52 Given: 1. class Super { 2. public int getLenght() { return 4; } 3. } 4. 5. public ...
  A: The method getLength in Class Sub is overriding its super class method, but has a different return ...
SCJP12/4/2006
  Q: QUESTION NO: 70 Given: 1. public class X { 2. public X aMethod() { return this;} 3. } 1. public ...
  A: A: Cannot be added since it matches the name and parameters of an existing method, but the return ...
SCJP12/2/2006
  Q: QUESTION NO: 107 Which three demonstrate an “is a” relationship? (Choose three) A. public class X { ...
  A: The "is a" relationship is the same as the instanceof operator. A. X y = new Y(); //valid B. Shape ...
SCJP12/2/2006
  Q: QUESTION NO: 106 Given: 11. try { 12. if ((new Object))(.equals((new Object()))) { 13. ...
  A: Line 12 has a few problems. When you create a new object you need to use the constructor syntax, ...
SCJP12/1/2006
  Q: QUESTION NO: 31 Given: 1. public class Alpha1 { 2. public static void main( String[] args ) { 3. ...
  A: The answer is B, although each number is on a different line. i starts at 0 outside the loop. i is ...
SCJP12/1/2006
  Q: QUESTION NO: 22 Which statement is true? A. catch(X x) can catch subclasses of X. B. The Error class ...
  A: A: try { //code to try } catch (Exception e) { //exception to catch. } if any subclass of ...
SCJP12/1/2006
  Q: QUESTION NO: 1 Given: 1. public class Test { 2. public static void main(String args[]) { 3. class ...
  A: line 6 is assigning a new instance of Foo to an Object reference, the cast here is not needed. ...
runescape account hacking/cheats11/30/2006
  Q: ok what do you mean by key logger and how would i do this, laso is there any cheats at all for free ...
  A: A keylogger is a back door in a victims computer that records keystrokes as they type them. These ...
SCJPJAVA11/29/2006
  Q: QUESTION 24 Given: 1. package foo; 2. 3. import java.util.Vector; 4. 5. private class MyVector ...
  A: Outer classes cannot be private, they can only be public and "pacakage" (no access modifier). In ...
SCJP JAVA11/29/2006
  Q: QUESTION 19 Given: 1. public class Test { 2. public int aMethod() { 3. static int i = 0; 4. i++; 5. ...
  A: Line 3 of Test has a static variable in a method which is not allowed. The following 'alternatives' ...
SCJPJAVA11/29/2006
  Q: QUESTION 15 Given: 1. class A { 2. protected int method1(int a, int b) { return 0; } 3. } Which two ...
  A: C is ok, since the second parameter is not the same type as the second parameter in A's method1. If ...
Mandar(JAVA)11/28/2006
  Q: ClassOne.java: 1. package com.abe.pkg1; 2. public class ClassOne { 3. private char var = 'a'; 4. ...
  A: There is a compiler error on line 5 and 6 of ClassTest.java. The method getVar() in class ClassOne ...
runescape account hacking/cheats11/27/2006
  Q: i was wondering what are the go about on hacking runescape accounts . i know it can be done because ...
  A: hacking accounts generally is related to having a keylogger installed on someones system that ...
runescape hack11/25/2006
  Q: I read the article you had answered about hacking into runescape and making bots that would run ...
  A: Unless you have a good amount of knowledge of java, I'm probably not going to be able to help you ...
how to add a hyperlink to a dialog11/24/2006
  Q: I want to add a hyperlink on a JDialog box, which on clicking will open a file. I simply added ...
  A: If you want to anything more than basic HTML you should use the JEditorPane class instead of a ...
How to get a class in another classloader?11/24/2006
  Q: I know there are 3 classloaders in tomcat server, one is for server application the classpath of ...
  A: This depends on how the classloaders are organized. If classloader A is an ancestor of classloader C ...
Java Project11/23/2006
  Q: Do you know how to create a class? Yes Do you know how to make a method? Yes, but not sure how it ...
  A: Since the issueBook method for each sub class will be different, you can declare it abstract, and ...
Java Constuctors11/23/2006
  Q: What are Java Constructors? Please explain with detail and exampes. Also show me some Java programs ...
  A: A constructor is the method that is called to create an instance of a class. If you do not provide a ...
javaw versus java -jar11/17/2006
  Q: So, I wrote a java application that runs on my own machine by either double-clicking the JAR file ...
  A: If you look in the file accoication the jar you should see exactly what is run. Jar files use the ...
group by in java11/7/2006
  Q: Is there any "group by" function like SQL group by in java? Thanks, lzzzz
  A: Not really, but its not to hard to do in a few lines of code. Although this depends on the data type ...
Need Comments plz11/6/2006
  Q: Harper, I am a 1st year student at university and was wondering if you can be of any help. I have ...
  A: I'm more of a Java person, but I will do my best here. Note that this code should never be used in ...
JTable to XML and XML to JTable10/31/2006
  Q: How do I convert a JTable to a XML file and a XML file to a JTable? I searched a lot on the ...
  A: Please see: http://java.sun.com/products/jfc/tsc/articles/persistence4 Depending on the content of ...
getting processor id10/30/2006
  Q: sir, I wanted to have a unique aunthentication procedure based on processor id. regards, ...
  A: I don't think there is anyway of getting what you want. There are probably some tricks you can pull ...
java10/24/2006
  Q: 1.what is the use of tagged interfaces in java? explain me with an eg taking SingleThreadDemo ...
  A: 1. Tagged interfaces are used to denote a class or instances of a class specially. Serializable is ...
getting processor id10/21/2006
  Q: sir, In Java, is there any OS independent way to get the processor/CPU id. regards, sreekanth.
  A: What do you mean by id? You can determine the architecture of the system by using: ...
desktop file search10/19/2006
  Q: sir, for traversing through directories, i am using the following code. but its not able to compile ...
  A: The code segement is somewhat incomplete. I did not recieve any compiler warnings when I tried to ...
desktop file search10/16/2006
  Q: sir, 1. i am using core java. i want to find the path of a particular file in my system. is there ...
  A: When java installs it should be in the path for most systems. 1. There is no good way to do file ...
Question10/4/2006
  Q: I am a senior in high school and have been asking many people to help me answer a question but I ...
  A: Runescape was created by a small set of developers, it would take a very long time for an individual ...
Executing a java program from another directory10/2/2006
  Q: Sir, My problem is: I have one java program in the current directory "C:\Current" by name ...
  A: First, java.exe does not take a directory structure to start, rather it takes the name of the class. ...
asking for tutorials10/2/2006
  Q: im a programmer but of different language,im reading right now about mobile application in Java ...
  A: I haven't really done much with mobile devices, but http://java.sun.com/developer/onlineTraining/ is ...
jar file9/26/2006
  Q: I am using JCreator to code a simple GUI program. Now, what I'd like to do is to convert the java ...
  A: I haven't used JCreater, so I can't help you much. The problem you are running into however is that ...
query on interfaces and abstract classes9/21/2006
  Q: i have a small query regarding when to use interface and when to use abstract classes.... i have a ...
  A: Interfaces cannot have fields, and do not define constructors, and all methods have the same ...
transfering data between swing components9/20/2006
  Q: Artemus, I have a program that has the main container. Inside, it will have 4 panels named panel1, ...
  A: If you are not using a layout manager the component can resize itself, after doing so you can ...
printing9/19/2006
  Q: How can i print out the output of the data program? And how can create a data file that i could see ...
  A: What is "the data program"? If your running an external process you can use the ProcessBuilder ...
Executing a java program from another java program with platform independence9/18/2006
  Q: Sir, You have mentioned in the answer of my previous question that for platform independence we need ...
  A: If you want to wait until the process is finished you can read from the processes stdout and write ...
Regarding Java IDE creation in java9/18/2006
  Q: ------------------------- Followup To Artemus Harper Dear Sir, Thanks a lot for taking concern to ...
  A: Syntax highlighting is not easy, but its considered basic by may IDEs. See: Read: ...
Regarding Java IDE creation in java9/16/2006
  Q: ------------------------- Followup To Artemus Harper Dear Sir , Thanks for ur reply.I created a ...
  A: Basic features for an IDE: Synatx highlighting Goto line number Multiple files open at once. ...
Running java program using RunTime.getRunTime().exec()9/15/2006
  Q: Sir, can u tell me how to ececute a java program which is already compiled using another java ...
  A: Runtime.exec method does not do shell commands. If you want to execute shell commands use cmd.exe /C ...
Regarding Dialogs in java9/12/2006
  Q: ------------------------- Followup To Mr.Artemus Harper Thanks for ur reply.Sir How to get the ...
  A: I haven't used swt. Using swt is not trivial. You can download swt from www.eclipse.org/swt/ The ...
Create a window in Java with 2 circles ramdomly move in the window9/10/2006
  Q: 1st, I'd like to thank you. 2nd, how can I draw the 2 lines from the top corner to each of the ...
  A: In order to draw a line to the corner of a circle you will have to calculate where that is ...
Create a window in Java with 2 circles ramdomly move in the window9/7/2006
  Q: I am new with GUI Java. I try to write a program which will create a window (which I did) with 2 ...
  A: What you want it to have a timer object that updates the the variables on where the circles and ...
application memory space8/30/2006
  Q: I have three questions about application memory management, 1.does an application run within its ...
  A: 1. It depends on the OS, but usually yes. 2. Again, depends on the OS, but most desktop OSs handle ...
Dictionary8/28/2006
  Q: I saw your explanation about helping creating a dictionary...and I want to ask ...
  A: MSWord is a bit complicated, since there is no easy way to get at the format. What you can do is ...
applet signed certificate8/28/2006
  Q: i signed my applet and i got six months free certificate,but now my problem is can i get certificate ...
  A: No, you have to resign and redeploy your applet every six months. This is designed as a security ...
getting images from remote machine using applets8/23/2006
  Q: iam woring in larsen and toubro mysore,india. iam new to core java. in my project i compleated ...
  A: 1. You can communicate with the server the applet is located on. For other computers you will have ...
What is Its Purpose of Java?8/22/2006
  Q: What purpose does Java, Java Script, etc. really serve? The latest Java, or Script downloaded into ...
  A: First: Java and java script are two different enties, you can have one without the other. Java is ...
log information and log level8/11/2006
  Q: A Logger such as Log4j has several logging levels -- debug, info, warn, error, fatal, I wonder what ...
  A: Its mostly up to you. The idea is that someone may only want to look at warn logs and higher to see ...
Buttons are not shown when drawImage() method is used8/1/2006
  Q: Sir I replaced paint() method with paintComponent() but the result is same as before.Sir ...
  A: When you say getImage the image retured is not always fully loaded, trying to paint the image before ...
Buttons are not shown when drawImage() method is used7/31/2006
  Q: Sir In my swing window, I am using two buttons and an image. I am using fillRect() method to ...
  A: When you are using swing you should not use the paint method. Since that method also paints the ...
project Titels7/28/2006
  Q: Respected Sir, i m doing Bachelor of IT Engg. from RSCOE (Pune university) and i m in final ...
  A: Java has a rather large scope on what it can do, focusing on what you studied is best. Java is good ...
makin dictionary in java7/24/2006
  Q: Followup To Question - Well i want to make an English dictionary in java, but i couldnt get any ...
  A: If you just want a dictionary for spell checking you can use a HashSet instead. E.g. ...
makin dictionary in java7/21/2006
  Q: Well i want to make an English dictionary in java, but i couldnt get any idea dat how i will do ...
  A: As I said this is why you would use a HashMap. E.g. import java.util.*; HashMap<String,String> ...
Java7/21/2006
  Q: I am having a String object s= "7/21/06"; i want ot change the string object to date object. ...
  A: You should use the DateFormat to read in and write out dates. E.g. DateFormat myDateFormat = new ...
makin dictionary in java7/19/2006
  Q: Well i want to make an English dictionary in java, but i couldnt get any idea dat how i will do ...
  A: You can use a HashMap to store all the words to their definations. If the Dictionary is large it ...
java7/19/2006
  Q: what is static?why we use static?
  A: static means that the field/method is independent of instances of the class its declared in. All of ...
Simple java applet problem7/17/2006
  Q: Okay, First off, I'm an experienced programmer, looking to get into coding applets. I have coded ...
  A: I believe that gcj generates executable code, not code that is run in the java vm. This error means ...
Synchronization7/17/2006
  Q: What synchronization constructs does java provide ? How do they work?
  A: When you synchronize on an object your thread gains exclusive use of that object until ...
How can I know weather a printer is on/off?7/11/2006
  Q: I understand, So what does PrinterStateReasons and printerState objects should provide if not a ...
  A: The PrinterStateReason is any possible known states the printer is in. It might be none of these, ...
java -cp resourcedir;lib.jar -jar main.jar7/10/2006
  Q: I encounter a problem with "java -cp resourcedir;lib.jar -jar main.jar", is java looking for ...
  A: Although I have not tried this myself. It is possible classes loaded via the -jar flag will only ...
Help on Static Inner Class7/10/2006
  Q: What is the difference between the static class and static inner class in Java?
  A: static classes have to inner classes. Differences between static classes and non-static classes: ...
How can I know weather a printer is on/off?7/9/2006
  Q: The PrintServiceLookup.lookupPrintServices method returns a list of all the installed printers. of ...
  A: Its not really possible to determine if the printer is on or off, the printer might be a network ...
JAVA7/8/2006
  Q: I created a form with a button in java. How can I open an application e.g. (Microsoft calculator) ...
  A: Warning: Executing external applications may fail on different operating systems. ...
Calendar in Java7/8/2006
  Q: I want to write a code in java that constructs a gegorian calendar, where the months are represented ...
  A: Why write code for a gregorian calendar when one already exists (java.util.GregorianCalendar)? See ...
Where is Iterator Interface Implemented?7/6/2006
  Q: I am using the java.util.HashSet class, which has an Iterator method that returns an Iterator. I ...
  A: Each class in java.util implements its own iterator. These iterators are private classes, and ...
Drag and Drop audio and video files from windows explorer to Applet?6/24/2006
  Q: ...... Can u help me out to how to Drag and Drop audio and video files from windows explorer to ...
  A: In order to allow drag and drop to do anything usefull with Applets it must be trusted by the user. ...
Swings Applets6/23/2006
  Q: sir i have problem with swing applet.when i call repaint() in swings it will not clear back ...
  A: When repaint it called, then at some latter time (generally within .5 seconds) the paint rotunie is ...
FTP6/22/2006
  Q: i have some source code to make a FTP. but i'm not sure how to make my FTP can block all data ...
  A: The term copyright material is rather undefined. Copyrighted by who? Do you mean registered by US ...
get the user names from Active Directory domain6/20/2006
  Q: Currently i am working on weblogic portal regarding the SSO(single Sign on).I just wanted to know ...
  A: You can use System.getenv(String) method to get various enviromental variables, some of which ...
JTextArea and caret postion6/18/2006
  Q: Sir, I was making one application which has 2 JTextArea's and 1 button. When i enter some text in ...
  A: The problem is that when you clear the text the enter key is still being processed by the text area, ...
Regarding Browser plugin in JAVA6/18/2006
  Q: "Hi, I want to develop a plugin for browser (for IE,Mozilla,safari...). Can i do it in java? If yes ...
  A: Each browser uses different technonlogy for plugins, so some customization for each browser would be ...
JTextPane and mouse disabling6/14/2006
  Q: Sir, Can u tell me how to disable mouse right click and left click buttons when put on a JTextPane. ...
  A: If you subclass the JTextPane you can override the processMouseEvent(MouseEvent) method, and simply ...
What is the machanism of super()6/13/2006
  Q: What is the machanism of super() (algorithim or code used in implementing in Super()). How it dicide ...
  A: When you use super each class above yours is checked to see if it has that method or constructor ...
Java Virtual Machine Launcher6/3/2006
  Q: When I log in I get a box appear on my desktop which says Java Virtual Machine Launcher Could not ...
  A: There is something set to startup when you log in that is a .jar file. The jar file for some reason ...
Java Question5/31/2006
  Q: I am preparing for my java final exam and i came across 2 questions: a) Rank the following ...
  A: a) Determining what grows the fastest depends on what is going to produce the biggest number for a ...
Bitwise operators in Java5/20/2006
  Q: Good morining sir, Could please tell me about Bitwise Operators in Java, what is the use of those ...
  A: > Could please tell me about Bitwise Operators in Java The bitwise operators: << shift left >> shift ...
Swings and date, time5/13/2006
  Q: Can u please tell me how to change time after every 1 minute, which displayed on a label. That is, i ...
  A: You can use the Timer class (use the one in javax.swing not java.util). E.g. import ...
Swings and desktop5/13/2006
  Q: Can u solve my following problem: I have to simulate the desktop environment of windows using Java. ...
  A: You can do this, the amount of work required depends on how funcational you want it to look. E.g. A ...
manipulate the super class attribute in its sub classes?5/12/2006
  Q: I have a abstract super class and its two sub classes, the super class have a protected attribute, ...
  A: You cannot manipulate the access level of fields. You can manipulate the access level of methods so ...
Swings and winamp application opening5/12/2006
  Q: Can u please tell how to open Winamp, if we click a button in the form developed. Means, i developed ...
  A: The main problem is determine where winamp is located. If you know (or assume some default location) ...
related to tabbedpane in java5/12/2006
  Q: how we use the textfields,labels and buttons in the tabbedpane....please explain the coding in java ...
  A: What you do is create a JPanel for each tab you want. In the JPanel put your JTextFields and JLabels ...
How to hack into runescape?5/11/2006
  Q: Im wanting to know how to hack into www.runescape.com i dont know how long ago you hacked into it ...
  A: I don't think anyone has actually hacked into runescape. Bots have been created, exploits have been ...
JVMPI & JNI5/10/2006
  Q: I'm using the attached piece of code as reference for a class project, but I have never seen the ...
  A: 1. If there is no access modifier then the method/field/class has package access. Every class in the ...
Images in Game Applets - Pong5/8/2006
  Q: Harper, I have been working on this Java version of pong for a few weeks now. As far as the game ...
  A: You could try buffering your image. Keep an Image field around as a buffer, create it using ...
Referencing Files5/4/2006
  Q: Heyas, Yeah I did wonder if really this was meant to be in the registry or, at least, the ...
  A: I've been using Eclipse for some time, and the version I am using supports java 1.5 (still a few ...
Referencing Files5/2/2006
  Q: Hey again, That approach worked perfectly for reading files, but as the preference file stores the ...
  A: Its rather rare to actually write to a jar file. If the file was online doing this would be simply ...
Batch File in Java5/2/2006
  Q: Hi i have one java file and i hav to run batch file for running cd command and then java commmand so ...
  A: Instead of changing the directory and running java you could do: java -classpath ...
seach string in web browser4/30/2006
  Q: I am trying to make the following program: Program checks the html web page seachs for the specific ...
  A: What you would do is open a stream to the URL, wrap a Reader around the InputStream, and dump it to ...
Referencing Files4/29/2006
  Q: Heyas, I've got a program that stores user variables in a file called preferences.ini at the root ...
  A: If you jar, its rather difficult to actually write to it, so if your fine in just reading you can: ...
displaying the content of HTML File4/23/2006
  Q: I am doing my project in Java Swing.I am having a program to get the input from the user as URL in a ...
  A: You are probably getting an EOFException because there is an empty or malformed file at C:\Documents ...
integration of modules4/22/2006
  Q: sir, I have sent the following question before some day and I tried according to your answer.But ...
  A: So the labels in the popup menu of f1, f2, and f3 are not showing when you call their main method, ...
displaying a web page4/22/2006
  Q: We are students of an engineering college.We are doing our project in Java Swing.Our problem is need ...
  A: You may need to configure your firewall to allow java access to the internet. The new version of ...
Viewable windows4/21/2006
  Q: Heyas, I've written a card game with a GUI, and just implemented options to change the resolution ...
  A: Either: A: The frame needs to be invalidated, use frame.invalidate(). B: All component changes ...
Building a website4/20/2006
  Q: Even i could not complete them well, but i am fine with that assignment. I really appreciate that. ...
  A: I do not recall what tools you are using for your web site. If you mean what parts of a site should ...
Java swing4/18/2006
  Q: I am a student at a high school in Belgium, I have to make a multiplayer-over-network game on ...
  A: There are several drawImage methods. The one you probably want to use is: drawImage(Image image,int ...
Java swing4/16/2006
  Q: I am a student at a high school in Belgium, I have to make a multiplayer-over-network game on ...
  A: 1. The getImage() method gives back an Image not a BufferedImage. 2. Directly refering a file on ...
sir, I have three java files...4/14/2006
  Q: sir, I have three java files f1.java,f2.java and f3.java.one for detecting remote os.secnd one for ...
  A: If f1.java has a main method you can call it from f4. E.g. public void actionPerformed(ActionEvent ...
Array4/10/2006
  Q: Is it possible to create an array which will store any type of data, such as integer, float, or ...
  A: You can create an array of Object which will store any non-primative. For primatives you can use ...
Java4/9/2006
  Q: When I go into a card site,it says my computer doesn't support java. How do I download java so I ...
  A: You can download the newest version of Java from java.sun.com. When you run a java applet from the ...
Thumb Impression and Photo Scan using java4/4/2006
  Q: In my project i need to take thumb impression and photo scan using java application , i came to know ...
  A: This depends on what format the thumb impressions and photo scans are using. You can use JNI to ...
Integrating two java applications4/4/2006
  Q: I was wondering... what would be an efficient way of integrating two Java applications written by ...
  A: > I understand that RunProcess has an exec() method that allows a user to do this. But what are the ...
Pannels of images, or what? Thanks3/29/2006
  Q: Good morning/Afternoon/Evening name is Tim Dunning. I'm trying to create a message board using java ...
  A: I would swap images. Spefically I would create a JLabel containing that has no text and an icon of ...
Pannels of images, or what? Thanks3/28/2006
  Q: Good morning/Afternoon/Evening name is Tim Dunning. I'm trying to create a message board using java ...
  A: This somewhat depends on if you are displaying each panel in its own frame or in one big frame (or ...
How to arrange the Layout?3/28/2006
  Q: I try to learn from the link that you provided me, but i still cannot get my layout done as what i ...
  A: If you have to you can simply not use a layout and put the components in the location with the size ...
Converting pixels into cm3/27/2006
  Q: The code below is in regards to pixels, how would I convert the pixels into Centimetres? ...
  A: assuming you are using the jgoodies API... you can convert Centimeters into pixels, so if you want ...
How to arrange the Layout?3/26/2006
  Q: I am a Java beginner and now i need to create a ChattingRoom application for my assignment. I try to ...
  A: I would look at the tutorial for layout managers: ...
Rectangles and Ovals3/25/2006
  Q: i have created this code, i would like random amounts of rectangles to appear between 0 and 3 and ...
  A: well you are drawing several rectangles in the corner in your loop. You probably want them in random ...
I would like a random shape size to appear3/25/2006
  Q: I would like random number of rectangles to appear between 0-2 and also random size each time of ...
  A: You can use the Random class for that... e.g. import java.util.Random; public class RandNumbers { ...
Listening For Window Size in Java3/23/2006
  Q: I am using Java 4 to create a drawing. My drawing has to be abble to resize if the window is ...
  A: You don't want a WindowListener, rather you want a ComponentListener. You can use getWith and ...
Backtracking3/22/2006
  Q: Most humbly, it si requested that i am developing an URDU(national language of Pakistan) Parser, for ...
  A: I'm not entirly sure what you want to do, but you might want to see if using javacc will do you any ...
UDP based file transfer3/20/2006
  Q: I am doing my academic project in this area. I want to transfer all filetypes of files using udp.I ...
  A: Well to read and write files you can use a FileInputStream and a FileOutputStream. But for transfer ...
Disable Tristate check box node in a Jtree3/17/2006
  Q: I am using Tristae check boxes as nodes of a JTree. I wantto disable a few nodes. But it is not ...
  A: A shared component is generally used to render each item in the JTree. If you disable one node, you ...
java.io3/15/2006
  Q: Basically, i have a script to copy a complete file and produce an output file containing an exact ...
  A: Well you just need to change your while loop a bit... CopyFile: while ((c = in.read()) != -1) { ...
on multiple jvm's3/14/2006
  Q: what happens if we install multiple JVM's in a single system
  A: You have multiple JVM's on your system then. What happends depends on what you are doing. Generally ...
Cpu3/13/2006
  Q: sir sorry for further bothering u..actually am not really clear with the java code for cpu ...
  A: If you download the commandline process viewer from ...
GUI Pauses3/11/2006
  Q: Heyas, I'm making a graphical card game where one human player plays against 3 computer opponents. ...
  A: You do want to create another thread for this. But you may need to repaint after the thread is ...
Adding a program to batch file3/11/2006
  Q: Another question to ask. I tried adding another program into the folder of a program that executes ...
  A: Its only copying the Service.class and the Server_Stub.class to the client directory. I would ...
Cpu3/11/2006
  Q: Sir, I used the following code (Obtained from all experts.com) to calculate CPU Utilization for a ...
  A: This above code will only guess at the CPU cycles, in most cases it will not work. If you can find a ...
Java3/8/2006
  Q: Is there any way to make a java program runs whenever the computer is turned on? Thanks
  A: This very much depends on the operating system of the computer. You could put the java program in ...
JAVA3/8/2006
  Q: i created a simple window panele and added some buttons and a textbox. my question is how can i ...
  A: I would recomend the replaceSelection(String) method, which performs the same function as if the ...
java.awt3/7/2006
  Q: I am trying to do a program, that when the mouse points to the task bar(depending on its color) to ...
  A: your problem is your import statements. none of the package names are upper case. Color is a class ...
java swing3/4/2006
  Q: i am doing project on java awing. i have to display an image on the JFrame object. on the image, the ...
  A: Example: /* * JZoom.java * * Created on March 5, 2006, 2:06 PM */ import javax.swing.*; import ...
Prime numbers3/1/2006
  Q: I have been trying to find the suitable source code to find the prime numbers, I was able to get ...
  A: Your program does not test if a number is prime, rather it tests to see if the number is a multiple ...
barcode ttf install2/23/2006
  Q: Running AIX 5.2. Have Java14 installed. We have a java app that needs to print out barcode. We ...
  A: I would recomend just reading in the font at runtime, you can use the Font.createFont method for ...
write thread on the button2/22/2006
  Q: i have a button, already made in swing can u tell me how to write the thread on that button.
  A: I assume you mean execute a thread when the button is pressed. For the button you either have an ...
Java/Email Conflict?2/19/2006
  Q: I have a problem with my Dell Inspiron 600m Laptop finding a conflict with Java. For some odd ...
  A: Chances are you had an older version of java installed on the system, when you installed the newer ...
dynamic array/ array list of arraylists2/10/2006
  Q: well i'm new to java. i need to read stuff from a file and store in some data structure. say i have ...
  A: If your using java 1.5 you can use generics... e.g. ArrayList<ArrayList<String>> myList = new ...
Why isn't this generic class declaration working?2/7/2006
  Q: I have, essentially, the following class declarations: class Foo { } class Bar<F extends Foo> { } ...
  A: F is not defined, all new types have to appear in the template list. A "correct" way of doing this ...
java2/6/2006
  Q: my question is what circumstances would you use abstract classes and interface plz answer me with ...
  A: You use abstract methods and interfaces when you want to declare a functionality without actually ...
Servlet Code - JSP form submit1/26/2006
  Q: Need Help: Posting data to a servlet from a jsp form? hi experts, I'm trying to find logic and ...
  A: You would need a Map (Hashtable or HashMap) with keys of line_x values, and values of Lists ...
Table with expanding row1/25/2006
  Q: Actually, the display model is a list of Results. This list is displayed in a JTable. Let's ...
  A: Well you can't really use a JTreeTable anyways since you want one row to expand across multiple ...
Strinbg to IP address1/25/2006
  Q: I encountered problem with the following statements. CommandParser cp = new ...
  A: import java.net.*; ... InetAddress address = InetAddress.getByName(client_ip); byte[] dot_address = ...
Table with expanding row1/24/2006
  Q: I want to display search results in a table. The feature I am puzzled about is the ability to show ...
  A: It sounds like the first column in the table is not connected to the other columns (if that is when ...
JNI1/23/2006
  Q: I am trying to access a data member of a class I defined in java through JNI, for example: public ...
  A: Just perform a cast on jobject to jobjectArray. All of the JNI classes that represent java objects ...
java book or website1/21/2006
  Q: i am goinn to do project in grid computing.we choose java as aprogramming language. i am a beginner ...
  A: To learn the basics on java, start at java.sun.com, they include a lot of basic tutorials. The area ...
Java not working in one of my brousers1/19/2006
  Q: I have IE and Netscape that I use. The reason I loaded Netscape is that my IE would not open any ...
  A: Java does have a plugin for IE. One thing you could try is to go into the java control panel, and ...
string1/18/2006
  Q: I am attempting to build program in which a program would prompt the user to enter the name of a ...
  A: If you want to send and recieve text you should use a Writer. e.g. BufferedWriter toRecomtepc = new ...
Comments needed for Code1/13/2006
  Q: Can you please help me with commenting on this code. I got the code working but need to comment the ...
  A: /* * We need stdafx.h in order to do user input/output. */ #include "stdafx.h" /* * Entry point for ...
paint image1/11/2006
  Q: Followup To Question - ------------------------- Hi!Thanks for answering my previous question..I ...
  A: For whatever component your background is in (e.g. a JDesktopPane) you need to subclass the ...
Java Problem1/9/2006
  Q: im doing an aplete for a company im working for who are working on an ecological study on newt ...
  A: This depends on the component you are using. Most text componenets you can use the getText() method ...
Java1/7/2006
  Q: What is the difference between checked exception and unchecked Exception. ...
  A: If a checked exception is thrown, or you call a method that declares that a checked exception may be ...
paint image1/7/2006
  Q: .I wud like to ask about another thing..will u please give me some codes on dumping a database.I'm ...
  A: There are shell commands to dump and restore a database. If you want to do it just using sql then I ...
Java12/25/2005
  Q: I run your example and it did work very fine thank you. As you know it only search for the queens ...
  A: Well instead of replacing x and y with 0 and 0, instead get an x and y from the user (you can ask ...
Java12/24/2005
  Q: I cam up with a very long solution which is about checking all 8 directions to see if there is ...
  A: No, what I ment was to use a for loop to check each direction, not each space... e.g. ...
Resource-friendly timer12/23/2005
  Q: Heyas, I'm considering making a very simple program which will run in the background all the time, ...
  A: You can use the java.util.Timer to schedule an event to occur at a speficied time (the ...
Java12/23/2005
  Q: I'm a beginner in java and im building an 8 queen chess puzzle using java text console no graphics. ...
  A: If you want to disallow the user from putting a queen in a position that would "attack" another ...
java project12/22/2005
  Q: please i am about to write my final project in java programming before i graduate please can you ...
  A: What you pick mainly depends on your experence. For example: Build a gui for sorting and keeping ...
component generated events12/22/2005
  Q: i came across this question in a multiple choice past exam paper whilst revising and am not sure of ...
  A: 1. This doesn't make any sence at all. 2. This is generally how it is done. 3. This is wrong. 4. ...
java12/20/2005
  Q: Iv got a second question. In my main menu are three options as you know from the previous1.Display ...
  A: When printing out your matrix the line that determins what mark to use: String ...
java12/18/2005
  Q: im a beginner in java and i found ur answer a bit difficult 2 understand could u pleas show me some ...
  A: Ok here is a solution. It assumes you are using java 1.5. So if you get a compiler error you are ...
java event conflict12/18/2005
  Q: I have made a simple "scribble paint" program in Java in which you drag your mouse over a Frame to ...
  A: The problem is you are combining java 1.0 functionality with java 1.2 functionality. the mouseDown ...
java12/17/2005
  Q: I made a simple choice program that displays arrays using java text console no visuals in blueJ ...
  A: First: You mean adding a value to an array, not adding an array. In order to add values we first ...
Command12/14/2005
  Q: It is me again. I found a piece of code from the Internet one of whose functions is enabling the ...
  A: I would try printing out the exact command that you are using in exec. You could pipe out the output ...
Core Java12/11/2005
  Q: Can We declare a constructor as protected,public or Private. If no then will it lead to ...
  A: Yes, you can give any access modifier to a constructor (including none). Also note that constructors ...
How to a private method outside a class12/6/2005
  Q: actually what my question is i want to test a private method outside that class in JUnit. for ex: i ...
  A: You would either need to somehow tunnel the method to make it accessible, or use reflection. ...
paint image12/4/2005
  Q: ------------------------- Hi!Thanks for answering my previous question..Just a follow-up,does the ...
  A: Yes, if you use JDesktopPane instead of JPanel you will paint the background of the desktop pane. ...
paint image11/30/2005
  Q: ------------------------- Hi! Please give me some sample code of yours on how to paint a background ...
  A: If you want a custom background for a JFrame just set a JPanel with the custom background as the ...
java gui11/29/2005
  Q: currently the user plays the game in a terminal window and game events are printed as ...
  A: Well you probably want to use a BoarderLayout for the Frame. Putting the Text component you want to ...
Java11/28/2005
  Q: There are couple of questions which i would like to ask. 1. I downloaded a piece of code from the ...
  A: 1. since the lock is released just after it is created, you wouldn't see anything happen. 2. It ...
Java11/18/2005
  Q: I encountered some problems with some of the sample codes that i downloaded from the Internet and ...
  A: 1. Well from the error message, when you run the application it doesn't have access to the desktop. ...
counting character in a file11/11/2005
  Q: I need some help in counting the occurences of characters in a file. I got the code to open the file ...
  A: you can keep them in an int[], where the index into the array is the count of that letter. E.g. ...
Java Script Pop11/9/2005
  Q: I understand they are different - I have have checked my browser settings and they appear correct. ...
  A: Its hard to say what the problem is, but as I mentioned, java and javascript and different things. ...
closing/ending JFrame applications10/27/2005
  Q: my question is simple and straightforward i have seen two methods for closing/ending JFrames, those ...
  A: For the most part if you use dispose, the application may continue to run if there is other Frames ...
Jar Files10/27/2005
  Q: Mr. Harper, I am a high school student learning Java, and I have a good feel for object-oriented ...
  A: First by "opening" the archive you are actually asking java to launch the application in side. If ...
items10/25/2005
  Q: i want rooms to contain an item. i currently have a class called item looks like this. import ...
  A: It seems rooms have items, you probably just need to add something like getItemString method to ...
Developer's Productivity10/25/2005
  Q: I am a dotnet developer, I was working in a good company but the only problem there was the ...
  A: This is something that comes with experence. If the job is expecting you to complete a task that ...
Compile java program from the console10/25/2005
  Q: I have done just what you said but now when i run command prompt and type the command ipconfig to ...
  A: the path enviromental variable is mearly a semicolon seprated list of paths to look for applications ...
splash screen10/20/2005
  Q: How do I use a layout manager and gridbag layout to add a splash screen to a program, that displays ...
  A: I don't see what a layout manager has to do with a splash screen. To show a splash screen just ...
java swing10/19/2005
  Q: am a java swing developer and one of many maniacs in java all around the world am crazy about java ...
  A: From my experence when dealing with a small database both java and .NET are about equal in ...
Since ++ has higher precedence than =, why does the following code print 1 ?10/18/2005
  Q: Since ++ has higher precedence than =, why does the following code print 1 ? ---------------------- ...
  A: The reason is that you are using the post increment as opposed to the pre increment. The post ...
Compile java program from the console10/17/2005
  Q: I am using Window Xp. There is a java program that needs to be compiled and run from the console but ...
  A: Assuming that you have installed the SDK, you would: right-click on My Computer and select ...
FIFO10/11/2005
  Q: I am writing a program that enforces the FIFO rule. I am planning to use the Queue class with an ...
  A: Queue (java.util.Queue) is an interface that defines simple operations for a Queue. If you want to ...
Jtree10/8/2005
  Q: I have Three questions 1. as alaways, an applet shows Applet droped down menu on top left corner to ...
  A: 1. I do not know what you are talking about 2. Not very easily, but messing with the graphics can ...
Transfering an ActionListener variable's values from a Panel to a class and back again10/8/2005
  Q: I am currently working on a project which requires me to translate text submitted by a user via a ...
  A: Well assuming that the Frame class has access to the translator and the JPanel (which would have a ...
random from a set of character10/6/2005
  Q: Is there another way to do this without using the array? ThanksHello, I am just wondering how you ...
  A: Well you could use a String (which is a char[] underneath) e.g. String chars = "+-/*"; int r = ...
random from a set of character10/5/2005
  Q: I am just wondering how you would generate a random character from a set of characters. For example, ...
  A: First you would need a random number generator: import java.util.Random; ... Random random = new ...
jframes and show()/setvisible(true) methods9/27/2005
  Q: my question is simple, but i was unable to find an answer in my java books what is the difference ...
  A: the setVisible method replaces the hide and show methods. The old method names are still there so ...
DateTime Convertion9/27/2005
  Q: Good day. From the following is my question, please kindly take a look to help. String ...
  A: Most of this can be performed in the DateFormat class and the Date class. See the parse and format ...
Java Palindrome Program9/26/2005
  Q: I have a Palindrome program, but it won't compile without errors, can you look at the program? // ...
  A: The method looks fine... Perhaps you just need to wrap it in a class to have it function correctly. ...
gui design9/24/2005
  Q: iam just wondering about a layout, iam using grid layout and border layout to show my GUI, but when ...
  A: You can set the maximum size of the components using the setMaximumSize method, but I am not sure ...
toString()9/23/2005
  Q: I am writing a program, displaying this matrix 1 2 3 4 | 10 1 2 3 4 | 10 1 2 3 4 | 10 - - - - - - 3 ...
  A: The code in your toString method will simply return the output instead of using System.out.println, ...
Java Beginner Program9/22/2005
  Q: i am a beginner at java and I am taking an AP computer course this year. My teacher gave us an ...
  A: This is too general for me tog correctly answer. The program requirments are too vague, also I do ...
jtogglebutton and actions9/21/2005
  Q: I have an action assigned to a jtogglebutton, but also to an inputmap key binding. The problem is ...
  A: The problem is that the action reacts to the selection or deselection of the toggle button, it does ...
Add fraction9/20/2005
  Q: I am new to Java 2 and I wonder if you can help me out or point me to a tutorial on any web sites ...
  A: Well you would do it the same way you would in math: public Fraction add(Fractaion f) { int gcd ...
left alignment grid layout9/19/2005
  Q: .. Just to followup - I'm not using the gridbag layout, just the grid layout, which is where I'm ...
  A: you can use: label.setHorizontalTextPosition(SwingConstants.LEFT) to tell the label to show its text ...
java question9/16/2005
  Q: i got so many compile errors. the code is not working. will you please remove the errors. regardsi ...
  A: I meant this to be an example, not somthing that was fully functional. Also there are not very many ...
BorderLayout9/15/2005
  Q: i have a problem that i haven't found a solution yet. It's a part of my project i've been doing in, ...
  A: The border layout does exactly what is says it does, don't change that. Instead you can add a JPanel ...
concatenation in Textfield9/15/2005
  Q: I have designed a scientific calculator in java with one text field. When i enter 2nd digit in the ...
  A: This is probably a design of the calculator. You cannot for instance just set the text. Since you ...
Random number9/14/2005
  Q: Now i am not sure I understand "Random random = new Random(357);" Could you elaborate on that. When ...
  A: If you just want a "random" number then just use the no argument constructor. Using new Random(357) ...
Random number9/14/2005
  Q: I am new to Java and what I try to accomplish is to have my program create a random number between 1 ...
  A: The first place I would look is the java API: http://java.sun.com/j2se/1.5.0/docs/api/index.html Oh ...
java9/10/2005
  Q: I am so stumped! I am a student and we were given this assignment to finish. it is a program that ...
  A: You need a for loop over the word, getting each character and checking if it is a vowl. When you ...
java programming9/10/2005
  Q: I am learning java programming and I have been stuck on this program for days! Could you please tell ...
  A: Your regDate in SmallBoat class is never initilized, if you want to have the regDate be the time ...
java and java swing9/9/2005
  Q: if i create a page with password and login and Ok Button. how can i go to next page if i click Ok ...
  A: I have given you code, you just need to assemble it. Also "next page" does not mean anything in ...
Java Swings9/8/2005
  Q: ------------------------- Question - Hi harper, In swings if i click a button called submit ...
  A: This depends on wether you have the pages in a JPanel or a JFrame. If you have them in a JPanel, ...
Java and Sound Editing9/7/2005
  Q: I want to make a program which take humann voice or any other sound as input and changes its ...
  A: I haven't delt with java sound much. I know that you can record any play back sound on a mic, I ...
GUI wrappers9/6/2005
  Q: I was wondering if you had any resources or any tips on how to design and create gui wrappers for ...
  A: I'm not sure what you mean by "wrappers for unix functions". Do you mean creating buttons that have ...
Java Swings9/3/2005
  Q: In swings if i click a button called submit then it should take me to next page. How do i do this ...
  A: I have no idea what it means to "take you to the next page" but if you have a button you can attach ...
record the time9/2/2005
  Q: I am trying to write a program where I can time how long I type the sentence. For example, if I type ...
  A: The simplest way of doing this is to compare the time from when they started to when they ended. You ...
java (arrays)9/2/2005
  Q: i have a computer science problem that i'm not being able to solve. i have a test and i'm doing ...
  A: If this was not a test, then I would just use the sort method in Arrays: int[] array = ...; ...
problems with desktoppane and internal frames8/31/2005
  Q: I have 6 classes which are different GUI windows. Now what Iwant to do is create a desktop and add ...
  A: For the most part you can treat a JInternalPane as if it were a Window (or Frame or Dialog). For ...
Hacking8/27/2005
  Q: Thats is the exact game i want to hack! Could you tell me how? And when you hacked it what did you ...
  A: The first thing you have to relise is the only hacking that really can be done is client hacking. ...
Web Application Development8/11/2005
  Q: My question is: I have a web site and I would like to add a link to it, so by pressing on it, a ...
  A: You could write an active x web application which should be easy to port from a standalone c++ ...
java swing8/9/2005
  Q: how to insert values of a text box in a database?
  A: Well first you want to get the text e.g. String text = textBox.getText(); String text2 = ...; Then ...
cursor8/9/2005
  Q: In Some portion of my java applet i want cursor to be invisible and disable. How Is it possible in ...
  A: Best shown by example: import java.awt.image.*; import javax.swing.*; import java.awt.*; public ...
copy java data to C structure8/2/2005
  Q: i m facing a problem that i have to copy java structure to C structure and C structure back to Java. ...
  A: Well lets first look at possible incompadibilities: 1. char[] in C is ASCII while java's String is ...
swing and other java stuff8/1/2005
  Q: i have the following questions i´ve been trying to answer on my own, but was unable to do so. these ...
  A: 1. The code for creating your applet is roughly: public void run() { YourApplet applet = new ...
Java Link7/29/2005
  Q: I would like to create a button in my java program, such that a pdf-document will open in acrobat ...
  A: Runtime.getRuntime().exec("cmd start /c "+file); This is the simplest solution. It also will only ...
Regarding a pure java application7/28/2005
  Q: I have a java application. My current question is in particular about two different classes. One is ...
  A: Compare what you have to JFileChooser. Since that is using a model dialog the setVisible(true) ...
Chat system in java and php7/26/2005
  Q: . I am doing my last year in Bsc(Hons)Software Engineering. For my final year project, i'm ...
  A: Since your using php I assume you will be using a server that uses PHP, and the client will be java. ...
Executing with java vs javaw7/25/2005
  Q: Platform: j2sdk1.4.2_04 on Wimdows XP Pro Spk2 I have a java desktop application using JTabbedPane ...
  A: I can't really say what the issue is. Is might be related to the command window being visible or ...
Roman Letters to Numerical Value7/23/2005
  Q: I have a project to do. I am not asking you to give me the whole answer. I want some tips and hints ...
  A: Java is used in a wide range of areas. Many jobs require experence in J2EE or J2ME. There are also ...
Related to Java main arguments7/21/2005
  Q: I was developing a gui for my java application, so that user can enter the input(arguments) in the ...
  A: Im not entirly sure what you are trying to do. Does the program run without a gui, on say the ...
plz explain oops concepts...7/20/2005
  Q: plz explain oops concepts in detail.are they not in c?
  A: c can have oop, but it is not easy to do (c++ has oop). The fundemential idea o oop is that you ...
Reverse number7/19/2005
  Q: i'm kinda new in Java. Im supposed to write a program that will reverse a given number using modulo. ...
  A: You will need a while loop. when you % a number by 10 you get the last digit. E.g. int a = 1234 int ...
how is use userdefined package7/14/2005
  Q: how to use userdefined package in a pregram
  A: If you mean how do you declare packages, just use the package keyword e.g.: package mylib.mypackage; ...
Rotating Numbers7/10/2005
  Q: I'm trying to rotate the inputted word.. there seems to be an error that i don't really understand. ...
  A: Your program seem to be written not to expect a space between the word and the number. What happens ...
java reverse prog7/7/2005
  Q: i have to do a programming in java that will reverse a given number, for eg. 1 2 3 will become 3 2 1 ...
  A: well if you mod 10 a number you get its last digit. If you divide a number by 10 you cut off the ...
adjacent repeating letters7/3/2005
  Q: Some words have adjacent repeating letters. For example, the word “tomorrow” has a double ‘r'. In ...
  A: Well it sounds fairly simple, just iterate though the characters, keep the last character stored, ...
call toanotherprogram6/27/2005
  Q: I made 4 programs in java(p1.java p2.java p.java and p4.java) the first ones shows the option to ...
  A: You generally don't call one program from another (although you can) instead you generally call a ...
hello6/21/2005
  Q: So maybe you are suggesting that C++ would be a better language to work with? What I am doing is I ...
  A: Its not really the language, rather its whatever API you find that will handle the video. If you ...
hello6/19/2005
  Q: I want to devise an application in Java that is feed video from my camera through the firewire port ...
  A: Java cannot do it by its self, there might exist some library that would assist you in this. You ...
Java6/19/2005
  Q: I think Java is installed on my pc but do I really need it ? What can it do for me ? I'm 76 and get ...
  A: Java is not really a program, rather it is a tool required for some applications to run, espically ...
Java Question - How to6/9/2005
  Q: How would I write this program with a for loop? public class PenniesForPay { public static void ...
  A: Since your program calls System.exit in the while loop, I do not understand what you are doing. ...
Delete of a record in a pgm j2se6/7/2005
  Q: I made a programa in Java. The query, insert and Update work ok. The delete opcion have the ...
  A: Your delete needs a from e.g.: Delete From Empleados where IdEmpleado=3 Also you should not use ...
entering a given .class file!!6/2/2005
  Q: ! i would like to ask a simple (probably) question, but i really don't know what to do with that! i ...
  A: You must make sure that the .class file is in your classpath. E.g. If you run javac on the ...
chars and strings6/1/2005
  Q: i have the following question that seems very simple but actually i was unable to answer ok, a ...
  A: String var = ""+ch1+ch2; This works since this statements resolves to: String var = (""+ch1)+ch2; ...
Changing the working directory in Java?6/1/2005
  Q: I know that the following changes the the "user.dir" property of the Java program, but through my ...
  A: You don't, changing user.dir is not supported in the java platform. You should consider writing your ...
; expected. Why??5/29/2005
  Q: i'm writing a program in java, everything is correct but the compiler hits wrong at the following ...
  A: You should declare totalarea up front instead of redeclaring it in the for loop. Also (assuming ...
cloning in java5/25/2005
  Q: what is cloning in java & types of cloning in java.
  A: cloning is the copying of an object to create an identical object. The method clone() in Object ...
Calling outside programs and commands in Java?5/22/2005
  Q: In Java how do I call programs/processes (.exe,.bat,.pl, etc.) that are located elsewhere on the ...
  A: To execute external programs you would use: Process someAppProcess; //Handle to the process, you can ...
I want to learn JAVA in a month5/22/2005
  Q: How are u? I am working in a QA(testing)environment. I want to shift my career to Development ...
  A: 30 days is somewhat hard to learn java in unless you are already quite versed in a language like ...
String vars and input classes5/21/2005
  Q: i have two questions for you: when i write some code like the following: string stringVar; ...
  A: Question 1: "hello" doesn't go anywhere. stringVar is mearly a reference to "hello". If there are ...
exception handling5/19/2005
  Q: Here's the basic structure of my program import stuff; ...
  A: 1st do not have file operations in your paint method, you do not want to reparse the file every time ...
java5/19/2005
  Q: why java does not support multilple inheritence? what is c.v.s?
  A: see an answer about multiple inheritence: ...
displaying letters5/17/2005
  Q: im currently making a game of hangman whilst learning java my current problem is that if i have a ...
  A: It does not appear you are actually changing display. Strings cannot be modified, calling ...
hashcode() !!!!!!!!!5/17/2005
  Q: I dont know how to implement hashcode, and i need it urgently. can u please tell me the code for it ...
  A: Just borrow the hashcodes from addrBookName and emaList. E.g. public int hashcode() { return ...
applet keep loading but not run5/16/2005
  Q: I have created an applet which is run by number of .class files which i have zipped and inclusing ...
  A: There are a couple of options you can use. 1st you can use the appletviewer to run the applet ...
Query takes Logger time to Execute5/15/2005
  Q: i am doing the development in the J2ee arch.(ejb and struts frame work). will it work by doing like ...
  A: Since I only have experence with J2SE, I don't think I can help you all that much. But I think ...
java code helppppppppp5/13/2005
  Q: How are u Plz help me I want to ask about java code on how to get the value from multiple choice ...
  A: Im not entirly sure what you are stuck on. If you are using radio buttons then you must be using ...
Constructor and destructor5/13/2005
  Q: Does Java has destructor? If yes, how do I code them in my program? Thanks in advance. Good day... ...
  A: Yes, the finalize() method is called before the object is to gced. Note that the invocation of ...
Query takes Logger time to Execute5/10/2005
  Q: I have a query which takes a logger time to execute( In EJB gets timeout). Query is almost tunned . ...
  A: By background task, you probably mean Thread. E.g. if you have a JButton that you are excuting a ...
random disguise5/7/2005
  Q: im currently making a game of hangman and i would like to be able to print out a random word from my ...
  A: you could try using the random class: import java.util.Random; ... Random random = new Random(); ...
Serialization5/3/2005
  Q: I want to know what is Serialization.What is the meaning of the serialized state.What is the meaning ...
  A: Serialization is the process of transforming an object to binary data that can be stored on say a ...
wordlist hangman4/22/2005
  Q: im trying to make my word list for hangman using an array. I want to be able to add more words to ...
  A: First you should put your words into a file. If you format your file if return delmited you can use ...
Data files outside of jar files4/21/2005
  Q: I am making a spaceshooter game in java. This game has a highscores list that is saved in a txt ...
  A: First you cannot use getResource to get a writable file. You can only read from these resources. ...
compile .java code in Unix environment4/20/2005
  Q: I've taken over a Java project but don't know the basics of compiling .java code into .class ...
  A: javac will use the newer of .java or .class files when compiling. If the code depends on any ...
objects and equality4/18/2005
  Q: my question is simple and straightforward: how do you compare objects for equality? to make my ...
  A: Labels are Components, they are only equal to themselves. If you want to see if they have the same ...
java4/17/2005
  Q: I would like to ask about a Java homework assignment I can't solve. : Develop a Java application ...
  A: Well this depends on what you are having trouble on. 1st if its reading in the data, you can use a ...
Reading and Writing Serializable objects4/14/2005
  Q: I have a file called "messageFile.dat". This is a binary file of objects, It was written using ...
  A: For the most part you read them back in the same way you wrote them: ObjectInputStream inputStream ...
Java question4/14/2005
  Q: i have a question about java,please hel with this; These are the tasks • To multiply two positive ...
  A: Aside from doing multiple subtractions, additions, shift operators (i.e. emulating what is already ...
Priority Queue4/13/2005
  Q: I want to create a queue. Elements are added to the queue in order of priority (High priority ...
  A: I am not entirly sure what you want. Elements are added into a data structure in any order. The ...
pdf & web data manip and extraction4/11/2005
  Q: I am a novice and would appreciate any path you light that may assist in future programming tasks I ...
  A: 1. I have tried various java APIs for pdf documents (the free ones). I have found that for any ...
Internet4/11/2005
  Q: Is it possible to dial modem or connect to internet from a java application? If possible please tell ...
  A: Java has many operations once connected to the internet (or intranet). There might be a library that ...
Java programming4/11/2005
  Q: I am working on building a Java program for a database.That holds names, address, city , etc I have ...
  A: "where a window will open and not to have to use the DOS prompt" Use javaw to startup an application ...
gui/swing4/9/2005
  Q: i am a self-taught computer science student i've been studying for about 3 months the java ...
  A: The Swing library is a gui library that is written entirly in java using an object oriented model. ...
toString(int i) method of converting an int to a string4/8/2005
  Q: First off thanks for answering my question before, had figured out the toString method...But this ...
  A: You should probably make a class to store an integer and a String. Then just have an array of that ...
Java Technology Architecture4/8/2005
  Q: I would like to know what are the Background methods happening in JVM when a Java Program works from ...
  A: This depends on what your program is doing. If you are using the gui then there will be an event ...
Overwriting/Deletion in a text file4/6/2005
  Q: Heyas, I'm making a project for a PDA using Java (a mix of Java versions not exceding 1.3). I ...
  A: I don't really have experence with J2ME (if thats what your using). But I know in J2SE you can use ...
Probably trivial for you but...4/6/2005
  Q: Sir, Below is a copy / paste from part of my program. A class contains the following methods to use ...
  A: Im not entirly sure what you are asking, but it does seem that you are not converting bytes to ...
Hash Tables4/1/2005
  Q: Hey again, I think that's the right answer, but it leaves me with a problem still. I want to ...
  A: You can store the value as a Vector (or ArrayList). Just pull out the Vector and add a value. As for ...
Hash Tables3/31/2005
  Q: Heyas, I need to store a bunch of objects i've made in some sort of data structure. My objects ...
  A: You don't need a two dimensional hashtable. You can put Points into a hashtable, and that will work ...
JTable handling3/31/2005
  Q: I have a jTable with columns "date_from", "date_to", "description". I would like to protect the ...
  A: Here is a sample I made that, if the user selects a cell in which the value in the first collumn of ...
drag and drop animation3/25/2005
  Q: I still can't get it to work, here's the code import java.awt.*; import java.awt.event.*; import ...
  A: There are various problems with this code, like a missing } for the end of your mouseDragged method. ...
Java I/O and Char variables followup3/23/2005
  Q: and sorry about not being clear. I actually meant char variables as in the primitive type, e.g. ...
  A: You can use the read function of the reader. The return value is int though so you will need to cast ...
Java I/O and Char variables3/23/2005
  Q: I hope this question isn't too simplistic, but I was wondering how you write to a char type using ...
  A: Im not entirly sure what you mean by "write to a char type". If you mean using different character ...
RTFEditorKit with JEditorPane3/22/2005
  Q: The RTF that is doigg this is as follows: CARLISLE DOES NOT WARRANT PRODUCTS UTILIZED IN THIS ...
  A: I guess Im not sure how you are setting your your editor pane. I tried this code: import ...
Character By Character Input In Java 23/20/2005
  Q: First Of All Thankyou For Answerring my previous query about java character by character input. You ...
  A: I'll assume you know how to do this in c++. first make a private native static function in your ...
drag and drop animation3/19/2005
  Q: It is much appreciated! I just have a few simple questions in regards to what you sent; 1 - In your ...
  A: 1. This code is overriding the method processMouseEvent, just add it to your panel's code. 2. What ...
Character By Character Input In Java3/17/2005
  Q: I want to take input form user character by character (that is user enter a single character and it ...
  A: Doing this would require JNI. The command prompt is really meant as a simple way of communicating ...
drag and drop animation3/16/2005
  Q: I was just wondering if you could help me out, I am a bit stuck. I am trying to create an interface ...
  A: What you want to do is to store and playback the mouseEvents In your DragBallPanel override the ...
JAVA2 RUNTIME3/10/2005
  Q: I have 3 versions of Java2Runtime in my list of program files.Until recently, I did'nt know they ...
  A: There is not too many reasons to have multiple java2s. A few might be: 1. If there is a bug that ...
parrallel array's3/10/2005
  Q: If the colours are sorted it will be from the top red, green then blue. The search method should ...
  A: well in that case you can use the int value of the rgb to compare colors with. E.g. import ...
parrallel array's3/7/2005
  Q: well, the search method is so the user can input a search colour. i will call the search from the ...
  A: If you sort the colors red blue green purple, which one is first, last? How is the user going to ...
error with Java applet3/4/2005
  Q: WidgetApplet.java:13: WidgetApplet is not abstract and does not override abstract method ...
  A: The first error is due to not correctly declaring a method that is called itemStateChanged that ...
parrallel array's3/4/2005
  Q: I am currently trying to write a program that allows me to set up three parrallel array structure in ...
  A: normally you would not use parallel arrays for this. There are some considerations you have to ...
Input from Scanner.3/2/2005
  Q: I hope you are doing fine. Actually, i working on a project. I have one difficulty in that. I want ...
  A: Since there is no universial scanner interface, using any library that allows access to a scanner ...
Control scrolling in text area of Swings3/1/2005
  Q: How to control scrollbar of a text area using a button?i.e.,I want like when the user clicks on that ...
  A: First off text areas don't have scroll buttons. Instead they are placed in scroll panes. Then you ...
member variable scope2/28/2005
  Q: (see end of message below) : Hi, I'm learning Java and have following SIMPLE code snippet. ...
  A: You would need an instance of class X. There can be more than one. So when you create the button ...
java2/27/2005
  Q: I am writing a Java program in which the user enter the quantity of each fruit to be purchased. It ...
  A: int change = ... int dollars = change / 100; change %= 100; int quarters = change / 25; change %= ...
Swing-Frames2/25/2005
  Q: 1) How to make frames of different shapes, i.e; round,ellipse etc. shaped frames in swing? 2) ...
  A: 1. Since this is not supported on all platforms you are limited to square frames/windows. If you ...
how to create a random question?2/25/2005
  Q: i have a problem creating a random question for each user who logins, i mean i'm creating a desktop ...
  A: To generate a random number you can either: 1. use Math.random() to get a double and use that e.g. ...
Java applets2/24/2005
  Q: I recently installed a program called Video Ads Blocker, then I uninstalled it on the same day. Now, ...
  A: This depends on a couple of things. 1st what vendor are you using java from. If you are using/want ...
hashCode method2/23/2005
  Q: 1) In which cases hashCode method is used? 2) How to get a string back from the hashcode obtained ...
  A: 1. Hashcode is used in various places, more spefically in classes that rely on hashing objects such ...
package2/23/2005
  Q: whenever I am trying to make some packages outside the bin directory.I am able to makes them, as I ...
  A: You are not making any sence: packages in java are part of a class name they allow declaring a ...
"Final Year Project Ideas"2/23/2005
  Q: i m doing Bachelor of s/w Engg. and i m in final year.I need some final year project ideas using ...
  A: First java has three main areas of development: J2ME for cellphone applications J2EE for server ...
compiler2/23/2005
  Q: one is likely to find different compilers made by software houses. One factor of comparison, for ...
  A: Your question is not clear? You are not making any sence. In any case there really are not that many ...
Software development in java2/15/2005
  Q: I have one more niggling doubt.You said that java code can be easily reverse engineered,so is it not ...
  A: Users will still have to put in a good effort to reverse engineered java programs (espically if ...
hi2/15/2005
  Q: I am not really sure is this the right topic but here goes... I would like to know what is the main ...
  A: 3rd gen languages interact directly with the machine, you can tell the computer exactly what to do. ...
Software development in java2/15/2005
  Q: I am a newcomer to Java though I know programming in C.I am interested in learning to develop my own ...
  A: There is no one language that works for everything, otherwise there would be only one language. ...
java2/7/2005
  Q: can u explain security problem in applets
  A: you are being a bit vague... but: In order to ensure that an applet does not take over the system ...
Use of JNDI for getting database conn2/4/2005
  Q: Harper.. I added this exception clause in the main clause /* public static void main (String args ...
  A: I prodived you not with a way of getting your code to compile. If you want a less debug way of doing ...
Find the greatest sum with moving cursor2/2/2005
  Q: This is an interesting programming question that I would like your help to solve. Though the ...
  A: Lets say you have a MxN grid. Then initilize N states which include the current progress and N new ...
split method not apparent in earlier version of JDK?2/1/2005
  Q: Ive stumbled upon a little bit of a problem here, im programming a financial package as part of my ...
  A: Yea its pretty easy using StringTokenizer: StringTokenizer tokenizer = new ...
core java1/31/2005
  Q: 1)Can U Just Explain the OOPs concept with general example and how to implement tese concept in ...
  A: 2. The act of either throwing a checked exception or calling a method which declares a checked ...
troubleshooting1/30/2005
  Q: I'm trying to open Geocities Page Builder. Go to www.geocities.com and page builder link is there. ...
  A: Well Im not sure exactly where the problem is happening. It could be a popup blocker is preventing ...
Java and cellphones1/30/2005
  Q: I have a WAP cellphone and it lets me download and play java games. Is it possible for me to write ...
  A: Sure its possible to do that. Writing games or any complex program takes quite a while to do. For ...
Question1/26/2005
  Q: Sir, I have a topic, Please give me some potential comments on this topic so anyone can read, easily ...
  A: My experences with extreme programming is that it can be used to quickly implement a feature since ...
socket programming : chat program1/20/2005
  Q: How to create the chat program where one server can chat with multiple client at the same time. For ...
  A: This can be a big undertaking. A few pointers: Classes you want to look at: java.net.ServerSocket ...
Image to Buffered Image1/19/2005
  Q: I hope you are doing fine. I have a question regarding saving an image. i want to introduce the ...
  A: 1. Simply draw the image to the buffer. 2. ImageIO class is the only class in the standard api which ...
garbage collector1/18/2005
  Q: i read in boooks that we can demand garbagecollector by using Runtime.gc() is it true? can we ...
  A: When control has returned from gc as much garbage has been collected as possible. Although you are ...
I want to know: 1. How is...1/17/2005
  Q: I want to know: 1. How is the tab control implemented in Java? 2. Is there any provision for ...
  A: 1. JTabbedPane is a gui class that simulates (does not use!) a "tab control," it does not actually ...
java programming1/17/2005
  Q: java programme for moving an image alongwith the mouse movement
  A: Lettts see here. I could pull up a piece of code I have, but it is a bit complex. So I'll just make ...
Why does the following code print nothing?1/16/2005
  Q: Why does the following code print nothing? --------------------------------- public class Test{ ...
  A: well it should print out "true", but not "Equal". This is because Strings can only be equal to ...
java / animation1/15/2005
  Q: my name is Naoufal Kassari and i studie java programation, i want to create many animation with ...
  A: Animation is fairly easy. Simply parametrize your drawing rotinue, and have a Timer that changes it. ...
How to calculate and show the remaining time left in a JProgressBar1/11/2005
  Q: i have created a JProgressBar, that shows me the progress of my task in terms of ...
  A: Well there are various formules you can use. A simple one is: time diff*bytes copied/bytes remaining ...
Classes12/17/2004
  Q: ! the "wrap" is declared as follows at the bottom of JTextArea.java public class JTextArea extends ...
  A: You will notice that the only place that wrap is "used" is in: public boolean ...
about security12/13/2004
  Q: i know some generators can decode the .class file to source code... is there anyway i can prevent? ...
  A: There are obfusicators that can make it more difficult to decompile class files. Making .class files ...
improving java12/10/2004
  Q: java doesn't accept writing a function inside another function(nested subprograms).I want to add ...
  A: Although java does not permit functions in functions, you can put classes in functions and functions ...
Picture show program12/3/2004
  Q: I have a HW . it is about displaying a picture in a frame and there are 4 buttons to do the ...
  A: I don't do entire problems (genarlly) espically not homework, since its your class and your ...
.net service to java service12/3/2004
  Q: We have .net command line service that we use internally. This service can do the following ...
  A: There are sevelal ways of doing this. using Runtime.exec(...) you can run any appication, get its ...
Classes12/3/2004
  Q: ! i have overridden the getScrollableTracksViewportWidth() method and made it to return true, which ...
  A: I just haven't had enough time to determine what the appropiate solution is. Fundimentally what you ...
Classes12/1/2004
  Q: ! i tried but i don't get the expected results. I tried getting the method from JTextArea, but it ...
  A: If you override the method and return true, Then word wrap is off. However when you return false, ...
core java11/29/2004
  Q: Is it possile to write a java program without main,createobjcts ,call the methods?
  A: Yes it is possible to have a fully functional java program without a main, however it is a hack to ...
Java Calculator11/23/2004
  Q: Im currently designing a calculator using java. I have designed the GUI and it seems to be ok, ...
  A: You can use replaceSelection to either insert text where the users cursor is or replace text if it ...
convert from int to byte11/22/2004
  Q: i am trying to convert an array from integer to byte but i don't know how would you plz help me, ...
  A: First, createImage accepts either png, gif, or jpeg format, not raw. For using raw rgb data use ...
Classes11/21/2004
  Q: ! actually, i found out a way to find out the button click of a tab. I used the mouse motion ...
  A: This is (again) the responsibility of the UI. You could probably override the calculateTabHeight to ...
Jvm & threads11/21/2004
  Q: sir, 1>how many minimum threads willl run when u launch ur class with main method only. how many ...
  A: This depends on JVM version, platform and java options. On my system (win xp) running jVM 1.5, I ...
Classes11/17/2004
  Q: ! what you said i understood. Actually for my text editor, i'm using a vector to hold filenames for ...
  A: You can add a ContainerListener to recieve events when a component is added or removed, this however ...
Classes11/17/2004
  Q: ! just now after the previous reply, i understood everything. But now, im facing a new problem. How ...
  A: Well in my example I record the index of the tab in the CloseButtonAction class. You can ask the ...
Java Question11/17/2004
  Q: What would the code be to create a class that returns the smallest set of unit-length closed ...
  A: Let me see if I understand this correctly: If your input is: 1, 1.3, 3.2,3.3, 3.5, 4.5. So you would ...
hi, A simple question,...11/16/2004
  Q: A simple question, but i m tired of searching. I am talking about the signed jar, what's LEGAL ...
  A: Signing a jar mearly means that you are asserting that this jar came from you and it is unmodified. ...
Classes11/15/2004
  Q: ! i tried the following code, but the button is added to the main tab area and not to the tab title. ...
  A: As I said, whatever you add must implement UIResource. This means you need to extend JButton and ...
Classes11/13/2004
  Q: ! but in what way does implementing UIResource for the class CloseButton prevents it from creating ...
  A: 1. The method implementation of addComponent in JTabbedPane goes like this: public void ...
Classes11/12/2004
  Q: ! the reply you gave is working perfectly. But i need some more clariffication. I understood all the ...
  A: Insets are the buffer around a component. If you increase the buffer it allows for more white space ...
java11/11/2004
  Q: "i have developed a console based chat program. there is n client's and one server. server has to ...
  A: you cannot use goto since java does not support it. You cannot really allow someone type a message ...
java11/11/2004
  Q: "i have developed a console based chat program. there is n client's and one server. server has to ...
  A: Its hard to say whats wrong. A few guesses though: 1. make sure you spell quit correctly (it looks ...
Classes11/10/2004
  Q: ! I have currently extended JTabbedPane class to my own class (NewTabbedPane) which contains methods ...
  A: Doing this is not easy, but I spent the time and wrote up a simple example of how to have close ...
Classes11/9/2004
  Q: Or have u noticed netscape browser? They have a small 'X' button at the end of the tab bar. Is it ...
  A: The netbeans source is there. When you choose to download, just scroll down to "Other distributions, ...
objects(in java)11/8/2004
  Q: Can an object have more than one type?
  A: Depending on your defination of type... An object can be referenced as its class or one of the ...
Classes11/7/2004
  Q: ! i couldn't fully understand what you mean. Could you plz explain in detail?Hi!! actually what im ...
  A: Every swing component has a ui class that is responsible for rendering it, and deciding how the user ...
Hi Mr. Harper, I want to...11/7/2004
  Q: Harper, I want to create a program in Java (an applet) that, adds, subtracts, multiplies and ...
  A: To determine if a fraction is in lowest form, just determine if the gcd if the numerator and ...
object factories11/4/2004
  Q: I have been trying to understand the idea behind object factories in Java, but I only have access to ...
  A: A factory is basicly a dispatcher to retrive an object that follows the citeria that is given. The ...
Classes11/4/2004
  Q: ! i still get the StringIndexOutOfBoundsException. I already told you that im making an editor for ...
  A: You are either going to have to use a library that already does that. Or you have to override the ...
changing content inside a tag in a HTML file using Java11/2/2004
  Q: Your answer wouldnt help me, because I dont have any attribute inside the tag. Its just the text ...
  A: well just use addAttribute, except use the special IMPLIED attribute. E.g. ...
Converting to Gray-Image and display it11/1/2004
  Q: I am trying to Convert an TYPE_INT_RGB into a gray scale image, by the ...
  A: Here is a sample that works, although it does not use the ColorConvertOp. My intial guess is that ...
Non-static variable and static context10/30/2004
  Q: I need to print the database's data on a TextArea of a standalone application . I used ...
  A: The easiest solution (but not the best) is mearly to declare the area as static. I would first try ...
Classes10/29/2004
  Q: ! im trying your previous reply. Is there a way to find the Charset of a file through java?Hi!! the ...
  A: There is no way to "find" a charset, instead you can guess the format given some of the characters. ...
Linked Binary Tree10/28/2004
  Q: I am trying to figure out a different method to find the height of a linked binary tree other than ...
  A: Fundementally you can express anything without using recursion. Just use a stack to simulate ...
Classes10/28/2004
  Q: ! the solution you gave works out. But there is one problem. When i open the "jdkhome.reg" using ...
  A: The reg file is in unicode. You would use something like: import java.nio.charset.*; BufferedReader ...
Classes10/27/2004
  Q: ! thanks for being very cool with me. You r absolutely right. Im looking for the path of javac. ...
  A: This is a horrible hack, but it *should* work on a windows platform. Use Runtime.exec("regedit /e ...
Classes10/26/2004
  Q: I tried getting the properties dump. But no property is having its value as "C:\J2SDK142" or ...
  A: Let me make this clear: Without using JNI (on windows only!) there is no way to determine the ...
core java10/26/2004
  Q: sir my question is 1> whats the difference betwen Reflexion& Introspection. 2>how many maximum ...
  A: Introspection is a spefic kind of Reflection, in that it only tries to determine information at ...
Classes10/25/2004
  Q: Actually java is installed at "C:\J2SDK142" and its JRE at "C:\Program ...
  A: Since there can be many or none jdk installations, there is no clean way to determine the path to ...
Classes10/23/2004
  Q: ! that was a wonderful answer. It worked perfectly. Actually, im trying to do a small ide for java ...
  A: The java.home varible should be (unless you change it using setProperty) the directory of the ...
About Enumeratoion10/22/2004
  Q: how are you I want to know about Enumeration what is that and about hasecode and hashmap ...
  A: An emumeration simply is a list that you can enumerate though, that is get one value at a time from ...
Error Message from a Serialization Project10/22/2004
  Q: Artemus, Thank you for your timely response. Actually, I tried different ways either change the ...
  A: oh right you also need to switch the arguments you are using... Your constructor has String,float ...
Classes10/21/2004
  Q: ! java is installed in my system and it is working perfectly. But i want to find the installation ...
  A: Let me get this straight: you want to determine the location of the java install directory from a ...
Set Font in JEditorPane10/21/2004
  Q: I am able to set font in JTextField but somehow am not able to set font in JEditorPane. I have ...
  A: Since you are writing a chat program, you probably want to allow different fonts in your program. ...
Classes10/19/2004
  Q: ! i have the following problems: 1. There is a main class called "note". This class "note" is used ...
  A: 1. Its not clear what you want to do. If you wish to access stuff outside a package it must be ...
Send image over network10/19/2004
  Q: I would like to load an image in 1 of a chat clients and the rest of the other clients that is ...
  A: One possible problem is that the read method of filestream doesn't necessarly read the entire file, ...
java10/16/2004
  Q: what is the difference between interface and abstruct class, expalin in detail
  A: An interface is just like an abstract class except: 1. interfaces cannot contain non-static fields ...
building a mail server10/13/2004
  Q: i am planning to build a small mail server that will collate all the different mails people have ...
  A: First, before you start you should consider any legal implications this may involve. Creating/using ...
mediatracker10/12/2004
  Q: sir can u plz tell me what is basically use of mediatracker class in our prgms.i m not getting for ...
  A: In order to streamline the effectiveness of loading images, most operations which create an image ...
ImageIcon and getPath()10/12/2004
  Q: i'm am doing a prgram that display's a digital image in it by a JLabel and you can choosing it by a ...
  A: you should not have to worry about slashes at all. Chances are the image is not valid or is ...
How to determine if an application has bound a socket10/7/2004
  Q: I need to know if Sun Java System Message Queue is running (in order to start an application that ...
  A: I really have not used JSM, but if it is a system wide app, there is probably a way to determine if ...
reverse the file contents10/6/2004
  Q: I want to reverse the contents of a text file and store it in another file.Means the content of ...
  A: Well first, what do you mean by reverse? It can mean: 1. reverse every character so that the first ...
java applets (circle)10/5/2004
  Q: I have the following coding using java applets, my aim is to create a circle, which when clicked on, ...
  A: well in the init method (make one if you don't have one), you create a mouse listener for the app. ...
java swing/gui dialog box10/1/2004
  Q: Do you know of any way to close a dialog box automatically or have it refresh automatically to keep ...
  A: Im not entirly sure what you want. Dialog boxes can be closed at anytime by using setVisible(false) ...
Hi, Mr.Harper, Thanks for...10/1/2004
  Q: Mr.Harper, Thanks for your great help! I tried the first solution by using following command: javaw ...
  A: 1. Its not common to require a lot of memory to run the VM. I think the default size is 90M 2. If ...
Internatinalization9/30/2004
  Q: I am doing the multilingual system (in Thai). Technologies used are JAVA and Oracle9i. The question ...
  A: Its hard to say. How are you getting the information from the user? It might be the interface the ...
java ann dist ributed client/server9/25/2004
  Q: Please I need to know the difference between java and a distributed client/server
  A: A distributed client/server acts together to give content to the user. The client is the gateway for ...
Doubts -reg[Applet and Swing]9/23/2004
  Q: sir i am a final year Computer Engineering Student in South India.i started learning java for past ...
  A: 1) if you are going to have it on the web use an Applet, otherwise use swing. 2) consider use a ...
array problem9/23/2004
  Q: i create an array to allow user to enter their 5 favourite numbers.then from the 5 numbers, this ...
  A: You need to pass in the array of ints to the compare function i.e. public static int compare(int[] ...
about exception while running the program9/22/2004
  Q: when i compile the program ,it gets compiled.but after running the program it gives me ...
  A: if you want to run an applet that does not have a main function, you must create an html file for it ...
Swing Layout9/20/2004
  Q: My JFrame has a BorderLayout. I am placing a JTabbedPane at the North. I want that when the user ...
  A: well the JTabbedPane is a combination of the tabs and the container that holds each item that the ...
JAR encryption9/20/2004
  Q: I got an applet. How can I prevent anyone from downloading it & decompiling the class file? Can I ...
  A: Although you cannot prevent anyone from decompiling or downloading it (the jar has to be downloaded ...
File Choosers9/18/2004
  Q: i'm making an image-only FileChooser and made the main JFrame that has a Button to display the file ...
  A: Its hard to determine what is happening... 1st are you puting out debug statements to determine if ...
When I try to run a game at...9/18/2004
  Q: When I try to run a game at Pogo.com it won't start. I think it has something to do with javascript
  A: I would check the help section of pogo and see if you meet the system and sofware requirments. Since ...
Interfacing with other apps9/14/2004
  Q: I want to interface another application thru a java program. Something like - type a character in a ...
  A: I suggest you get clever, a commandline program which allows you to control winamp, and run that ...
Flash background colour9/7/2004
  Q: I am trying to get the background on a Java Panel to flash from one colour, to another, and back ...
  A: My guess is that your doing these operations on the Event Thread, usually happens when you respond ...
query9/5/2004
  Q: I am going to begin on a project called 'Back up Servers'. The only thinh i know about the project ...
  A: Once you know more about the project you should look for libraries which fit the needs of the ...
filestream8/27/2004
  Q: could I get the basic syntax for opening a random access file, appending a one-byte value to it, ...
  A: import java.io.*; public class AppendByte { public static void Main(String[] args) throws ...
Files' MetaData extraction8/27/2004
  Q: I am wring a java class to be embeded within a webpage to display a table of files within a folder. ...
  A: Nope, even if I was just using c++ I wouldn't have a clue on how to expose this information. I know ...
Developing Rule Engine in Java8/21/2004
  Q: Sir, Me & my friends have decided to develope a small rule engine at our level. We r currently ...
  A: The only rule based lanuage I've had any experence with is OWL (and DAML). For that I used the jena ...
Client/Server - Distributed Applications8/19/2004
  Q: I am going to implement a project in a month but don't have the required knowledge for that, that ...
  A: there are two direct apporaches to this: 1. use Sockets, with these you can send bytes over a stream ...
Interfaces8/19/2004
  Q: Interfaces have method declarations. My interface has five methods. I want to implement my interface ...
  A: Here is an example: public interface Interface1 { void method1(); String method2(); int ...
Swing drag and drop8/16/2004
  Q: Environment : JDK : 1.4.2 Requirement: Would like drag/drop between apps as copy by default without ...
  A: Example: import javax.swing.*; import javax.swing.event.*; import java.awt.datatransfer.*; import ...
problem with painting the jcombobox value8/11/2004
  Q: for your info, i've already added the repaint() but it didnt help except making things worst. if i ...
  A: OK I took a closer look at your code (was a bit busy) First: Don't use getGraphics, unless your ...
problem with painting the jcombobox value8/7/2004
  Q: i'm using a 'for loop' to paint the chosen values of the jcombobox upon pressing a jbutton. the idea ...
  A: The only thing I can think of is to call the super paint method first before you start painting. ...
How to use Runtime.exec to invoke cmd.exe in windows?8/5/2004
  Q: its quite right but its not complete, sorry if i'm saying that, how my Runtime.exec or javac and ...
  A: First I will assume that you have a default directory set up to use. This also assumes that you want ...
Convertion of C++ program in to Java8/4/2004
  Q: Sir, In our Java WebBased project some functionality is written in C++ program as a supporting ...
  A: There isn't tool I'm aware of that does this. And even if there were it wouldn't be perfect, aside ...
How to use Runtime.exec to invoke cmd.exe in windows?8/4/2004
  Q: i have no idea of how to invoke or calling the cmd.exe in my application with javac and ...
  A: I think what your asking is how to get the output from javac.exe and java.exe. When you use ...
Interfacing java, Ms Access and Ms Excel8/3/2004
  Q: How do I interface java 2.1, ms access and ms excel.
  A: What do you mean by interface? Run java code as a macro in ms access and ms excel or read and modify ...
java table cell won't redraw automaticall7/31/2004
  Q: I wrote a java program for stock market trading. The stock quotes are fed through internet from my ...
  A: Since I do not have all the code: SampleFrame.java, my guess is that your not changing that data ...
Could you please let me know what event is associated with JMenuItem accelerator key in swing?7/30/2004
  Q: Could you please let me know what event is associated with JMenuItem accelerator key in swing? The ...
  A: Well either its: 1: a focus problem, if something is grabbing the keyevent before the menu can react ...
help please with handler(chain of responsibility)7/28/2004
  Q: temperature < 0 degress, temperature > 40 degress it will store in either a Bin, Shelf or aisle. i ...
  A: Well I see two problems with this code: 1. you are calling super.CheckCriteria, but this class only ...
Changing an Image7/26/2004
  Q: I'm sorry, I realized that after I had already sent it. Image Icon = ...
  A: You cannot change the image once you make it. If you are drawing this image or if it is part of an ...
Can you use a JList within a JTable column?7/26/2004
  Q: I have very limited knowledge of Java Swing and have been assigned the responsibility of updating an ...
  A: This depends on your current tableModel you are using for the table. If you are just using the ...
Java GUI7/23/2004
  Q: Sir,Is it possible to provide "Minimize" functionality to a JWindow?
  A: No, a JWindow does not show up in the Taskbar. You can hide a JWindow, but not minimize it. You can ...
Activating wav file7/20/2004
  Q: I'm developing a Java 3D application and need it to play some audio (say for example to play a ...
  A: Here is an example (wav format works): import javax.sound.sampled.*; import java.io.*; public class ...
Question7/19/2004
  Q: Sir I want to ask some detail about the topic. The topic is, "What in your opinion, is ...
  A: Native Assembly will always be necessary, as java bytecode and MSIL (Microsoft Intermediate ...
Java Swing Tool bar7/14/2004
  Q: I can move the toolbar in my application but cant get the current changes made. i want to keep the ...
  A: I have no good clean solution... but this example (although a bit buggy) shows how to get and set ...
Application using LDAP7/11/2004
  Q: I am working on LDAP (Lightweight Directory Access Protocol) and have to create an application in ...
  A: I do have some extra time to help in projects like this. I cannot however guarantee a set amout of ...
deprecated API7/11/2004
  Q: well thank you for the answer, i solve it already, the problem is in the setting of Data ...
  A: As the documentation states the reason that getText() in JPasswordField is depracated is that it ...
error in JDBC driver7/9/2004
  Q: i have this problem, i'm using the JdbcOdbc driver for MS Access, and it's work but it's produce ...
  A: I've never use JdbcOdbc before so its hard to determine the problem. It is possible but unlikely ...
about swing and awt7/8/2004
  Q: what is the basic difference between awt and swing. is awt is peer base? if so how's that work ? ...
  A: AWT is peer based. In the AWT framework the operating system provides the controls. And all of the ...
Saving a linked list7/4/2004
  Q: i have two linked lists, called patient and doctor. I want to save the data in the linked list to a ...
  A: If you want a simple way of storing objects you can use the ObjectOutputStream and OBjectInputStream ...
What is the difference between ActionListener and MouseListener?7/1/2004
  Q: What is the difference between ActionListener and MouseListener? I want to know wether ...
  A: The actionListener is called when an action is performed. I.e. a button is clicked or the components ...
closing a frame with a JButton6/29/2004
  Q: i am writing a program that simulates a hospital. in that the user is presented with a screen that ...
  A: when the button is pressed simply call setVisible(false) then dispose() on the Frame. No need for ...
Unloading and Loading another window?6/24/2004
  Q: first, i'm just a begginer in Java so i'm not sure if my my question would be exact has i want to ...
  A: To show a splash screen use a JWindow, since a JWindow has no borders or title bars. You can add an ...
Java: How to access a java file6/4/2004
  Q: I am making a game which is similar to "Who Wants to be a Millionaire" and I am wondering how I ...
  A: If I understand your question correctly: You want to load a file that has the next question so you ...
Help with Java5/30/2004
  Q: I am trying the following, a client app will take an image and send it via tcp to a server. The ...
  A: Well its not very hard: import java.net.*; import java.awt.*; import javax.swing.*; ... final ...
JAVA5/29/2004
  Q: about java bean, why we write the static key word in main function , and why we write the key word ...
  A: main is static since its a more minimal starting point. If main was not static then the class that ...
Data Encryption5/26/2004
  Q: May i ask is there any data encryption technique in JAVA? and what is the method/technique do JAVA ...
  A: Yes there is enncryptions rotinues in the java sdk. Look at the documentation for java security ...
java input5/24/2004
  Q: How can i input (strings,values)from key boad using JAVA.& How can i creat simple interface for ...
  A: well for gui apps, you have to make a text field and say a button for the user to click when they ...
java5/21/2004
  Q: 1)when we are using vector? vector is thred safe it contain all methods are synchronized?when will ...
  A: 1) I would have to look at the source code. If it isn't then you can synchronize on the vector to ...
java coding5/17/2004
  Q: respected sir my final year project is image compression.in that i want to create archieve ...
  A: Your question is unclear. Do you want to use a local directory on the harddrive or not? What files ...
About Java5/15/2004
  Q: When I go to play games on yahoo or pogo or any other web site it tells me i don't have java ...
  A: just because you have windows XP doesn't mean you have java installed. goto ...
JAVA5/11/2004
  Q: hey i really appreciated your help, i've been voting for you and nominating as well! its helping me ...
  A: Something like this: int hit = 0; for(int i = 0; i < 3;i++) { char userChar = ...
JAVA5/9/2004
  Q: hey man, so far im progressing good with my program. i've been able to easily create 3 random ...
  A: Although your approach would work preferably you don't want to simply "retry until you get it". The ...
help5/7/2004
  Q: just need a basic code of drawing a map.hi, help me with a code for drawing a map of a country, i.e ...
  A: Well if you have the gif, jpeg, or png of the map you can create an Image using ToolKit.getImage(URL ...
image5/7/2004
  Q: In coding how can we identify image is grayscale or color? plz tell me
  A: Although there are spefic techniques depending on the format of the image, if you want a general ...
Programming Project - Need Assistance5/6/2004
  Q: I'm having some difficulty writing a program. The requirements are listed below. Basically the ...
  A: Well I don't really have the time to look though your code, but for say average you simply sum up ...
BLUEJ5/4/2004
  Q: I have Windows Me on my System.Where can I use these commands then? Please suggest. -pl.Hello Sir, ...
  A: If you cannot find the command prompt, then you can make a batch file with those commands. Just ...
BLUEJ5/3/2004
  Q: .. My problem is ....... I have recently installed Bluej from a CD , on my system.Installation was ...
  A: well I tried it and it works for me... try using this command in this command in the commandprompt: ...
Other aproach i took5/2/2004
  Q: this is how i tried making the images work ... but my applet does not initialize :( maybe you can ...
  A: Double check where the images are trying to be loaded from. You should never assume the location of ...
JAVA APPLET... making a game5/2/2004
  Q: i have this war card game to write and i was so stuck on it that i did it the simplest way i could ...
  A: The most common mistake in loading images is that they are dynamically loaded, so multiple images ...
Touchgraph link browser right click won't work in linux jre 1.4.25/1/2004
  Q: Wanted to mention that the touchgraph link browser(java client) client starts correctly in Redhat 9, ...
  A: Im probably a bit out of my league on this one, but my best guess is that right-clicking is not ...
java objects4/25/2004
  Q: How can we know number of objects in java?Give me example code?
  A: First consider if profiling is what you need, if you need this look at the documentation for the ...
interaction of Java with C4/24/2004
  Q: I have a program in c which takes in command line arguments and process them. Now, I need to make a ...
  A: You aren't 100% clear on what you want. You can execute the java virtual machine and pass it the ...
Hi Artemus, How can I remove...4/23/2004
  Q: How can I remove (not disable) the closing button on the right top corner of a JFrame? If can't ...
  A: The closest answer I have is to use setUndecorated(true) on the frame. Unfortunally this also ...
java4/21/2004
  Q: How we can swing an applet?
  A: well the same way you would upgrade an application into Swing. Go though and change the various ...
java4/21/2004
  Q: What is the purpose of applet programming?
  A: Applet programming allow the creation of applets which can be automaticly downloaded and run in the ...
File filters4/18/2004
  Q: ! im using jdk1.4.1. I want to know how to extend the "javax.swing.filechooser.FileFilter" class so ...
  A: Well its fairly simple: there are two methods that are needed to be implemented: accept(File f) ...
java banner4/16/2004
  Q: I am attempting to place a rotating banner system on my web site. I use coffee cup fro HTML and ...
  A: well it looks a bit confusing, but try continuing the pattern by adding more of the same statements. ...
java4/15/2004
  Q: What is a byte code? What is the difference between .exe file and byte code?
  A: well an exe is a program that can run on a Windows machine. byte code is the compiled code, but it ...
get a Class path4/15/2004
  Q: Sorry, this is not exactly my question. What I really need is that I have a java class, let's say ...
  A: oh thats easy: In your example: java.net.URL url = Test.class.getResource("Test.class"); would get ...
get a Class path4/13/2004
  Q: How can I get a Java Class file path for a non-Servlet class? Thanks a lot! Zhenwu
  A: Well first I ask why do you need the class path, since you very rarely need it directly. to get the ...
java4/7/2004
  Q: Why AWT components are called as heavy weight components and SWING components are called as light ...
  A: Heavy weight since they are pinned down to the window, for example if you try and draw over the ...
java4/6/2004
  Q: How does thread synchronization occur in a monitor?
  A: well simply put when you synchronize on an object or declare a (non-static) method to be ...
background image of Applet4/4/2004
  Q: How to make background image (with .gif or .jpeg) of an Applet? Best of all, refer me some sample ...
  A: if your not using swing then add (possibly create) a call to paint a paticular image e.g. import ...
java4/4/2004
  Q: Which is the base class for all swing components?
  A: You really should find this out yourself. But JComponent is the base class for all swing components ...
java4/2/2004
  Q: what is a JAR file?
  A: a JAR file is just like a zip file except that it uses '/' as the directory sperator instead of '\'. ...
java4/2/2004
  Q: what is the function of garbage collector?
  A: The garbage collector is responsible for unallocating unused memory. In that every time you create a ...
java4/1/2004
  Q: I am working on project IMAGE COMPRESSION.I want to make new archive means new file &then add the ...
  A: If your going to be doing your own compression algrothim then simply create a subclass of ...
Java3/31/2004
  Q: I am a new programmer in Java. Could U please Help me on how to do Core Programming. As such How Do ...
  A: lets see here first make sure you have the following: 1. Java SDK J2SE (from java.sun.com) 2. An ide ...
Java VM graphics3/30/2004
  Q: What is the simplest bytecode program for Java Virtual Machine to draw on a screen using I J K M ...
  A: well even in java byte code calls to kernal methods take up space. But java code is compiled, and I ...
Java VM graphics3/29/2004
  Q: What is the simplest bytecode program for Java Virtual Machine to draw on a screen using I J K M ...
  A: ouch thats a bit rough with only 128 bytes. I mean to do any gui work requires you have to use java ...
Can't get japanese character using request.getParameter() in jsp3/28/2004
  Q: I am trying to pass japanese characters from my html page to jsp . but when I am getting characrs ...
  A: Its hard to say what the problem is but perhaps the display of the String is not correct... double ...
creating a program macro to fill in web forms?3/27/2004
  Q: I have a question. I would wondering if you know if it is possible to create a program that can ...
  A: The biggest problem in this is the controling web browser. Java can contact the web page and log in ...
ImageCompression in java3/24/2004
  Q: heelo!sir, I study in IT Engineering in Gujarat(INDIA).I am final year student.And I select my ...
  A: Your question is a bit hard to understand, but if all your asking is how to mimic the behaviour of ...
------------------------- ...3/22/2004
  Q: But Sir I am using version 1.3 of JDK. I guess there is no such method setDragEnabled in JTable for ...
  A: Well the awt version of drag and drop is not simple. I would suggest looking at a tutorial if you ...
java:GUI,Networking3/20/2004
  Q: We try to write a client program that should display the stock values of some companies. How could ...
  A: well if your remotly connecting to a web site and parsing out the html on that page. Then you can ...
Using JPanel3/15/2004
  Q: I am having a problem with a class that i created, a class that extends JPanel and i want to add it ...
  A: well when you add it it is visible by default. And the default layoutmanager for JPanel should ...
java nio3/13/2004
  Q: please help me as i am stuck, i am working on a server to convert it from using java io to nio in ...
  A: well the only solution I can think of is to make an InputStream that reads from a ByteBuffer (or a ...
Mouse Entered event in Swing3/11/2004
  Q: I am creating a calculator in Java using Swing and I would like a message to appear when they pass ...
  A: just add a mouse motion listener to the button: e.g. import java.awt.event.*; ... ...
convert Word document to pdf, rtf,or html3/11/2004
  Q: I want to remove the metadata-"last saved by", from a Word document,through an application. It seems ...
  A: Since word documents are a closed format, its somewhat difficult to help. The only suggestion is to ...
how to substract time values in java3/9/2004
  Q: i am new to programming and I would like to ask your help with simple java. How can I substract two ...
  A: well your going to have to first parse out the string: String time; //get the value of time ... int ...
JTable3/9/2004
  Q: I am writing a swing application that has a JTable. The JTable is supposed to be loaded with data ...
  A: well thats tough... Here is an example of a split table, one that has two split views: import ...
JTable and XML file3/6/2004
  Q: I would like to know how to translate a JTable data into a XML document(*.xml)? I would like to know ...
  A: Since java 1.4 doesn't really have much support for xml, your probably going to have to use a ...
separate the string3/2/2004
  Q: my question is i want to separate the string .ex:- if i entered in command line Prashant.Naik the ...
  A: Just use the regular expression: This will replace all characters except for a..z,A..Z, and 0..9 ...
Exceptions2/28/2004
  Q: Throwable class has constructors. When we can use that constructor? can we create an object as ...
  A: public String unimplementedMethod() throws Throwable { Throwable t = new Throwable(); throw t; ...
method overriding in java2/28/2004
  Q: I want to ask you a intresting question regarding method overriding. What is the difference ...
  A: If you have the same methods in two classes, but the sub class declares it private it is know as ...
dictionary2/27/2004
  Q: how can we make a dictionary program in java which sort just 10 words? example if i give ...
  A: You can use the Arrays class e.g. import java.util.*; ... Vector people = new Vector(); ...
Java2/26/2004
  Q: when i try to compile the java file, this message appear "java uses or overrrides a deprecated API, ...
  A: You are using some method in the java library that is not recommend you use since it is out of date. ...
Swing +DB + JNI2/26/2004
  Q: i'm new in Java2 and particularly i'm interesting on JFC Swing. Could you indicate me a good web ...
  A: Well I got all my tutorials direct from the java developers site (http://java.sun.com) ...
comparison2/25/2004
  Q: What should programming language I will use, Visual Basic or Java? Please tell me the advances of ...
  A: VB is an easier to learn lanuage, but is more limited. You can do many simple things in VB, while ...
about swings2/25/2004
  Q: please give me the importance of swings over applets. thanking u sir
  A: swing is a java renderer components. Advantages: 1. Crossplatform look so your applet look the same ...
JList rendering2/24/2004
  Q: FollowupThank you so much for taking your time to answer my question, Mr. Harper! In the 1st part ...
  A: Well that partially depends on how you are making your ListCellRenderer. if you are making it as an ...
JList rendering2/24/2004
  Q: 1.I am using Java SDK 1.4.2 on a Linux platform. 2.I have developed an application where it is ...
  A: Your question is a bit confusing, but... If you have to you can just keep a reference to the first ...
reading input2/23/2004
  Q: what is the command line for reading in a file (Standard input) into an array that one can ...
  A: Well what you ask for is a bit vague. Do you want to manipulate the file, or just the array that has ...
user interface2/17/2004
  Q: Cheers for the help but i am having problems getting it to work. I tried to install it which runs ...
  A: Hrm it seem that the target environment doesn't contain a functional JVM. In netbeans you can ...
JAVA Project2/15/2004
  Q: I'm having some difficulty with the below project. We are supposed to have three classes (Book.java, ...
  A: Lets see here: first you will need some data structure to keep the patrons and the books, you can ...
Keypresses and Key events2/15/2004
  Q: Hey, I appreciate your help in this. I'm just about low intermediate or higher beginner in my skill ...
  A: what you want to do is have events for key pressed and key released, You can't change the key typed ...
gui2/14/2004
  Q: 1- i need a container that can display images , text , flashes , applets at the same time , this ...
  A: Well a basic container will do. For awt just subclass Container, for swing subclass JComponent, or ...
Java Applet2/13/2004
  Q: I am desperatlety stuck on how to implement a situation where you get a square to move around the ...
  A: This moves a square in a clockwise fashion, Im sure you can figure out how to change this to do ...
question on thread2/12/2004
  Q: i am not undertstanding some concepts of java-multithreading. i have someQ1. method stop() has ...
  A: 1. stop and yield are completly different. Yield simply temporarly stops to allow other threads to ...
whst is the code for implementing...2/11/2004
  Q: whst is the code for implementing a change in colour of a button. For example instead of the grey, ...
  A: well if you just want to change the button when it is unpressed, you can set the background color to ...
what is advantage of using...2/11/2004
  Q: what is advantage of using java swings
  A: Platform independinace, using swing you can ensure that all users will be looking at the same "look" ...
Java Applet2/9/2004
  Q: I am trying to implement a situation where a user clicks a button on the applet to change the shape ...
  A: Only rectangular object are supported in Java and html. You can resize an applet by using ...
Java1/5/2004
  Q: I am required to do a final project in my java class which includes creating a game with at least ...
  A: start by designing a class Card. The card should have two private fields, denomination (int) and ...
knowing cpu load information in java.12/29/2003
  Q: can i write an application that is similar to resource meter in windows in java language.why means, ...
  A: You cannot learn any of this information without using JNI. Java is not designed to monitor or ...
Online games site12/25/2003
  Q: Online games site --- I want to make an online games web site similar to Yahoo! Games and MSN Games. ...
  A: Wow your really asking for a lot. For most online gaming java applets are the way to go as they do ...
Cannot draw image12/18/2003
  Q: I have the following lines in my program: Image image = ...
  A: The toolkit creates the image, but it hasn't finished loading the image when you are drawing it. You ...
Java EditorPane class12/14/2003
  Q: My school project is to write web browser in java. ALL is working fine for now, except one thing: I ...
  A: Well not easily. The way that the api does it is by setting various attributes in the style sheet. ...
I am confused with file IO APIs in java.io.*, could you tell me a general principle when we shoudl use buffered or stream etc.?12/13/2003
  Q: I am confused with file IO APIs in java.io.*, could you tell me a general principle when we shoudl ...
  A: The stream you use depends on how you want to interpret or write the data. If you are using plain ...

All Questions in This Category

Email this page
     
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2006 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.