Search Results

Showing results 1 to 40 of 122
Search took 0.01 seconds.
Search: Posts Made By: TheWhite
Forum: Java Sep 10th, 2009
Replies: 3
Views: 210
Posted By TheWhite
I know all that already, but it doesn't explain how I can get the image from a different package in the same project...

getClass().getResource(...)

package OtherApp:
icon.jpg


package...
Forum: Java Sep 10th, 2009
Replies: 3
Views: 210
Posted By TheWhite
I have 1 package that manages the main JFrame of my application.
This JFrame needs to access an image (which is a resource) of another package.

I was able to get it to work using:
new...
Forum: Java Sep 7th, 2009
Replies: 12
Views: 560
Posted By TheWhite
Thread.join() Waits for this thread to die. (http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#join%28%29)

Just think about what this thread does.
It does something in a while...
Forum: Java Aug 31st, 2009
Replies: 10
Views: 870
Posted By TheWhite
Let me just show you a little quirk I have with your code, and let me note that the way you are doing it can work, but there's a better way.... it will make it easier for you, and me, and anyone else...
Forum: Java Aug 31st, 2009
Replies: 12
Views: 560
Posted By TheWhite
Glad you got it working :).

Let me show you how I did it with minimal code added to the SecTimer class:


import java.util.Timer;

