<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ocr.gui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import ocr.controllers.ControleDesenhoObservador;
import ocr.controllers.ImagemGetter;

/**
 *
 * @author 407456
 */
public class PainelDesenho extends JPanel implements MouseListener, MouseMotionListener,
                                                     ImagemGetter, ControleDesenhoObservador{
    private BufferedImage imagem;
    private boolean[] pixels;
    private int TAMANHO_X;
    private int TAMANHO_Y;
    

    public PainelDesenho() {
        this.initComponents();
    }
    
    public void initComponents(){
        this.imagem = null;
        
        this.addMouseListener(this);
        this.addMouseMotionListener(this);
    }
    
    private void paintGrid(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        g.setColor(new Color(0x00000000));
        
        for (double y = 0; y < TAMANHO_Y; y++) {
            for (double x = 0; x < TAMANHO_X; x++) {
                if (pixels [(int)x + (int)y * TAMANHO_X]){
                    
                    g.fillOval((int)x, (int)y,
                               10, 10);
                }
            }
        }
    }

    @Override
    public void paintComponent(Graphics g) {
        
        if(this.pixels == null){
            this.TAMANHO_X = this.getWidth();
            this.TAMANHO_Y = this.getHeight();<commit_msg>Desenho alterado para o centro do mouse<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ocr.gui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import ocr.controllers.ControleDesenhoObservador;
import ocr.controllers.ImagemGetter;

/**
 *
 * @author 407456
 */
public class PainelDesenho extends JPanel implements MouseListener, MouseMotionListener,
                                                     ImagemGetter, ControleDesenhoObservador{
    private BufferedImage imagem;
    private boolean[] pixels;
    private int TAMANHO_X;
    private int TAMANHO_Y;
    

    public PainelDesenho() {
        this.initComponents();
    }
    
    public void initComponents(){
        this.imagem = null;
        
        this.addMouseListener(this);
        this.addMouseMotionListener(this);
    }
    
    private void paintGrid(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        g.setColor(new Color(0x00000000));
        
        for (double y = 0; y < TAMANHO_Y; y++) {
            for (double x = 0; x < TAMANHO_X; x++) {
                if (pixels [(int)x + (int)y * TAMANHO_X]){
                    
                    g.fillOval((int)x - 5, (int)y - 5,
                               10, 10);
                }
            }
        }
    }

    @Override
    public void paintComponent(Graphics g) {
        
        if(this.pixels == null){
            this.TAMANHO_X = this.getWidth();
            this.TAMANHO_Y = this.getHeight();
{'fraction_non_alphanumeric': 0.09837019790454016, 'fraction_numerical': 0.015133876600698487, 'mean_word_length': 2.0228671943711523, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3493192', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1032, 'n_words': 237}