<commit_before>package com.capitalistleptonrill.enzka.view;

import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;
import javax.swing.JFrame;

import com.capitalistleptonrill.enzka.controller.ViewController;


public class EnzkaWindow extends JFrame implements MouseListener {
	
	private static final long serialVersionUID = -7778149466213338281L;
	
	private ArrayList<CardButton> cardButtons;
	private CardButton discard;
	private int selectedButton;
	private Rectangle deck = new Rectangle(400, 100, 120, 180);//deck rectangle
	private Rectangle leftSideButton = new Rectangle(900, 200, 80, 100);//button to expand view
	private Rectangle rightSideButton = new Rectangle(20, 200, 80, 100);//button to expand view
	private int viewingIndex = 0;
	
	private ViewController master;
	
	public EnzkaWindow(int x, int y, int width, int height, ViewController creator) {
		super("Enzka");
		this.setBounds(x, y, width, height);
		this.setVisible(true);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		Container pane = this.getContentPane();
		pane.setBackground(new Color(18, 167, 11));//green felt color
		addMouseListener(this);
		
		cardButtons = new ArrayList<CardButton>();
		selectedButton = -1;
		
		master = creator;
	}
	
	public void drawCardButton(int x, int y, int w, int h, String name) {
		CardButton button = new CardButton(x, y, w, h, name);
		cardButtons.add(button);
		repaint();
	}
	
	public void drawDiscardPile(int x, int y, int w, int h, String name) {
		discard = new CardButton(x, y, w, h, name);
		repaint();
	}
	
	public void clearScreen() {
		cardButtons.clear();
		discard = new CardButton(0, 0, 0, 0, "");
		repaint();
	}
	