public class SecTimer {

cThread thread; //create...
Forum: Java Aug 31st, 2009
Replies: 10
Views: 870
Posted By TheWhite
What do you mean Player = one.setHand()? "one" is already a player right? and "one" already exists in the main game.... "Player =" ??

one.setHand(Hand hand); would set the hand.
one.getHand();...
Forum: Java Aug 30th, 2009
Replies: 10
Views: 870
Posted By TheWhite
First, your function getHand() is a little misleading.

When you "get"Something(), it should always return the value of the Something, in that class.
Likewise, when you "set"Something() (what you...
Forum: Java Aug 28th, 2009
Replies: 23
Views: 1,129
Posted By TheWhite
From the code I gave you up top, take out the main method, then make a Class which extends JApplet that calls the new Class() that I gave you in its constructor.

Thats it... It only takes 2...
Forum: Java Aug 27th, 2009
Replies: 23
Views: 1,129
Posted By TheWhite
The whole painting on 1 canvas isn't really java oo, but i guess its still doable if your hard pressed on doing it that way.

Point p = new Point(Number.x, Number.y);
Math.max() will return the...
Forum: Java Aug 26th, 2009
Replies: 12
Views: 560
Posted By TheWhite
This piece of code isnt right for many reasons...

@Override
public void run() {

Thread runnable = new Thread(new TimerThreads()); //what does this do?
runnable.start();

...
Forum: Java Aug 26th, 2009
Replies: 23
Views: 1,129
Posted By TheWhite
I'll do you 1 better. I spit this out in a few minutes from some older source code I had.


import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;...
Forum: Java Aug 26th, 2009
Replies: 12
Views: 560
Posted By TheWhite
Wheres the subclass?

You are not overriding run() because SecTimer does not extend Thread or implement Runnable..

And what is this:
Runnable runnable = new TimerThreads();
runnable.run();
...
Forum: Java Aug 26th, 2009
Replies: 23
Views: 1,129
Posted By TheWhite
I see what your doing. You are drawing everything using the Applets paint() function. Opps on my part -- I didn't bother to look :)

Java is object oriented. I would have made each box an object...
Forum: Java Aug 26th, 2009
Replies: 5
Views: 352
Posted By TheWhite
I came across something called:
JIntellitype (http://melloware.com/products/jintellitype/index.html)

Its basically a java package which includes a (.dll) library and a HotkeyListener which...
Forum: Java Aug 25th, 2009
Replies: 23
Views: 1,129
Posted By TheWhite
That was for the previous post.

Maybe a combination of a JButton and a JTextField. The JButton would use an ActionListener, when clicked, a JTextField would be placed in its place which is...
Forum: Java Aug 25th, 2009
Replies: 23
Views: 1,129
Posted By TheWhite
I would make a class called Box which extends any kind of Container (a simple one at most, maybe even Container itself). Something like a JTextArea wouldn't really work out since you can only add...
Forum: Java Aug 25th, 2009
Replies: 5
Views: 352
Posted By TheWhite
I'm making an app that, when executed will continue to do something in an infinite loop, forever (or until the process is manually stopped).

My goal is to create a process with a unique name which...
Forum: Java Aug 25th, 2009
Replies: 23
Views: 1,129
Posted By TheWhite
You want to open an applet using another applet? It would make sense for an Applet to open a JFrame or a JFrame to open another JFrame, but not for an Applet which opens another Applet.... Applets...
Forum: Java Aug 25th, 2009
Replies: 6
Views: 297
Posted By TheWhite
Got it. Just a little more research and I found this:

Point mPoint = MouseInfo.getPointerInfo().getLocation();
Forum: Java Aug 25th, 2009
Replies: 6
Views: 297
Posted By TheWhite
I noticed that the Robot class gives you functions to move and click the mouse. Is there a way to get the position the mouse is currently in or am I missing something? Remember, im talking about on...
Forum: Java Aug 24th, 2009
Replies: 12
Views: 560
Posted By TheWhite
All the thread would have to do is sleep for a second then call the function tick() .

tick() would increment SecTimer's sec, min, or hour vars depending on what the values already are.

Your...
Forum: Java Aug 24th, 2009
Replies: 6
Views: 297
Posted By TheWhite
You are the man Ezzaral. Any time I try to do something unconventional with java, you always have an answer :).

I will try this out now!
Forum: Java Aug 24th, 2009
Replies: 6
Views: 297
Posted By TheWhite
Yep. Ive used it before. I was just wondering if there was a way to do it in java without having a JFrame open in order for it to recognizes a component.
Forum: Java Aug 24th, 2009
Replies: 6
Views: 297
Posted By TheWhite
I'm trying to make an app that will memorize 1 point on the screen and continuously click that point (running on a timer) until it is manually stopped.

I've noticed that the mouse functions...
Forum: Java Aug 24th, 2009
Replies: 7
Views: 740
Posted By TheWhite
Why not use the windows shortcut hotkey to run your java program? All you have to do is create a shortcut and define it a hotkey which will cause it to start. You can have your app automatically...
Forum: Java Aug 21st, 2009
Replies: 10
Views: 870
Posted By TheWhite
Every player has a Hand which could be:
A rock, A paper, or A scissor

Every player could have:
A name, A hand, A number of Wins, A number of Losses, and a choice that will affect his hand/number...
Forum: Java Aug 21st, 2009
Replies: 4
Views: 683
Posted By TheWhite
Excellent. Thank you Ezzaral. You've been a great help. I've never used System.getProperty() until now. This will be very useful.

I've also took your function a little further and modified it into...
Forum: Java Aug 21st, 2009
Replies: 4
Views: 683
Posted By TheWhite
Thanks Ezzaral.

I'm a little unsure of how I would extract just that 1 file, but I guess its necessary.

Is there a better way I can get an absolute path to a file without using that junky...
Forum: Java Aug 21st, 2009
Replies: 12
Views: 560
Posted By TheWhite
Threads were a real tease for me cause I learned of them on my own too.

1 thing that will help you understand is that a Thread need only contain 1 function and an optional constructor.


public...
Forum: Java Aug 20th, 2009
Replies: 4
Views: 683
Posted By TheWhite
Ok, this one is a little tough for me to explain.

I have a runnable jar file that contains a .exe that I'm trying to exec in my program like a command line function.

Usually to execute a .exe...
Forum: Java Aug 20th, 2009
Replies: 3
Views: 439
Posted By TheWhite
hmm... well thats funny..

You are correct.. Here I specified the cmd with 2 \'s, but ur way also works when line is given as a paramater, using only 1 \'s.

I guess java automatically throws in...
Forum: Java Aug 20th, 2009
Replies: 3
Views: 439
Posted By TheWhite
String line = "Extracting from E:\\Junk\\morejunk\\file.txt";
System.out.println(line); //prints: Extracting from E:\Junk\morejunk\file.txt

String[] splitPath =...
Forum: Java Aug 14th, 2009
Replies: 5
Views: 423
Posted By TheWhite
and how did you create the clip?
Forum: Java Aug 14th, 2009
Replies: 5
Views: 615
Posted By TheWhite
If you are trying to make some kind of encryption or possibly a random password maker u can use random ascii decimal values between 32-126. (look at http://www.asciitable.com/)

all you would have...
Forum: Java Aug 14th, 2009
Replies: 9
Views: 488
Posted By TheWhite
You are not really telling us what is happening exactly that makes it look messed up....

Additionally, you can use a null layout in your JPanel, but you will have to use setLocation(int x, int y)...
Forum: Java Aug 14th, 2009
Replies: 5
Solved: increment
Views: 247
Posted By TheWhite
You want changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)

* toggle: false, extend: false. Clear the previous selection and ensure the new cell is selected.
*...
Forum: Java Aug 13th, 2009
Replies: 6
Views: 342
Posted By TheWhite
I only skimmed over your code.

I sometimes use a class called Global which contains a list of functions defined statically. Any class can then call Global.function(arg0) on any of the Global...
Forum: Java Aug 13th, 2009
Replies: 18
Views: 529
Posted By TheWhite
You also need try catch statements to catch the exceptions when someone enters something wrong. I wish ya the best of luck.
Forum: Java Aug 13th, 2009
Replies: 18
Views: 529
Posted By TheWhite
I'm going to give you what I did in a nutshell. Try to study it so you can better understand the better way of doing it.


import java.util.Scanner;

public class Family {
static Scanner input...
Forum: Java Aug 13th, 2009
Replies: 18
Views: 529
Posted By TheWhite
You are over complicating things.... You gotta think a little bit differently when programming...

You do not have to make several different choice variables. Remember, the user makes 1 and only 1...
Showing results 1 to 40 of 122

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC