Forum

Posts

RECENTLY INDEXED PROGRAMMING SOLUTIONS OF Java


Side-scrolling  

How do you make a game side-scrolling, like in mario? Any links to a tutorial? Continue Reading
Views : 31
Thursday 25th of October 2012

Im a little confused on what classes are!  

I just read a chapter in my java book about classes. It gives an example of a problem and says you will need 3 classes, a customer class, a cars class, and a service quote class. each get different things and do different things. my question is, are all these classes in one program, or are they... Continue Reading
Views : 78
Thursday 25th of October 2012

copying a part of a string and moving it to the end of the string  

If I have a String name "sentence" which contained the words: "Translate the string to Pig Latin" How would I select the consonants or every letter before a vowel and move it behind the word, like this: (the apostrophe and caps are added to shows the letters i moved to the back of... Continue Reading
Views : 37
Thursday 25th of October 2012

Need Help with Magic Square  

Hi, I'm new to Java and I am kind of stuck on trying to print out my square, and also I want to make sure I have the correct formatting in my code for SquareTest.java. Any suggestions are great. Here are the two codes: Continue Reading
Views : 27
Thursday 25th of October 2012

addcomponenet error.  

Java Code: .addGroup(layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE) ... Continue Reading
Views : 57
Thursday 25th of October 2012

Using the random class  

For this method, i have to randomly generate a new job with random priority and execution time. The chances of creating a new job is equal to PERCENT_NEW_JOB which is 6. Im not sure on how to create a new job with a random chance of actually creating. heres the code /*Randomly... Continue Reading
Views : 55
Thursday 25th of October 2012

missing return statement  

Hi guys could you help me out here? I can't tell whats wrong with my code it keeps giving me a missing return statement, } expected. Heres the class im having problems with.The program is a calculator in which you type in the expression, which is taken as a string and... Continue Reading
Views : 37
Thursday 25th of October 2012

Bring component to front of a container  

Okay well i don't understand why in java added components are sent to the back instead of the front, but is there a way i can bring a component to the front? , Using a JApplet. And I'm reprogramming my tetris game. Before it would save the coordinates of all the squares in a... Continue Reading
Views : 24
Thursday 25th of October 2012

not sure what im doing wrong with these if else statements  

I am having problems with this. this is supposed to give you a list of things. the full code is this Java Code: package students; import javax.swing.JOptionPane;public class... Continue Reading
Views : 51
Thursday 25th of October 2012

Improve my GUI!  

Hello. I would really appreciate some help which is not available in the API! I have written a program which is a text analyser. It gets some text (either from keyboard or a file) and displays various statistics about the text. At the moment the program effectively displays like... Continue Reading
Views : 18
Thursday 25th of October 2012

Newbie asking for directions  

Hello guys.I decided to try and learn Java. I already know the basics of C and good Perl but i have no idea about Java. Never tried to learn before as well. So i basically know nothing about Java. I tried to surf and find out some general guidelines in the web but till now i only had to... Continue Reading
Views : 49
Thursday 25th of October 2012

Java Gif image analyser  

Need help with a gif image analyser basically the gif image is a binary file so will use the BinInput file but from the gif file i need to get height, width etc Could someone please help? , please could you provide an example as i am puzzled if you don't mind please Continue Reading
Views : 62
Thursday 25th of October 2012

implements  

can u explane for me this code:private class TextFieldHandler implements ActionListener51 {52 // process text field events53 public void actionPerformed( ActionEvent event )54 {.... thanks Continue Reading
Views : 34
Thursday 25th of October 2012

First post :D, Well im new to java, here is my first ever project!  

Hey so i am taking IT at college for 2 years, and we do 4 hours of programming each week, so i created a simple, yet effective program, it's a colour picker that gives you a hex value.I think i have done well in terms of GUI ease of use, and layout.Let me know how i can improve and... Continue Reading
Views : 49
Thursday 25th of October 2012

After adding new columns to my Table  

Hello everybody,After I created a JTable with:JTable MaTable =new JTable();MaTable.setModel(new DefaultTableModel(new Object [N][1], new String [1])); I wanted to add new columns to it, so I did this:TableColumn Colonne = new TableColumn(); Continue Reading
Views : 58
Thursday 25th of October 2012

Selecting Specific Data in a file and writing to another  

I am trying to select specific data from a text file and write to the another file,in the same instance i want this application to loop the results,each time it obtains the right string,it should read, write and return to searching more strings, i have no idea on where to begin,assistance... Continue Reading
Views : 40
Thursday 25th of October 2012

Highlight JTextField using Jbutton  

Hi,I have finally scripted my program to copy a selected text field when a JButton is clicked, however, how do i highlight this to show the user it has been succesfully copied?Thanks Continue Reading
Views : 53
Thursday 25th of October 2012

Linked List node class help!!  

My instructor gave us an assignment that is supposed to support a Linked List that has two different trails of references. If you follow one trail of references it gives you the int values of the list in the order they were added and the other trail gives you the int values of the list in... Continue Reading
Views : 56
Thursday 25th of October 2012

what the wrong in my program ><  

hi every one :)I am still having begun in Java ;) and i hav this sheet I wrote the program But there are mis-outputs :confused::confused: That is the question Continue Reading
Views : 46
Thursday 25th of October 2012

Connect Four  

i am creating a code to make the grid and play the game Connect Four, I am stuck on a few elements and was wondering if anyone had any advice Java Code: import java.awt.*;import... Continue Reading
Views : 20
Thursday 25th of October 2012

No Such Method Error - simple  

Hi.This is my very first time writing java codes and I'm trying to build a small program to calculate the followin sum: Sum = 30 + 60 + 120 + 240 + 480 + 960. Here's the code that I came up with : Continue Reading
Views : 45
Thursday 25th of October 2012

char datatype  

Why does the following char assignment produce an error? Java Code: char myChar = '\u000a'; mh_sh_highlight_all('java'); When the following... Continue Reading
Views : 39
Thursday 25th of October 2012

Print the second Largest in an array  

Hi, I need to print the second largest element of array. I have written the code to print the first largest, can anyone guide me how do I modify it so that it prints second largest instead Java Code: Continue Reading
Views : 38
Thursday 25th of October 2012

Why doesn't my program function correctly  

This is just a simple program that lets users input Principal, Duration and Rate and it will output Compound interest. It has no errors but it doesn't work, when I put in numbers it just says 0.0 all the time for the result :confused: ... Continue Reading
Views : 53
Thursday 25th of October 2012

Out of bounds exception Errors (Trouble finding problem)  

I have a program that takes a word(Tuesday) and is supposed to translate into pig latin. The rule of pig latin are: 1) Take all the consonants before the first vowel you see (i.e. Tuesday = uesdayT) 2) Then add ay to the end. 3) If there are no vowels in... Continue Reading
Views : 130
Thursday 25th of October 2012

call chaining  

What is the problem here..? Why doesn't this work? public class Foo2 { String a = "he"; String test1(){return a + "ll";} String test2(){return "oo";} String test3(){return "ow";}}public class Foo{ public static void... Continue Reading
Views : 27
Thursday 25th of October 2012

Help with event to change output value in a division  

Hi group! I am quite new to Java. I need a litlle push; I have been on this for a couple of weeks. Here is my code: --- Java Lesson Continue Reading
Views : 75
Thursday 25th of October 2012

Exception in thread "main" java.util.NoSuchElementException  

Java Code: public class Animal{ protected int id; protected String type; protected double mass; //------------------------------------------------------------------------ // Sets up an... Continue Reading
Views : 83
Thursday 25th of October 2012

Testing if an input is an integer  

Hi, I'm writing a method that asks the user for an integer. The user can enter a string or anything they want. If the user enters anything but an integer, the method would repeatedly ask the user for an integer until the user enters one. I'm confused right now, how do I check if a string is an... Continue Reading
Views : 32
Thursday 25th of October 2012

Color over BufferedImage  

I have bufferedImage and I want to draw rectangles over it. Everything works fine, except that the color of the rectangle is always black even though I have the code like: g2d.setColor(Color.RED);g2d.fillRect(x, y, width, height); I think it is happening because... Continue Reading
Views : 17
Thursday 25th of October 2012