32,204 Topics

Member Avatar for
Member Avatar for J-Dub

I used one action listener for an array of buttons that do different things. Exploring methods. I am fairly new to java. I just made a tic tac toe program. I am hoping for people to look it over and tell me what they think, ways to make it better, …

Member Avatar for peter_budo
0
416
Member Avatar for sarathsshanker
Member Avatar for JeffGrigg
0
65
Member Avatar for sarathsshanker

[code]import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import javax.servlet.http.HttpSession; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.PrintWriter; import java.io.IOException; import java.text.DecimalFormat; public class ShoppingServ extends HttpServlet { String link; String[] books; String[] music; String[] computers; String<ArrayList> selitems; // JAVA.STRING.LANG doesnot take parameters error String<ArrayList> cartitems ;// JAVA.STRING.LANG doesnot take parameters error …

Member Avatar for Slimmy
0
189
Member Avatar for pseudorandom21

I need to run some code written in Java from my personal website. How do I even begin?

Member Avatar for NormR1
0
122
Member Avatar for sirlink99

I am making a game where random obstacles appear. The obstacles will move towards you. I currently have this code to animate the obstacles. [CODE] for (int i = 0; i < obstacle.size(); i++){ // animate walls obstacle.elementAt(i).x -= 1; } [/CODE] My vector multiple instances of the Walls class …

Member Avatar for stultuske
1
111
Member Avatar for Haridha
Member Avatar for Srin

My panel's paintcomponent method draws a line based on the initial click and the current position as the mouse is dragged. Releasing the mouse leaves one line from the mouse press location to the mouse released location. The problem is. on the next click/drag, the old line disappears when the …

Member Avatar for Srin
0
1K
Member Avatar for jovialbimmer

Hello all. I have to write a java program that allows a user to enter an octal digit and output the binary equivalent for as many numbers as the person wishes using a direct access method. The error is that even though it compiles, the answer (the binary number) continuously …

Member Avatar for JeffGrigg
0
142
Member Avatar for Haridha
Member Avatar for rotten69

Hey, I'm getting this error every time I run my program. I dunno what it means and how to fix it. [code] Uncaught error fetching image: java.lang.NullPointerException at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:99) at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:113) at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:240) at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172) at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136) [/code]

Member Avatar for NormR1
0
246
Member Avatar for andersonelnino

1)DEFINITION OF DATA REQUIREMENTS Produce an itemised consigment note for each customer including -dimension,weight and price per parcel. -total weight and price consigment -number of parcels RESIDENT DATA -up to 2kg-£7.50 -up to 4kg-£8.00 -up to 10kg-£8.55 -up to 12kg-£9.10 -up to 14kg-£9.70 -up to 16kg-£10.35 -for each extra 2kg,up …

Member Avatar for NormR1
0
214
Member Avatar for sathya88

[code] public class exception4{ public static void method(){ try{ exception4.method2(); throw new Exception("method throw"); } catch(Exception e) { System.out.println("method Exception caught"+ e); //throw e; } } public static void method2(){ try{ throw new Exception("method2 throw"); } catch(Exception e) { System.out.println("method2 Exception caught"+ e); e.printStackTrace(); [COLOR="Red"][B]//throw e; [/B][/COLOR] [COLOR="Green"][U]if include this …

Member Avatar for JeffGrigg
0
254
Member Avatar for J-Dub

I need to know how I can set up a action listener for an array of buttons. I am trying to make a tic tac toe game. I am new to programming. I have seen someone on here ask a similar question but I could not grasp what they where …

Member Avatar for mKorbel
0
4K
Member Avatar for akasekaihime

we are ordered to create a payslip in applet but I am not able to create one for I do not know compute the gross pay, net pay and total deduction.....also I do not know the relation of the days worked,overtime worked and overtime rate to the gross pay......what should …

Member Avatar for hfx642
-1
140
Member Avatar for akasekaihime

I have created my own payslip but then when I compiled it, they said that there are no more errors but I cannot view my output on the applet viewer............ is there something wrong with my code or is the viewer at fault here?? here is my code............ [CODE]import javax.swing.*; …

Member Avatar for akasekaihime
0
318
Member Avatar for Haridha
Member Avatar for DarkPheonix

[B]Could u tell me why the following problem is coming on running the program where im getting the out twice each time wen i shd get it only once , wen im entering a input im getting the menu twice[/B] [CODE]import java.io.*; class Television{ private String MANUFACTURER; private int SCREEN_SIZE; …

Member Avatar for FireBlah
0
319
Member Avatar for rayvarde

plzz help me how can i do the 3 sorting in 1 program user input using bufferedReader plzzz... bubble sort slection sort insertion sort

Member Avatar for rayvarde
0
84
Member Avatar for vishal1949

I am making a program where i have to write a recursive function that reverses a string. I am a new programmer and need help. The function should return a String and take only one argument, also a String. [CODE]import java.io.*; public class RecursiveFunction { public static void main(String [] …

Member Avatar for JeffGrigg
1
395
Member Avatar for javinpaul

Just wondering is there any way to modify Classpath in your program and force them to include a new directory in classpath ??

Member Avatar for JeffGrigg
0
228
Member Avatar for sarathsshanker

im not able to figure out the meaning of this piece of code: [code] public int void countTokens(String s) { StringTokenizer st= new StringTokenizer(); return st.countTokens(); } [/code]

Member Avatar for stultuske
0
376
Member Avatar for Ashley256

Am trying to create a JTable application but when i try to run the program in netbeans it bring an error on the addRow() and removeRow() and yet when i run it in the commandPrompt it works well what could be the problem. below is a snippet of the code …

Member Avatar for Majestics
0
87
Member Avatar for anjoz

Hi im trying to design a program that matches wildcards example the * , ?, [], {} etc but ive read that java has its own regex support I want to manually code the matching idont know where to start or how to do the program/ design it. Can you …

Member Avatar for Ezzaral
0
77
Member Avatar for gunjannigam

I want to have two textfields which will have the following validations 1) Both should be Integers 2) The value in one textfield should be a integer multiple of other I have used two JFormattedTextFields to this. This is what i have done till now [CODE] NumberFormat updateFormat,sampleFormat; updateFormat = …

Member Avatar for mKorbel
0
266
Member Avatar for VIPERHlr

Hi, I desperately need help for my java assignment. I am required to make an encryption/decryption program using netbeans. It basically takes the users message and encrypts it into characters and vice versa for decryption. My teacher say it has something to do with using arrays. There are 2 main …

Member Avatar for peter_budo
0
134
Member Avatar for hervens

Hello, I have the current sample xml document below: [CODE]<Units> <category name="Temp"> <unit id="0"> <unit_name>celcius</unit_name> <fromFormula>inFrom0</fromFormula> <-- need this value <toFormula>inTo0</toFormula> </unit> <unit id="1"> <unit_name>fahrenheit</unit_name> <fromFormula>inFrom1</fromFormula> <toFormula>inTo1</toFormula> </unit> </category> <category name="Length"> <unit id="0"> <unit_name>feet</unit_name> <fromFormula>InLengthFrom</fromFormula> <toFormula>inLenghTo</toFormula> </unit> </category> </Units>[/CODE] Now, I am trying to retrieve the value "inFrom0" from the …

0
55
Member Avatar for tammy12w

help im new to this.... why are get method useful?? for example why write this: [CODE]public class name { private String yourname; public void setname(String Fname){ yourname= Fname; } public String getname(){ return yourname; } public void sayying(){ System.out.printf("hello %s", getname()); } }[/CODE] when this also does the same thing …

Member Avatar for stultuske
0
117
Member Avatar for laguardian

So I'm creating a program that calculates the “Sum of Powers” after the user inputs two integers N and M. The sum of powers is computed as N^M+ N^(M-1)+ N^(M-2)….+N^0. But I don't know how to finish it. I'm kinda confused using return method, loops, etc. Here's what I have …

Member Avatar for Slimmy
0
2K
Member Avatar for ericfrank

I am trying to write a sample program that can call use the main method of "SequenceFilesFromDirectory", which aims to convert a set of files into sequence file format. [CODE]public class TestSequenceFileConverter { public static void main(String args[]){ String inputDir = "inputDir"; String outputDir = "outoutDir"; SequenceFilesFromDirectory.main(new String[] {"--input", inputDir.toString(), …

Member Avatar for NormR1
0
194
Member Avatar for ErangaD

I am a VB.net programmer and I am very new to PHP HTML and Java Scripts I am doing a project for my company using PHP HTML and Java Scripts and I want to Know how to make readonly a text box after it gets the input This text box …

Member Avatar for ErangaD
0
4K

The End.