Bitmap/Bresenham's line algorithm: Difference between revisions
Content added Content deleted
m (→{{header|C++}}: Formatted code, no functional changes) |
m (→{{header|Java}}: small changes) |
||
Line 1,283: | Line 1,283: | ||
public class Bresenham extends JFrame { |
public class Bresenham extends JFrame { |
||
BresenhamPanel panel; |
|||
public static void main(String[] args) { |
public static void main(String[] args) { |
||
Line 1,293: | Line 1,291: | ||
public Bresenham() { |
public Bresenham() { |
||
⚫ | |||
Container content = getContentPane(); |
|||
content.setLayout(new BorderLayout()); |
|||
panel = new BresenhamPanel(); |
|||
⚫ | |||
setTitle("Bresenham"); |
setTitle("Bresenham"); |
||
pack(); |
pack(); |
||
Line 1,304: | Line 1,299: | ||
class BresenhamPanel extends JPanel { |
class BresenhamPanel extends JPanel { |
||
final int |
final int centerX, centerY; |
||
public BresenhamPanel() { |
public BresenhamPanel() { |
||
w = 600; |
int w = 600; |
||
h = 500; |
int h = 500; |
||
centerX = w / 2; |
centerX = w / 2; |
||
centerY = h / 2; |
centerY = h / 2; |