package aufgaben.b20160413; import java.awt.Color; import java.awt.Graphics; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import javax.imageio.ImageIO; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import aufgaben.Aufgabe; import misc.Utils; public class Aufgabe6 extends Aufgabe { private final int width = 500, height = 500; private boolean done = false; private String name; private BufferedImage image; private Color[][] pixels; private JSpinner spinner; private JPanel panel; private ArrayList arr; public Aufgabe6() { name = "YUV Visualisierung"; this.setSize(width, height); this.setTitle(name); this.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.out.println("close"); done = true; } } ); this.setLayout(null); } @Override public boolean done() { return done; } @Override public String getName() { return name; } @Override public void init() { arr = new ArrayList(); panel = new JPanel() { public void paint(Graphics g) { g.clearRect(0, 0, this.getWidth(), this.getHeight()); for(int x = 0; x= 0.0 && gr >= 0.0 && b >= 0.0 && r <= 1.0 && gr <= 1.0 && b <= 1.0) { g.setColor(new Color((int)Math.round(r*255), (int)Math.round(gr*255), (int)Math.round(b*255))); g.fillRect(x, y, 1, 1); } } } /* double max = 0.0; for(int x = 0; xarr.get(y)) max = arr.get(x); } } System.out.println(max); */ g.setColor(Color.BLACK); g.drawRect(0, 0, 199, 199); } }; panel.setBounds(100, 200, 200, 200); spinner = new JSpinner(new SpinnerNumberModel(1f, 0f, 1f, 0.01f)); spinner.setBounds(100, 100, 100, 20); spinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { panel.repaint(); } }); this.add(panel); this.add(spinner); } }