From 48368019e61ebeaa61e30c96d3d0a577c9a95c97 Mon Sep 17 00:00:00 2001 From: Ruben Amendoeira Date: Mon, 21 May 2018 17:17:49 +0100 Subject: [PATCH 1/3] Expanded SkillIconManager to include smaller versions Needed small icons to use for the Skill Calc redesign, decided to expand the skill icon manager to include these, created a new folder in the resources with the small png's. --- .../runelite/client/game/SkillIconManager.java | 16 ++++++++++++---- .../resources/skill_icons_small/agility.png | Bin 0 -> 203 bytes .../main/resources/skill_icons_small/attack.png | Bin 0 -> 225 bytes .../main/resources/skill_icons_small/combat.png | Bin 0 -> 16037 bytes .../skill_icons_small/construction.png | Bin 0 -> 216 bytes .../resources/skill_icons_small/cooking.png | Bin 0 -> 220 bytes .../resources/skill_icons_small/crafting.png | Bin 0 -> 220 bytes .../resources/skill_icons_small/defence.png | Bin 0 -> 190 bytes .../resources/skill_icons_small/farming.png | Bin 0 -> 373 bytes .../resources/skill_icons_small/firemaking.png | Bin 0 -> 240 bytes .../resources/skill_icons_small/fishing.png | Bin 0 -> 240 bytes .../resources/skill_icons_small/fletching.png | Bin 0 -> 201 bytes .../resources/skill_icons_small/herblore.png | Bin 0 -> 222 bytes .../resources/skill_icons_small/hitpoints.png | Bin 0 -> 223 bytes .../main/resources/skill_icons_small/hunter.png | Bin 0 -> 277 bytes .../main/resources/skill_icons_small/magic.png | Bin 0 -> 231 bytes .../main/resources/skill_icons_small/mining.png | Bin 0 -> 212 bytes .../resources/skill_icons_small/overall.png | Bin 0 -> 15923 bytes .../main/resources/skill_icons_small/prayer.png | Bin 0 -> 321 bytes .../main/resources/skill_icons_small/ranged.png | Bin 0 -> 258 bytes .../resources/skill_icons_small/runecraft.png | Bin 0 -> 251 bytes .../main/resources/skill_icons_small/slayer.png | Bin 0 -> 546 bytes .../resources/skill_icons_small/smithing.png | Bin 0 -> 237 bytes .../resources/skill_icons_small/strength.png | Bin 0 -> 232 bytes .../resources/skill_icons_small/thieving.png | Bin 0 -> 169 bytes .../resources/skill_icons_small/woodcutting.png | Bin 0 -> 240 bytes 26 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 runelite-client/src/main/resources/skill_icons_small/agility.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/attack.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/combat.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/construction.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/cooking.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/crafting.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/defence.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/farming.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/firemaking.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/fishing.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/fletching.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/herblore.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/hitpoints.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/hunter.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/magic.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/mining.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/overall.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/prayer.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/ranged.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/runecraft.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/slayer.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/smithing.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/strength.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/thieving.png create mode 100644 runelite-client/src/main/resources/skill_icons_small/woodcutting.png diff --git a/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java b/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java index 089096abe9..d3883be67b 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java @@ -35,11 +35,12 @@ import net.runelite.api.Skill; @Slf4j public class SkillIconManager { - private final BufferedImage[] imgCache = new BufferedImage[Skill.values().length]; + // * 2 to account for the small version of each icon + private final BufferedImage[] imgCache = new BufferedImage[Skill.values().length * 2]; - public BufferedImage getSkillImage(Skill skill) + public BufferedImage getSkillImage(Skill skill, boolean small) { - int skillIdx = skill.ordinal(); + int skillIdx = skill.ordinal() + (small ? Skill.values().length : 0); BufferedImage skillImage = null; if (imgCache[skillIdx] != null) @@ -49,7 +50,8 @@ public class SkillIconManager try { - String skillIconPath = "/skill_icons/" + skill.getName().toLowerCase() + ".png"; + String skillIconPath = (small ? "/skill_icons_small/" : "/skill_icons/") + + skill.getName().toLowerCase() + ".png"; log.debug("Loading skill icon from {}", skillIconPath); synchronized (ImageIO.class) { @@ -64,4 +66,10 @@ public class SkillIconManager return skillImage; } + + public BufferedImage getSkillImage(Skill skill) + { + return getSkillImage(skill, false); + } + } diff --git a/runelite-client/src/main/resources/skill_icons_small/agility.png b/runelite-client/src/main/resources/skill_icons_small/agility.png new file mode 100644 index 0000000000000000000000000000000000000000..19c26d9022e735cf728a217473960dfad46c07ab GIT binary patch literal 203 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|t_%#v!o013JhwA9*?<&d zNswPKgTu2MX&_FLx4R2N2dk_HNO^%rWHAE+w=f7ZGR&GI0TlG}ba4#fxXycOBj*7H z373cNUf(xdsGXAVzxkwy-ohnY1dnJIpJhL8+rj(cQIvFy*6azN+TWK6zgcNv9sE9I q`>GeNA5ZX34_6j>7=N~c&;IWtkv(40dzS%CX7F_Nb6Mw<&;$S~A3y&9 literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/attack.png b/runelite-client/src/main/resources/skill_icons_small/attack.png new file mode 100644 index 0000000000000000000000000000000000000000..4d9aaa87f655a5fbae8b023eaa946b20099c60f0 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv4DbnY1=4Od`nz{BSL7u|1vm$| zS*Aq!HdSPoS96w^mjh+hPql*dFqQ=Q1v5B2yO9RsBze2LFm$lWdH^|`1s;*b3=G`D zAk4@xYmNj^(8troF@)oKasoqh=xPO%>!%_E8fR`^z+@bLkVVXaMQb6`K0gajo zjO#+Rl@Bt-$Vvr>YEMzn+QDKi<}ih8U4wzx+9+1h#sD6M!qal46Zd^61e(j>>FVdQ I&MBb@0PW*DzW@LL literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/combat.png b/runelite-client/src/main/resources/skill_icons_small/combat.png new file mode 100644 index 0000000000000000000000000000000000000000..80a81b4c8b07388b8230bf5613c18e01b0530ffc GIT binary patch literal 16037 zcmeI3dsGuw9>)jpMHHo|)q2iCjI;}AGLsjO*${bJum)p51?o{JnMoK;GBF7dQnc*4 z)aMpN-L6P|QCHML)h%p&KX6gubX~FHV?jBtRxE0D-L4g->?8pK7ns92+x=(H|m z^@2)DCqs}|I2jkGQe{#$%9=@;xk+(xT(gDJkp=>S?6)dDK0LcdH6i-)hCO#x(}%4v z+c$@VRDZX$_A`Eh|L51HUTXYo_iQp?@#1T%ep~kb$VoY;&s>^kR=xJ_j9&3wi~rQs zt4Hm4*i>`ha<=?N);??t=D+-!32pcxPxk8km=x%5zJL10R5cd58~pK)XCF-WZppn` z`76JlYV-aO<~Jw*v1v;IH!Qj{cHflqlabY{4#YHh{ShUvN6VqTi=V*Jp%**+LPD=U zkI92{mw(7ZzJKu7SbLxf(wNxxi|Df%)xbi`L)9ph4{4~dmjF`yO2Y13YetPG@-CFxwV=2s`{<3-c zS2yzu+V)f|*nML7i+{jpYUg&eX3W(<5Gp29(`;$VIjEL03NW0~5CXf=O!I~y`AoYR z(=I1$Tn(WoO;Nn>kDumoNj!?TP^v_f<~SmgOmtX?6i0HZ*0EeG!+A3m9Jw8(0~iS# z#;<@6Y^nYhF%;UPc*p^4}Vw?kV)08T19AzQ6Qb9Ohi-bpTBV+=hG$KM0 zF@q~Ygi;t0!(xOl5~C6Xm58`qAD)6k|C3vA9jcC>)ioS#Me#CiHZuytIXO9k9I=41 z=wYEuCW8?XEE4hQ9(-%A$%fhaChIhJknT9~gjH)H%{G!Uah-874V7h!;_;jV^?bVK zWiK)dJIg#}g02$Itm1|&BuzM#V-1zVpv1G@ zo@hioW+N1|GLnx-`66MeFdUUeqGDt^B193SR}gnkAcm68eH^o4Ly6L-FBpfyNnP%c zqIi1tjiFScNhYfeGiiyWcm+Lo0ZHO$q);Zs#1b8!5FrR3373TPH4=>AW05j3rW0y( z2rhF?vah^f=y*z-8qT>sNL?j=RNieA^6KMktKXV0;3{g?u3*5%MFovIst+k%Vhx z5~)-q6m}0WK$w0*C6ZP;n{s<)8J%mc%9BE@=-b-uFp#baV#X|1!nrY{c-=d*r{wfh z6sN|u!BI@>tUU^?GkpnM4)Z2$L}Q{e2kn-!o-yR?oh5?g9ouv zI$I8AA!77&h74tAx})}$f#Kz_vsN3(|G`37vF!hD8HTp2{x6onlf~Lh%%mr91>Bv$ z-3>!qIrn<@-C5ncwf|0(<62ZlS&W!XK^ieV0h>*FIqYflj4Aijpg77vS(Fq`D8zDj zpymNp^Z`@lK3{gFuKL|rZU}w0h@_t(o+!P#^$O#B#-Vhvp%Wi-ZF0H-^=kwBr#Xv; zA%x`ghG>UFwvl?rz&eRiaet#Hq| zwOs%qEMAnGfJ)aRES>O-5WC&zqoxiGKYvhknnq@DSNRzaz@kCaRSX zfI9%TD^*3PI{okk`aC`t{OJAZQYGJtL?Hg1iqT#mA)DZ_O!6PrT{{)t>GQ z&pIaiv#juF$ESZ4C-`1D=M$7yzIMjpfO^%uc^pn1C$y;5ULJT};PZy4Dx~7e(N$xF zdx|DZJoYp@&_1K^gz|Kty6wg54#kg(v-QFMPPlL$^*zU_s}I^a%skHj={WCvg+Op1 z`HL5Cj^v-rBp-*&n&oJxDpS(aV<6dw1nH@$p%>etZPxJzr2iW}FxQH;+g z-txjL-_tlU)Z>yWXKXAEKDhG~FJGD|DS5R1$ZSjQj%hxRgD6c&isb2XAFZyuU+W{M2zHBe~ z-H4i6-|d#{RZoN&7hZjJ1gUE;Ic{(?&sj1q$h-WStZi2+dhXss-%#!_?;Ac`yWXJ6 zz^?oPF1R)Pa^RaIW1)I?vu~;H=7=9u^6+i&97MSKGc%FVIp!>xDC)A554!sm^N@5>jw(LeSH%L(Q#^36tM@ z!TA|m8>2e!ckq%IZqHQ&jG0$IYF*wZ$@_d>SH&u|2e#ZG>~;cM#gYN+Lx jRXIo2jwn1j(+Bz&melkr;dHw5HRz;-Eal|aXmTV0KWt)E2|`nqk^vPL`M@76OW@20%ro6jG7#HoE4lsJ&)cLIKdGV6vSjK zGIdJJoL*kZ7M2zf$=DbfNft>7)&@4N2OIer+C+JrdUpmT0gYzxboFyt=akR{03%#F AHvj+t literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/cooking.png b/runelite-client/src/main/resources/skill_icons_small/cooking.png new file mode 100644 index 0000000000000000000000000000000000000000..2030f1d25bea66f72b100557d8073322444c4592 GIT binary patch literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^3h)VWP0r8x{{8N<9)Z{Z!RmBQ zps-X}bs3OiED7=pW^j0RBMrn!@^*J&=wOxg0CG4BJR*x37`TN&n2}-D90{Ocn5TjR${J7F`2FYG@IS`Ex9%oKE3+n$J= z`E$YT2-}&htEbLp+EjFQbEt)MxJ%Efpz|;6)5_pI;wmpM2a4TF zw4Vl~7)yfuf*Bm1-ADs*lDyqr7&=&GJ%Aj}0*}aI1_o|n5N2eUHAey{80qQa7{YPg zwf7+J0Rs-^zX^>Va}`dpon$bn_&+o2vnGFuSpq}ohG-=}E;hm2uWF65vQIc(v)fP_ z&Y2Q>=|VK$1F4&t_!@hljQC0!qCAg>jC6&7I;J!Gca%qgD@k*tT_@uL2FMJ#}JO| z$q5b2;sy*xGOWG5Q$rkh5-koNkrZcM!a21udLwrSgTe~DWM4fF@ZFy literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/farming.png b/runelite-client/src/main/resources/skill_icons_small/farming.png new file mode 100644 index 0000000000000000000000000000000000000000..0b9becd5f51ffba87569075aa7d6b4ef5adb3f1c GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}QGic~E08WskE+Q}D$9y%tITSv z%&93zDoBfLC{1rDNe@Zfo>X`_I_p?*W=utHd|_HtV`+MKZGKr+d__)tOxE%4y8ME) zsF!asJM zJe(=f9HDG*nagDQ#)_p=qo4P`3156d^g_vsO!Gq5n7@oH+@jJBhZofVoyOql>gTe~ HDWM4fvQdc! literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/firemaking.png b/runelite-client/src/main/resources/skill_icons_small/firemaking.png new file mode 100644 index 0000000000000000000000000000000000000000..a9297c8edcc81b99e73e8cbd0ec4635f8ad93631 GIT binary patch literal 240 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^3h)VWP0r8RY{`7rpK;v^)(9&e zpzz^}^1DEau_VYZn8D%MjWiG^$=lt9p@UV{1IXbl@Q5sCVBi)8VMc~ob0mO*S)MMA zAsp9D`wsFt8*(`BG;sK&o)O6Au_%Y(`wQXs`@QbQPi_9{Fs-+PW5dctCpc@qPi;FI zz3n&e?M0c3{hD9wsG3>Y`R$k1x8^uE#guNbFC2aH=_(FfYI5b1*cHtj8ZIwazp-;Z c`xATl0|65L|5?hFfVMJty85}Sb4q9e0NkEW8vpEal| zab30NAnySM9_GIp><=!oHbpc{sbAVwuUYXwRBDC%Hqp7v2Rxd)bz7R5GuS1aK5=i{ ztoFx9FU#Wn&eFG4RX0PotWnB8Cwx!Bl}ju8%%lDJOTDxlLVdsWd8RC~FBZ|ivDNMJ aN5)M|B3w0_7+(TyW$<+Mb6Mw<&;$S|g-ied literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/fletching.png b/runelite-client/src/main/resources/skill_icons_small/fletching.png new file mode 100644 index 0000000000000000000000000000000000000000..56b50c406751596f865f75a4d55efd3bcf827c2c GIT binary patch literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPHV5AX?bO)b%F(c@65=Cs%228vbf zWYz&vj3q&S!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--ebn|p^4B@z5 z+q+TlfC3M5tU>2t78z!N&%e*NBnP@LfApUFq|Rl7);h&sp@uHG)~r4=R8LHcxLNPW mS>5Tb{3Bvnwzx`d0mJ_g{=5yJPEG)t$l&Sf=d#Wzp$PzSi8%)V literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/herblore.png b/runelite-client/src/main/resources/skill_icons_small/herblore.png new file mode 100644 index 0000000000000000000000000000000000000000..fde27351c406beb4c5357c1762ea2575bd2c3f47 GIT binary patch literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ%`eJjc+bF4&A@P#fng;B zLmE(mK{)8H4Ul3i3GxeOaCmkDB*>WL?e4vL>4nJa0`PlBg3pY5YR7 zVY6fp<1)rBi`j-74oYSo^K(3x=I}R1)6Y>aLHTln0%Lb8L$8$R`HWZRlz|p7c)I$z JtaD0e0s#F0K$8Ff literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/hitpoints.png b/runelite-client/src/main/resources/skill_icons_small/hitpoints.png new file mode 100644 index 0000000000000000000000000000000000000000..bf431f7518a0b82655a38783bbbafd8e6d47bef2 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^3h)VWP0r8RY{^_@%gMmN2o$^P z&nT}P@Ce9aED7=pW^j0RBMrn!@^*J&=wOxg0CG4BJR*x37`TN&n2}-D90{Ocq^FBx z2*>s0ga$^j6{1?Pa1 zGa3&Dh#WCUNGLE9Vd1i1&}B5_aoA=l?Z_e_;Si?8z_2Stw25s-N*2%(22WQ%mvv4F FO#s-PGmQWM literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/hunter.png b/runelite-client/src/main/resources/skill_icons_small/hunter.png new file mode 100644 index 0000000000000000000000000000000000000000..88be793bbb425a8b56d02f912e891f6e54c73665 GIT binary patch literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}cz{octG2X^hLp6HjI5r#lAeOH zzM_i0lA4*GftIY2fwG3CtdgFRx}lnuftr@7hQ5`qiIuvEsjjiPmWi&0wz7;e&=^r^ zAvJ9o1w~;kZFxya$^ZZV0|k4-@0|crj3q&S!3+-1Zlr-YN#5=*3>~bp9zYIffk$L9 z0|U1(2s1Lwnj--e^zw9Z43W58+tk|D{vdl%y;Rbvs`Q^%k9H zSZu=_*LY#y!nM;k{mm;)NQ!jX_{{QVKU4D=$>(3)1*CjD{<3+kvL>4nJa0`PlBg3pY5 literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/mining.png b/runelite-client/src/main/resources/skill_icons_small/mining.png new file mode 100644 index 0000000000000000000000000000000000000000..57430882d0ecc3f2dde4c7e188e2098cbc2d7dcc GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|ZZ`U*)ipo?PlIcs zK#H*>$S;_|;n|He5GTpo-G!lpRn`N@;VkfoEM{Qf76xHPhFNnYfPx{OE{-7_*LhEF z0DLY40fK2)lo~lxbE}1kZ+5OcvbC9E9JgVe8RR0Xg-6dtDnm{r-UW|g#|!p literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/overall.png b/runelite-client/src/main/resources/skill_icons_small/overall.png new file mode 100644 index 0000000000000000000000000000000000000000..7f00fa97a362ec2eabfd403e0a6fa9c37cb80faa GIT binary patch literal 15923 zcmeI3dsGuw9>)jQRzs(( zt*x($N{^LVANZ=`qt$i6x0KbjKGqf$OVL%k_*k_S>tmI&lLSb(z#Pum?mv4b=OmNg z{oU{H&i&lq{muPn7VF2o6A~OA3_(yxVnUpOz4r8cyS~c)4oHCi&R)9N64D(I)V;Uo z8w9Og*B^p{6tq^W*Jm+K#*xL?1c_R$z-DJMX)^^u?yI|&?S1#8zE8~gk2c=WkLWzp z<}QecIB<7b#b!7@bZ6zj)0Z}Hc$e-qb!z3jMVlsfdBb(|*y#y2{mV`bF*EO84;`47 z*Y&eI)hB*Q51mnI#V-DmtA0`5BN@8T?aS}1`+Gt+1}}SdymmyV>$ATt z85QztMeZlVLy{KUx30<;43B9Ty*0eNKbkjhM{IS_7L2|eqk)R2K0soIovIIs7PAM9g41oD6@lhDt2^wDZTBw<#=~v`6>sy?W@5O`Ak3 z8oC@a9=T%0?7OC?&$;(fT2gzax@LLkg0!5G8L_IA+H1p?6kV&mQQ;2j$>2GLuYMSD zuxdg6y^XsjZ8-GG)0@b#it+WgGsYVs2$Rw&Y0flV5=Jl<5l%8jO60cKSl$q%iFVs? zVg}_D7%3BNjTAmCJ1P{=WTY@vu0wS;EtN$l zc_6E!ksV7BapN{bEJBfXL^>U}%wlO%>2Su+V(+AJW^E4WNSSS;5Ci34vh4&FKZ~+D z2eow*B+(qlmTfnC`H%!cnJEh^aj-WpZu1swO&hIQ-r_cz-R;iaNoV>Or-jzzX;((M z>2_ouk5A@J1>Xv3*!;t^b_#bg_7sLONBOeMUnbZp;mImNL@I418JA<21_34h_4Y@j z;&3Mw#VS=WDu*TF6tM!6t1!7_1S-Z*G$4qtClEu&=01r#@s31k(HD%vkaXtk4n^_z zY#BqR!xF6yCvGLE#JDJS?jo8dF%(xSNQp`XD{xW;XDVeVjH^@X{! zWK9DF1Zy?WcstG3CEOg)$1@j_9ZaTD5K_5V2}>1(7?!AI1Z-5Pl(12ZN+b$}lv2ww zn}%p3Osk<1Xa}23vjeh>%{6c3Nv3ADY;AIwX>SFw;dTe**_e^Srk&Yba+)iON8{b# z7*2RJ9 z0A3y!0EFA*adGnjygV)d2)D`O;^qT*d0YSxZj;Bw%?I%ExBwvBCXb7o58&l-0YJD- z9v3$sz{}$TfN+~UE^a=6m&XMF;Wl|(+4yBdWJUH+$ z%<@e8`{HxTE;nAB`^#&^j)>w~WXh3ex2h}a_H8uQ*M{$2(~n6xT3zz_$oHNfEZjWc z(EFM*VMT8qcHBC#?!D)wOX{otap!x}Em1?sgqOPR18;;U{Cn=Pf>l*dzF0cM{^nor zrLP@6rdz&AIb}{o(uIRLId1pyr&AseLX+d~iZcpKVL$8~o1WUW{K2${uglL?Rh1QP z**eI4eD!`;?v#eF-F^1-UjF6Y$}OTI{oVCD>UtOaq2%m0r~1y=dmqLw_39k*mBAUl zraYtbzI!|RtRFNt2dJWf29h^5I_orCY zemkkZ?DYLd+9EP+{iM{YeharB%wM(g!|*PP42H>PuGA#gefvH$@Mgb1Wlx%V?MQKP zXnz8QM(Zc`O;;AJ6W6?UVS;vPV0g zhuBjuRAp=~tn9J0sC<$3lQG|2+-u0|a$-eFI5`E9Fa3ChzS|BuXzap>w}wp5|Da-C za9Qk+kCq$%7&=dVz;u3vR`8Q%{MCcogO-HGoeeE3U3zEv=biE;Hy@9RPWWhj_Y*JX gNB=y3-fK|${#W&TE|rNqFC{0&kBciAJ#FEC0LMS+w*UYD literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/prayer.png b/runelite-client/src/main/resources/skill_icons_small/prayer.png new file mode 100644 index 0000000000000000000000000000000000000000..7c348987ebd24249442ad5a685ef1b90647d654a GIT binary patch literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}RDe&2D?>SmDJ;x8b;G=An-d+33$HF+`*=e}YdJ5_XvUHtzhDN3XE)M7oFs2| z7lsa2Sq~tGv%n*=n1O*?7=#%aX3dcR3Ko01IEF}Ej_r@;Yc}9v*=*z6uw+V8?1At5 z)s}d;p8Hd&a(nl=zYGs}1hfNAXYgo!G$_`r{ci3MYJU6At9OSpb!I!KzT4~1b-z0{ zv~sTplj4!o%cV+-s#j_}N`IJ{F~6W=;!4wc=E=O@o++L_SGjY~+ryk2Ke62IWvROc Pw4TA!)z4*}Q$iB}C~@@x5%^$J=BKE11ej$rU~^>bP0l+XkKgc4O= literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/runecraft.png b/runelite-client/src/main/resources/skill_icons_small/runecraft.png new file mode 100644 index 0000000000000000000000000000000000000000..2c52ffe9139bc3f027cfa47eb4105e01de262e22 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa2=EDUO)Oy8V9C;L&N*SigvhAS z^73*921cOdat7<=K#H*>$S;_|;n|He5GTpo-G!lpRn`N@;VkfoEM{Qf76xHPhFNnY zfP(p+E{-7_*L{1f`C1HkT$U@Dp3UnI+sW{VO)REiVVqszt&o#n3q?2|rp-%Jv1cd{ ze0$2=^v3Uc-taHN-Hvis{iB<#c~5lYEz#Pk=r7~cIypps$CWns36gWK{xd4LUiHW2 n%p}*nXI_5&SvYg=jRNK^cVsPC@1AY}TFv0;>gTe~DWM4f0(nxQ literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/slayer.png b/runelite-client/src/main/resources/skill_icons_small/slayer.png new file mode 100644 index 0000000000000000000000000000000000000000..f02563044c4ed3021994f92795824bcc79613695 GIT binary patch literal 546 zcmV+-0^R+IP)Clmt#r zPI`KJxV8l{EGs%QD@{xm{{H?&Jvi&)-R0cYTU%So%F5Qnx$NZNKsPI~n2FBL&d|TJ zprD{bLqkbONWiI^^z`(dn3k=UiPO=~(96h!f(^m9v6_Z@ii8$FKR}+GBK7aLku zHZh}*gU!nVr=|kN$H)5m`RwZG@9E{@)y_&lI!{jyUs6dyH8xB?H@lyWR!l}wQBhi0 zP%SM0ARiq+I3M29%G=DthlT-)i2(or02m1~r2qf`0d!JMQvg8b*k%9#00Cl4M??UK z1szBL000SaNLh0L01FcU01FcV0GgZ_0002NNklE)pQA2j@_swdocGLOm@x1Q^9>YUJCd)&BB17WhbVy2%?)nf3N4e%Xr_Ju zK$c~q@k(N@0-g74PpW5;7rQeg>o%OM?7@862M7NCR<_yxm;OkH}&M25w;xW@MN(M*=9A?&;zf z!f{=<=b&JN0uRgQjSU@Q4ojGv82Jv#D}KA*#aXp}?%bWNMTfQrE}fD!LGRfW9=>NQ zvev{UX4~)JYPLx_BKt03!G1ZTzzgB)ol;~iTQ{67Q#WDu{&wz^g4|5sRNlg%if0d4 YxqgURyuFgE1GJLC)78&qol`;+02AO!y8r+H literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/strength.png b/runelite-client/src/main/resources/skill_icons_small/strength.png new file mode 100644 index 0000000000000000000000000000000000000000..976c550712da6174c7ef10653c9c7d911790babf GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^3h)VWP0r78v(aZ@U|cw<>cXZL zps>W7(z!s2u_VYZn8D%MjWiG^$=lt9p@UV{1IXbl@Q5sCVBi)8VMc~ob0mO*NuDl_ zAsp9r&s^j@puppLQNg0&EYs0f4C@OUv)DA6eywUK6hqnKH9L&ur|qwfNh}tw6-nV| UJ}bOy4bV0QPgg&ebxsLQ0Pbr`YybcN literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/thieving.png b/runelite-client/src/main/resources/skill_icons_small/thieving.png new file mode 100644 index 0000000000000000000000000000000000000000..4aca64fdb09668655b409c219a3b66b893760a65 GIT binary patch literal 169 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|uK)l42QqeIEHXsPfj?%=Hx6X z5#j92EaBqp>@0C4EX_AjAX>_l^$@GK!3MU3tDFoG7dX0XZJK`r^)Yz5`njxgN@xNA DP^BvE literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/skill_icons_small/woodcutting.png b/runelite-client/src/main/resources/skill_icons_small/woodcutting.png new file mode 100644 index 0000000000000000000000000000000000000000..379d09b76f6365a3cd46be0520ee463fea31a610 GIT binary patch literal 240 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ%`eKWvgKr0$q-@1!Eal|ab34}BkutP9+v%zwOnEjDGVuU3~UZYOO`eMb?@M<6u0|(I-g z(s_`j$;mro(w+;AkAg)tET^py*z9xks-^oo=XWzZUh64s$~q8Wq3^S!TP% boelgsnW8%nRkrv7tz__Y^>bP0l+XkK$j3-^ literal 0 HcmV?d00001 From 84213d1eff8f77bd4121d5dbcc15376a3266a323 Mon Sep 17 00:00:00 2001 From: Ruben Amendoeira Date: Mon, 21 May 2018 18:31:07 +0100 Subject: [PATCH 2/3] Added/Changed custom UI components MaterialTabs: - Added a second constructor for use cases where the programmer does not want the screen switching functionality, only the tab selection functionality (think of them as fancy radio buttons - Tweaked the border on the material tab so that the highlight overlays instead of appending to the bottom. IconTextField: - Fixed copyright link - Refactored to include the new FlatTextField (code was taken from this class to produce the new class) FlatTextField: - Added this new component, it is pretty much the same as IconTextField but used for just text input purposes, no icons. --- .../client/ui/components/FlatTextField.java | 170 ++++++++++++++++++ .../client/ui/components/IconTextField.java | 79 ++++---- .../components/materialtabs/MaterialTab.java | 2 +- .../materialtabs/MaterialTabGroup.java | 24 ++- 4 files changed, 232 insertions(+), 43 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java b/runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java new file mode 100644 index 0000000000..e51de3481b --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2018, Psikoi + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.ui.components; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.ActionListener; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.EmptyBorder; +import javax.swing.text.Document; +import lombok.Getter; +import net.runelite.client.ui.ColorScheme; + +/** + * This component is a JTextField with a flat design look. + */ +public class FlatTextField extends JPanel +{ + @Getter + private final JTextField textField; + + //the default background color, this needs to be stored for hover effects + @Getter + private Color backgroundColor = ColorScheme.DARKER_GRAY_COLOR; + + //the default hover background color, this needs to be stored for hover effects + @Getter + private Color hoverBackgroundColor; + + // the input can be blocked (no clicking, no editing, no hover effects) + @Getter + private boolean blocked; + + public FlatTextField() + { + setLayout(new BorderLayout()); + setBorder(new EmptyBorder(0, 10, 0, 0)); + + this.textField = new JTextField(); + this.textField.setBorder(null); + this.textField.setOpaque(false); + this.textField.setSelectedTextColor(Color.WHITE); + this.textField.setSelectionColor(ColorScheme.BRAND_ORANGE_TRANSPARENT); + + add(textField, BorderLayout.CENTER); + + textField.addMouseListener(new MouseAdapter() + { + @Override + public void mouseEntered(MouseEvent mouseEvent) + { + if (blocked) + { + return; + } + + if (hoverBackgroundColor != null) + { + setBackground(hoverBackgroundColor, false); + } + } + + @Override + public void mouseExited(MouseEvent mouseEvent) + { + setBackground(backgroundColor); + } + }); + } + + public void addActionListener(ActionListener actionListener) + { + textField.addActionListener(actionListener); + } + + public String getText() + { + return textField.getText(); + } + + public void setText(String text) + { + textField.setText(text); + } + + public void addInputKeyListener(KeyListener l) + { + textField.addKeyListener(l); + } + + public void removeInputKeyListener(KeyListener l) + { + textField.removeKeyListener(l); + } + + @Override + public void setBackground(Color color) + { + setBackground(color, true); + } + + public void setBackground(Color color, boolean saveColor) + { + if (color == null) + { + return; + } + + super.setBackground(color); + + if (saveColor) + { + this.backgroundColor = color; + } + } + + public void setHoverBackgroundColor(Color color) + { + if (color == null) + { + return; + } + + this.hoverBackgroundColor = color; + } + + public void setEditable(boolean editable) + { + this.blocked = !editable; + textField.setEditable(editable); + textField.setFocusable(editable); + if (!editable) + { + super.setBackground(backgroundColor); + } + } + + public Document getDocument() + { + return textField.getDocument(); + } + +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/IconTextField.java b/runelite-client/src/main/java/net/runelite/client/ui/components/IconTextField.java index 39a18486d0..f9f84d87b2 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/IconTextField.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/IconTextField.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2017, Adam - * Copyright (c) 2018, Psikoi + * Copyright (c) 2018, Psikoi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,31 +33,23 @@ import java.awt.event.ActionListener; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.text.Document; -import net.runelite.client.ui.ColorScheme; /** - * This component is a JTextField with an icon on its left side. + * This component is a FlatTextField with an icon on its left side. */ public class IconTextField extends JPanel { - private final JTextField textField; + private final FlatTextField textField; //to support gifs, the icon needs to be wrapped in a JLabel private final JLabel iconWrapperLabel; - //the default background color, this needs to be stored for hover effects - private Color backgroundColor = ColorScheme.DARKER_GRAY_COLOR; - //the default hover background color, this needs to be stored for hover effects - private Color hoverBackgroundColor; - - // the input can be blocked (no clicking, no editing, no hover effects) - private boolean blocked; - public IconTextField() { setLayout(new BorderLayout()); @@ -67,35 +59,44 @@ public class IconTextField extends JPanel this.iconWrapperLabel.setVerticalAlignment(JLabel.CENTER); this.iconWrapperLabel.setHorizontalAlignment(JLabel.CENTER); - this.textField = new JTextField(); - this.textField.setBorder(null); - this.textField.setOpaque(false); + textField = new FlatTextField(); + textField.setBorder(null); - add(iconWrapperLabel, BorderLayout.WEST); - add(textField, BorderLayout.CENTER); + JTextField innerTxt = textField.getTextField(); + innerTxt.removeMouseListener(innerTxt.getMouseListeners()[innerTxt.getMouseListeners().length - 1]); - textField.addMouseListener(new MouseAdapter() + MouseListener hoverEffect = new MouseAdapter() { @Override public void mouseEntered(MouseEvent mouseEvent) { - if (blocked) + if (textField.isBlocked()) { return; } - if (hoverBackgroundColor != null) + Color hoverColor = textField.getHoverBackgroundColor(); + + if (hoverColor != null) { - IconTextField.super.setBackground(hoverBackgroundColor); + IconTextField.super.setBackground(hoverColor); + textField.setBackground(hoverColor, false); } + } @Override public void mouseExited(MouseEvent mouseEvent) { - IconTextField.super.setBackground(backgroundColor); + setBackground(textField.getBackgroundColor()); } - }); + }; + + textField.addMouseListener(hoverEffect); + innerTxt.addMouseListener(hoverEffect); + + add(iconWrapperLabel, BorderLayout.WEST); + add(textField, BorderLayout.CENTER); } public void addActionListener(ActionListener actionListener) @@ -125,8 +126,23 @@ public class IconTextField extends JPanel { return; } + super.setBackground(color); - this.backgroundColor = color; + + if (textField != null) + { + textField.setBackground(color); + } + } + + public void setHoverBackgroundColor(Color hoverBackgroundColor) + { + if (hoverBackgroundColor == null) + { + return; + } + + this.textField.setHoverBackgroundColor(hoverBackgroundColor); } public void addInputKeyListener(KeyListener l) @@ -139,23 +155,12 @@ public class IconTextField extends JPanel textField.removeKeyListener(l); } - public void setHoverBackgroundColor(Color hoverBackgroundColor) - { - if (hoverBackgroundColor == null) - { - return; - } - this.hoverBackgroundColor = hoverBackgroundColor; - } - public void setEditable(boolean editable) { - this.blocked = !editable; textField.setEditable(editable); - textField.setFocusable(editable); if (!editable) { - super.setBackground(backgroundColor); + super.setBackground(textField.getBackgroundColor()); } } @@ -163,7 +168,7 @@ public class IconTextField extends JPanel public boolean requestFocusInWindow() { super.requestFocusInWindow(); - return textField.requestFocusInWindow(); + return textField.requestFocusInWindow(); } public Document getDocument() diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java b/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java index 3d84cb483d..fd4b4d2c82 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java @@ -48,7 +48,7 @@ public class MaterialTab extends JLabel { private static final Border SELECTED_BORDER = new CompoundBorder( BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.BRAND_ORANGE), - BorderFactory.createEmptyBorder(5, 10, 5, 10)); + BorderFactory.createEmptyBorder(5, 10, 4, 10)); private static final Border UNSELECTED_BORDER = BorderFactory .createEmptyBorder(5, 10, 5, 10); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTabGroup.java b/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTabGroup.java index 67978efd37..58fac5474f 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTabGroup.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTabGroup.java @@ -58,11 +58,19 @@ public class MaterialTabGroup extends JPanel public MaterialTabGroup(JPanel display) { this.display = display; - this.display.setLayout(new BorderLayout()); + if (display != null) + { + this.display.setLayout(new BorderLayout()); + } setLayout(new FlowLayout(FlowLayout.CENTER, 8, 0)); setOpaque(false); } + public MaterialTabGroup() + { + this(null); + } + /* Returns the tab on a certain index. */ public MaterialTab getTab(int index) { @@ -93,16 +101,22 @@ public class MaterialTabGroup extends JPanel return false; } - display.removeAll(); + if (display != null) + { + display.removeAll(); + } for (MaterialTab tab : tabs) { if (tab.equals(selectedTab)) { tab.select(); - display.add(tab.getContent()); - display.revalidate(); - display.repaint(); + if (display != null) + { + display.add(tab.getContent()); + display.revalidate(); + display.repaint(); + } } else { From 566439e38d684e222df3e303f1343f63fbd4854f Mon Sep 17 00:00:00 2001 From: Ruben Amendoeira Date: Mon, 21 May 2018 20:54:18 +0100 Subject: [PATCH 3/3] Skill Calc plugin redesign Following the obsidian redesign update, this time I've ventured into the skilling calculators. Major changes were made, here are the most noticeable: - Added a title to the top of the plugin panel - Resized the skilling selectors to a 3x6 grid and used the MaterialTabs for the selection behavior. - Resized, recolored and reshaped the input panels and respective labels to better fit the new theme and aesthetic. - Added a new action "on enter", the textfield will now request focus on the next logical textfield, (example, when enter is pressed on the current level field, it will request focus on the target level) - Reworded the input labels from "XP" to "Experience" - Resized, recolored and reshaped the boost/modifier selectors - Recolored the actions/selections indicator to a dark gray - Recolored all item panels to a dark gray, and instead added a left side thick border to indicate availability (green/red) - Added required level indicator on the sub-title of each item - Added hover effects for the individual items - Added hover effects for the material tabs --- .../skillcalculator/SkillCalculator.java | 45 +++++-- .../skillcalculator/SkillCalculatorPanel.java | 125 ++++++++++-------- .../plugins/skillcalculator/UIActionSlot.java | 70 ++++++++-- .../UICalculatorInputArea.java | 56 ++++---- .../skillcalculator/UICombinedActionSlot.java | 20 +-- .../net/runelite/client/ui/ColorScheme.java | 2 + 6 files changed, 202 insertions(+), 116 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java index 5218a1ac44..2caa3b78e5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Kruithne + * Copyright (c) 2018, Psikoi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +26,8 @@ package net.runelite.client.plugins.skillcalculator; import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.text.DecimalFormat; @@ -32,6 +35,7 @@ import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; +import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JCheckBox; import javax.swing.JLabel; @@ -43,6 +47,8 @@ import net.runelite.client.game.SpriteManager; import net.runelite.client.plugins.skillcalculator.beans.SkillData; import net.runelite.client.plugins.skillcalculator.beans.SkillDataBonus; import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry; +import net.runelite.client.ui.ColorScheme; +import net.runelite.client.ui.FontManager; class SkillCalculator extends JPanel { @@ -75,11 +81,20 @@ class SkillCalculator extends JPanel this.uiInput = uiInput; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - setBorder(BorderFactory.createLineBorder(getBackground().brighter())); - // Register listeners on the input fields.. - uiInput.uiFieldCurrentLevel.addActionListener(e -> onFieldCurrentLevelUpdated()); - uiInput.uiFieldCurrentXP.addActionListener(e -> onFieldCurrentXPUpdated()); + // Register listeners on the input fields and then move on to the next related text field + uiInput.uiFieldCurrentLevel.addActionListener(e -> + { + onFieldCurrentLevelUpdated(); + uiInput.uiFieldTargetLevel.requestFocusInWindow(); + }); + + uiInput.uiFieldCurrentXP.addActionListener(e -> + { + onFieldCurrentXPUpdated(); + uiInput.uiFieldTargetXP.requestFocusInWindow(); + }); + uiInput.uiFieldTargetLevel.addActionListener(e -> onFieldTargetLevelUpdated()); uiInput.uiFieldTargetXP.addActionListener(e -> onFieldTargetXPUpdated()); } @@ -110,6 +125,8 @@ class SkillCalculator extends JPanel // Create action slots for the skill actions. renderActionSlots(); + add(Box.createRigidArea(new Dimension(0, 15))); + // Update the input fields. updateInputFields(); } @@ -142,7 +159,7 @@ class SkillCalculator extends JPanel if (neededXP > 0) actionCount = (int) Math.ceil(neededXP / xp); - combinedActionSlot.setText(formatXPActionString(xp, actionCount)); + combinedActionSlot.setText(formatXPActionString(xp, actionCount, "exp - ")); } private void clearCombinedSlots() @@ -163,15 +180,21 @@ class SkillCalculator extends JPanel JLabel uiLabel = new JLabel(bonus.name); JCheckBox uiCheckbox = new JCheckBox(); - // Adding an empty 8-pixel border on the left gives us nice padding. - uiOption.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); + uiLabel.setForeground(Color.WHITE); + uiLabel.setFont(FontManager.getRunescapeSmallFont()); + + uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0)); + uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR); // Adjust XP bonus depending on check-state of the boxes. uiCheckbox.addActionListener(e -> adjustXPBonus(uiCheckbox.isSelected(), bonus.value)); + uiCheckbox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR); uiOption.add(uiLabel, BorderLayout.WEST); uiOption.add(uiCheckbox, BorderLayout.EAST); + add(uiOption); + add(Box.createRigidArea(new Dimension(0, 5))); } } } @@ -186,6 +209,8 @@ class SkillCalculator extends JPanel { UIActionSlot slot = new UIActionSlot(action); uiActionSlots.add(slot); // Keep our own reference. + + add(Box.createRigidArea(new Dimension(0, 5))); add(slot); // Add component to the panel. slot.addMouseListener(new MouseAdapter() @@ -223,15 +248,15 @@ class SkillCalculator extends JPanel if (neededXP > 0) actionCount = (int) Math.ceil(neededXP / xp); - slot.setText(formatXPActionString(xp, actionCount)); + slot.setText("Lvl. " + slot.action.level + " (" + formatXPActionString(xp, actionCount, "exp) - ")); slot.setAvailable(currentLevel >= slot.action.level); slot.value = xp; } } - private String formatXPActionString(double xp, int actionCount) + private String formatXPActionString(double xp, int actionCount, String expExpression) { - return XP_FORMAT.format(xp) + "xp - " + NumberFormat.getIntegerInstance().format(actionCount) + (actionCount > 1 ? " actions" : " action"); + return XP_FORMAT.format(xp) + expExpression + NumberFormat.getIntegerInstance().format(actionCount) + (actionCount > 1 ? " actions" : " action"); } private void updateInputFields() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPanel.java index b0e520a33e..06b75a8417 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPanel.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Kruithne + * Copyright (c) 2018, Psikoi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,96 +26,108 @@ package net.runelite.client.plugins.skillcalculator; -import java.awt.Dimension; +import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.image.BufferedImage; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; +import java.awt.GridLayout; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JPanel; +import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.SwingConstants; +import javax.swing.border.EmptyBorder; import net.runelite.api.Client; import net.runelite.client.game.SkillIconManager; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.PluginPanel; +import net.runelite.client.ui.components.materialtabs.MaterialTab; +import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; class SkillCalculatorPanel extends PluginPanel { - private JButton activeButton; - private int uiButtonIndex = 0; private final SkillCalculator uiCalculator; private final SkillIconManager iconManager; - private final JPanel uiButtonGrid = new JPanel(); - private final GridBagLayout uiButtonGridLayout = new GridBagLayout(); - private final GridBagConstraints uiButtonGridConstraints = new GridBagConstraints(); + private final MaterialTabGroup tabGroup; + + private final MouseListener tabHoverListener; SkillCalculatorPanel(SkillIconManager iconManager, Client client) { super(); + getScrollPane().setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + tabHoverListener = new MouseAdapter() + { + @Override + public void mouseEntered(MouseEvent e) + { + MaterialTab tab = (MaterialTab) e.getSource(); + tab.setBackground(ColorScheme.DARKER_GRAY_HOVER_COLOR); + } + + @Override + public void mouseExited(MouseEvent e) + { + MaterialTab tab = (MaterialTab) e.getSource(); + tab.setBackground(ColorScheme.DARKER_GRAY_COLOR); + } + }; + this.iconManager = iconManager; - BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS); - setLayout(layout); + setBorder(new EmptyBorder(10, 10, 0, 10)); + setLayout(new GridBagLayout()); - uiButtonGridConstraints.fill = GridBagConstraints.BOTH; - uiButtonGridConstraints.weightx = 1; - uiButtonGridConstraints.ipady = 12; - uiButtonGridConstraints.insets = new Insets(2, 2, 2, 2); + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.gridx = 0; + c.gridy = 0; + + tabGroup = new MaterialTabGroup(); + tabGroup.setLayout(new GridLayout(0, 6, 7, 7)); - uiButtonGrid.setLayout(uiButtonGridLayout); - uiButtonGrid.setBackground(ColorScheme.DARK_GRAY_COLOR); - uiButtonGrid.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); addCalculatorButtons(); final UICalculatorInputArea uiInput = new UICalculatorInputArea(); + uiInput.setBorder(new EmptyBorder(15, 0, 15, 0)); uiInput.setBackground(ColorScheme.DARK_GRAY_COLOR); uiCalculator = new SkillCalculator(client, uiInput); - add(uiButtonGrid); - add(Box.createRigidArea(new Dimension(0, 8))); - add(uiInput); - add(Box.createRigidArea(new Dimension(0, 14))); - add(uiCalculator); + JLabel title = new JLabel("Skilling Calculator"); + title.setBorder(new EmptyBorder(0, 1, 8, 0)); + title.setForeground(Color.WHITE); + + add(title, c); + c.gridy++; + + add(tabGroup, c); + c.gridy++; + + add(uiInput, c); + c.gridy++; + + add(uiCalculator, c); + c.gridy++; } private void addCalculatorButtons() { for (CalculatorType calculatorType : CalculatorType.values()) { - final JButton uiButton = new JButton(); - final BufferedImage icon = iconManager.getSkillImage(calculatorType.getSkill()); - uiButton.addActionListener(e -> openCalculator(calculatorType, uiButton)); + MaterialTab tab = new MaterialTab("", tabGroup, null); + tab.setOpaque(true); + tab.setVerticalAlignment(SwingConstants.CENTER); + tab.setHorizontalAlignment(SwingConstants.CENTER); + tab.setBackground(ColorScheme.DARKER_GRAY_COLOR); + tab.setIcon(new ImageIcon(iconManager.getSkillImage(calculatorType.getSkill(), true))); + tab.setOnSelectEvent(() -> uiCalculator.openCalculator(calculatorType)); + tab.addMouseListener(tabHoverListener); - uiButton.setIcon(new ImageIcon(icon)); - uiButton.setToolTipText(calculatorType.getSkill().getName()); - uiButton.setFocusPainted(false); - - uiButtonGridConstraints.gridx = uiButtonIndex % 4; - uiButtonGridLayout.setConstraints(uiButton, uiButtonGridConstraints); - uiButtonGrid.add(uiButton); - uiButtonIndex++; + tabGroup.addTab(tab); } } - - private void openCalculator(CalculatorType calculatorType, JButton button) - { - // Remove highlight from existing button.. - if (activeButton != null) - activeButton.setSelected(false); - - // Set the new button as selected.. - button.setSelected(true); - activeButton = button; - - // Invoke the calculator component.. - uiCalculator.openCalculator(calculatorType); - - // Refresh rendering.. - revalidate(); - repaint(); - } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java index 75abc211a7..e3939210e7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Kruithne + * Copyright (c) 2018, Psikoi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,15 +30,30 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.border.Border; +import javax.swing.border.CompoundBorder; +import javax.swing.border.EmptyBorder; import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry; +import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; class UIActionSlot extends JPanel { + private static final Border GREEN_BORDER = new CompoundBorder( + BorderFactory.createMatteBorder(0, 4, 0, 0, (ColorScheme.PROGRESS_COMPLETE_COLOR).darker()), + BorderFactory.createEmptyBorder(7, 12, 7, 7)); + + private static final Border RED_BORDER = new CompoundBorder( + BorderFactory.createMatteBorder(0, 4, 0, 0, (ColorScheme.PROGRESS_ERROR_COLOR).darker()), + BorderFactory.createEmptyBorder(7, 12, 7, 7)); + SkillDataEntry action; private JShadowedLabel uiLabelActions; private static final Dimension ICON_SIZE = new Dimension(32, 32); @@ -52,11 +68,32 @@ class UIActionSlot extends JPanel { this.action = action; - BorderLayout layout = new BorderLayout(); - layout.setHgap(8); - setLayout(layout); + setLayout(new BorderLayout()); + setBorder(RED_BORDER); + setBackground(ColorScheme.DARKER_GRAY_COLOR); - setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + MouseListener hoverListener = new MouseAdapter() + { + @Override + public void mouseEntered(MouseEvent mouseEvent) + { + if (!isSelected) + { + setBackground(ColorScheme.DARKER_GRAY_HOVER_COLOR); + } + } + + @Override + public void mouseExited(MouseEvent mouseEvent) + { + if (!isSelected) + { + updateBackground(); + } + } + }; + + addMouseListener(hoverListener); JLabel uiIcon = new JLabel(); @@ -69,17 +106,22 @@ class UIActionSlot extends JPanel uiIcon.setMaximumSize(ICON_SIZE); uiIcon.setPreferredSize(ICON_SIZE); uiIcon.setHorizontalAlignment(JLabel.CENTER); - add(uiIcon, BorderLayout.LINE_START); uiInfo = new JPanel(new GridLayout(2, 1)); + uiInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); + uiInfo.setBorder(new EmptyBorder(0, 5, 0, 0)); JShadowedLabel uiLabelName = new JShadowedLabel(action.name); - uiInfo.add(uiLabelName); + uiLabelName.setForeground(Color.WHITE); uiLabelActions = new JShadowedLabel("Unknown"); uiLabelActions.setFont(FontManager.getRunescapeSmallFont()); + uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR); + + uiInfo.add(uiLabelName); uiInfo.add(uiLabelActions); + add(uiIcon, BorderLayout.LINE_START); add(uiInfo, BorderLayout.CENTER); } @@ -102,11 +144,17 @@ class UIActionSlot extends JPanel private void updateBackground() { - if (isSelected) - this.setBackground(isAvailable ? Color.GREEN : Color.RED); - else - this.setBackground(isAvailable ? Color.GREEN.darker() : Color.RED.darker()); + setBorder(isAvailable ? GREEN_BORDER : RED_BORDER); + setBackground(isSelected ? ColorScheme.DARKER_GRAY_HOVER_COLOR.brighter() : ColorScheme.DARKER_GRAY_COLOR); + } - uiInfo.setBackground(getBackground()); + @Override + public void setBackground(Color color) + { + super.setBackground(color); + if (uiInfo != null) + { + uiInfo.setBackground(color); + } } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICalculatorInputArea.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICalculatorInputArea.java index c845cc522e..99a370001d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICalculatorInputArea.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICalculatorInputArea.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Kruithne + * Copyright (c) 2018, Psikoi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,21 +25,19 @@ */ package net.runelite.client.plugins.skillcalculator; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.GridLayout; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.border.EmptyBorder; +import net.runelite.client.ui.ColorScheme; +import net.runelite.client.ui.FontManager; +import net.runelite.client.ui.components.FlatTextField; class UICalculatorInputArea extends JPanel { - private final GridBagLayout uiLayout; - private final GridBagConstraints uiConstraints; - - private int gridX = 0; - private int gridY = 0; - JTextField uiFieldCurrentLevel; JTextField uiFieldCurrentXP; JTextField uiFieldTargetLevel; @@ -46,15 +45,11 @@ class UICalculatorInputArea extends JPanel UICalculatorInputArea() { - uiLayout = new GridBagLayout(); - uiConstraints = new GridBagConstraints(); - uiConstraints.insets = new Insets(3, 9, 3, 9); - setLayout(uiLayout); - + setLayout(new GridLayout(2, 2, 7, 7)); uiFieldCurrentLevel = addComponent("Current Level"); - uiFieldCurrentXP = addComponent("Current XP"); + uiFieldCurrentXP = addComponent("Current Experience"); uiFieldTargetLevel = addComponent("Target Level"); - uiFieldTargetXP = addComponent("Target XP"); + uiFieldTargetXP = addComponent("Target Experience"); } int getCurrentLevelInput() @@ -116,26 +111,25 @@ class UICalculatorInputArea extends JPanel private JTextField addComponent(String label) { + final JPanel container = new JPanel(); + container.setLayout(new BorderLayout()); + final JLabel uiLabel = new JLabel(label); - final JTextField uiField = new JTextField(6); + final FlatTextField uiInput = new FlatTextField(); - uiConstraints.gridx = gridX; - uiConstraints.gridy = gridY; + uiInput.setBackground(ColorScheme.DARKER_GRAY_COLOR); + uiInput.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR); + uiInput.setBorder(new EmptyBorder(5, 7, 5, 7)); - uiLayout.setConstraints(uiLabel, uiConstraints); - add(uiLabel); + uiLabel.setFont(FontManager.getRunescapeSmallFont()); + uiLabel.setBorder(new EmptyBorder(0, 0, 4, 0)); + uiLabel.setForeground(Color.WHITE); - uiConstraints.gridy++; - uiLayout.setConstraints(uiField, uiConstraints); - add(uiField); + container.add(uiLabel, BorderLayout.NORTH); + container.add(uiInput, BorderLayout.CENTER); - gridX++; - if (gridX % 2 == 0) - { - gridY += 2; - gridX = 0; - } + add(container); - return uiField; + return uiInput.getTextField(); } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICombinedActionSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICombinedActionSlot.java index e09d566940..f8333bfb50 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICombinedActionSlot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICombinedActionSlot.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Kruithne + * Copyright (c) 2018, Psikoi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +33,8 @@ import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; @@ -44,13 +47,12 @@ class UICombinedActionSlot extends JPanel UICombinedActionSlot() { - BorderLayout layout = new BorderLayout(); - layout.setHgap(8); - setLayout(layout); - - setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + setLayout(new BorderLayout()); + setBackground(ColorScheme.DARKER_GRAY_COLOR); + setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)); JLabel uiIcon = new JLabel(); + uiIcon.setBorder(new EmptyBorder(0, 0, 0, 5)); SkillCalculator.spriteManager.addSpriteTo(uiIcon, 582, 0); uiIcon.setMinimumSize(ICON_SIZE); @@ -60,16 +62,18 @@ class UICombinedActionSlot extends JPanel add(uiIcon, BorderLayout.LINE_START); JPanel uiInfo = new JPanel(new GridLayout(2, 1)); - uiInfo.setBackground(Color.ORANGE); + uiInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); uiLabelTitle = new JShadowedLabel("No Action Selected"); - uiInfo.add(uiLabelTitle); + uiLabelTitle.setForeground(Color.WHITE); uiLabelActions = new JShadowedLabel("Shift-click to select multiple"); uiLabelActions.setFont(FontManager.getRunescapeSmallFont()); + uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR); + + uiInfo.add(uiLabelTitle); uiInfo.add(uiLabelActions); - setBackground(Color.orange); add(uiInfo, BorderLayout.CENTER); } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ColorScheme.java b/runelite-client/src/main/java/net/runelite/client/ui/ColorScheme.java index bec0c4f052..8cee06d0ca 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ColorScheme.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ColorScheme.java @@ -41,6 +41,8 @@ public class ColorScheme public static final Color DARK_GRAY_COLOR = new Color(40, 40, 40); public static final Color MEDIUM_GRAY_COLOR = new Color(77, 77, 77); public static final Color LIGHT_GRAY_COLOR = new Color(165, 165, 165); + + public static final Color DARKER_GRAY_HOVER_COLOR = new Color(60, 60 , 60); public static final Color DARK_GRAY_HOVER_COLOR = new Color(35, 35, 35); /* The color for the green progress bar (used in ge offers, farming tracker, etc)*/