|
I still need mega help on this >.<
|
|
|
|
|
|
OH I THINK I AM STARTING TO UNDERSTAND! If I let the user enter an integer as a grade, I could have an if statement that would send the correct letter grade to the class of the enum, and the enum would output the appropriate grade AND decide with a simple Boolean if the grade is passing or failing. IT ALL ADDS UP! Thank you so much for the help! I think I can finally do this problem!
I am assuming that enum is in its own class because I think that is what the teacher wants us to do :P. But I understand the logic you are using.
|
|
|
|
|
we're currently making a trial application that will display a swf on java.
Can we have some more info on how to load swf in java.
|
|
|
|
|
dfan23 wrote: Can we have some more info on how to load swf in java.
You really need to make a greater attempt to do some research for yourself before posting these questions. Use Google and search for Java and SWF.
|
|
|
|
|
|
How to return a value from one class to another class ?
|
|
|
|
|
dfan23 wrote: How to return a value from one class to another class ?
Quote Selected Text
I presume you mean instance rather than class, but in either case it is the parameter on the return statement from a method call.
|
|
|
|
|
|
use the compositionrelation between classes
one clase use another this is the best
|
|
|
|
|
I'm building my first Android app at the moment and it all seems to work well. I guess it's less complex than your average MS app but the help seems helpful and all the methods seem to be explained well.
I've got one issue with debugging which is driving me mental though.
I haven't installed the source for android so if I cause an error inside the framework the debugger reports that it can't find the source. Now, i could install the source and point the debugger to where it's living and then I'd get the code to break inside the framework code but what I'd rather do if it's possible is to get the code to break at the last point in my code before it enters the framework (most of these errors are caused by things like typos of DB fieldnames). Does anyone know if this is possible and if so how I can do this?
Cheers
Russ
|
|
|
|
|
Hi guys,
I want to make a game for Nokia phones is java possible to make games for Nokia? Please guys if u know it tell me?
Thank u
|
|
|
|
|
Take a look here[^] for some suggestions.
|
|
|
|
|
Clever! Who would of thought to search Google...
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Nagy Vilmos wrote: Clever! Who would of thought to search Google...
Fewer than 10% of new posters here
|
|
|
|
|
Richard MacCutchan wrote: Fewer than 10% of new posters here
ftfy
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
public class RunThread
{
public static void main(String[] args) throws InterruptedException
{
TwoThread tt = new TwoThread();
tt.start();
for(int i = 0;i<25;i++)
{
System.out.println("Main Thread");
}
}
}
class TwoThread extends Thread
{
public void run()
{
for(int i=0;i<25;i++)
System.out.println("New Thread");
}
}
The output of this program is always "Main Thread" displayed 25 times followed by "New Thread" 25 times. Can someone explain why this sequence is always followed? Even though a thread is already spawned, why does the main function always get executed before the new thread?
|
|
|
|
|
Since you included run in your second thread then you need to invoke that method not start so you have to change the tt.start() to tt.run()
|
|
|
|
|
When several threads are ready (i.e. not waiting on something), the Windows kernel will select one thread (actually one thread for each available core) and run it; it relies on process priority, thread priorities and historic information to decide which one(s). And it will typically reconsider only at specific points in time (some 60 times per second). As soon as a thread becomes ready or a running thread is no longer ready (e.g. it blocks on a WaitOne), it will reconsider.
Your code not having any thread synchronization leaves full freedom to the kernel, which applies a specific algorithm, so don't expect random behavior for short-lived threads.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Be forewarned: this is a difficult question; folks on StackOverflow, Eclipse forums, Sun forums, and ComEclipse support, and others have been stumped by it. If you can answer this, you're a certified programming god.
---
How can I create an SWT Variant object that contains a float array?
Since SWT's Variant type doesn't support this out of the box, here's my attempt to make this work:
public static Variant CreateVariantForArray(float[] array)
{
if(array == null){
return null;
}
short FADF_FIXEDSIZE = 0x10;
short FADF_HAVEVARTYPE = 0x80;
short fFeatures = (short) (FADF_FIXEDSIZE | FADF_HAVEVARTYPE);
int elementSize = 4;
int pvData = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT,
4 * array.length);
OS.MoveMemory(pvData, array, 4 * array.length);
int sizeofSafeArray = 12 + 4 + 1 * 8;
int pSafeArray = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT,
sizeofSafeArray);
int offset = 0;
OS.MoveMemory(pSafeArray + offset, new short[] { 1 }, 2);
offset += 2;
OS.MoveMemory(pSafeArray + offset, new short[] { fFeatures }, 2);
offset += 2;
OS.MoveMemory(pSafeArray + offset, new int[] { elementSize }, 4);
offset += 4;
OS.MoveMemory(pSafeArray + offset, new int[] { 0 }, 4);
offset += 4;
OS.MoveMemory(pSafeArray + offset, new int[] { pvData }, 4);
offset += 4;
OS.MoveMemory(pSafeArray + offset, new int[] { array.length }, 4);
offset += 4;
OS.MoveMemory(pSafeArray + offset, new int[] { 0 }, 4);
offset += 4;
int pVariant = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
short vt = (short) (OLE.VT_ARRAY | OLE.VT_R4);
OS.MoveMemory(pVariant, new short[] { vt }, 2);
OS.MoveMemory(pVariant + 8, new int[] { pSafeArray }, 4);
return new Variant(pVariant, OLE.VT_VARIANT);
}
It doesn't work. Any idea why? Or better yet, got any code that takes a float[] and gives back a Variant?
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|
|
Here is a thought, What is an array? an array is a collection of elements. The array has size right, then why not use a for loop with that size and loop over the float array and pass the value in each iteration to the method that does the manipulation .
|
|
|
|
|
You're suggesting something like
float[] myFloats = new float[] { 4.2, 7.5 };
for (int i = 0; i<myFloats.length; i++)
{
automation.Invoke(bazMethodId, myFloats[i]);
}
That doesn't work, I'm afraid. The 3rd party COM object expects an array, not a float. Passing in a float results in an exception.
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|
|
Whats the name of the COM product?
|
|
|
|
|
I'm not at liberty to say, actually. It's a legacy COM object from the 1990s. It is no longer being supported by its authors, but we cannot yet migrate away from it.
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|
|
What does the COM understand (i mean an array of type?) and on the receiving side what are you guys doing?
|
|
|
|