32,199 Topics

Member Avatar for
Member Avatar for ASIWYFA

Hey guys, I am having trouble with my java pacman game. What I have currently is the basics. I am reading in my maze from a txt file which is working. I am stumpted on how to replace the W for my walls with my jpeg of a blue wall(imgGhost …

Member Avatar for JamesCherrill
0
570
Member Avatar for arawani

Hai, can anyone help me? missing return statement error keep appear when i tried to run this code class CoffeeBags{ //Data member private static final double PRICE_PER_LB = 5.99; private static final double TAX_RATE = 0.0725; private int numberOfBags; private double totalPrice; private double totalPriceWithTax; private int bagWeight; //constructor public …

Member Avatar for arawani
0
94
Member Avatar for unikshegz

I am working on a java project,i want to sequentially read an ASCII file into an arraylist and then add a method to print out the array. i want to also be able to search through the ASCII file can anyone help me with the coding. will realy b much …

Member Avatar for unikshegz
0
133
Member Avatar for juniper2009

Dear All I am trying to learn JAVA with Eclipse.I have a class like Form.java and it has a form which contains 4 text fields.When I press the submit button(Register) I want my program to put every thing into a file(test.txt) line by line. I tried to do something from …

Member Avatar for JamesCherrill
0
131
Member Avatar for gunjannigam

I have a database hosted at a remote location. I want to access that database. But I keep getting the error [CODE] com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'username'@'%' to database 'db' [/CODE] This is the code that i have written [CODE] Connection con = null; Class.forName("com.mysql.jdbc.Driver"); String username = "username"; …

Member Avatar for gunjannigam
0
2K
Member Avatar for Dean_Grobler

Hello there, In one of my projects I'm working on currently. I have a 'cancel' button in my GUI window that is suppose to close the JFrame the button resides in. I have done some research on the web about this. But it seems like one has to write a …

Member Avatar for masijade
0
129
Member Avatar for iraqi4life

Basically, I have a project which I need create a output format of DD/MM/YYYY - Which I used in a toString, it works fine. I then used a switch case for all the days in a month, and of course I took into consideration the leap year. When I try …

Member Avatar for islam-morad
0
100
Member Avatar for appunu

Hello guys, I have coded something which would return the contents of a excel sheet as a hashTable. The code is [CODE] public Object[][] validDataProviderScenarioOne() { excelWorker excel = new excelWorker(); String pathValue = excelWorker.LocatingXls("Data.xls"); Hashtable<String, String>[] hashDrv =(Hashtable<String, String>[]) excel.contentReading(pathValue, "xxxxx_Login"); Object[][] obj = new Object[hashDrv.length][1]; for(int i=0; i<hashDrv.length; …

Member Avatar for kramerd
0
136
Member Avatar for LevyDee

Hi guys, as the thread says, im new to java. My department is more in the c++ side of things. My form class... [code] import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.Vector; public class DogForm extends JFrame { private String _adminLogin = new String("admin"); …

0
63
Member Avatar for insanely_sane

Yeah... I have a headache... So I have the following code: [CODE]public class inc { public static void main (String args[]) { new inc(); } public inc() { System.out.println (addTwo(7)); } public int addTwo(int n) { System.out.println (n); if (n < 1) { return 2; } else { return addTwo(n-1)+2; …

Member Avatar for insanely_sane
0
153
Member Avatar for bonett09

[CODE]import java.util.Scanner; class CalcAvg{ public static void main (String args[]){ Scanner s = new Scanner(System.in); int sum = 0; int avg = 0; for(int i = 0; i < 10; i++){ System.out.println("Enter a number: "); int num = s.nextInt(); sum = sum+num; } avg = sum/10; System.out.println("The sum is: " …

Member Avatar for kvass
0
137
Member Avatar for hatux

Hello people. My aim is to assing an array with words read from system.in in a single entry. So if the users enters "Hello there" i will have 0,Hello 1,Therre I have managed to achieve this with the following piece of code. [CODE] import java.util.Scanner; public class mein { public …

Member Avatar for hatux
0
125
Member Avatar for ausops

I'm working on a constructor which lets the player input a starting sudoku grid and also checks if it's valid and can be played, ie, it doesn't already have duplicate numbers. The code listed here is my newest attempt and works on making each number +1 to another array. So …

Member Avatar for ausops
0
145
Member Avatar for kezkez

I am having a hard time figuring out how to use the db object created in the first action event within the second action... how can i make the object visible there? i am trying to say add a record to db object by saying something like ... class Action2 …

Member Avatar for kezkez
0
157
Member Avatar for Amrinder07

Hi!..I am Amrinder and i am new to java language as i am a student of Engg. i have to make a program using Swings or Frame in which Loop would be handled by Two different Buttons named as Start & Stop.....but how can i make a loop in ActionEvent …

Member Avatar for Amrinder07
0
145
Member Avatar for mcosta

Hello all, I'm sorry if this is an easy fix, but I've searched everywhere and spent 3 days on this and would like my life back. I'm trying to Select data from a database using a PreparedStatement and it isn't working for me. No errors, just no data. I can …

Member Avatar for mcosta
0
83
Member Avatar for AaronLLF

Hi. Hopefully this is my final question for this code. As you may know, I got a code from lloydgoodall.com for a Java & LWJGL FPCamera. It came with several errors, which I got to fixing, and after many, many Google searches, Option+Space's, and hitting my head against my desk's, …

Member Avatar for JamesCherrill
0
567
Member Avatar for jemimaloh

Hey, my code fragment is now this: [CODE]File fileName = "E:\\Major Project\\FinalLap\\278d.gz.txt.txt"; int index = fileName.toString().lastIndexOf("\\"); filed = fileName.toString().substring(0, index);[/CODE] And I hope to just get the file's name "278d.gz.txt.txt" after the last instance of "\\" and assign it to variable "filed". Can anyone tell me what am I doing …

Member Avatar for jemimaloh
0
123
Member Avatar for Khodz

So I'm working on a database-type program for the Java course that i'm doing and i seem to have run into a bit of a roadblock. This class compiles and runs alright but where i have a problem with it is when i try to amend the text file using …

Member Avatar for Khodz
0
191
Member Avatar for ponens

So I am fairly new to Java and I have been trying to create a simple program that reads a list of names and a number from an external text file. So I will show you that code first. [CODE] public static void startReadFile() { // Get an ArrayList of …

Member Avatar for quuba
0
133
Member Avatar for afas87

hi.... Iam working on file compression using Huffman algorithm... my problem is that when i try to restore the compressed file.. only text file can be recovered.. other file recovered with the size; but cant be opened i read byte each time from the file to restore it thanks...

Member Avatar for quuba
0
35
Member Avatar for famida

how to validation of textfield in java using netbeans IDE 5.5 i have done with validating the length of Textfield i need for number like if text values is number then i want a message to b displayed please help...........

Member Avatar for peter_budo
0
236
Member Avatar for compe_dsd

this doesn't really involve codes but.... i have a problem in using my netbeans...i'm still new to this program and i don't know the controls and menus...I made buttons/JButtons but I don't know what to do next. I want that when I click a button, another lists or box will …

Member Avatar for famida11
0
117
Member Avatar for jems5

With this code segment, I must be able to output text file data with names of persons along with int values after performing calculations. The program isolates the names, int values and float values and should output the percentage of each value as a functions of total... example out is... …

Member Avatar for quuba
0
99
Member Avatar for Javano

Ok well i have a function called drawVerticalLine and it's method header is the following : void drawVerticalLine(int[][] img,int lineWidth, int linePosition) so what happenes is a picture is converted to a 2d array etc and passed on to this function, now the goal is to draw a red verticle …

Member Avatar for tong1
0
106
Member Avatar for noneta

i wrote this code to reverce a word but its give me a error donno why:S i hope u can help me :) [CODE]import javax.swing.JOptionPane; public class sentence { private static void reverse (Sentence){ String sentence; sentence s = new sentence(); sentence=("hello"); } /** * @param args */ public static …

Member Avatar for peter_budo
0
102
Member Avatar for iraqi4life

Hello, I have a method that is returning a value of DD/MM/YYYY However, if the day if 5 or month is 7, it must have a 0 before it. So it would be, 05/07/YYYY, mine is 5/7/YYYY which isnt what I am looking for. Any help?

Member Avatar for peter_budo
0
48
Member Avatar for krishna_sun82

Servlet tag and servlet mapping tag are present in the web.xml as shown below [CODE] <servlet> <servlet-name>AbcServlet</servlet-name> <servlet-class>edu.studies.service.AbcServlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>AbcServlet</servlet-name> <url-pattern>/abc/*</url-pattern> </servlet-mapping> [/CODE] But it still says The requested resource (Servlet AbcServlet is not available) is not available. What did I miss? Please help.

Member Avatar for ~s.o.s~
0
214
Member Avatar for Chalandria

Again I have been given an assignment and have done it completely wrong. Please understand that I am completely new to programing and made the mistake of entering an accelerated class. I'm not looking for an A, I just want to pass and seek out help as often as I …

Member Avatar for Chalandria
0
348
Member Avatar for Pink12

Develop an application with object oriented model for an e-ticketing system for a cinema. It should allow its customers to browse and book tickets for movies. The system should handle customer registration , ticket processing and payment and support maintenance of the system as adding , deleting and updating movie …

Member Avatar for tenorsax08
0
76

The End.