如何用Java绘制指针?

时间:2017-05-02 17:20:05

标签: java background jcomponent markers

我有JLabel作为我的JPanel的背景。我需要在db中以不同的坐标显示超过400个点。如何自动绘制这么多标记?

1 个答案:

答案 0 :(得分:0)

保持要绘制的点的ArrayList。然后你可以覆盖标签的paintComponent()方法来首先绘制图像(通过调用super.paintComponent()),然后遍历ArrayList并绘制每个点。

Custom Painting Approaches查看$pattern = '/.*[\.\/]([a-zA-Z0-9\-]+\.\w{2,3})\/.*/'; $results = $reader->noHeading()->takeColumns(1)->toArray(); $cleaned = array(); for($i = 0; $i < count($results); $i++){ if(preg_match($pattern,$results[$i][0],$cleaned[$i]) === 1){ echo "<pre>"; var_dump($cleaned[$i][1]); echo "</pre>"; } } 示例,了解从ArrayList绘制对象的工作示例。