From dd656cba5a639d85c3ecf666741277f837c2edd3 Mon Sep 17 00:00:00 2001 From: "mikael.lantz" Date: Thu, 18 Nov 2021 14:38:37 +0100 Subject: [PATCH] fix: wip of showing icon for games with saved states --- .../se/lantz/gui/GameListDataRenderer.java | 22 ++++++++++++++++++ .../resources/se/lantz/16x16SaveIcon-1.png | Bin 0 -> 683 bytes .../resources/se/lantz/16x16SaveIcon-2.png | Bin 0 -> 740 bytes .../resources/se/lantz/16x16SaveIcon-3.png | Bin 0 -> 737 bytes .../resources/se/lantz/16x16SaveIcon-4.png | Bin 0 -> 702 bytes .../resources/se/lantz/18x18SaveIcon-1.png | Bin 0 -> 778 bytes .../resources/se/lantz/18x18SaveIcon-2.png | Bin 0 -> 847 bytes .../resources/se/lantz/18x18SaveIcon-3.png | Bin 0 -> 864 bytes .../resources/se/lantz/18x18SaveIcon-4.png | Bin 0 -> 806 bytes .../se/lantz/save-states-icon-20.png | Bin 0 -> 904 bytes .../se/lantz/save-states-icon18-clean.png | Bin 0 -> 737 bytes .../resources/se/lantz/save-states-icon18.png | Bin 0 -> 801 bytes 12 files changed, 22 insertions(+) create mode 100644 src/main/resources/se/lantz/16x16SaveIcon-1.png create mode 100644 src/main/resources/se/lantz/16x16SaveIcon-2.png create mode 100644 src/main/resources/se/lantz/16x16SaveIcon-3.png create mode 100644 src/main/resources/se/lantz/16x16SaveIcon-4.png create mode 100644 src/main/resources/se/lantz/18x18SaveIcon-1.png create mode 100644 src/main/resources/se/lantz/18x18SaveIcon-2.png create mode 100644 src/main/resources/se/lantz/18x18SaveIcon-3.png create mode 100644 src/main/resources/se/lantz/18x18SaveIcon-4.png create mode 100644 src/main/resources/se/lantz/save-states-icon-20.png create mode 100644 src/main/resources/se/lantz/save-states-icon18-clean.png create mode 100644 src/main/resources/se/lantz/save-states-icon18.png diff --git a/src/main/java/se/lantz/gui/GameListDataRenderer.java b/src/main/java/se/lantz/gui/GameListDataRenderer.java index c5b2c7c..01b5b78 100644 --- a/src/main/java/se/lantz/gui/GameListDataRenderer.java +++ b/src/main/java/se/lantz/gui/GameListDataRenderer.java @@ -3,10 +3,13 @@ package se.lantz.gui; import java.awt.Color; import java.awt.Component; import java.awt.Font; +import java.awt.Insets; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; +import javax.swing.ImageIcon; import javax.swing.JList; +import javax.swing.SwingConstants; import se.lantz.model.data.GameListData; import se.lantz.model.data.GameView; @@ -35,6 +38,8 @@ public class GameListDataRenderer extends DefaultListCellRenderer { this.boldItalic = getFont().deriveFont(Font.BOLD + Font.ITALIC); this.bold = getFont().deriveFont(Font.BOLD); + this.setHorizontalTextPosition(SwingConstants.LEADING); + this.setHorizontalAlignment(SwingConstants.LEADING); } @Override @@ -59,6 +64,7 @@ public class GameListDataRenderer extends DefaultListCellRenderer private void handleGameListData(Object value, boolean isSelected) { + this.setIcon(null); GameListData listData = (GameListData) value; if (listData.isFavorite()) { @@ -68,6 +74,7 @@ public class GameListDataRenderer extends DefaultListCellRenderer { case 1: this.setForeground(isSelected ? fav1ColorSelected : fav1Color); + this.setIcon(new ImageIcon(this.getClass().getResource("/se/lantz/16x16SaveIcon-1.png"))); break; case 2: this.setForeground(isSelected ? fav2ColorSelected : fav2Color); @@ -105,6 +112,7 @@ public class GameListDataRenderer extends DefaultListCellRenderer break; } } + } private void handleGameListView(Object value, boolean isSelected, int index) @@ -170,4 +178,18 @@ public class GameListDataRenderer extends DefaultListCellRenderer } } } + + @Override + public void setBounds(int x, int y, int width, int height) { + super.setBounds(x, y, width, height); + if (getIcon() != null) { + int padding = 1; + int textWidth = getFontMetrics(getFont()).stringWidth(getText()); + Insets insets = getInsets(); + int iconTextGap = width - textWidth - getIcon().getIconWidth() - insets.left - insets.right - padding; + setIconTextGap(iconTextGap); + } else { + setIconTextGap(0); + } + } } diff --git a/src/main/resources/se/lantz/16x16SaveIcon-1.png b/src/main/resources/se/lantz/16x16SaveIcon-1.png new file mode 100644 index 0000000000000000000000000000000000000000..704190cc7de59af5dbd56caeba78d75cf9fbc185 GIT binary patch literal 683 zcmV;c0#yBpP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz0zgSbK~y+TO;SB? z(?A%$J6{~zRbv`zr3w>*(nzUPkm!ua|3J{8Y)Gv-B4$u42Ix=d(ke*Mj%B5SvcQlr zsse&YQD{EwI8N>J9nU!t;*FKW=jY>n-q-Y?e*EV3uH)FH(h?y=h{RxqQp&ROS8*(5 zYB25x!65L3B3s)#w0dv7y0Tn*_+WGMDF~DjB^AB65Po3Xx~b+1gs9WgkMG`pNC`VX z|H?R{1}?(@8U-|IwaBwA{^&9J_MPftP$5#vB$laQ&;&X=QzROb;}iP)1wH#jdzVD1 zsS0WwhLiCaFa{VN%pQdyJv<^&MA*#mUjd-k|co_m@2yrgKKGh>07O&R5Xc3qmgE& zG6f+FLwrvQO3C%bWYL4n>`0#p{OAys)w?&AygSRcYqeS~m%|jZ7IdYl*1}1n(K!43 zMG^Mvcbl%Pu6YaYaL{*Mw_Gk;mSvhIQUN*~4x7y;IU?@p&vuh+qGoH=}u8-v1>bUxgmpLV+qcZ>owaEiquZ1Ep&luR*v z;AKWodhwIV1U>Y#3WC7T3XLHN767nb7jit=*ckXe#&;Dbu)elX49C%BuRjB z1a_5*>1r9{oVMD3jt&p@-|joMgRT(QaU8ue#^NOIcDr!K3vX~v7~kF7`wPJPO`|V; RTI>J-002ovPDHLkV1mJ5Fs%Rp literal 0 HcmV?d00001 diff --git a/src/main/resources/se/lantz/16x16SaveIcon-2.png b/src/main/resources/se/lantz/16x16SaveIcon-2.png new file mode 100644 index 0000000000000000000000000000000000000000..e6572f3862585d14a1fbbe228bfdbf6b17a159f0 GIT binary patch literal 740 zcmVPx#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz0(nV9K~y+TEmBQP z6G0SyGdnHYC3ay=E#eW8CM6LL>QU`g6TRuh01-SxF!5@<7$6=L6XQWVkoc3DAQw&W zq=`Y~pdln^!U0elnj*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)s^QfreUHg*fmWPooAeTzE>)hpo|}06N0!{Tw3}Mlb&Sy TR2)L)00000NkvXXu0mjfEU`

Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940#ivuK~y+THBw7! zQ$ZO0X6_`pxlxk_LQ3jR(*{zgS%`vynE#;Y&MxXs>jM$o>!P7l?N7)?iJ-2Ox;1FJ zZJ~>1QKb!pXkItZ`&aqsLEKzHm9elr7%8v9@*}0>(&5#RdcKux`XGwYW&6c6Ppf`1r{uUaReL z!I^KwrMH(k44TVYWT90*r>k z$!G)`2QA>8Ua;>~wz)+sE2sPa07Kj55RmevgmI8*Z;x%gCaKi=1I_Y%8jl0M29Cjj zAV@%aP^?;IwOw|2$e+K^l!F8I@|9i?an3!@a~y}mm+QLlr9H&XsH<1h^=s<-FmOIwCQn zW;~vZojrH->$hOUBH>6XmCEIE>2z8MkHk*}71scnW;X~di6sn}N#Rl;- z8Vz_yDIkL;nM}eh)_76UNAbazfk5fTPbL$@&N kS}l0SgExdAE;dS~e@rn;D_ZFHasU7T07*qoM6N<$f{znIcK`qY literal 0 HcmV?d00001 diff --git a/src/main/resources/se/lantz/18x18SaveIcon-1.png b/src/main/resources/se/lantz/18x18SaveIcon-1.png new file mode 100644 index 0000000000000000000000000000000000000000..b097e794c2e59f6ed661ad2cb14ec8f277179def GIT binary patch literal 778 zcmV+l1NHogP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940-s4lK~y+TeN#(o z6HyetubDh)n^Y6ijj>jtv=#gl{Q*KZ>e_|if3RJMD|Mx`JHfq@qU(YP))ZO=7cqfQ zv|6dtyfc%@efZs(6zawUxw-c{_niBk@0_9Ut6v`6zo(?k<#LYWjK^asWx{o(Qkir* z7>%SHGsc8)I-QQ;Y^==l7n}6j^39dS>-m}Kt*uRC2qgqRtqfx%45i}=Vu;e3bM|n3 z<7@5Pbne2=&JJ@JZfQqw#K5rFV1T#Q+~phO^&3Jd=N!o>F_~miP^0laj^GBfL9r=C z*Ei_fcl7XZf<#6sJ^KEm<#|ZVBE%@A?4MSoQKy+H`si_l1JQUS-oubRo6Wke8-;-t zC?Fr>mP@ImU%j-rMOa)f%orVpAvDukF`OWp);ji)s|%*tAZu%r<2gfWAp};&xUCJ3 zPCQ0K3#{QNI0Md;L`ocB$ZaZUbo-t<4p#l@b-GW z*!LeZ+MpP8A8!b)O}E<>oPIvoM;a6v%R}})VgoMfU>{Qg^E?l04AOR;6O@rB?y9cyA1(x1pVTrxlDGd-e?Hqb=^d%RDxr5brqe-=ku6PL_+J~ za9F8Ss?};boxWHsq>@>QKE&+?CnTPYY6Sxft?EE zn@mYGbzp)SZ#J9tdcD9eEb-@z>%07*qo IM6N<$g7)KQ*Z=?k literal 0 HcmV?d00001 diff --git a/src/main/resources/se/lantz/18x18SaveIcon-2.png b/src/main/resources/se/lantz/18x18SaveIcon-2.png new file mode 100644 index 0000000000000000000000000000000000000000..ff9ca5664461968e0129b3a59b27bfefa25ea8e5 GIT binary patch literal 847 zcmV-V1F-ywP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940^~_VK~y+THB(DW zQ$ZA+nfIYBjnV?GWn(33LXa4?x-+p#Vpw3}0&r_05o2PAJA;n^2bqMS3DkP27{F_bPYZr9CBfijgFBE7tQhO5tfBO{PdO80hu`MbJ^l&oPZ9mi20;m}vFWw2YG zKS#HJiovtWdVZl{qX^NxUax7I4L7ue5@5kJ`S_9C*_Mm*VkJR$c9n8?SlQqrg>Bow zObCa81872srmjVEb2KtU(;0bhid??blp(aP>o^(H7&s(tDo`Z=A~R8T^_mL)GAgF; z1BsSaIZ}+ovMeU0w5&=4D^;cV7-zTdsJms+yHl)hfJBBAOE3nfSS*x^CFEo%6z0WZ zv8khP-nK4ya(TM7MGjR`NHl}#BZn@8EEEd5MpwUmMHq4GCY_vU+My)W0+89-Di$T3 zPUCC}>B+u zg`kK;BAATd@5g?^6IfR&l~^p6NF+QSPj@ijc6m9VYK|LiAaG}cmY0{4$t2PS0)gJ% z-v0jna5#)8sI6QotF1u1)|NE34wYcXH#av^sZ=(bMZ*UN2jy}Z4p8C5Hp2m^9J*oR zoMYnX1Q!SZEXsp5{2_#-VW55mc!6b4o<7^#|En9ORkiC}91ox9@O5Ug`G4t5Hdjbz zauutp>89fVQX#Q}OxFyPrc3shm8G%KaWoBd+gvWxqkdD)71o3RN$dk=gJu};q}uH4 Z?0;Fxp0SO51Azbl002ovPDHLkV1ny4dYAwJ literal 0 HcmV?d00001 diff --git a/src/main/resources/se/lantz/18x18SaveIcon-3.png b/src/main/resources/se/lantz/18x18SaveIcon-3.png new file mode 100644 index 0000000000000000000000000000000000000000..94ff6b5e83f75bc1a42c1055f1e902a1bec0b241 GIT binary patch literal 864 zcmV-m1E2hfP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940`*BmK~y+THB;S7 zlTjQ#=e!^8i*&QL97szo67wP)1a%qgIz$MvG82oEf+8ZKpt_5ox~eql4@mQ3gQPnl zy3lEA(#4!GXjuz;-N(Dnckg>n&%4zS~Y?-Fl>s1t`Uay;` z*`lhZWw~9hYOQ9Pb;g)1EBSn0NUUy&m#-%2p`*w8dk_2CTBoKag&>p=e7GeTBZgrr zs!Rm2IF}^$@X_P%iH%n8-ud}?rZ8l2MV3$l!y%$Ec5#%Pil~>y$lNDFsU%5gMu~7c z95NLg@8b$=FuMr0w8VzakoVK1yPHnWu+xKNBhiddO1IKKvzkVPU=5G3EX)4l_G#U_ zOYYpJZ(j4xPF$&8v{M>}?jDavRRJA_kpKZ1Od{bh4TnW0Lwb&|bXp7zih%(;2U&s} zh5^nvw-|09jdR|N?V4U7PN#6Y>C7y7`>yFjYgv|YGA7xx;n8LQD49_s>+AI&X|c9U zCa%IqKh8CSjY5i*R4NrFgs4=?4X$jI;>lAMKCVvOARlJQ@>lr8$rE-6GjmJV3q`$% zHyMB;UDx$yOgy+R#>Z$X#fC4C#kd$9A-8VshPc2m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Qlf8_hRBSYmQBuyx4!m$c4iKjhPpkG2>AHFsSv)_h5;qf k52y_;!=NXbD=RDi0gsf6BEGOzivR!s07*qoM6N<$f-oRsG5`Po literal 0 HcmV?d00001 diff --git a/src/main/resources/se/lantz/save-states-icon-20.png b/src/main/resources/se/lantz/save-states-icon-20.png new file mode 100644 index 0000000000000000000000000000000000000000..3d2824e9a7dcd1b52ee1d06243f65b6a646ca608 GIT binary patch literal 904 zcmV;319$w1P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D106|3K~y+TEtA_$ z6Hyd~XQp#(OQ)^H+Dc6bks^325u(vZ;!AJ|2|NdHz!l*ExZ(|fL^Kj(OyNpQ35kS| zC_PTkoz8UXH*9yC-GA@3{n*~d<+b9VMke)fFn{oB>ApHHu^uOvwd0!dN$m3%)?Rb?=6Ez98O zx}ITZfQ6-(%d2mch<0*vqUfqJ9=Q=klBMt~z$6GXRbh`>hVOaYn1+Uc&?lHI&da$K!zY_4QOLg?>d*5Q*|gB;xx%g|K8<-rL*L4fV^XQ{6JhqX#k`K@ea* zI5>c*>pIM6G>WNKt7S47O!#nQ;Yt0;M`=Qb^(D zEjDrrKe0m-7{Cj~2S8}ieBy>qR133ED1dq1s6ru_<`Is!4d#&}hc4V#D}|X^?jg&w z^NWRC)=tFB<#MrDTw7aXwisHi7I_c}E|p5h$Hz1|olX~DEVP_nAWJ_le}$QO5_r(I z&CN~n93CESY;3HotZ<1!X2I|;E-v!Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940(MD6K~y+TeUr;> z(@+qGeU6WvOC#E(kkD=j6(Cim3tplR0jyad@eaTP04q@Y80`yGLM%!uagkVrRO$i> zMa9iMcARtJvr{D4bQDi~X3os~^UqkkZGC?7_>s}NTCD~_Fq_S^)`c+C#w?V}$#kmq zOiHO#(C_!1FK5QRezPrZ-@UiFey6syxU;kEoF_bw#~LT4m!>)hmFGNTt?$dH&z^s2 ze_gCz-QVArf#jAAlurzT%7Udp1!0io5W@F;UWDfsibW-yr9MZnAz9F+B7`{k_PrZL zB$m0w8Dp|PYj~{DXh2Mp7z;)6JDHHZQmKStn1=xf2;`GKkMtGVI?e_MJ()~)cXwN@R=Hfh)~J_?70n#x;|3FnmvcEdIB2)ql&#n6Yiny8 z8yn4LlPq8xkH*-7XEEot=%xV*+rY*=7P@iCB6zaTRO^gu&x1+!f!Snx0H4C&+uQpCw*rG7 Tihtah00000NkvXXu0mjfSW`+` literal 0 HcmV?d00001 diff --git a/src/main/resources/se/lantz/save-states-icon18.png b/src/main/resources/se/lantz/save-states-icon18.png new file mode 100644 index 0000000000000000000000000000000000000000..ecc31f981666cd39e1d9139e318deb80833492c9 GIT binary patch literal 801 zcmV++1K#|JP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T;0HU<5N8;Nz1MhT-&y05ko5 zU)d7(BfA0IN(wcB1Op4J-ERM8m((a{icpLY5NB@J z>FH^`UZ*X$X=P<)eSN)9D8PcY;mt4{621t=5VS%Gcl_ewf^+Y5It+Yubu}Cg0g&R& zZ3ciV|6rWB)|kO0k>ePPJgUJHByw92{tBS@wBEjZ-@N>z9CtjK&2{jg@NhAex$g8@ z?dwjr-@fjS#uHn)zK^8=|AnxW?YOdiGpl|1{Pf8)hQ{5P=b