Todd Swift

Greenhorn
+ Follow
since Apr 11, 2006
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 Todd Swift

After many months of studying I've passed the SCJP! I've really enjoyed preparing for it, especially browsing javaranch....
15 years ago
The retake promotion that I signed up for was valid for vouchers purchased by the end of September 2006; maybe they will offer the promotion again?
Thanks for your help; putting the panel in the frame worked! Thanks to all for your help.
15 years ago
Hi, I'm reading the Head First Java book and am having problems using the example regarding the paintComponent method (pg. 364 chapter 12). I've made a subclass of JPanel but cannot seem to call the paintComponent method. I've pasted my code below; any tips would be appreciated!

-----------------------------------------------------------
package mydrawpaneltest;

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

public class MyJPanel extends JPanel {

/** Creates a new instance of MyJPanel */
public MyJPanel() {
}

public void paintComponent(Graphics g) {

g.setColor(Color.orange);
g.fillRect(20, 50, 100, 100);

}
}


----------------------------------------------------------

package mydrawpaneltest;

public class Main {

public Main() {
}

public static void main(String[] args) {

MyJPanel myJPan = new MyJPanel();
myJPan.repaint();
}
}
15 years ago