Cod de un paint
public class ventanatext extends JFrame implements ActionListener, MouseListener, MouseMotionListener {
JTextArea oTextArea; JToggleButton oBoton, oBorrador, oCuadro, oCirculo, Linea, circR, cuadR, color; JPanel oPanel; JFrame oFrame; MyCanvas oCanvas = new MyCanvas(); int old_x = 0, old_y = 0; private int boton = 0; JToolBar oBarraHerramienta; Graphics g = oCanvas.getGraphics(); public JColorChooser jcc = new JColorChooser(); Color c; // Figura figuraDibujarMientras;
// Vector vectorLapiz = new Vector();
// Vector vectorBotones;
ventanatext() { // …ver más…
;
ImageIcon[] relleno = new ImageIcon[8]; relleno[0] = new ImageIcon(getClass().getResource("semi.png"));
circR = new JToggleButton("", relleno[0]); circR.addActionListener(this);
// vectorBotones.add(circR);
ImageIcon[] relle = new ImageIcon[8]; relle[0] = new ImageIcon(getClass().getResource("cud.gif"));
cuadR = new JToggleButton("", relle[0]); cuadR.addActionListener(this);
//