async buffered image: rename changed to loaded
This commit is contained in:
@@ -44,9 +44,9 @@ public class AsyncBufferedImage extends BufferedImage
|
||||
}
|
||||
|
||||
/**
|
||||
* Call when the buffer has been changed
|
||||
* Call when the image has been loaded
|
||||
*/
|
||||
public synchronized void changed()
|
||||
public synchronized void loaded()
|
||||
{
|
||||
loaded = true;
|
||||
for (Runnable r : listeners)
|
||||
@@ -57,9 +57,10 @@ public class AsyncBufferedImage extends BufferedImage
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a function to be ran when the buffer has changed
|
||||
* Register a function to be ran when the image has been loaded.
|
||||
* If the image is already loaded, the function will not be ran.
|
||||
*/
|
||||
public synchronized void onChanged(Runnable r)
|
||||
public synchronized void onLoaded(Runnable r)
|
||||
{
|
||||
if (loaded)
|
||||
{
|
||||
|
||||
@@ -415,7 +415,7 @@ public class ItemManager
|
||||
return false;
|
||||
}
|
||||
sprite.toBufferedImage(img);
|
||||
img.changed();
|
||||
img.loaded();
|
||||
return true;
|
||||
});
|
||||
return img;
|
||||
|
||||
@@ -317,7 +317,7 @@ class LootTrackerBox extends JPanel
|
||||
BufferedImage transparentImage = ImageUtil.alphaOffset(itemImage, .3f);
|
||||
imageLabel.setIcon(new ImageIcon(transparentImage));
|
||||
};
|
||||
itemImage.onChanged(addTransparency);
|
||||
itemImage.onLoaded(addTransparency);
|
||||
addTransparency.run();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -116,7 +116,7 @@ class TimeTrackingPanel extends PluginPanel
|
||||
BufferedImage subIcon = icon.getSubimage(0, 0, 32, 32);
|
||||
materialTab.setIcon(new ImageIcon(subIcon.getScaledInstance(24, 24, Image.SCALE_SMOOTH)));
|
||||
};
|
||||
icon.onChanged(resize);
|
||||
icon.onLoaded(resize);
|
||||
resize.run();
|
||||
|
||||
materialTab.setOnSelectEvent(() ->
|
||||
|
||||
@@ -78,7 +78,7 @@ public class InfoBoxManager
|
||||
if (image instanceof AsyncBufferedImage)
|
||||
{
|
||||
AsyncBufferedImage abi = (AsyncBufferedImage) image;
|
||||
abi.onChanged(() -> updateInfoBoxImage(infoBox));
|
||||
abi.onLoaded(() -> updateInfoBoxImage(infoBox));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user