Normand Briere
2018-07-07 09ddd38fd4a8a7100c834a5e976f4796fae53541
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package timeflow.app.ui;
 
import javax.swing.*;
import java.awt.*;
 
public class DottedLine extends JPanel
{
   public void paintComponent(Graphics g)
   {
       int w=getSize().width, h=getSize().height;
       g.setColor(Color.white);
       g.fillRect(0,0,w,h);
       g.setColor(Color.lightGray);
       if (w>h)
       {
           for (int x=0; x<w; x+=4)
           {
               g.drawLine(x,0,x+1,0);
           }
       }
       else
       {
           for (int y=0; y<h; y+=4)
           {
               g.drawLine(0,y,0,y+1);
           }            
       }
   }
   
   public Dimension getPreferredSize()
   {
       return new Dimension(1,1);
   }
}