Changeset 1102 for trunk/src/org/expeditee/items/widgets/ButtonWidget.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/ButtonWidget.java
r1005 r1102 1 1 package org.expeditee.items.widgets; 2 2 import java.awt.BorderLayout; 3 import java.awt.Color;4 3 import java.awt.Dimension; 5 4 import java.net.URL; … … 9 8 import javax.swing.border.EmptyBorder; 10 9 10 import org.expeditee.core.Colour; 11 import org.expeditee.gio.swing.SwingConversions; 11 12 import org.expeditee.items.Text; 12 13 … … 14 15 15 16 //Will be the default class for Rubbish Bin, Reset and Undo Button Widgets 16 public class ButtonWidget extends InteractiveWidget{17 17 public class ButtonWidget extends SwingWidget 18 { 18 19 protected JButton clicked_ = new JButton(""); 19 20 protected SVGIcon icon_ = null; 20 21 21 22 public ButtonWidget(int dimension, String filePath, Text source, String[] args) 22 23 { … … 25 26 26 27 clicked_.setBorder(new EmptyBorder(0, 0, 0, 0)); 27 clicked_.setBackground( Color.white);28 clicked_.setBackground(SwingConversions.toSwingColor(Colour.WHITE)); 28 29 29 30 Dimension size = new Dimension(dimension, dimension); 30 31 icon_ = new SVGIcon(); 31 try{ 32 33 try { 32 34 URL imageURL = ClassLoader.getSystemResource(filePath); 33 35 icon_.setSvgURI(imageURL.toURI()); 34 // This STILL works, unsure why. Don't remove it has an affect on the button appearance.36 // This STILL works, unsure why. Don't remove it has an affect on the button appearance. 35 37 icon_.setUseAntiAlias(true); 36 38 icon_.setScaleToFit(true); … … 39 41 _swingComponent.add(clicked_); 40 42 this.setWidgetEdgeThickness(0.0f); 41 this.setWidgetEdgeColor(Color.white); 42 } 43 catch(Exception e){ 44 43 this.setWidgetEdgeColor(Colour.WHITE); 44 } catch(Exception e) { 45 45 //Set a default image if image is missing 46 46 System.out.println("Unable to load image from directory"); … … 49 49 50 50 @Override 51 protected String[] getArgs() { 51 protected String[] getArgs() 52 { 52 53 // TODO Auto-generated method stub 53 54 return null; 54 55 } 55 public boolean itemHeldWhileClicked(InteractiveWidget bw) { 56 57 public boolean itemHeldWhileClicked(Widget bw) 58 { 56 59 // TODO Auto-generated method stub 57 60 return false; 58 61 } 59 public boolean getdropInteractableStatus(){ 62 63 public boolean getdropInteractableStatus() 64 { 60 65 return false; 61 66 } 62 67 63 68 @Override 64 boolean setPositions(WidgetCorner src, float x, float y) { 69 public boolean setPositions(WidgetCorner src, float x, float y) 70 { 65 71 boolean result = super.setPositions(src, x, y); 66 72
Note:
See TracChangeset
for help on using the changeset viewer.