286 Posted Topics

Member Avatar for sirlink99

I have an error when I shorten 3 lines of code to one. How come this code works [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Vector; public class Draw extends JPanel implements KeyListener, Runnable, ActionListener{ Vector<Wall> walls = new Vector<Wall>(); Vector<Enemy> enemy = new Vector<Enemy>(); Player p = new …

Member Avatar for sirlink99
0
222
Member Avatar for xiangzhuang

use a for loop, and have an answer variable that is set to 1. then decrement the for loop, and then multiply the number in the for loop to the number in the answer, and once you are done return the answer.

Member Avatar for JamesCherrill
0
429
Member Avatar for xiangzhuang

posting empty methods as your attempt will not get you any replies. please try something, and then post the code if it doesn't work. If you are stuck look through the api, and see what you can find.

Member Avatar for stultuske
0
140
Member Avatar for federerforehand

you need to indent everything inside the brackets for example [CODE] bracket1{ inBracket1{ variableInBracket1 } variableBracket1 } [/CODE] so your code should look like this [CODE] public class printCards { public static void main (String []args) { int x = 0; // keeps count of how many card final int …

Member Avatar for hfx642
0
221
Member Avatar for ali11
Member Avatar for some00001

try using the different Math funcions that are implemented into java [CODE] Math.round(); Math.random(); [/CODE]

Member Avatar for DarkLightning7
0
91
Member Avatar for TheHelp

There is no get text method for a JButton. assign the text as a variable, and then just use that to print out, and set the text on the JButton

Member Avatar for TheHelp
0
95
Member Avatar for pyro 214

you could use something like this to get an idea. As a starter you will start at the lower end of the scale. [url]http://www.payscale.com/research/CA/Job=Software_Engineer_%2F_Developer_%2F_Programmer/Salary[/url]

Member Avatar for Ancient Dragon
0
1K
Member Avatar for Vreality

The second example [URL="http://download.oracle.com/javase/tutorial/uiswing/components/textfield.html"]here[/URL] is a search through the text. all you would need to do is read the .txt file and store it as a string. then display it in the text field to search through.

Member Avatar for Vreality
0
240
Member Avatar for sirlink99

I am wondering what the difference is. So far what I think is correct is that software engineering is more user oriented, and less efficiency oriented, while computer science is more computer orientated, and focuses on using memory the most efficient way. This is important in bigger projects such as …

Member Avatar for Netcode
0
314
Member Avatar for sirlink99

I got this error, when the bullet collides with the enemy. [CODE] 341, 458 null 341, 458 null 341, 458 null 341, 456 java.awt.Rectangle[x=340,y=75,width=50,height=50] 341, 456 java.awt.Rectangle[x=325,y=45,width=50,height=50] 341, 456 java.awt.Rectangle[x=479,y=15,width=50,height=50] 341, 454 java.awt.Rectangle[x=340,y=76,width=50,height=50] <CUT THIS OUT. ABOUT 1000 LINES LIKE THE ONES ABOVE> 305, 352 java.awt.Rectangle[x=222,y=36,width=50,height=50] 305, 352 java.awt.Rectangle[x=299,y=6,width=50,height=50] 341, …

Member Avatar for sirlink99
0
203
Member Avatar for sirlink99

It will soon be time for me to choose where to go to post secondary. I am wondering what schools people suggest preferrably in Ontario, Canada. I plan to go for Software/Video Game development/programming (because of my lack of artistic ability), Web Development, and Mobile development. I will accept any …

Member Avatar for sirlink99
0
223
Member Avatar for j23

if you assigned a variable called inputSum and then called the average method with the parameter inputSum then you could do the same thing, except you wouldn't need to add your numbers in the average method.

Member Avatar for hiddepolen
0
166
Member Avatar for lbgladson
Member Avatar for sirlink99
0
1K
Member Avatar for sirlink99

If I have a himachi server running is there a way to send a file into a specific folder on a different computer without them having the client? For a file transfer like program that the recipient does not need to download?

Member Avatar for sirlink99
0
47
Member Avatar for Onlineshade
Member Avatar for Mi_99

make the previousInput equal to the result, and then reuse it when you do another calculation previousInput = 3 currentInput = 2 Sign = * previousInput = result = 3*2 = 6 next operation previousInput = 6 currentInput = 1 sign = - previousInput = result = 6-1 = 5

Member Avatar for sirlink99
0
189
Member Avatar for J-Dub
Member Avatar for sirlink99
0
258
Member Avatar for sirlink99

I am making hearts, and I cannot seem to add all the cards to the deck. here is my code [CODE] import java.lang.reflect.Array; import java.util.Vector; public class Hearts { String cards[][] = {{"Spade ", "Heart ", "Club ", "Diamond "}, {"A","2","3","4","5","6","7","8","9","10","J","Q","K"}}; Vector <String> deck = new Vector<String> (); String player1[] …

Member Avatar for sirlink99
0
123
Member Avatar for gahhon
Member Avatar for plasticfood

Use println to see if all of your code is executing. also you have super.paintComponent(g); in both of your codes. make sure that they are not interfering with each other. maybe try calling one paint from the other.

Member Avatar for plasticfood
0
144
Member Avatar for sirlink99

I have an array of cards. It looks like this [CODE] String cards[][] = {{"Spade", "Heart", "Club", "Diamond"}, {"1","2","3","4","5","6","7","8","9","10","J","Q","K"}}; [/CODE] how would I get the suit and the "rank" of the card. I have tried [CODE] System.out.println (cards[1][5] + " of " + cards [1]); [/CODE] but that gave me …

Member Avatar for Taywin
0
224
Member Avatar for mrjillberth

maybe try reading this [url]http://en.wikipedia.org/wiki/ElGamal_encryption[/url] What I know of encryption so far is that it uses matrices to hide the message. for example [ [ = one large [ lets say your encryption matrix is [1 2] [a b] [3 4] [c d] your decryption matrix would be 1r(ad-bc) [d …

Member Avatar for mrjillberth
0
1K
Member Avatar for Dante2

If you just wanted to test it out you could make a desktop os like running XP in a VM. It would involve all of the difficulties of making it boot up os, but it would still be impressive. Then later you would only need to make minor changes to …

Member Avatar for JeffGrigg
1
406
Member Avatar for sirlink99

I am trying out something new and I am wondering if this is valid and is not working because of some other code glitch. Graphics class: [CODE]import java.awt.*; import javax.swing.JPanel; public class Drawing extends JPanel{ KeyCommands kc = new KeyCommands (); public void startGraphics (){ System.out.println ("Adding KeyListener"); addKeyListener (kc); …

Member Avatar for sirlink99
0
151
Member Avatar for gahhon

couldn't you do [CODE] public double (double number1, double number2){ return (Math.pow(number1, number2)); } [/CODE]

Member Avatar for gahhon
0
149
Member Avatar for sirlink99

I am trying to do basic animations with images, and I am wondering how I could get a smaller image from a larger one without going through and editing it. I made a sprite [URL="http://translate.google.com/translate?hl=en&u=http%3A%2F%2Fwww.famitsu.com%2Ffreegame%2Ftool%2Fchibi%2Findex1.html"]here[/URL] and downloaded the image. As you see in the thumbnail the animation is from all …

Member Avatar for sirlink99
0
268
Member Avatar for sirlink99

I have this laptop, and whenever I press the power button it lights up. Then when the windows loading screen would pop up, it is just a pure black screen (no line for the bios boot up). And then it freezes there. I managed to turn it on today, and …

Member Avatar for sirlink99
0
171
Member Avatar for sirlink99

I am taking data management this year, and we are currently learning about matrixes. I know they are used to encrypt things, and the teacher even used it as an example. my problem is the following. We are only learning how to encrypt and decrypt using a 2x2 matrix. That …

Member Avatar for Ezzaral
0
114
Member Avatar for sha11e

readInt and readLine (except this could be numbers as well maybe use a for loop to see if each character is a letter)

Member Avatar for NormR1
0
305
Member Avatar for srinidelite

I made a snake game as well so if you would like to inspect my code after you fix yours to see how you could improve efficiency, just message me.

Member Avatar for srinidelite
0
196
Member Avatar for javaNooblet

if you are using if statements then I would suggest you store the last value in each textfield then you compare them to see if they are not equal (has been changed) then you can recalculate the rest of the values using the one you used in the if statement. …

Member Avatar for NormR1
0
4K
Member Avatar for sirlink99

I am just learning how to use sockets, and I have managed to get my server to send a message to my socket, but when I try to send a message from my socket to my server I get an error. Here are my codes Server: [CODE] package BasicNIO; import …

Member Avatar for NormR1
0
315
Member Avatar for theadjectivenou

maybe have it declared and set separately [CODE] int j; j = 1; [/CODE]

Member Avatar for Ezzaral
0
147
Member Avatar for isebas

gender is a string use .equals (); put the "m" into quotes inside the brackets to compare the two strings

Member Avatar for isebas
0
236
Member Avatar for jtodd

The previous post was right about the first error. For the second one try this code [CODE] Phone application = new Phone(); application.runPhone(); [/CODE] then add a method in your phone like so [CODE] public void runPhone (){ Phone p = new Phone (); } [/CODE] That may fix the …

Member Avatar for JavaStudent321
0
432
Member Avatar for sirlink99

I am making a website and the header is not displaying properly in chrome. It only shows a couple of rows of pixels and then it stops. [URL="agnes-fitness.com"]Here[/URL] is the site. Another smaller problem is that if you refresh a couple of times in ie the header will be stretched. …

Member Avatar for teedoff
0
40
Member Avatar for sirlink99

I am making a website and I have a little problem with it on IE and opera, but IE is the bigger issue. I have 2 images the first one is what it looks like on IE and the second one is what it is supposed to look like. What …

Member Avatar for tiggsy
0
98
Member Avatar for sirlink99

I get this error when I run my applet on a website [CODE] Java Plug-in 1.6.0_26 Using JRE version 1.6.0_26-b03 Java HotSpot(TM) Client VM User home directory = C:\Users\Adam ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump …

Member Avatar for mKorbel
0
517
Member Avatar for sirlink99

I have a css menu that changes sizes for no apparent reason. This is my whole css code [CODE]style.css: body { background: url('Images/testBackg.jpeg') 50% 50% no-repeat; } #images{ margin-top:10px; margin-bottom:10px; } #labelId { float:left; } #inputId { float:right; } #contactForm { max-width:50%; min-width:50%; } #headerWrap { margin-left: auto; margin-right: auto; …

Member Avatar for sirlink99
0
103
Member Avatar for sirlink99

I have made a simple java program that gets a user to fill out a form, and then checks if all the parts were filled out. I am now having trouble with how to send the file in an email to a set users email account. How could I do …

Member Avatar for sirlink99
0
241
Member Avatar for sirlink99

I am not sure where this could go, but I believe this is the most appropriate forum. I am wondering how to cast a number to a character in actionscript. I have the key code and I would like to cast it as a character so that I can then …

0
59
Member Avatar for pudgeeboy

cout<<i is c++ not Java if you need to have the conditions of 1 - 100 [code] for (int i = 1; i <= 100; i++){ // loops from 1 - 100 if (i <=35){ // checks if it is between 1 and 35 System.out.println (i); // prints out the …

Member Avatar for Anuradha Mandal
0
158
Member Avatar for singh_soorma94

I have in a couple of comments in some areas, but they are generic. you can delete them if you wish. I have already released my code on thetechgame.com. Anyways here is the main part of the code the frame portion is separate. [CODE] package snakeColored; import javax.swing.*; import java.awt.event.*; …

Member Avatar for sirlink99
0
161
Member Avatar for muff1n

you want to use graphics. You also want to implement MouseMotionListener, and KeyListener, which are both located in java.awt.event. I suggest you look through the API docs to find out how to make a JFrame, and how to set the layout. But the combo box and JFrame are located in …

Member Avatar for muff1n
0
179
Member Avatar for kehayov

you don't actually need anything in your for statement. It will result in an infinite loop though, unless you use a break statement, like the OP used.

Member Avatar for JeffGrigg
0
163
Member Avatar for sirlink99

I have this problem, that whenever I set the frame size using the setSize () method the size inside the frame is actually smaller, because the frame size is included in this dimension. My question is how would I make it so that the inside of the frame is the …

Member Avatar for JamesCherrill
0
149
Member Avatar for sirlink99

I am trying to export a project using eclipse, and the Images that I have in a separate folder do not export. I have tried to use [icode]image = new ImageIcon (Toolkit.getDefauleToolkit ().getImage("Image/image.png"));[/icode] and [icode]image = new ImageIcon (ImageIO.read (new File ("Image/image.png")));[/icode] and neither of them worked. It works when …

Member Avatar for sirlink99
0
1K
Member Avatar for sirlink99

I am trying to save an image with this line [CODE]ImageIO.write(image, "JPG", new File(fileDestination.getText()));[/CODE] but it is giving me an error. [CODE] java.io.FileNotFoundException: C:\Users\Adam (Access is denied) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<init>(Unknown Source) at javax.imageio.stream.FileImageOutputStream.<init>(Unknown Source) at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(Unknown Source) at javax.imageio.ImageIO.createImageOutputStream(Unknown Source) at javax.imageio.ImageIO.write(Unknown Source) at screenCapture.CaptureScreen.actionPerformed(CaptureScreen.java:111) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) …

Member Avatar for NormR1
0
319
Member Avatar for lashbandi

The messages.length returns an int. It tells you how many messages you have. If you replace the 5 here [CODE]System.out.println("Message " + (int)(5*Math.random()));[/CODE] with your max value passed into the method you will not have to constantly update that number, as it will always be passed in with the new …

Member Avatar for sirlink99
0
282

The End.