mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-01-12 14:14:52 +08:00
try to avoid not supporting translucent
This commit is contained in:
parent
091898551e
commit
cfa7b4832a
@ -135,6 +135,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
public File getAssetObject(String assetId, String name) throws IOException {
|
||||
try {
|
||||
AssetsIndex index = (AssetsIndex) C.GSON.fromJson(FileUtils.read(getIndexFile(assetId), "UTF-8"), AssetsIndex.class);
|
||||
if (index == null || index.getFileMap() == null || index.getFileMap().get(name) == null)
|
||||
throw new IOException("Assets file format malformed.");
|
||||
return getAssetObject(assetId, (AssetsObject) index.getFileMap().get(name));
|
||||
} catch (JsonSyntaxException e) {
|
||||
throw new IOException("Assets file format malformed.", e);
|
||||
|
@ -59,7 +59,12 @@ public final class OfflineAuthenticator extends AbstractAuthenticator {
|
||||
public UserProfileProvider login(LoginInfo info) throws AuthenticationException {
|
||||
if (StrUtils.isBlank(info.username))
|
||||
throw new AuthenticationException(C.i18n("login.no_Player007"));
|
||||
String uuid = getUUIDFromUserName(info.username);
|
||||
String uuid;
|
||||
try {
|
||||
uuid = getUUIDFromUserName(info.username);
|
||||
} catch(IllegalArgumentException e) {
|
||||
throw new AuthenticationException("Could not find md5 digest algorithm, please reinstall Java or even your OS.", e);
|
||||
}
|
||||
if (uuidMap != null && uuidMap.containsKey(info.username) && uuidMap.get(info.username) instanceof String)
|
||||
uuid = (String) uuidMap.get(info.username);
|
||||
else {
|
||||
|
@ -15,6 +15,7 @@ import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Window;
|
||||
|
||||
@ -182,10 +183,14 @@ public class TranslucentPopupFactory extends PopupFactory {
|
||||
boolean isComboBoxPopup = (contents instanceof BasicComboPopup);
|
||||
|
||||
if (WindowTranslucencyHelper.isTranslucencySupported()) {
|
||||
try {
|
||||
//每像素透明
|
||||
WindowTranslucencyHelper.setWindowOpaque(w, false);
|
||||
//内容组件半透明
|
||||
w.setOpacity(isTooltip ? 1.0f : isComboBoxPopup ? 0.95f : 0.95f);//0.85f : 0.95f);//0.8f : 0.95f);
|
||||
} catch(Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
// component.getContentPane().add(contents, BorderLayout.CENTER);
|
||||
|
@ -27,7 +27,9 @@ public class WindowTranslucencyHelper {
|
||||
* @return true, if is translucency supported
|
||||
*/
|
||||
public static boolean isTranslucencySupported() {
|
||||
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT);
|
||||
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
||||
return device.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT) &&
|
||||
device.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ apply plugin: 'maven'
|
||||
|
||||
dependencies {
|
||||
compile 'com.google.code.gson:gson:2.2.4' // Apache License 2.0
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2"
|
||||
//compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2"
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
|
||||
|
Loading…
Reference in New Issue
Block a user