318 Posted Topics

Member Avatar for oppie204

But you have answered your own question in your thread title. [B]It does not exist. It is not a standard java package. Whoever is teaching you java must have told you this.[/B] One simple way to accept input from a user is the Scanner class. Which is an actual java …

Member Avatar for pbl
0
747
Member Avatar for summey

For a method to return a type other than void, you need specify the type you wish to return in the construction of the method. [CODE]public void frostCake[/CODE] This method declaration tells you 3 things. 1.the modifier (public) 2.[B]the return type[/B]...in this case the return type is void 3. The …

Member Avatar for summey
0
194
Member Avatar for sariberri

Ok, it seems the nextLine() method doesn't retrieve the "nextLine()" Because, if you just call nextLine() once, it prints the array fine. I made this simple code to test, and it works fine for me. [CODE] public static void getFile(Scanner f) { String[] sArray = new String[12]; //listFlights=new Flight[count/3]; //num=listFlights.length; …

Member Avatar for sariberri
0
158
Member Avatar for bangor_boy

For your first question, instead of repeating code, you could remove the code after the first 2 cases and only have it executed on the 3rd etc.. i.e. [CODE]public void showFeelings(int howManyGoals) { switch (howManyGoals) { case 0: case 1: case 2: System.out.println("Oh dear, not very good"); break; case 3: …

Member Avatar for JKP()
0
183
Member Avatar for Slyvr
Member Avatar for sirlink99
Member Avatar for Akill10

Hi, I've been thinking about this for a while. What is the best way to design a program? What I don't understand is how people think of which classes etc. they will use and what they are called. For example, in a program which simulates the card game BlackJack. How/why …

Member Avatar for Akill10
0
121
Member Avatar for sariberri

[QUOTE=sariberri;1438567]Pleaseee help me guys. I can't figure out why the elements in my array are null. I'm reading in from a file and take each line and saving it as a variable in the object and then adding the object to the array. This is what I have so far...when …

Member Avatar for Akill10
0
200
Member Avatar for hanvyj

[CODE]Nest nest = new Nest(); myOtherClass = new MyOtherClass(nest);[/CODE] This creates an instance(object) of your Nest class.

Member Avatar for hanvyj
0
102
Member Avatar for Geowil
Member Avatar for Geowil
0
101
Member Avatar for davetheant

[QUOTE=davetheant;1436458] and yes, I'm sure. It compiles and runs up until i use a method from that library.[/QUOTE] If it compiles and runs before you try to use methods from the library, chances are it can't find the library. So are you 100% sure you have the library in the …

Member Avatar for ~s.o.s~
0
406
Member Avatar for fairy1992224

I am completely confused about what this thread is, and what everybody has posted. It seems to be a jumble of different unrelated threads all thrown into one.

Member Avatar for peter_budo
-1
106
Member Avatar for Johnsupertramp

You seem to mix up the <..> signs. For example, in your enterNumbers() method, your for loop never runs([B]simple debugging using System prints told me this[/B]). You have the wrong sign in the loop's definition, it should run until it is [B]less than[/B] the length of the array, not greater …

Member Avatar for Akill10
0
1K
Member Avatar for aesthete

Java Methods: [url]http://download.oracle.com/javase/tutorial/java/javaOO/methods.html[/url] Java IO: [url]http://download.oracle.com/javase/tutorial/essential/io/file.html[/url] All you need to know about "functions" and file IO in java

Member Avatar for Akill10
0
194
Member Avatar for gaupoit

If your print out reads: 5+3 =8 Then you must not be printing everything in the same statement. If this was your intention, then using System.out.print instead of System.out.println on your first print will allow your second print to be on the same line. If it wasn't your intention, then …

Member Avatar for Akill10
0
83
Member Avatar for Akill10

How can I do this? I'm not even sure what the problem is so I can't really search google. Why is this not possible?: [CODE] #include <iostream> #include <cmath> using namespace std; void vGameLoop(); void vDoMenu(); void vDealMenu(); void vDoDeal(); int main(){ vGameLoop(); return 0; } class CCards{ const int …

Member Avatar for Akill10
0
139
Member Avatar for mbouster

Or you could pass custArray into the backupfiledefaultfilename() as a parameter.

Member Avatar for chikkupa
0
109
Member Avatar for john sigma
Member Avatar for Akill10

Ok, The only reason I'm asking this is because I want to be absolutely clear on it. In C++, if I write [CODE]int* ipSomePointer;[/CODE] [B]Is this the same thing as:[/B] [CODE]int *ipSomePointer;[/CODE] [B]or[/B] [CODE]int& iSomeRef = ...;[/CODE] [CODE]int &iSomeRef = ...;[/CODE] It does give the same result as each other …

Member Avatar for Akill10
0
128
Member Avatar for Akill10

Ok, I am sort of new to C++, and I just came across something that I don't fully understand. [CODE]int main(){ int iX=5; { int iY=30; std::cout<<iY<<std::endl; } std::cout<<iX<<std::endl; return 0; }[/CODE] What does it mean when I make a code block with no if,else etc..? Does it just make …

Member Avatar for Akill10
0
136
Member Avatar for kdmuk10

Your loop runs from i=1;i<21 ...So if you revert the value of i to something below 21, then it will then start from that number. I don't see the confusion :D

Member Avatar for kdmuk10
0
107
Member Avatar for DanieltheE
Member Avatar for kangkan_14

If you are researching scope of variables etc. It would also suit you well to understand static methods and variables. [url]http://download.oracle.com/javase/tutorial/java/javaOO/classvars.html[/url]

Member Avatar for kangkan_14
0
278
Member Avatar for renovatiotr

Sadly, this is what happens to people who are too lazy too learn. If the original code actually worked, and the person you [B]stole[/B] this off copied his entire project...Judging by your lack of effort and understanding, I conclude your problem is most probably a very basic one....*HINT* You cannot …

Member Avatar for Akill10
0
110
Member Avatar for jaycastr

[QUOTE=jon.kiparsky;1420356]If you're just starting out, you should certainly not be using an IDE, any more than you should use a calculator in a math class. The conveniences provided by an IDE might be useful for someone who knows what they're doing, but they will prevent you form learning things you …

Member Avatar for Akill10
1
460
Member Avatar for cms271828
Member Avatar for cielle

crossposted here: [url]http://www.java-forums.org/advanced-java/36607-perform-hamming-window-fft-java.html[/url] You should link to all your crossposts, that way, if you find the answer in one of them, it may allow somebody searching for the same answer to find it easier.

Member Avatar for quuba
0
1K
Member Avatar for axa121

Instead of using a while loop, change it to an if statement. Then call your Play() method in the actionPerformed method. Therefore, you take input, check it, enter the play method, then if nothing gets done, it returns to the actionPerformed and does it again. What this is doing is, …

Member Avatar for axa121
0
236
Member Avatar for sthanner
Member Avatar for WolfShield

You could use simple error checking using try and catch like this: [CODE]import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); double num1, num2, answer, loop_calc=1; String num1s="",num2s=""; boolean isNum = false; //boolean for while loop String operator, rego; System.out.println("Welcome to the …

Member Avatar for WolfShield
0
280
Member Avatar for aligajani

A major difference is, an Array has a fixed size, whereas an ArrayList can grow dynamically. Arrays can hold primitive types like int, whereas ArrayLists [B]cannot[/B] they can only hold [B]objects[/B] Also, Arrays are not part of a class, therefore they have no methods that you can use to change …

Member Avatar for dheeraj208
0
189
Member Avatar for Kreative

OP is from 2007 guys, Unless he is terribly slow, I would assume he has gone past this problem.

Member Avatar for Akill10
-1
217
Member Avatar for Kuroshi
Member Avatar for mrnutty
0
94
Member Avatar for churva_churva
Re: GUI

You posted the error wrong, you just posted your main class again. Besides that, It looks like your problem lies with your actionPerformed method. You don't have one. You call a method [CODE]public void ActionListener(ActionEvent e){ String name=answer.getText(); String greet="Hello,"+name; greeting.setText(greet); }[/CODE] it should be [CODE]public void actionPerformed(ActionEvent e){ String …

Member Avatar for Akill10
0
281
Member Avatar for churva_churva

Well, if it was a problem that is not obvious, why not post the solution here for others to see? grrrrrr

Member Avatar for Akill10
0
135
Member Avatar for jemz

If you want a space between the 2 different outputs at the end, just add an empty string. [CODE]System.out.println(name +" "+ cname);[/CODE]

Member Avatar for Akill10
0
154
Member Avatar for mag12203

Seems your problem lies in your logic for testing palindromes. [CODE] if(!Character.isLetter(ch) && !Character.isLetter(ch1) && ch != ch1) { found = false; }[/CODE] So, this means, your method will only return false if all these expressions are true. So, if I enter "hole": the first two checks will return false(they …

Member Avatar for GuruMS
0
135
Member Avatar for Akill10

Hi, I've started to learn about threads in java. I'm trying to make this simple animation of a rectangle. Where am I going wrong? I was under the impression that if a class implements Runnable, when it is executed, it looks for the start method, which in turn starts the …

Member Avatar for Akill10
0
170
Member Avatar for LianaN

Hey, this is a small class I wrote that has a method for resizing an image [CODE] import javax.swing.ImageIcon; import java.awt.Image; import java.awt.Graphics2D; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.AlphaComposite; import javax.swing.JPanel; import javax.swing.JFrame; public class ImageResize extends JPanel{ private Image img; private int width,height; public ImageResize(){ ImageIcon ii = new …

Member Avatar for LianaN
0
1K
Member Avatar for Akill10

Hey, I was wondering if somebody could test this out for me? I need to know if it acts the same on other pcs as it does on mine. The game seems to randomly speed up/slow down. Can you test if it does the same? [url]http://www.filefront.com/17673747/BoundingBox.jar[/url] It's a simple space …

Member Avatar for Akill10
0
127
Member Avatar for Kuroshi

By draw itself do you mean using a method inside its own class to draw on the JPanel in another class?

Member Avatar for Kuroshi
0
591
Member Avatar for Akill10

First of all, Is it actually possible for a keyboard to be able to accept input from multiple separate keys at the same time? For instance, If I was to make a simple game like pong, and set an up and down key for each player, could both players press …

Member Avatar for Akill10
0
285
Member Avatar for Akill10

Hey, I've never really used packages before so I was wondering if what I am doing is possible. i have a package called spacewars with all my classes. I then created another package from that called spacewars.resources. I am not sure what the best way to access those resources is. …

Member Avatar for ~s.o.s~
0
100
Member Avatar for sciprog1

Well, all you need to do is paint on the panel. So in the class that extends JPanel create the paintmethod [CODE]public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g;[/CODE] then simply draw onto the panel [CODE] g2d.drawImage(bgImage,0,0,null); g2d.drawImage(character,0,0,null);[/CODE] this will draw the background image first, then draw …

Member Avatar for sciprog1
0
183
Member Avatar for Slyvr

[QUOTE=Slyvr]Not originally, but I just added it. That's not related to the issue though. The problem is doing calculations to the wallet amount in the right panel and then setting that amount onto the text field in the left panel.[/QUOTE] Of course it is related to your issue. If your …

Member Avatar for seanbp
0
116
Member Avatar for mangopearapples

[QUOTE=mangopearapples;1418794]Huh? That code is a loop isn't it? [CODE]while(right){x++;} while(!right){x--;} while(down){y++;} while(!down){y--;}[/CODE][/QUOTE] or use if statements. if(right) x++; //etc...

Member Avatar for mangopearapples
0
468
Member Avatar for Akill10

Hi, I'm a bit stumped. I'm trying to find out a way to make a bullet fly from a spaceship. So far, I managed to make it work but it attaches onto the coord's of my ship image(I used the position of this to map the starting position of my …

Member Avatar for JamesCherrill
0
346
Member Avatar for gladius33

[QUOTE=gladius33;1418939]thaaanqq u[/QUOTE] Please god don't let him come back and say that code doesn't work! Ha!

Member Avatar for ajst
0
190
Member Avatar for Akill10

Hi, I am pretty sure there is a more effective way of achieving this. Would love for some input from you guys. Basically, I have a class called GamePanel and it contains this: [CODE] SpaceShip spaceship = new SpaceShip("Galatar"); public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.drawImage(bgI,0,0,null); …

Member Avatar for Akill10
0
178
Member Avatar for endro

[QUOTE=endro;1418792]Would you suggest I rename it? I had some variables in there already though...[/QUOTE] it looks like you just mispelled the Payroll class. Payroll.setHours(i,hours);//..change everywhere you have payroll.method() I'm also not sure if you have these classes in the same file or separate files, so you will need to create …

Member Avatar for endro
0
137

The End.