Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Icons #224

Merged
merged 7 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ An example for the Battleship puzzle demonstrates the proper format for XML file
</edu.rpi.legup.Legup>
```
Element values are dependent on the type of `edu.rpi.legup.puzzle`.

## Licensing
Some of the icons used in Legup were taken from or derived from the icons found on https://fonts.google.com/icons, which is licensed under the [Apache-2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html).
6 changes: 3 additions & 3 deletions src/main/java/edu/rpi/legup/ui/HomePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void initButtons() {
}
};

ImageIcon button0Icon = new ImageIcon("src/main/resources/edu/rpi/legup/homepanel/openproof.png");
ImageIcon button0Icon = new ImageIcon("src/main/resources/edu/rpi/legup/images/Legup/homepanel/proof_file.png");
this.buttons[0].setIcon(resizeButtonIcon(button0Icon, this.buttonSize, this.buttonSize));
this.buttons[0].setHorizontalTextPosition(AbstractButton.CENTER);
this.buttons[0].setVerticalTextPosition(AbstractButton.BOTTOM);
Expand All @@ -85,7 +85,7 @@ private void initButtons() {
setMaximumSize(getSize());
}
};
ImageIcon button1Icon = new ImageIcon("src/main/resources/edu/rpi/legup/homepanel/edit.png");
ImageIcon button1Icon = new ImageIcon("src/main/resources/edu/rpi/legup/images/Legup/homepanel/new_puzzle_file.png");
this.buttons[1].setIcon(resizeButtonIcon(button1Icon, this.buttonSize, this.buttonSize));
this.buttons[1].setHorizontalTextPosition(AbstractButton.CENTER);
this.buttons[1].setVerticalTextPosition(AbstractButton.BOTTOM);
Expand All @@ -97,7 +97,7 @@ private void initButtons() {
setMaximumSize(getSize());
}
};
ImageIcon button2Icon = new ImageIcon("src/main/resources/edu/rpi/legup/homepanel/edit.png"); // PLACEHOLDER
ImageIcon button2Icon = new ImageIcon("src/main/resources/edu/rpi/legup/images/Legup/homepanel/puzzle_file.png");
this.buttons[2].setIcon(resizeButtonIcon(button2Icon, this.buttonSize, this.buttonSize));
this.buttons[2].setHorizontalTextPosition(AbstractButton.CENTER);
this.buttons[2].setVerticalTextPosition(AbstractButton.BOTTOM);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/edu/rpi/legup/ui/LegupPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ public abstract class LegupPanel extends JPanel {
/**
* Alerts panel that it will be going visible now
*/

protected final int TOOLBAR_ICON_SCALE = 40;
public abstract void makeVisible();
}
8 changes: 7 additions & 1 deletion src/main/java/edu/rpi/legup/ui/ProofEditorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,13 @@ private void setupToolBar() {
for (int i = 0; i < ToolbarName.values().length; i++) {
String toolBarName = ToolbarName.values()[i].toString();
URL resourceLocation = ClassLoader.getSystemClassLoader().getResource("edu/rpi/legup/images/Legup/" + toolBarName + ".png");
JButton button = new JButton(toolBarName, new ImageIcon(resourceLocation));

// Scale the image icons down to make the buttons smaller
ImageIcon imageIcon = new ImageIcon(resourceLocation);
Image image = imageIcon.getImage();
imageIcon = new ImageIcon(image.getScaledInstance(this.TOOLBAR_ICON_SCALE, this.TOOLBAR_ICON_SCALE, Image.SCALE_SMOOTH));

JButton button = new JButton(toolBarName, imageIcon);
button.setFocusPainted(false);
getToolBarButtons()[i] = button;
}
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/edu/rpi/legup/ui/PuzzleEditorPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ private void setupToolBar() {
for (int i = 0; i < ToolbarName.values().length; i++) {
String toolBarName = ToolbarName.values()[i].toString();
URL resourceLocation = ClassLoader.getSystemClassLoader().getResource("edu/rpi/legup/images/Legup/" + toolBarName + ".png");
JButton button = new JButton(toolBarName, new ImageIcon(resourceLocation));

// Scale the image icons down to make the buttons smaller
ImageIcon imageIcon = new ImageIcon(resourceLocation);
Image image = imageIcon.getImage();
imageIcon = new ImageIcon(image.getScaledInstance(this.TOOLBAR_ICON_SCALE, this.TOOLBAR_ICON_SCALE, Image.SCALE_SMOOTH));

JButton button = new JButton(toolBarName, imageIcon);
button.setFocusPainted(false);
getToolBarButtons()[i] = button;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class TreePanel extends JPanel {
private JPanel main;
private TreeView treeView;
private TreeToolbarPanel toolbar;
private LegupUI legupUI;
// private LegupUI legupUI;

private JLabel status;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package edu.rpi.legup.ui.proofeditorui.treeview;

import javax.swing.*;
import java.awt.Dimension;

public class TreeToolBarButton extends JButton {

private TreeToolBarName name;
private final Dimension MINIMUM_DIMENSION = new Dimension(60, 60);

public TreeToolBarButton(ImageIcon imageIcon, TreeToolBarName name) {
super(imageIcon);
this.name = name;
this.setSize(60, 60);
this.setSize(MINIMUM_DIMENSION.width, MINIMUM_DIMENSION.height);
this.setMinimumSize(this.MINIMUM_DIMENSION);
}

public TreeToolBarName getToolBarName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class TreeToolbarPanel extends JPanel {
*/
public TreeToolbarPanel(TreePanel treePanel) {
this.treePanel = treePanel;
this.setLayout(new GridLayout(4, 1));
this.setLayout(new GridLayout(4, 1, 0, 2));


addChild = new TreeToolBarButton(new ImageIcon(ClassLoader.getSystemResource("edu/rpi/legup/images/Legup/AddChild.png")), TreeToolBarName.ADD_CHILD);
delChild = new TreeToolBarButton(new ImageIcon(ClassLoader.getSystemResource("edu/rpi/legup/images/Legup/DelChild.png")), TreeToolBarName.DEL_CHILD);
Expand Down
Binary file removed src/main/resources/edu/rpi/legup/homepanel/edit.png
Binary file not shown.
Binary file removed src/main/resources/edu/rpi/legup/homepanel/newpuzzle.png
Binary file not shown.
Binary file not shown.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/AddChild.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/Check All.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/Check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/Collapse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/DelChild.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/Directions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/Hint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/Merge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/edu/rpi/legup/images/Legup/Submit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.