Forum

Posts

RECENTLY INDEXED PROGRAMMING SOLUTIONS OF Java


Make a highscore. (HELP!)  

Hey guys, This is my first post, so please be nice! :) I recently started studying programming at the university and since our teacher is quite... 'fuzzy' when it comes to his lectures, I feel like I'm falling behind quite a bit... What I need help with (as... Continue Reading
Views : 24
Monday 24th of September 2012

New to Java need help in class  

I have to do the following2) Prompt for and accept 3 integers from the keyboard.3) Add the following calculation to the java program. The calculation must be written using java code. add int number1 to int number3 plus 5 then multiply the... Continue Reading
Views : 39
Monday 24th of September 2012

Keylistener  

Hey guys I'm trying to program a game of snake but my keylistener to change directions isn't working. I've set it up like all the examples I've seen online and I can't see what I'm missing. I've made a SSCCE for just the up direction (either 'w' or the up arrow key): Continue Reading
Views : 20
Monday 24th of September 2012

...---::Graphics HELP! ::---...  

Here is my code and it dosent seem to print a rectangle on the screen, why is that! Can anyone please take a took for me! Continue Reading
Views : 27
Monday 24th of September 2012

My program won't recognize the mouse's motions~  

I have a mediocre knowledge of Java (I know the fundamentals) and have been watching a youtube series to learn how to program games better. The video, Continue Reading
Views : 30
Monday 24th of September 2012

If else problem  

I am trying to make it so when "new game" is put in as the user input then the program should return "Hello", but if anything else is entered then "Goodbye" is returned. I am using these as examples until I have fixed this problem, I have played around and tried multiple things and I do not see... Continue Reading
Views : 32
Monday 24th of September 2012

Removing components from an array  

I am trying to add and remove JTextFields in JPanel whenever a button is pressed. If the JPanel contains any of the JTextField array, that is msg, all the elements of msg should be removed before adding. The adding method works fine. now i want to remove elements. Can someone help me in... Continue Reading
Views : 30
Monday 24th of September 2012

Multiplication loop  

Below is some simple coding I am trying to practice on. I am currently going through Java for Dummies vol. 4 and trying out some simple progs.I was expecting this program to:1. Ask user for int between 1-102. Take user number and multiply that number times 0, 1, 2, 3, ...... Continue Reading
Views : 27
Monday 24th of September 2012

Sudoku solve method using backtracking  

Hello all. I am trying to get this program to work using backtracking and now I am at a standstill. I have created the methods checkCol, checkRow, and checkBox and I believe they are correct. I have started writing a solve method and that is where I am stuck. I am not to sure how to implement... Continue Reading
Views : 30
Monday 24th of September 2012

how do you update JTextField  

How do you write a message in a text field through code? For example, if the user enters something like "How are you?" in the text field, how would I make it so that the text field changes to "Great!"? Continue Reading
Views : 29
Monday 24th of September 2012

javac not recognized  

Hello,For my programming class at college, I am required to write code in java in a text editor and then, utilizing the command prompt, compile and run that java file. However, when I try to compile the java program using javac, I get "'javac' is not recognized as an internal or... Continue Reading
Views : 29
Monday 24th of September 2012

Developing shopping cart  

hi I want to develop shopping cart website where i can make easily updation and people can post articles in that so any boudy can provide some Idea Continue Reading
Views : 23
Monday 24th of September 2012

Pass a string from a class to another  

I'm trying to pass a String from one class to another class but the result I'm getting is 'null'. I want to pass the String username from LoginFrame to HomeworkFrame; HomeworkFrame: Java Code: Continue Reading
Views : 34
Monday 24th of September 2012

List methods add(int k, Data data), set(int k, Data data), remove(int k)  

Hello,I've recently started studying Java, and I've encountered some problems with lists. I would be really grateful if someone could create these 3 methods for me, since I would have a great example to use. I have to create the 3 methods in bold. Here's the code I have: Continue Reading
Views : 24
Monday 24th of September 2012

writing strings to a file  

