Search Results

Showing results 1 to 34 of 34
Search took 0.01 seconds.
Search: Posts Made By: Alex Edwards ; Forum: Java and child forums
Forum: Java Nov 22nd, 2008
Replies: 7
Views: 960
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 12th, 2008
Replies: 8
Views: 786
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 3rd, 2008
Replies: 10
Code Snippet: Simple Equation Solver
Views: 5,223
Posted By Alex Edwards
Solves simple string-based expressions.

Currently only supports integers, but can easily be expanded to support float-types.
Forum: Java Nov 1st, 2008
Replies: 19
Views: 1,267
Posted By Alex Edwards
This should be an easy project, until you have to create a command for executing an applet instead of a standalone application.

Also executing packaged-classes might be a bit tricky.

It will...
Forum: Java Oct 22nd, 2008
Replies: 12
Views: 1,765
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: 8
Views: 644
Posted By Alex Edwards
It might do you some good to learn RMI from the book Head First Java or get a brief overview by reading Head First Design Patterns. Both books are good and provide more information about programming...
Forum: Java Oct 14th, 2008
Replies: 3
Views: 3,689
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,375
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 2nd, 2008
Replies: 0
Views: 437
Posted By Alex Edwards
I typically don't post anything unless I have a question or comment... but I am still trying to understand Serialization for Network-Applications and I ran into a brick wall (repeatedly) during a...
Forum: Java Sep 24th, 2008
Replies: 4
Views: 501
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: 1
Views: 3,612
Posted By Alex Edwards
There are a number of issues with the above code.

First of all, when declaring a variable (like menu), you should initialize it on the spot... even if it is a null initialization.

Secondly, you...
Forum: Java Sep 22nd, 2008
Replies: 5
Views: 592
Posted By Alex Edwards
Remive the semi-colon by your while-statement and you should be in business =)
Forum: Java Sep 16th, 2008
Replies: 10
Views: 1,008
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 7th, 2008
Replies: 1
Views: 404
Posted By Alex Edwards
There needs to be some kind of simple commonality between classes.

An interface allows for many benefits via the implementation of the Object Model and how objects communicate with each other,...
Forum: Java Aug 27th, 2008
Replies: 4
Views: 997
Posted By Alex Edwards
An interface is a static context template that classes can implement. The methods within the interface have no body and must be of public access.

In addition, interfaces can also contain...
Forum: Java Aug 25th, 2008
Replies: 11
Views: 949
Posted By Alex Edwards
This worked for me--


import javax.sound.sampled.*;

public class test_sound {

private class MyThread extends Thread{

int seconds = 1, sampleRate = 8000;
Forum: Java Aug 24th, 2008
Replies: 6
Views: 643
Posted By Alex Edwards
Why not store the current time in a data type (like a long) when the key is pressed and when the key is released subtract the new time from the old time?

Here's an example--


public class...
Forum: Java Aug 22nd, 2008
Replies: 8
Views: 1,659
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 20th, 2008
Replies: 3
Views: 478
Posted By Alex Edwards
I can already see you using the Bridge and/or Strategy pattern from the specs.

You'll also most likely end up using the Observer pattern.


Try not to be distracted by the specs too much. Break...
Forum: Java Aug 1st, 2008
Replies: 9
Views: 1,887
Posted By Alex Edwards
This is the error I'm getting when trying to load this using FireFox (after 3 attempts)


Java Plug-in 1.6.0_07
Using JRE version 1.6.0_07 Java HotSpot(TM) Client VM
User home directory =...
Forum: Java Jul 31st, 2008
Replies: 11
Views: 944
Posted By Alex Edwards
First and foremost I'd like to say that I'm damn impressed!

If I remember correctly, using switch/case statements yields much faster selection than if-else statements.

I don't think that's the...
Forum: Java Jul 28th, 2008
Replies: 40
Views: 3,494
Posted By Alex Edwards
There are a few ways we can do this.

In my opinion, the best way to do this is create a class that accepts these kind of values and stores them in appropriate data types (the types listed in each...
Forum: Java Jul 25th, 2008
Replies: 4
Views: 2,677
Posted By Alex Edwards
I found some links that rendered Images to .gifs, which seemed useless at first but then I looked into the Image class and all of the "helper" classes for its methods.

I think I'll try to look...
Forum: Java Jul 24th, 2008
Replies: 8
Views: 945
Posted By Alex Edwards
Here's a Generic extension of your max-value finder where anything that implements Comparable can be compared--



public class Manip{

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

...
Forum: Java Jul 22nd, 2008
Replies: 3
Views: 435
Posted By Alex Edwards
Since you used to be a programmer, I'd suggest for you to get used to using IDE's such as--

NetBeans 6.1 (or higher)

--there are others (I think JUnit is one) but this is a very good one that...
Forum: Java Jul 21st, 2008
Replies: 8
Views: 764
Posted By Alex Edwards
In the event that you need some tips for doing this project, refer to the following links--

http://www.daniweb.com/forums/thread135648.html

http://www.daniweb.com/forums/thread135617.html
...
Forum: Java Jul 13th, 2008
Replies: 10
Views: 972
Posted By Alex Edwards
It took me some time but I managed to whip up this simplified SizeableArray class that should answer most/all of your questions.


/**
// Hi Alex

// Thanks for your suggestion. I should have...
Forum: Java Jul 10th, 2008
Replies: 9
Views: 876
Posted By Alex Edwards
Let's break down the problem into steps...

->Accept user input
->Perform the desired operation / use recursion
->Prove that the operation has been done (by a display)

... these steps are in...
Forum: Java Jun 28th, 2008
Replies: 5
Views: 721
Posted By Alex Edwards
Remember that even strings/values can be split in half perfectly. You'll have to find a way to ignore the middle character in odd strings. You'll most likely want to make a method like this that...
Forum: Java Jun 23rd, 2008
Replies: 4
Views: 495
Posted By Alex Edwards
You could resort to absolute positioning, but in the event that the Panel is resized you may want to use a layout.

I'd suggest looking up the following in google--

Java class LayoutManager
...
Forum: Java Jun 17th, 2008
Replies: 3
Views: 1,953
Posted By Alex Edwards
Hello!

Have you heard of the interface Comparable?

It allows you to compare like-objects with its implementation.



public static void sort(Comparable[] values, int start, int end)
Forum: Java Jun 14th, 2008
Replies: 18
Views: 1,867
Posted By Alex Edwards
I've been looking into a few sites to see if group-parsing can be done in an easier fashion (i.e. parsing a group from the "deepest" paranthesized group then simplifying that expression and appending...
Forum: Java Jun 5th, 2008
Replies: 3
Views: 1,226
Posted By Alex Edwards
I think it has something to do with the way the stream works--

if you call the method nextInt it will return the value on the line and attempt to the next line of code.

I'm almost certain that...
Forum: Java Jun 4th, 2008
Replies: 13
Views: 8,261
Posted By Alex Edwards
import java.awt.*;
import java.applet.*;

public class graphic extends Applet {
Button button1;
public void init() {
}

public void paint(Graphics g) {
Showing results 1 to 34 of 34

 


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

©2003 - 2009 DaniWeb® LLC