Search Results

Showing results 1 to 40 of 100
Search took 0.01 seconds.
Search: Posts Made By: Alex Edwards ; Forum: Java and child forums
Forum: Java Apr 29th, 2009
Replies: 10
Views: 893
Posted By Alex Edwards
If you post your files, people will be more willing to help because it gives them time to look at your logic and help you understand which steps to take to complete your project.
Forum: Java Nov 22nd, 2008
Replies: 7
Views: 937
Posted By Alex Edwards
Unfortunately, the implementation of ArrayList<T> looks [something] like this--


//... necessary imports

public class ArrayList<T> extends List<T> implements Collection<T>, Serializable{

...
Forum: Java Nov 22nd, 2008
Replies: 7
Views: 937
Posted By Alex Edwards
You'll probably have to reposition your read-stream cursor after each object read, otherwise you won't retrieve the right byte value from the file to match the data type(s) for the Object you are...
Forum: Java Nov 12th, 2008
Replies: 8
Views: 759
Posted By Alex Edwards
Chances are likely that your Instructor wishes for both your getArms and getLegs methods to return an array of Limbs--



Arm[] getArms(){


return arms;
}
Forum: Java Nov 12th, 2008
Replies: 28
Solved: Weird Question
Views: 1,727
Posted By Alex Edwards
If you work in an environment similar to mine, you'll have people telling you to "GIYF!" quite a bit XD.

If there is a term you don't understand, you should definitely study it. I find it much...
Forum: Java Nov 10th, 2008
Replies: 28
Solved: Weird Question
Views: 1,727
Posted By Alex Edwards
Reflection is a very specialized solution, much like the Java Native Interface, Remote-Method Invocation, Wildcards, Design Patterns, transient values, volatile values, concurrency, etc.

Don't...
Forum: Java Nov 8th, 2008
Replies: 28
Solved: Weird Question
Views: 1,727
Posted By Alex Edwards
Use either TreeMap (http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html) or HashMap (http://java.sun.com/javase/6/docs/api/java/util/HashMap.html)

Dictionary is also an okay way to go,...
Forum: Java Nov 2nd, 2008
Replies: 4
Views: 626
Posted By Alex Edwards
http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html


import java.math.BigInteger;

public class TestingBigInteger{


public static void main(String... args){
Forum: Java Oct 23rd, 2008
Replies: 10
Views: 887
Posted By Alex Edwards
Yes, I am very sorry for mixing static fields and members. Fields execute once and only once when the first object of the type is created (otherwise if a program executed all static fields of all...
Forum: Java Oct 23rd, 2008
Replies: 10
Views: 887
Posted By Alex Edwards
static values are resolved at compile time, before objects are created.

A static member of a class is a shared location in memory between objects of that class.

Because static values are...
Forum: Java Oct 22nd, 2008
Replies: 12
Views: 1,726
Posted By Alex Edwards
It may be possible that Java won't support an image-type in future releases and therefore not provide Serialization support for it but that depends on what it is.

I remember getting warning...
Forum: Java Oct 16th, 2008
Replies: 4
Views: 793
Posted By Alex Edwards
I don't believe Menus or certain 'Views' would be possible without some type of Composite structure, so a reference to a Collection (or more appropriately, a Composite) within a Collection is good...
Forum: Java Oct 16th, 2008
Replies: 4
Views: 793
Posted By Alex Edwards
Ok, let me see if I understand what you're asking.

Let's first determine what a collection is.

Collection (programming) - a structure that holds many objects of some type (in old versions of...
Forum: Java Oct 14th, 2008
Replies: 3
Views: 3,565
Posted By Alex Edwards
This managed to work for me--


import java.util.*;

public class TestClass1{
static String seatLayout = null;
static String fn = null;

public static void main(String... args){
Forum: Java Oct 14th, 2008
Replies: 11
Views: 1,353
Posted By Alex Edwards
You could use a State Machine, or State Pattern based on how many times an object has been encountered, or the State of an object can depend on the type of object it encounters...

It may simplify...
Forum: Java Oct 13th, 2008
Replies: 11
Views: 1,353
Posted By Alex Edwards
Would an Adapter be overkill?

I.E.




public class AdaptedA<T extends A> extends A{

private T myType = null;
Forum: Java Oct 13th, 2008
Replies: 11
Views: 1,353
Posted By Alex Edwards
Bah, disregard this post >_<



public <T extends A> void doSomething(T type){

if(type instanceof [SpecialNeedClass]){
// typecast only for this type
}
//...
Forum: Java Sep 24th, 2008
Replies: 5
Views: 1,028
Posted By Alex Edwards
This might help--


public class NullTest{

public static void main(String... args){

Object obj = null;
System.out.println(determineNull(obj));
obj = new Object();
Forum: Java Sep 24th, 2008
Replies: 4
Views: 500
Posted By Alex Edwards
I marked the Thread daemon as a good practice. Unfortunately it makes the example hard to see, the way the code is currently written. Consider this example instead--


import javax.swing.*;
...
Forum: Java Sep 24th, 2008
Replies: 5
Views: 649
Posted By Alex Edwards
Though Stephen has already pointed this out, you need to get rid of the access modifiers when declaring data types in your main method.

The reason is because it is irrelevant for a method to have...
Forum: Java Sep 24th, 2008
Replies: 4
Views: 500
Posted By Alex Edwards
Why exactly does class B have to extend A?

From an immediate glance I can see a potential cycle instantiation issue.

Think about it--

1) Class A, after static initialization, will...
Forum: Java Sep 20th, 2008
Replies: 3
Views: 761
Posted By Alex Edwards
Because I don't like to repeat myself (http://www.daniweb.com/forums/thread142503.html) =P
Forum: Java Sep 16th, 2008
Replies: 10
Views: 1,003
Posted By Alex Edwards
Sometimes the best way to test to see if something is concurrent or not is to use a tracing technique.

Basically split the code that is shared by threads onto different pieces of paper and pretend...
Forum: Java Sep 16th, 2008
Replies: 10
Views: 1,003
Posted By Alex Edwards
Here's yet another example, though probably overkill--


import java.util.concurrent.*;
import java.net.*;

public class ConcurrentExample{

public final ExecutorService es;
private Future...
Forum: Java Sep 16th, 2008
Replies: 10
Views: 1,003
Posted By Alex Edwards
I don't think it's the run method that isn't executing, Peter.

I think the problem is that you are not submitting a Runnable target as the argument for the Thread to execute.

I actually don't...
Forum: Java Sep 14th, 2008
Replies: 2
Views: 1,617
Posted By Alex Edwards
Maybe this will do the trick?


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Ball extends JApplet implements MouseListener {
private MyThread blueBall[]...
Forum: Java Sep 13th, 2008
Replies: 6
Views: 1,672
Posted By Alex Edwards
After running some tests I realized that somehow your transform is jumping between 1-22 on the (result?) matrice--


import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;...
Forum: Java Sep 9th, 2008
Replies: 3
Views: 4,386
Posted By Alex Edwards
From what I understand, all objects are saved as .dat files for Java to reinterpret back into an object during deserialization.

To save files with an extension, I'd assume you'd use...
Forum: Java Sep 9th, 2008
Replies: 9
Views: 2,006
Posted By Alex Edwards
Yes, this version is much easier to understand.

Also the DataInputFilterStream is flawed and will only work for the InputStream provided by the System class, and does not work well with files.
...
Forum: Java Sep 9th, 2008
Replies: 9
Views: 2,006
Posted By Alex Edwards
This approach was probably unnecessary, but I took it anyways.

Try this--


import java.io.*;

public class DataInputFilterStream extends FilterInputStream{

public...
Forum: Java Sep 1st, 2008
Replies: 4
Views: 5,521
Posted By Alex Edwards
Personally I'd read all of the characters into a String then tokenize the String based on the space character.
Forum: Java Aug 30th, 2008
Replies: 4
Views: 5,521
Posted By Alex Edwards
The problem is that your Charact method is stuck in the while loop. You obtain the length of the file and state the conditon numChar != -1.

Keep in mind what data types are for. They store a copy...
Forum: Java Aug 30th, 2008
Replies: 12
Views: 1,088
Posted By Alex Edwards
Errors 1, 2 (and most likely 3) are generated because third.getPages is being parsed as a variable that exists within the Class associated by the object third.


total=first.getPages()+...
Forum: Java Aug 25th, 2008
Replies: 11
Views: 3,378
Posted By Alex Edwards
There are a lot of questions...

First, will resizing the screen be an issue at all? If not then you could make a custom track using GeneralPath and Graphics2D fairly easily.

You could do so...
Forum: Java Aug 25th, 2008
Replies: 11
Views: 3,378
Posted By Alex Edwards
Why not g.fillOval()?

Also, will repainting be an issue? How much detail will be displayed on your screen? Are you at all using images?

A lot of questions come to mind since this seems like an...
Forum: Java Aug 22nd, 2008
Replies: 14
Views: 3,010
Posted By Alex Edwards
Do you want to draw an image from a file, or do you want to be able to "rotate" a set of pixels such that they emulate a rotating String?

This can be either really simple or hard depending on...
Forum: Java Aug 22nd, 2008
Replies: 8
Views: 1,615
Posted By Alex Edwards
I suppose you're using a GCanvas, or most likely the GraphicsProgram from the acm.program package?

You could have GCanvases pre-painted with components and when you advance a level, simply set the...
Forum: Java Aug 22nd, 2008
Replies: 8
Views: 1,615
Posted By Alex Edwards
Although I haven't attempted it before, I'd assume you'd have a particular zone renderred on the screen with a type of "cover" over it. Either that or only render certain pixels ahead of the borders...
Forum: Java Aug 21st, 2008
Replies: 3
Solved: primary key
Views: 748
Posted By Alex Edwards
Javascript is in the web development section, not here =/
Forum: Java Aug 17th, 2008
Replies: 7
Views: 1,346
Posted By Alex Edwards
I didn't pay close attention to the first post. Apparently JFrame has an initial Layout of BorderLayout.

The OP added the TextArea to the Center Border. By simply adding the JMenuBar, I suppose it...
Showing results 1 to 40 of 100

 


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

©2003 - 2009 DaniWeb® LLC