public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D graph = (Graphics2D) g;
Dimension size = getSize();
float w = size.height;
int h = size.height;
switch (typ) {
case 0x01:
graph.setColor(Color.blue);
for (int i = 0; i < lastSample; i++) {
int x = Math.round((i * (float) w) / lastSample);
int y = channel1[i];
graph.drawLine(x, y, x, y);
}
graph.setColor(Color.red);
for (int i = 0; i < lastSample; i++) {
int x = Math.round((i * (float) w) / lastSample);
int y = channel2[i];
graph.drawLine(x, y, x, y);
}
}