	@Override
	public void paint(Graphics g) {
	  super.paint(g);
	  BufferedImage img = null;
	  try {
		    img = ImageIO.read(new File("res/images/" + discard.name));
	  } catch (IOException e) {
	  }
	  if(img != null) {
		  g.drawImage(img, discard.x, discard.y, discard.w, discard.h, this);
	  } else {
		  g.setColor(Color.BLACK);
		  g.drawRect(discard.x, discard.y, discard.w, discard.h);
		  g.setColor(Color.RED);
		  g.fillRect(discard.x, discard.y, discard.w, discard.h);
	  }
	  try {
		    img = ImageIO.read(new File("res/images/Enzka.png"));
	  } catch (IOException e) {
	  }
	  //draw deck
	  if(img != null) {
		  g.drawImage(img, deck.x, deck.y, deck.width, deck.height, this);
	  } else {
		  g.setColor(Color.BLACK);
		  g.drawRect(deck.x, deck.y, deck.width, deck.height);
		  g.setColor(Color.RED);
		  g.fillRect(deck.x, deck.y, deck.width, deck.height);
	  }
	  if(cardButtons.size() < 8) {
		  for (int i = 0; i < cardButtons.size(); i++) {
			  	CardButton button = cardButtons.get(i);
				try {
				    img = ImageIO.read(new File("res/images/" + button.name));
				} catch (IOException e) {
				}
				if(img != null) {
					g.drawImage(img, button.x, button.y, button.w, button.h, this);
				} else {
					g.setColor(Color.BLACK);
					g.drawRect(button.x, button.y, button.w, button.h);
					g.setColor(Color.RED);
					g.fillRect(button.x, button.y, button.w, button.h);
				}
		  }
	  } else {
		  for (int i = 0; i < 7; i++) {
			  if(viewingIndex + i > cardButtons.size() - 1) {
				  break;
			  }
			  CardButton button = cardButtons.get(viewingIndex + i);
			  try {
				  img = ImageIO.read(new File("res/images/" + button.name));
			  } catch (IOException e) {
			  }
			  if(img != null) {
				  g.drawImage(img, (120+10)*i+50, 350, 120, 180, this);
			  } else {
				  g.setColor(Color.BLACK);
				  g.drawRect((120+10)*i+50, 350, 120, 180);
				  g.setColor(Color.RED);
				  g.fillRect((120+10)*i+50, 350, 120, 180);
			  }
		  }
		  g.setColor(Color.BLACK);<commit_msg>Add image paths for jar file<commit_after>package com.capitalistleptonrill.enzka.view;

import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;

import javax.imageio.ImageIO;
import javax.swing.JFrame;

import com.capitalistleptonrill.enzka.Enzka;
import com.capitalistleptonrill.enzka.controller.ViewController;


public class EnzkaWindow extends JFrame implements MouseListener {
	
	private static final long serialVersionUID = -7778149466213338281L;
	
	private ArrayList<CardButton> cardButtons;
	private CardButton discard;
	private int selectedButton;
	private Rectangle deck = new Rectangle(400, 100, 120, 180);//deck rectangle
	private Rectangle leftSideButton = new Rectangle(900, 200, 80, 100);//button to expand view
	private Rectangle rightSideButton = new Rectangle(20, 200, 80, 100);//button to expand view
	private int viewingIndex = 0;
	
	private ViewController master;
	
	public EnzkaWindow(int x, int y, int width, int height, ViewController creator) {
		super("Enzka");
		this.setBounds(x, y, width, height);
		this.setVisible(true);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		Container pane = this.getContentPane();
		pane.setBackground(new Color(18, 167, 11));//green felt color
		addMouseListener(this);
		
		cardButtons = new ArrayList<CardButton>();
		selectedButton = -1;
		
		master = creator;
	}
	
	public void drawCardButton(int x, int y, int w, int h, String name) {
		CardButton button = new CardButton(x, y, w, h, name);
		cardButtons.add(button);
		repaint();
	}
	
	public void drawDiscardPile(int x, int y, int w, int h, String name) {
		discard = new CardButton(x, y, w, h, name);
		repaint();
	}
	
	public void clearScreen() {
		cardButtons.clear();
		discard = new CardButton(0, 0, 0, 0, "");
		repaint();
	}
	
	@Override
	public void paint(Graphics g) {
	  super.paint(g);
	  BufferedImage img = null;
	  String path = "res/images/";
	  try {
		   InputStream is = getClass().getResourceAsStream("/" + path + discard.name);
		   if(is == null) {
			   img = ImageIO.read(new File(path + discard.name));
		   } else {
			   img = ImageIO.read(is);
		   }
	  } catch (IOException e) {
	  }
	  if(img != null) {
		  g.drawImage(img, discard.x, discard.y, discard.w, discard.h, this);
	  } else {
		  g.setColor(Color.BLACK);
		  g.drawRect(discard.x, discard.y, discard.w, discard.h);
		  g.setColor(Color.RED);
		  g.fillRect(discard.x, discard.y, discard.w, discard.h);
	  }
	  try {
		  InputStream is = getClass().getResourceAsStream("/" + path + "Enzka.png");
		   if(is == null) {
			   img = ImageIO.read(new File(path + "Enzka.png"));
		   } else {
			   img = ImageIO.read(is);
		   }
	  } catch (IOException e) {
	  }
	  //draw deck
	  if(img != null) {
		  g.drawImage(img, deck.x, deck.y, deck.width, deck.height, this);
	  } else {
		  g.setColor(Color.BLACK);
		  g.drawRect(deck.x, deck.y, deck.width, deck.height);
		  g.setColor(Color.RED);
		  g.fillRect(deck.x, deck.y, deck.width, deck.height);
	  }
	  if(cardButtons.size() < 8) {
		  for (int i = 0; i < cardButtons.size(); i++) {
			  	CardButton button = cardButtons.get(i);
				try {
					InputStream is = getClass().getResourceAsStream("/" + path + button.name);
					if(is == null) {
						img = ImageIO.read(new File(path + button.name));
					} else {
						img = ImageIO.read(is);
					}
				} catch (IOException e) {
				}
				if(img != null) {
					g.drawImage(img, button.x, button.y, button.w, button.h, this);
				} else {
					g.setColor(Color.BLACK);
					g.drawRect(button.x, button.y, button.w, button.h);
					g.setColor(Color.RED);
					g.fillRect(button.x, button.y, button.w, button.h);
				}
		  }
	  } else {
		  for (int i = 0; i < 7; i++) {
			  if(viewingIndex + i > cardButtons.size() - 1) {
				  break;
			  }
			  CardButton button = cardButtons.get(viewingIndex + i);
			  try {
				  InputStream is = getClass().getResourceAsStream("/" + path + button.name);
					if(is == null) {
						img = ImageIO.read(new File(path + button.name));
					} else {
						img = ImageIO.read(is);
					}
			  } catch (IOException e) {
			  }
			  if(img != null) {
				  g.drawImage(img, (120+10)*i+50, 350, 120, 180, this);
			  } else {
				  g.setColor(Color.BLACK);
				  g.drawRect((120+10)*i+50, 350, 120, 180);
				  g.setColor(Color.RED);
				  g.fillRect((120+10)*i+50, 350, 120, 180);
			  }
		  }
		  g.setColor(Color.BLACK);
{'fraction_non_alphanumeric': 0.14562768551852281, 'fraction_numerical': 0.02740680524909999, 'mean_word_length': 3.2215686274509805, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '824441', 'n_tokens_mistral': 3664, 'n_tokens_neox': 2989, 'n_words': 704}