32,199 Topics
| |
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 … | |
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 … | |
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 … | |
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 … | |
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"; … | |
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 … | |
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 … | |
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; … | |
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"); … | |
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; … | |
[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: " … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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, … | |
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 … | |
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 … | |
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 … | |
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... | |
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........... | |
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 … | |
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... … | |
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 … | |
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 … | |
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? | |
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. | |
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 … | |
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 … |
The End.