Add progress of installing and game downloading

This commit is contained in:
huangyuhui
2017-03-02 13:18:25 +08:00
parent 57c6ae5e04
commit 0f390e63d3
8 changed files with 88 additions and 149 deletions

View File

@@ -11,7 +11,6 @@
*/
package org.jackhuang.hmcl.laf.tab;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
@@ -21,8 +20,6 @@ import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
import org.jackhuang.hmcl.laf.BEUtils;
/**
* JTabbedPane的UI实现类.
*
@@ -245,49 +242,6 @@ public class BETabbedPaneUI extends BasicTabbedPaneUI {
Rectangle[] rects, int tabIndex,
Rectangle iconRect, Rectangle textRect,
boolean isSelected) {
Rectangle tabRect = rects[tabIndex];
if (tabPane.hasFocus() && isSelected) {
int x, y, w, h;
g.setColor(focus);
switch (tabPlacement) {
case LEFT:
x = tabRect.x + 4;//父类中默认是+3
y = tabRect.y + 6;//父类中默认是+3
w = tabRect.width - 7;//父类中默认是 - 5
h = tabRect.height - 12;//父类中默认是-6
break;
case RIGHT:
x = tabRect.x + 4;//父类中默认是+ 2
y = tabRect.y + 6;//父类中默认是+ 3
w = tabRect.width - 9;//父类中默认是- 5
h = tabRect.height - 12;//父类中默认是- 6
break;
case BOTTOM:
x = tabRect.x + 6;//父类中默认是+ 3
y = tabRect.y + 4;//父类中默认是+ 2
w = tabRect.width - 12;//父类中默认是- 6
h = tabRect.height - 9;//父类中默认是- 5
break;
case TOP:
default:
//** modified by jb2011根据整体效果进行偏移修正
x = tabRect.x + 6;//父类中默认是+3
//** modified by jb2011根据整体效果进行偏移修正
y = tabRect.y + 4;//父类中默认是+3
//** modified by jb2011根据整体效果进行偏移修正
w = tabRect.width - 12;//父类中默认是-6
//** modified by jb2011-8的目的是使得焦点虚线框与选中底边保持一个像素的距离否则挨在一起在视觉上效果会较差
h = tabRect.height - 8;//父类中默认是 - 5
}
//** modified by jb2011绘制虚线方法改成可以设置虚线步进的方法步进设为2则更好看一点
// BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
BEUtils.drawDashedRect(g, x, y, w, h);
// 绘制虚线框的半透明白色立体阴影(因主背景色较淡,效果不明显,但显然比没有要好)
g.setColor(new Color(255, 255, 255, 255));// TODO 此值可提炼成UIManager属性哦
// 立体阴影就是向右下偏移一个像素实现的
BEUtils.drawDashedRect(g, x + 1, y + 1, w, h);
}
}
/**

View File

@@ -208,6 +208,7 @@ public class TMSchema {
return str + control.toString();
}
@Override
public String toString() {
return control.toString() + "." + name();
}
@@ -295,7 +296,7 @@ public class TMSchema {
private static EnumMap<Part, State[]> stateMap;
private static synchronized void initStates() {
stateMap = new EnumMap<Part, State[]>(Part.class);
stateMap = new EnumMap<>(Part.class);
stateMap.put(Part.EP_EDITTEXT,
new State[] {
@@ -453,92 +454,4 @@ public class TMSchema {
}
/**
* An enumeration of the possible component attributes and the
* corresponding value type
*/
public static enum Prop {
COLOR(Color.class, 204),
SIZE(Dimension.class, 207),
FLATMENUS(Boolean.class, 1001),
BORDERONLY(Boolean.class, 2203), // only draw the border area of the image
IMAGECOUNT(Integer.class, 2401), // the number of state images in an imagefile
BORDERSIZE(Integer.class, 2403), // the size of the border line for bgtype=BorderFill
PROGRESSCHUNKSIZE(Integer.class, 2411), // size of progress control chunks
PROGRESSSPACESIZE(Integer.class, 2412), // size of progress control spaces
TEXTSHADOWOFFSET(Point.class, 3402), // where char shadows are drawn, relative to orig. chars
NORMALSIZE(Dimension.class, 3409), // size of dest rect that exactly source
SIZINGMARGINS(Insets.class, 3601), // margins used for 9-grid sizing
CONTENTMARGINS(Insets.class, 3602), // margins that define where content can be placed
CAPTIONMARGINS(Insets.class, 3603), // margins that define where caption text can be placed
BORDERCOLOR(Color.class, 3801), // color of borders for BorderFill
FILLCOLOR(Color.class, 3802), // color of bg fill
TEXTCOLOR(Color.class, 3803), // color text is drawn in
TEXTSHADOWCOLOR(Color.class, 3818), // color of text shadow
BGTYPE(Integer.class, 4001), // basic drawing type for each part
TEXTSHADOWTYPE(Integer.class, 4010), // type of shadow to draw with text
TRANSITIONDURATIONS(Integer.class, 6000);
private final Class type;
private final int value;
private Prop(Class type, int value) {
this.type = type;
this.value = value;
}
public int getValue() {
return value;
}
public String toString() {
return name() + "[" + type.getName() + "] = " + value;
}
}
/**
* An enumeration of attribute values for some Props
*/
public static enum TypeEnum {
BT_IMAGEFILE(Prop.BGTYPE, "imagefile", 0),
BT_BORDERFILL(Prop.BGTYPE, "borderfill", 1),
TST_NONE(Prop.TEXTSHADOWTYPE, "none", 0),
TST_SINGLE(Prop.TEXTSHADOWTYPE, "single", 1),
TST_CONTINUOUS(Prop.TEXTSHADOWTYPE, "continuous", 2);
private TypeEnum(Prop prop, String enumName, int value) {
this.prop = prop;
this.enumName = enumName;
this.value = value;
}
private final Prop prop;
private final String enumName;
private final int value;
public String toString() {
return prop + "=" + enumName + "=" + value;
}
String getName() {
return enumName;
}
static TypeEnum getTypeEnum(Prop prop, int enumval) {
for (TypeEnum e : TypeEnum.values())
if (e.prop == prop && e.value == enumval)
return e;
return null;
}
}
}