This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

John McGahee

Greenhorn
+ Follow
since Jan 10, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John McGahee

Excellent explanation Thomas. Let me be a pain in the a** now, how is it that we can manipulate List objects, where List is just an interface? It has methods and everything that can be used.??
17 years ago
If all the methods in an interface are abstract what real purpose do they serve. I have a sneaking suspision that you can define an interface extending a defined class and that way you can use the properties/methods of that class
something like
class usefulUtility{
void methodA(){}
}
interface useless extends UsefulUtility{
abstract void methodB(){
}
}
So essentially even though you cannot manipulate the class you can use its methods when you implement the interface. Coz if thats not the case, I really don't understand why you would use interfaces???
17 years ago
Can you have a 2 dimensional Vector/ArrayList etc?
Is there a better(growable) substitute for say
String[][] strArray = new String[x][x];
or
Object[][] objArray = new Object[x][x]
???
-john
17 years ago
I am adding 2 panels in an applet. Now I want to add shapes to these two panels and draw lines on it. IT seems I can't do both, if I add components and then try to draw on the panel, the drawing wipes out the components. How can I do both. Say if I had to draw something like this (pardon my drawing skills are not up the park)
___
|___|
|
|
___
|___|
Now these squares I'm adding in the start() method like
Panel p1 = new Panel();
p1.add(squareImage);
getContentPanel().add(p1);
and then to draw I have the following code in the start() method
Graphics g = p1.getGraphics();
g.drawLine(x1, y1, x2, y2);
But as it turns out I either see the line or the square (depending on what gets called on repaint)
is there a better way to do this? which method should I put the different sections of this code?
Any feedback is more than welcome I'm kinda running out of ideas up here...lol
17 years ago
I am trying to draw a line on a JLayeredPane (which sits on top of the content Pane of a JApplet). Now it seems like I can't draw a line using
JLayeredPane jp = new JLayeredPane();
Graphics g = jp.getGraphics();
g.drawLine(x,x,x,x);
The above code doesn't work. Do I need a custom component for drawing the line. I can add() this components to the JLayeredPane. I was thinking maybe I could write a custom component which just fills its bounds with black, and then I could initialize this component and add it on to the JLaeredPane and set its bound so it seems like a line....did anybody get that?
How do i go about doing that?
17 years ago