Hello, I've searched the forum and I couldn't find any answers so here's my problem:
I have to partially fill in a rectangle, i'll express the idea using O's:
OOOOO
O-O- O
OOOOO
O----O
(-= white "squares/areas")
more or less, basically I leave out certain white areas here's my code:
import javax.swing.*; import java.awt.*; public class Drawing{ public static void main(String[] args) { Drawing d = new Drawing(); } public Color(){ JFrame frame = new JFrame("faces"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new MyComponent()); frame.setSize(800,600); frame.setVisible(true); } public class MyComponent extends JComponent{ public void paint(Graphics g){ int height; int width; g.clipRect(1,1,50,40); g.setColor(Color.black); g.fillRect(1,1,10,40); g.fillRect(2,1,50,10); //g.fillRect(6,2,50,20); } } }
the two g.fillRect lines that are NOT commented out fill in the first collumn and first row respectively, however I cant manage to fill a different row (3rd)....
(and individual squares within a given row column)
Any ideas?
pd g.clipRect(1,1,50,40) making the start coords 0,0 doesnt seem to make any difference...