Update jGui
This commit is contained in:
@@ -53,13 +53,13 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
|
||||
public final GuiCheckbox checkAll = new GuiCheckbox(contentPanel){
|
||||
@Override
|
||||
public void onClick() {
|
||||
playersScrollable.forEach(IGuiCheckbox.class).setChecked(true);
|
||||
playersScrollable.invokeAll(IGuiCheckbox.class, e -> e.setChecked(true));
|
||||
}
|
||||
}.setLabel("").setChecked(true).setTooltip(new GuiTooltip().setI18nText("replaymod.gui.playeroverview.showall"));
|
||||
public final GuiCheckbox uncheckAll = new GuiCheckbox(contentPanel){
|
||||
@Override
|
||||
public void onClick() {
|
||||
playersScrollable.forEach(IGuiCheckbox.class).setChecked(false);
|
||||
playersScrollable.invokeAll(IGuiCheckbox.class, e -> e.setChecked(false));
|
||||
}
|
||||
}.setLabel("").setChecked(false).setTooltip(new GuiTooltip().setI18nText("replaymod.gui.playeroverview.hideall"));
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import net.minecraft.util.Util;
|
||||
//$$ import org.lwjgl.Sys;
|
||||
//#endif
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageReader;
|
||||
import javax.imageio.stream.ImageInputStream;
|
||||
@@ -116,36 +115,27 @@ public class GuiYoutubeUpload extends GuiScreen {
|
||||
public final GuiButton thumbnailButton = new GuiButton().onClick(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Futures.addCallback(
|
||||
GuiFileChooserPopup.openLoadGui(GuiYoutubeUpload.this, "replaymod.gui.load",
|
||||
ImageIO.getReaderFileSuffixes()).getFuture(),
|
||||
new FutureCallback<File>() {
|
||||
@Override
|
||||
public void onSuccess(@Nullable File result) {
|
||||
if (result != null) {
|
||||
thumbnailButton.setLabel(result.getName());
|
||||
Image image;
|
||||
try {
|
||||
thumbnailImage = IOUtils.toByteArray(new FileInputStream(result));
|
||||
ImageInputStream in = ImageIO.createImageInputStream(new ByteArrayInputStream(thumbnailImage));
|
||||
ImageReader reader = ImageIO.getImageReaders(in).next();
|
||||
thumbnailFormat = reader.getFormatName().toLowerCase();
|
||||
image = Image.read(new ByteArrayInputStream(thumbnailImage));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
thumbnailImage = null;
|
||||
image = null;
|
||||
}
|
||||
thumbnail.setTexture(image);
|
||||
inputValidation.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
});
|
||||
GuiFileChooserPopup.openLoadGui(
|
||||
GuiYoutubeUpload.this,
|
||||
"replaymod.gui.load",
|
||||
ImageIO.getReaderFileSuffixes()
|
||||
).onAccept(file -> {
|
||||
thumbnailButton.setLabel(file.getName());
|
||||
Image image;
|
||||
try {
|
||||
thumbnailImage = IOUtils.toByteArray(new FileInputStream(file));
|
||||
ImageInputStream in = ImageIO.createImageInputStream(new ByteArrayInputStream(thumbnailImage));
|
||||
ImageReader reader = ImageIO.getImageReaders(in).next();
|
||||
thumbnailFormat = reader.getFormatName().toLowerCase();
|
||||
image = Image.read(new ByteArrayInputStream(thumbnailImage));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
thumbnailImage = null;
|
||||
image = null;
|
||||
}
|
||||
thumbnail.setTexture(image);
|
||||
inputValidation.run();
|
||||
});
|
||||
}
|
||||
}).setSize(200, 20).setI18nLabel("replaymod.gui.videothumbnail");
|
||||
|
||||
@@ -191,7 +181,7 @@ public class GuiYoutubeUpload extends GuiScreen {
|
||||
}
|
||||
|
||||
private void setState(boolean uploading) {
|
||||
forEach(GuiElement.class).setEnabled(!uploading);
|
||||
invokeAll(GuiElement.class, e -> e.setEnabled(!uploading));
|
||||
uploadButton.setEnabled();
|
||||
if (uploading) {
|
||||
uploadButton.onClick(() -> {
|
||||
|
||||
Reference in New Issue
Block a user