This is for anyone who might find it helpful. This template... * uses double-buffering, which can help game-makers fix that glitchy screen problem * can be exported as a runnable jar file. If you're like me and had trouble making your Applet executable, this is a possible fix. * Additionally … |
|
Re:
Why compiler gives me error when I call object MyObject ? public class ThisIsClass { public static void main(String[] args) { MyObject loan = new MyObject(); //error should be ThisIsClass loan = new ThisIsClass(); System.out.println(loan.toString()); } } It works fine when I change name of my class to MyObject or … |
|
The setSize() method of a Frame only resizes the frame itself, not the canvas inside. Is there a way to resize a frame based on what size you want the interior to be? I made this image to explain what I'm talking about: I used setSize(500,500); http://oi44.tinypic.com/4uymur.jpg I suppose I … |
|
If I am given the exact coordinates of three vertices in image-space (as in, the numbers are not integers, but can be rounded to find their location on the screen), how can I determine which pixels are inside the triangle and should be colored? If you look at the diagram … |
|
So I have a PrintWriter as a class variable which is created upon initialization. I want to make sure it gets closed when the Applet closes, but overriding the destroy() method doesn't seem to work (a System.out.println inside the method does not appear). 1. should I be doing this in … |
|
Right now I know that Applets can add any listener with the addMouseListener() method. But what I want to know is if I can make my custom class a mouse listener without having an Applet add it itself. |
|
Re:
Hi everyone! So, I hereby hope to show that I've made progress in coding java (largely due to the help of this great community). I want to thank everyone for dealing with me (especially James). :) The goal: The code below is supposed to seed a layout of boats into … |
|
Re:
Write a C# program to maintain personal information and wages of employees in an organization. The “Employee” class has different attributes like first name, last name, address, email and age as well as methods, (a) to calculate the weekly earnings (salary) of each of the employees, (b) to calculate yearly … |
|
**Does the code** int value = 5; if(value==5) System.out.println("value is 5"); if(value==6) System.out.println("value is 6"); **actually compute faster than** int value = 5; if(value==5) System.out.println("value is 5"); else if(value==6) System.out.println("value is 6"); **?** I would assume that it *is* faster, based on its name and all, but is that actually … |
|
An **applet** I am creating **uses Timers for its animation**. Even though the Timer is set to repeat at a constant 30ms, **the applet's framerate on my computer** versus on my brother's laptop **is significantly better**. Is there a chance that **on slower computers**, the **Timer "ticks" slower**, so to … |
|
My applet creates a new sound every time an impact occurs, which is very frequently. How come, when the sounds become too numerous, the game ceases to run smoothly? Here is the code that gets called many, many times: class soundThread extends Thread { String sound; soundThread(String i_sound) { sound … |
|
Re:
Does a Java applet have to contain a "main" method or does it run from the "init()" method. I have written a small game in java following and example in a book however it does not tell you how to run the damn thing. Code has no erros from what … |
|
I'm probably doing this wrong, because there has to be a way to do this. Here is my current code: import javax.sound.sampled.*; public class soundHandler{ soundHandler() { } public void newSound(String sound) { new soundThread(sound).start(); } } class soundThread extends Thread { String soundName; Clip clip = null; soundThread(String i_soundName) … |
|
**Background**: I have some experience in programming, but it's not a lot and not very good. I'm taking my first Java class this year, but because the pace is so slow I decided to just learn with the aid of the internet. This is how I have learned most of … |
|
I have two classes: (1) **Class A**, which extends JApplet, implements Runnable + some Listener stuff (2) **Class B**, which has a main method and is not an applet My question is, how do I create **class A** with **class B**'s main method? Is this even possible? What I'm doing … |
0 Reputation Points
~6K People Reached
Favorite Forums
Software Development
x
31
Computer Science
x
4