mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 09:37:36 -05:00
Compare commits
3 Commits
v0.3.3-bet
...
v0.3.3-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
336669f1d5 | ||
|
|
46cf7f4193 | ||
|
|
e9aeb09011 |
@@ -15,7 +15,7 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
version = '0.3.3-beta.2'
|
version = '0.3.3-beta.3'
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -80,6 +80,12 @@ public class Icon implements Comparable<Icon>
|
|||||||
if(mImageIcon == null && mPath != null)
|
if(mImageIcon == null && mPath != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if(mPath.startsWith("/"))
|
||||||
|
{
|
||||||
|
mImageIcon = new ImageIcon(mPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
URL imageURL = Icon.class.getResource(mPath);
|
URL imageURL = Icon.class.getResource(mPath);
|
||||||
|
|
||||||
@@ -93,6 +99,7 @@ public class Icon implements Comparable<Icon>
|
|||||||
mImageIcon = new ImageIcon(imageURL);
|
mImageIcon = new ImageIcon(imageURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
mLog.error("Error loading Icon [" + mPath + "]", e);
|
mLog.error("Error loading Icon [" + mPath + "]", e);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class IconManager
|
|||||||
/**
|
/**
|
||||||
* All icons in a sorted array
|
* All icons in a sorted array
|
||||||
*/
|
*/
|
||||||
public io.github.dsheirer.icon.Icon[] getIcons()
|
public Icon[] getIcons()
|
||||||
{
|
{
|
||||||
return getModel().getIconsAsArray();
|
return getModel().getIconsAsArray();
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,11 @@ public class IconManager
|
|||||||
Icon icon = getModel().getIcon(name);
|
Icon icon = getModel().getIcon(name);
|
||||||
|
|
||||||
ImageIcon scaledIcon = getScaledIcon(icon.getIcon(), height);
|
ImageIcon scaledIcon = getScaledIcon(icon.getIcon(), height);
|
||||||
|
|
||||||
|
if(scaledIcon != null)
|
||||||
|
{
|
||||||
mResizedIcons.put(scaledIconName, scaledIcon);
|
mResizedIcons.put(scaledIconName, scaledIcon);
|
||||||
|
}
|
||||||
|
|
||||||
return scaledIcon;
|
return scaledIcon;
|
||||||
}
|
}
|
||||||
@@ -172,6 +176,8 @@ public class IconManager
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ImageIcon getScaledIcon(ImageIcon original, int height)
|
public static ImageIcon getScaledIcon(ImageIcon original, int height)
|
||||||
|
{
|
||||||
|
if(original != null)
|
||||||
{
|
{
|
||||||
double scale = (double) original.getIconHeight() / (double) height;
|
double scale = (double) original.getIconHeight() / (double) height;
|
||||||
|
|
||||||
@@ -183,6 +189,9 @@ public class IconManager
|
|||||||
return new ImageIcon(scaledImage);
|
return new ImageIcon(scaledImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an icon and scales it to the specified height
|
* Constructs an icon and scales it to the specified height
|
||||||
* @param path
|
* @param path
|
||||||
@@ -190,12 +199,17 @@ public class IconManager
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ImageIcon getScaledIcon(String path, int height)
|
public static ImageIcon getScaledIcon(String path, int height)
|
||||||
|
{
|
||||||
|
if(path != null)
|
||||||
{
|
{
|
||||||
Icon icon = new Icon("", path);
|
Icon icon = new Icon("", path);
|
||||||
|
|
||||||
return getScaledIcon(icon.getIcon(), height);
|
return getScaledIcon(icon.getIcon(), height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Folder where icon, backup and lock files are stored
|
* Folder where icon, backup and lock files are stored
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,10 +20,16 @@ package io.github.dsheirer.icon;
|
|||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
import java.awt.*;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Frame;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -119,7 +125,7 @@ public class IconSelector extends JDialog implements DocumentListener
|
|||||||
String name = mNameText.getText();
|
String name = mNameText.getText();
|
||||||
String path = mFileLabel.getText();
|
String path = mFileLabel.getText();
|
||||||
|
|
||||||
io.github.dsheirer.icon.Icon icon = new io.github.dsheirer.icon.Icon(name, path);
|
Icon icon = new Icon(name, path);
|
||||||
mIconTableModel.add(icon);
|
mIconTableModel.add(icon);
|
||||||
|
|
||||||
IconSelector.this.dispose();
|
IconSelector.this.dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user