help with a program

1206 byte By rskurtza at 2007-9-30 1:33:28
given this pre-existing program that only contains various methods, the program needs a main class added to it that will roll an 8-sided die 10 times and print the results of each roll, but i have no idea how to do this... anyone got any ideas?public class Die{private final int MIN_FACES = ...

JTable + refresh

721 byte By scientificleea at 2007-9-30 1:33:30
Looked through the forums and read through the book excerpt but still can't find the answer.I have a panel. Inside are two panels. The bottom panel has a JTable inside a JScrollPane.My code works so far. I also have though is a JComboBox and a JButton. When I press the JButton I want the ...

New to arrays

974 byte By Avavaja at 2007-9-30 1:33:40
I am trying to find all the duplicates of intergers in a file. But i am not sure how to go about finding the duplictes.i think i need a nested loop. I am unsure how to find the duplicates and have the program output the array without the duplictaes. THanks... this is what i have so far. import ...

Arrays.binarySearch strange result

1359 byte By edecaa at 2007-9-30 1:33:47
I have the following:import java.util.*;class SearchTest { public static void main(String args[]) {char operators[] = { '*', '-', '+', '/' };System.out.println (Arrays.binarySearch(operators, '*'));System.out.println (Arrays.binarySearch(operators, '-'));System.out.println ...

write to a text file ?

2906 byte By Joho_loa at 2007-9-30 1:33:51
how can i get the file (shown below) to write to a text (.txt) file, which will show the two seat chosen, thanks this would help me loadsimport javax.swing.*;import javax.swing.JFrame;import java.awt.*;import java.awt.event.*;import java.io.*;public class seatchoser extends Frame implements ...

working with doubles

1486 byte By alice_ita at 2007-9-30 1:34:35
Hi,Ive got this problem, it must be something very easy and basic but Im a beginner and it's hours that Im on this error:...//sum it's the sum of the values into the window, w is the windowint sum = 0;int w = 0;int i = 0;//it's the average of the values in the windowdouble ...

DiveLog viewDive Method

1845 byte By sanderso34a at 2007-9-30 1:34:36
I'm new to java working through the DiveLog tutorial. The viewDive method in the DiveHandler class is throwing an error and I don't know why. Here's the code:public void viewDive(){try {DiveRecord Dr = new DiveRecord();if(input == null) {try{input = new ObjectInputStream(new ...

Following example in book....

1715 byte By Dennis_Ma at 2007-9-30 1:34:50
I am following an example in the book. I think i did everything I was supposed to but I get errors. Here is the code:import java.awt.*;import java.applet.*;public class PolyApp implements Runnable {MediaTracker tracker;Image joe;public void init() {String file = ...

Software Metrics

282 byte By 123avaja at 2007-9-30 1:34:52
hi allI have a GUI program which simply opens and views a java file. I would like to add a feature which would count the number of methods and variables, and calculate the number of if statements and while loops. Does anyone know how i can do this?Cheers

Ok, another one for you guys!

1130 byte By Dennis_Ma at 2007-9-30 1:34:56
import java.awt.*;import java.awt.event.*;import java.applet.*;public class Scribble extends Applet implementsMouseListener,MouseMotionListener {int oldX, oldY;public void init() {// Register the event handlersaddMouseListener(this);addMouseMotionListener(this);}public void ...

Exception Error=/

9436 byte By Aerina at 2007-9-30 1:34:58
Hello, java newb here. I have been working on one of my assignments for school. Where as we haven't gotten into GUI yet ... the many required output options of the assignment make it seem almost crazy not to have an interface to navigate with. I have probably bitten off a lot more than I can ...

inheritance help

7330 byte By newJavaGrla at 2007-9-30 1:35:02
hi. i'm having trouble finishing off code i know how to start but then i get a little bit lost. i just learned inheritance so if its a stupid thing i made a mistake on please forgive me. i put *** next to the places where i need help.. thank you any kind of help would be thoughtful.public ...

Edit multiple cells in JTable in one go

280 byte By khandkarsa at 2007-9-30 1:35:12
I need to be able to edit only one cell in a JTable and depending on a criteria some other cells of this JTable should automatically get updated. I know we have to do something with cell editors but am not sure how to do the same ? Can anyone help?Thanks in advance.

Displaying requested variable

1200 byte By andybeha at 2007-9-30 1:35:29
Hi All,I am trying to display a variable on my page as part of a debug process. I am actually modifying some code that was written for me by another developer and my past experience is in ASP not JSP.I have created a variable called cartID and am requesting it from the previous page as such:int ...

problem connecting to oracle 9.2 db

239 byte By dhrubo_tcsa at 2007-9-30 1:35:34
Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepointi am getting this run time exception ... i m using classes12.zip that comes with oracle client installation .... and my jdk version is j2sdk1.4.0_03

How do I call the native filechooser ?

105 byte By kiwioza at 2007-9-30 1:35:45
How do I call the native filechooser and not the swing jfilechooser.Please helpCraig

Detect Row Locking

163 byte By stormch@sera at 2007-9-30 1:36:07
Hi all, I need to write a function that able to check whether the particular record is current updating by some other people. How do i detect it ? Any API ?

System property that represents a user's My Documents folder

112 byte By correroa at 2007-9-30 1:36:21
Hi! What is the System property that points to a user's My Documents folder on Windows platform? Thanks!

File I/O under JDK1.4

809 byte By RageMatrix36a at 2007-9-30 1:37:17
I have been reading Ivor Hortons book and have reached the chapter dealing with File I/O under JDK1.4. He says that the old FileReader and FileWriter classes in java.io have been superseded by the new java.nio classes. Problem is, the new method of reading and writing files is MUCH more complex ...

SOAP + Google API code needed

229 byte By fattonymaximusa at 2007-9-30 1:37:18
Does anybody have sample code that will add a Google license key into the SOAP envelope and get it to connect to a google search it would be very handy and important for my projectThanking you in advanceTony

Add Calender items to a grid! Desperately need Help!

1170 byte By Young_Javamana at 2007-9-30 1:38:24
Can someone tell me how to display the variables hours, mins, and secs on my grid Layout! Cheers in advance!import java.io.*;import java.awt.*;import java.awt.event.*;import java.util.*;class Grid extends Frame{static PrintWriter screen = new PrintWriter(System.out,true);int hours, mins, secs, ...

capturing keystrokes from other programs

312 byte By JavaG33ka at 2007-9-30 1:38:34
Hi,I'm looking for away to to capture mouse and keyboard events from programs other than my java program. I want my program to log and analyse mouse and keyboard events from any program that is open in windows. I'm designing a user interface analyser. Can anyone ...

HELP PLEASE

1192 byte By Alan_Shearera at 2007-9-30 1:39:10
I want to sort an array;Person[ ] entry; so that it sorts the info (i.e. name number and initial into alphabetical order in terms of the surname)This is my Person class which holds the persons info for the array and i want to sort them in a Class called ArrayDirectory. Now i have no idea how to ...

Data Object design question

431 byte By sorchua at 2007-9-30 1:39:12
hi all, I am trying to make a graph application which requires me to read in a graph data file and draw the data onto a graph.I am just wondering what's the usual approach to this?is it........1) Create a data object with the load() and save() method built in?or2) Data object on it's own , ...

Can Firewall lead to IOException?

220 byte By solutionseekera at 2007-9-30 1:39:19
I am trying to connect to a TCPServer I created using TCPClient and trying to send and receive data...I am getting an IOException >> Connection refused: connectCan this be because of Firewall?

Designing front-end to legacy application

399 byte By javacmca at 2007-9-30 1:39:39
I'm designing a Java front-end to a legacy text-based application. Is there a tool that I can use to design screens with? I don't need to generate code, I just need to be able to tell a programmer "This is what the screen should look like. A drop down box should go here, etc." Looking for a ...

Key Listeners

778 byte By SecTecha at 2007-9-30 1:39:44
I need some help writing java code that will bring up a context menu from a JTextField when a <modifier><Keystroke> combination is pressed. I need to modify a current program that brings up a menu when a user right clicks in the JTextField. I need to make this same action available ...

TCP packets

7322 byte By solutionseekera at 2007-9-30 1:40:03
My UDPServer and UDPClient code works like a charm now :)I was doing the TCPServer and TCPClient and this is code for client import java.net.*;import java.io.*;public class TCPClientTest {public static void main (String args[]) {// arguments supply message and hostname of destinationSocket s = ...

Looping statements

1359 byte By visa798a at 2007-9-30 1:40:17
I am trying to set up a loop statement for the calculation of a mortgage amortization table. The formula I am using came from http://www.interest.com/hugh/calc/formula.htmlHere is what I have so far. It calculates the monthly payment given an array of interest rates and terms in years. public ...

Protecting the code

381 byte By Ravish007a at 2007-9-30 1:40:18
Hi,I am new to Java programming and want to know for sure whether there is any way by which I can prevent decompilation of my code(.class) files.If I sell my software's .class file, anyone can make his own program by viewing my source code by easy decompilaton.So is there any way to protect ...

UDPClient socket.receive() problem

1575 byte By solutionseekera at 2007-9-30 1:40:40
I have a slight problem.... while receiving the packets.....[code]/*** DECLARE AND INSTANCIATE DATAGRAM TO RECEIVE ***//* buffer for holding the incoming datagram*/byte[] buffer = new byte[size];DatagramPacket reply[] = new DatagramPacket[size];start = System.currentTimeMillis();/*** SEND ...

Need Feed back for my code

2193 byte By etow1288a at 2007-9-30 1:40:41
Hi I am writing a program to view a file and count the total number of characters and total number of linesin the file. Can you check if it counts correct total number of characters from a file?[i] // My code is below [/i][code]import java.io.*; public class ListFiles3 { public static void ...

Need Feed back for my code

2193 byte By etow1288a at 2007-9-30 1:40:42
Hi I am writing a program to view a file and count the total number of characters and total number of linesin the file. Can you check if it counts correct total number of characters from a file?[i] // My code is below [/i][code]import java.io.*; public class ListFiles3 { public static void ...

Real Quick Question

573 byte By wulfkuba at 2007-9-30 1:40:44
And a quick reply, I hope!So I have this program that is basically a dictionary and what it does is open a text file, inserts the file into a linked list, and then gives the user options to add, search, delete or print out the dictionary contents. So my question is, is it more efficient, given ...

Problems after installing

181 byte By Bruised-Leea at 2007-9-30 1:40:57
i installed java and everything went fine. However, i have no clue how to call the compiler...im sorry, im very new to this and this may seem like a very dumb question

Can't access variables in inner class!!!!!

965 byte By DM777a at 2007-9-30 1:40:59
Suppose there are two classes(one is Test and the other one is ThatAccess) which had the code like below:package AccessVariable;public class Test{public int i = 1;class Test1{public int j = 2;}}And another class:package AccessVariable;public class ThatAccess{public void mm(){Test1 aa = new ...

Setting PATH

541 byte By momal1a at 2007-9-30 1:41:12
HI all,Im having a few problems here.I have set the variables in my computer for using the J2SDK, J2EE and JWSDP.Here is the PATH settings:Variable Value ; C:\j2sdkee1.3.1\bin; C:\j2sdk1.4.0_01\bin; C:\jwsdp-1.3\apache-ant\bin; %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\WbemThe ...

simple design question

664 byte By szertlika at 2007-9-30 1:41:21
I'm beginning to see the rewards of making a program OO, but I think I still am not seeing the big picture. Like, I've made a tetris clone and I made a class called Grid. Now I'd like to make a two player chess game but I'm wondering, do I just make a new Grid class specifically designed ...

How to release command-prompt?

188 byte By va1210a at 2007-9-30 1:41:26
Is there some way of releasing the command prompt in windows when running java applications. I'm looking for a similar solution as running "[command] &" in linux..Thanks

can java know the OS in which it is running ?

198 byte By krrajesh2a at 2007-9-30 1:41:35
How can my java program know in which operating system it is running ?I hope someone gets their time out of the "how many programmers are girls" threadand respond.Thanks.

Windows and Focus

378 byte By rousava at 2007-9-30 1:42:19
Hi,I have a secondary window that pops up from a main window in my program. The thing I want is to not let the user get back to the main window as long as the secondary window is open. Only when say a quit button is clicked on the secondary window, then that window closes and the user can ...

API

121 byte By oops_there_it_is_a at 2007-9-30 1:42:40
I would like to see more references to html links to example code in the API, it is pretty cryptic for beginners.

How to compile a truly independent application?

900 byte By va1210a at 2007-9-30 1:42:53
Aftre having compiled my application to a class file on my computer, I tried to run it on another machine with the same OS as mine, but with a more limited class library. Instead of starting up like it did on my computer, the following printout wa spewed after running "java App":Exception in ...

Need help with a few simple applications.

2356 byte By beginnertojavaa at 2007-9-30 1:42:58
I've been making a few applications lately, and I get a few error messages that I don't really know what to do about.#1 variables.java:class variables{public static void main(String[] args) { // start variablesint myAge = 20;int hisAge = 20;int herAge = 20;int everyonesAge = myAge + hisAge + ...

Numeric type conversion

350 byte By kp_huanga at 2007-9-30 1:43:02
Hi, it may be asked by someone before.But,public static void main(String[] args){int i , j = 100;double temp = i * 0.1;i = (int) temp; //worksj = (int) j * 0.1; //fails, why?System.out.println(i);System.out.println(j);}error: loss of pecisionAny helps appreciate! ...

the instanceof operator

1421 byte By grand_poobaha at 2007-9-30 1:43:10
Hello again world.Here's the code in question:import java.awt.*;import javax.swing.*;class InstanceOperator{public static void main(String args[]){ JButton poo = new JButton(); if (poo instanceof JComponent) System.out.println("It is."); else System.out.println("It's not.");}}If I change ...

logic statement with an array

2021 byte By xyzcodeza at 2007-9-30 1:43:19
I am trying to add 10 elements of an array together only if the elements are not negative and then display the result, but I'm having a bit of trouble with the logic behind it. Can someone help me out please. This is what I've done so far.........public static void main(String[] args){try{int ...

Call paint() in init() ?

776 byte By b.E.n.Z.ia at 2007-9-30 1:43:39
Hello everyone. I've just started learning programming and there is this problem that i encountered, i thought i could use some of your expertise here.I am creating an applet. I need to narrate a story and draw at the same time. Is it possible ? I can't seem to call paint() into the init() ...

Why Java?

1855 byte By GnuVincea at 2007-9-30 1:44:08
Hi everyone. I don't mean to start a language war or anything, but would someone explain me why I should consider Java for programming? I know several languages and from what I have read, Java would not really help me. Maybe someone can point out some things?Two of the languages I really like ...

javadoc problem

630 byte By newonthisa at 2007-9-30 1:44:15
i'm trying to build some javadocs from command line.In my class i've the following:/** * interface Operacoes * @see ../novaForma/Forma */Well, i know that, in order to @see work, i need a fully qualified classname.And here lies my prob: how will i write that?My actual interface is ...