Skip to content

Commit

Permalink
Merge pull request #3 from LabunskyA/v2
Browse files Browse the repository at this point in the history
V2 binary-ready
  • Loading branch information
LabunskyA committed May 6, 2016
2 parents ef03122 + 32f84ab commit 4042764
Show file tree
Hide file tree
Showing 20 changed files with 18 additions and 12 deletions.
9 changes: 4 additions & 5 deletions scr/window/SimpleButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;

/**
Expand All @@ -16,8 +15,8 @@ class SimpleButton extends JToggleButton {
super();

try {
setIcon(new ImageIcon(ImageIO.read(new File(path))));
setPressedIcon(new ImageIcon(ImageIO.read(new File(pressedPath))));
setIcon(new ImageIcon(ImageIO.read(getClass().getResource(path))));
setPressedIcon(new ImageIcon(ImageIO.read(getClass().getResource(pressedPath))));
setMargin(new Insets(0, 0, 0, 0));
setBorder(BorderFactory.createEmptyBorder());
setBackground(Color.WHITE);
Expand All @@ -27,8 +26,8 @@ class SimpleButton extends JToggleButton {
SimpleButton(String path) {
super();
try {
setIcon(new ImageIcon(ImageIO.read(new File(path))));
setPressedIcon(new ImageIcon(ImageIO.read(new File(path.substring(0, path.indexOf(".")) + "Pressed.png"))));
setIcon(new ImageIcon(ImageIO.read(getClass().getResource(path))));
setPressedIcon(new ImageIcon(ImageIO.read(getClass().getResource(path.substring(0, path.indexOf(".")) + "Pressed.png"))));
setMargin(new Insets(0, 0, 0, 0));
setBorder(BorderFactory.createLineBorder(Color.WHITE, 1, false));
setBackground(Color.WHITE);
Expand Down
10 changes: 8 additions & 2 deletions scr/window/WelcomeLogo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
Expand All @@ -14,9 +13,16 @@
*/
public class WelcomeLogo extends JFrame {
public WelcomeLogo() {
try {
setIconImage(new ImageIcon(ImageIO.read(getClass().getResource("resources/Nya.png"))).getImage());
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}

BufferedImage logo = null;
try {
logo = ImageIO.read(new File("resources/getNya.png"));
logo = ImageIO.read(getClass().getResource("resources/getNya.png"));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
11 changes: 6 additions & 5 deletions scr/window/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.awt.event.ActionListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;

Expand Down Expand Up @@ -71,8 +70,11 @@ public Window() { //Here i will create main window of the program
super("getNya");

try {
setIconImage(new ImageIcon(ImageIO.read(new File("resources/Nya.png"))).getImage());
} catch (IOException ignored) {}
setIconImage(new ImageIcon(ImageIO.read(getClass().getResource("resources/Nya.png"))).getImage());
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

Expand Down Expand Up @@ -302,9 +304,8 @@ public void setWindowSizeNormal(Boolean normal) { //I need it to resize window e
}

private BufferedImage toBufferedImage(Image img){
if (img instanceof BufferedImage) {
if (img instanceof BufferedImage)
return (BufferedImage) img;
}

// Create a buffered image with transparency
BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 4042764

Please sign in to comment.