Hi everyone, so my problem is im trying to call some strings that the user inputs from one class to another class that writes those strings into the file. when i read the file i get null on the strings because im just calling the strings with nothing in them i guess. help please D: Continue Reading
Views : 28
Monday 24th of September 2012

Object file  

Hi! All ....can you tell me how to read .obj file and .class and see them in our source editor. Continue Reading
Views : 52
Monday 24th of September 2012

How to read and shuffle bytes from text file in Java....'  

There is a text file containing some text for which the following conditions are true:> text file contains no new line, all text is in single line'> length of text file is multiple of 4...(length%4==0)''Now, how can i split the contents of text file into 4... Continue Reading
Views : 17
Monday 24th of September 2012

Populating and Sorting a List<> of any number of different objects  

What I'm trying to do is take all my custom swing components and placing them into a List and then sorting them based on a property that will be common between them all. For example, I have two components (so far): Continue Reading
Views : 22
Monday 24th of September 2012

What does the keyword 'return' do  

I have many Java books. They mention the keyword 'return'. But, they do not explain what it does. What does this keyword do and accomplish? What is the point of using it? Thank you. Continue Reading
Views : 44
Monday 24th of September 2012

Loop programming exercise. Need review of my solution.  

Currently studying loops in Java. I have made a solution to a programming exercise, it works, but generally when I do something large I tend to make it more complex and messy than it is needed. Maybe you can help me find better solutions? The problem: Write a... Continue Reading
Views : 30
Monday 24th of September 2012

Get IE Browser handle to get Rectangle coordinates  

Hi Using java i would like to get the handle of IE browser and then from that get the rectangular cooridates (x,y,width,height) of only the browser area(the white part). Hope some one can help me with this as soon as possible. thanks Continue Reading
Views : 41
Monday 24th of September 2012

Change the package error  

Hello, I have a problem with a class which has the next code. Java Code: initComponents(); ImageIcon winIcon = new... Continue Reading
Views : 23
Monday 24th of September 2012

Help us choose a java tech for our project  

I and my friend are starting aur project based on java . We are planning to create a java based forum software . But we are confused to wheather make it a app on windows communicating a DB server ....or to make it based on serverlets (.But i think they are outdated now .)and somthing like... Continue Reading
Views : 34
Monday 24th of September 2012

assigning final instance variable inside a constructor vs method  

Hi all, How is it that one can assign a final instance variable inside a constructor but not inside a method? Thank you. Continue Reading
Views : 34
Monday 24th of September 2012

New and got a question  

First of all I just started learning Java on my own last Wensday. I am using the book think java how to think like a computer scientist(at least i think that is the name), and using eclispe for a compiler well i got to one of the exercises and it says to create variable named day... Continue Reading
Views : 33
Monday 24th of September 2012

recursive 99 bottles program is there better way to write it as a beginner  

okay so just being a hmmm... what is the word beneath novice, anyways for a book exercise i had to right a program for the song 99 bottles of beer, this was involving recursive methods. it hinted around to more than one method. but my code only had one method and got what it wanted.so my... Continue Reading
Views : 49
Monday 24th of September 2012

What is wrong with this code  

This is the error message that JGrasp gives me Java Code: ----jGRASP exec: javac -g Crammer.javaCrammer.java:15: error: variable xcoor might not have been initialized xcoor[i] =... Continue Reading
Views : 49
Monday 24th of September 2012

How to call getElementAt() method in new class definition  

Hi, I defined: public class FLabel extends GLabel implements Runnable{ //constructor public FLable(......){ .......... } public void run(){ ....... }} How can I call getElementAt()... Continue Reading
Views : 52
Monday 24th of September 2012

i've never used java before and i need help!!  

here is the description of what we have to do Write a Java program that perform the following:a. Prompts for user?s first name.b. Prompts for user?s last name.c. Prompts for user?s age.The program should then display your full name (as last name, comma,... Continue Reading
Views : 72
Monday 24th of September 2012

Is there any way to improve this code  

So i made my first game, it is called kill the dragon. it took me an hour to make. It gives the player the option to use 1 of 4 spells to kill the dragon. it works well but is there a way to make it better? Continue Reading
Views : 45
Monday 24th of September 2012