1 import javax
.swing
.JPanel
;
2 import javax
.swing
.BorderFactory
;
4 import java
.awt
.Dimension
;
5 import java
.awt
.Rectangle
;
6 import java
.awt
.Graphics
;
7 import java
.awt
.Graphics2D
;
8 import java
.awt
.GradientPaint
;
10 class CommitGraphPanel
extends JPanel
{
12 final int START_X
= 10;
13 final int START_Y
= 10;
14 final int COMMIT_COUNT
= 7;
16 public CommitGraphPanel() {
17 setBorder(BorderFactory
.createLineBorder(Color
.black
));
20 public Dimension
getPreferredSize() {
21 return new Dimension(200, 600);
24 public void paintComponent(Graphics g
) {
25 super.paintComponent(g
);
27 Graphics2D g2d
= (Graphics2D
) g
;
32 for(int i
= 0; i
< COMMIT_COUNT
- 1; i
++) {
33 cd
= new CommitDrawer();
37 currY
+= cd
.getHeight() + cd
.getArrowLength();
40 // Draw a last commit that has no arrow
41 cd
= new CommitDrawer();
44 cd
.setHasParent(false);