skinlf-6.7/0000755000175000017500000000000010460410034012602 5ustar twernertwernerskinlf-6.7/bin/0000755000175000017500000000000010460410032013350 5ustar twernertwernerskinlf-6.7/bin/alwaysontop.bat0000644000175000017500000000042507720225450016436 0ustar twernertwerner@echo off echo If you are using JDK1.4 and it complains about jawt.dll, use jdk.home\jre\bin\java instead of jdk.home\bin\java set OLDPATH=%PATH% set PATH=%PATH%;..\lib java -classpath ..\lib\nativeskin.jar;..\lib\examples.jar examples.alwaysontop set PATH=%OLDPATH% skinlf-6.7/bin/clock.bat0000644000175000017500000000043107720225450015146 0ustar twernertwerner@echo off echo If you are using JDK1.4 and it complains about jawt.dll, use jdk.home\jre\bin\java instead of jdk.home\bin\java set OLDPATH=%PATH% set PATH=%PATH%;..\lib java -classpath ..\lib\nativeskin.jar;..\lib\examples.jar examples.Clock clock.gif set PATH=%OLDPATH% skinlf-6.7/bin/demo.bat0000644000175000017500000000026407720225450015003 0ustar twernertwernerset THEMEPACK=%1 IF "%THEMEPACK%"=="" SET THEMEPACK=..\lib\themepack.zip java -classpath ..\lib\skinlf.jar;..\lib\examples.jar examples.demo %THEMEPACK% %2 %3 %4 %5 %6 %7 %8 %9 skinlf-6.7/bin/region.bat0000644000175000017500000000042607722166070015346 0ustar twernertwerner@echo off echo If you are using JDK1.4 and it complains about jawt.dll, use jdk.home\jre\bin\java instead of jdk.home\bin\java set OLDPATH=%PATH% set PATH=%PATH%;..\lib java -classpath ..\lib\nativeskin.jar;..\lib\examples.jar examples.nativesplash set PATH=%OLDPATH% skinlf-6.7/lib/0000755000175000017500000000000010460410034013350 5ustar twernertwernerskinlf-6.7/lib/themepack.zip0000644000175000017500000007377610460410034016061 0ustar twernertwernerPK 1gtk/PK 1icons/PK 1kde/PK i/f)0 gtk/empty.png sb``p Ҍ $'Rz%%E%y ! )z ũ%z FF FFVV R:K<}]/q2(+6 8 <">0@AtG_GY|Oǐ[?g`a`/e PeSBPK i/sDrz gtk/file0.png sb``p  $'L0R%g-||(YY-Œ Jz8TJYSb)7SM^Li N*btsYPK i/_uLO gtk/file1.png sb``p @,$L6)1Oǐ9q~H R)W-}]O:7U0xsJhPK i/ gtk/file10.png PNG  IHDRIDATx[ PV*%$*)sIIm򚽵Q^>9Osc |36{};-Ib 93)# +"Np}ׁƢ)U;Cbَ$M?Db B⥛}S%(e7q+;+y<&gZ_X)Ǎy81s^ s:m2 ӢwY IENDB`PK i/3:gtk/file11.png;PNG  IHDRIDATx CG ]?alk)Kg0?յz? 4[G!̟9Osc |36{};-Ib 93)# +"Np}ׁƢ)U;Cbَ$M?Db B⥛}S%(e7q+;+y<&gZ_X)Ǎy81s^ s:m2 ӢwY IENDB`PK i/T'acgtk/file15.png sb``p @,$[/)-Oǐ9q>xmŎ+i1i`)00;Z) PK i/+gtk/file16.png sb``p @,$[/)Oǐ9;j9?ɬuq^s_ǯY0$ 4dMSL nx|)m. ~.PK i/+gtk/file17.png sb``p | $'hjRў.!s+Ȳ'C|욬Ao_OKQË.-wOOO=P@'(á`G%QvzOW?uN MPK i/nrgtk/file18.png sb``p F $'?R.!sޞ z؆IDZkNz[}s铆[ VZ%' \|M #W gtsYPK i/> MQgtk/file19.png sb``p  6'l9$<]C*$Gt0|E |_1atsYPK i/  gtk/file2.png PNG  IHDRIDATx[ PV*%$*)sIIm򚽵Q^>9Osc |36{};-Ib 93)# +"Np}ׁƢ)U;Cbَ$M?Db B⥛}S%(e7q+;+y<&gZ_X)Ǎy81s^ s:m2 ӢwY IENDB`PK i/A~gtk/file20.png sb``p @,$$)wOǐ9o;2(0lylBo= N^8q{hxu;۵d #ޕG ~.PK i/Bgtk/file21.png2PNG  IHDRIDATxݐ {.Voi$b/`1qy_?*0YuU^z~Xϖ7ԣ' yKdt`8&INdc/-D2r m$/c&Dn`A仺!? .]/Ӄ.IENDB`PK i/3:gtk/file22.png;PNG  IHDRIDATx CG ]?alk)Kg0?յz? 4[G!̟kzUտeð/\W1י9^}qQ [G.) PK i/MtTWgtk/file24.png sb``p "@,$cHŜde  xxv,wS~) NvVT) PK i/MtTWgtk/file25.png sb``p "@,$cHŜde  xxv,wS~) NvVT) PK i/M~[^gtk/file26.png sb``p  $'L0R.!s|z*4.q=!o?b ) PK i/M~[^gtk/file27.png sb``p  $'L0R.!s|z*4.q=!o?b ) PK i/M~[^gtk/file28.png sb``p  $'L0R.!s|z*4.q=!o?b ) PK i/M~[^gtk/file29.png sb``p  $'L0R.!s|z*4.q=!o?b ) PK i/B gtk/file3.png2PNG  IHDRIDATxݐ {.Voi$b/`1qy_?*0YuU^z~Xϖ7ԣ' yKdt`8&INdc/-D2r m$/c&Dn`A仺!? .]/Ӄ.IENDB`PK i//X\gtk/file30.png sb``p  $'L0Rʞ.!s|zz`N<;KQg9W/sP9:&PK i//X\gtk/file31.png sb``p  $'L0Rʞ.!s|zz`N<;KQg9W/sP9:&PK i//X\gtk/file32.png sb``p  $'L0Rʞ.!s|zz`N<;KQg9W/sP9:&PK i//X\gtk/file33.png sb``p  $'L0Rʞ.!s|zz`N<;KQg9W/sP9:&PK i/Ƥ:nqgtk/file34.png sb``p  $vk) Oǐ9'T >kzsտeð w}ɶB+ wOm) PK i/MtTWgtk/file35.png sb``p "@,$cHŜde  xxv,wS~) NvVT) PK i/MtTWgtk/file36.png sb``p "@,$cHŜde  xxv,wS~) NvVT) PK i/ݱwgtk/file37.png sb``p "@,${+%NFa m~8 <"@ݺ?@AtG_GY|=Oǐ[>~~i >α,>qaI\mu0XUyųSӖ,a`adw~ieSBPK i/.gtk/file38.png sb``p "@,${+%NFa KلB B xn K#~?@cHŭd?4 X0sҤC.۶: Y)iK00G;}) PK i/Fԏx`dgtk/file39.png sb``p  $'L0Rڞ.!s+H az#;UǮ4:20sel@m ~.PK i/  gtk/file4.png PNG  IHDRIDATx[ PV*%$*)sIIm򚽵Q^>9Osc |36{};-Ib 93)# +"Np}ׁƢ)U;Cbَ$M?Db B⥛}S%(e7q+;+y<&gZ_X)Ǎy81s^ s:m2 ӢwY IENDB`PK i/L̜qpsgtk/file40.png sb``p  $'L0RV.!s-[{v0vl&) aXݑdjxHJ€wƪ_y6&ir]A~_X0xsJhPK i/2tvgtk/file41.png sb``p  $'L0R.!s-[{v0vL^=]S@ٛ6DȐߐwƪ_y6&ir]qK֙Ӂ1xsJhPK i/2w]agtk/file42.png sb``p  $'L0R.!s+H2/>zY ~.PK i/2;{}gtk/file47.png sb``p  $'L0R..!s-[{v0vL^=]S@ٛy:.}|O',[gm9.Zx'y ~.PK i/Xcggtk/file48.png sb``p  $'L0Rz.!s+HHH8U[o~;ވ̺;3xr{λ $u2xsJhPK i/rugtk/file49.png sb``p  $'L0R6.!s-[{v0vl&) a8JJBBZC(?#*l̼[*i.Q$pq~W0xsJhPK i/  gtk/file5.png PNG  IHDRIDATx[ PV*%$*)sIIm򚽵Q^>9Osc |36{};-Ib 93)# +"Np}ׁƢ)U;Cbَ$M?Db B⥛}S%(e7q+;+y<&gZ_X)Ǎy81s^ s:m2 ӢwY IENDB`PK i/muxgtk/file50.png sb``p  $'L0R.!s-[{v0vL^=]S@ٛy!wFGegf-_Lz4xM`hE(OW?uN MPK i/KSgtk/file51.png sb``p  $laR.!s3ehX!ye`*ׇþΫ^`,UW`9eƆCj-LWR>rt`=`pH\BbU ~.PK i/PVgtk/file52.png sb``p  $laR.!s3ehX!ye`  ?>mAYd÷nJCVɬUS{ԬaИ$bj`׸GKA阪ZSH?xାUOW?uN MPK i/pbSgtk/file53.png sb``p | $'hjR3=]C*Ldנdebemep7:ZYRQq^kgn2ҶuXO4nuuMe!tK߳8rrcs f̏k)fg(\;].*`0iat$:&PK i/Qgtk/file54.pngPNG  IHDR*IDATx; Do+9B-i)))iS$Ϛ*k`6a]F)9ϲYكV[;ֲmkbU/S*bU9@FU 8 PJX/>ZQynFI.8R.QZV/9'uUۂԘg+-}An:WIENDB`PK i/wTVgtk/file55.png sb``p Ң@,$v,.R.!s+xwnĐ+ughqo <]\9%4PK i/5SVgtk/file56.png sb``p Ң@,$v,.R.!s+쌎Đ+ugxWIP!:&PK i/"Y]gtk/file57.png sb``p  $'L0R*.!s0_C= mݿ/Z(ƻ߻E;Au&zOW?uN MPK i/ `WZgtk/file58.png sb``p  $'L0R.!s0_?뿼dEt%m*o^&[3xsJhPK i/  gtk/file6.png PNG  IHDRIDATx[ PV*%$*)sIIm򚽵Q^>9Osc |36{};-Ib 93)# +"Np}ׁƢ)U;Cbَ$M?Db B⥛}S%(e7q+;+y<&gZ_X)Ǎy81s^ s:m2 ӢwY IENDB`PK i/B gtk/file7.png2PNG  IHDRIDATxݐ {.Voi$b/`1qy_?*0YuU^z~Xϖ7ԣ' yKdt`8&INdc/-D2r m$/c&Dn`A仺!? .]/Ӄ.IENDB`PK i/B gtk/file8.png2PNG  IHDRIDATxݐ {.Voi$b/`1qy_?*0YuU^z~Xϖ7ԣ' yKdt`8&INdc/-D2r m$/c&Dn`A仺!? .]/Ӄ.IENDB`PK i/ljXS gtk/file9.pngSPNG  IHDRIDATxJ@>  mX(5(&{&yqL2Lewpp4_ՃFy܋轑/oƟ&ϒrTB,-D_'[B1%6zU#} 䫍VպMCI˵[Jgd]XJrqLZ 'rX)Z<~uLtG+}L>_jEI&DyG4U&Փ &/p!Bm&üܛo uɸIENDB`PK i/DX gtk/gtkrc\mo8L|U[=z ՝N1JLi?y! $MqyfM8 '󮭠wY bC<0֜򿟃6`\FC3ubP)B/=Ǖh^ 7Ÿ /(qVA%t-W&R=!Ug<67Sݰ z_JiFsFlcDяaFt:@Pe];y,pm%P7lM<&r گ6.AbpA:d6k̰#;8: o!6"eHOL66jJŢIDGfbb.jo)Y,~hA v3fc+I(|C~C`q/& nvR7?LVLg;,U*j4΁?h=SO0έP³#̇ Pw81Bw[rTsbF]l+$܃sM'V-|<"D2{=ru,5R= +"˯a nX spghu_ v|CSI3"N8 w d}oX\1.?32#&-FXT}$#B$iZa;$nP J:{mDҪї@ĘmyD -_ b: PdRpAOXwVί`F(2KZV1,orAC)ꠞgT $F2cr F9"w[r*TSbLmk m1ʌ;ټ3M HX|-~b.~H_IAyAUJs^C-ڎNWlԃ!PZAKƄX426 K?& euh dfXͿ]]9&9t( GyJDtLc]]ɴ*V>:=z{@9jW{zRAϺXo-B[J‚ʁ_QF9-B[ϕ`)epIs-YI8Xdffܵ,jd{h`U*(ys1Oh+1۽u3K 鲳N.LsQhH$iAѵv,%'dli[:THqZ(2m9&+gEB j ^4?L K7`;}][JP4A7鶸n8Tƍ:b3'1ĬT"TPUr&GM#u*=knϾDpT&8t^2l9}nX;|/ \ ~;5HU,=i xw0BC%;L(2|-on] Cm3.lhU2eɘy䶤a<0k"it!p9M\Q{|r:%BZrTpwO)kÒBZCP҈ 1N_&Ma' MAUPK i/?Agtk/optionmenu.png sb``p F@,$cמ,Rz%%E%y ! Ez & ũ%z FF FFVVƦ  Bvux_de:j(YY֘ ;:20l Otq Qk[ 6nzןl\ywv0|̻9%ng$np3IRﲌ Z;.XogSpDԈ&vL-b 1mY'W?dw8d ,3OeSBPK i/$_CFgtk/optionmenu_disabled.png sb``p F@,$cמ,Rz%%E%y ! Ez & ũ%z FF FFVVƦ  Bvux_decu2P#3:1dIwud`'ȟRq+٦ Cf KlܰɅƦLjQOO\10].|$mȥuj̒===Uڤ;\R'^>`(&/iA-bI=EVlvtEEgquY sXsx_`d|#shj13<]\9%4PK i/Ix-^_gtk/optionmenu_rollover.png sb``p F@,$cמ,Rz%%E%y ! Ez & ũ%z FF FFVVƦ  Bvux_detP#3:1dIwud`'Rq+9'##A$5l8Pկ?oTpSqLJC^is #vyBAٹC[ʬqXrnQSV!eZ[B6}ebNoؕ0\R}<K, D.aTWiD_WFM9xlwK"ggtsYPK i/^gtk/splitpane_downarrow.png sb``p  6,4c"+q(q.JM,SMeHS0T(N-(S0200R022221W6040T=^~QDF<2gGd1В dP%בac?DV _1Vry'/,pS-oT$GrrF4^W Z<]\9%4PK i/4gtk/splitpane_hhandle.png sb``p l@$gJ\#JRK2B2sSR2s S J  -L id/ue("d!(YYwH ;:20l [z8TJϖY+)J" x2I0@AtG_GY|kOǐ[5f`TS^^@{ O6 ڋ9U4᏷SX1 3- W4) PK i/qvicons/Computer.gif5S[HQ - @Pz;L7B a  1=$-f 5E]̮ۋFbYHfNtv93m׭_|َ4H+ۢ7hvc( WP, SRRRSS322rrrrsspQQQaaa^^G%Eu>z# !0C_C"`G *238@Y"vO!32#OebdF(^&9I, En4T>k6]L%39&U;rĻU5,D͙z6QfTmJEQQZ1D6іc!gX|v| }ltDV2vL{~j c3@+.#ԡY臩 ,cYE%#ZľdhU!Y%%%H.777wuu%ᱱ` Mw"95$Xs=`IW= iNdOOX[y]KT7NլƚW~x(NݺzʽPOьs#k¥:J[d`ˋ+=dF'W?HdnǕ 7V{wjq /PK i/]icons/InternalFrame.gifst0O`` `444 gY@Ad3~wy8s҉: >|s6jӦU8*N$w/ɕq( Z彦U[Վ"5=w3 5PK i/v`icons/TreeClosed.gif5Skah:4"A% :To"E 4NAk? ;.EPx Z N҂Ɋyw'}+[}|K6hh$}U6Unt&f\. J2:::88X,u:ryfZn # !0 hԐ@4"100ht =+#X]A [Ȉgg"dB!Ԡ2120j$Ȃ"I(Be. ~׍j0gw݆a$,I4! D НgFͶ4epGd0]Y#,3C"y(FIY`yfڌz].uTƖH,2shvV;0M3K%xTJՃ&~59l1h<-@oZj333fsyyjmnnN'HLL~K2}SkՏtdypɑǗ~Zepq470yz0n'?~p^n,d.vWJ (͝Zy;@.PK i/ Ûbicons/TreeOpen.gif5S?hQҀCPRA\A6BHX Ah@ЩZ8TLb[й Ulol)C5.Fλ çNAN}|nbksvZUPfz*J7Ng2l6|T-BAVullfx # !0 hԐ@4"100ht =+#X]A [Ȉgg"dB!Ԡ2120j$Ȃ"I(Be. ~׍j0gw݆a$,I4! D НgFͶ4epGd0]Y#,3C"y(FIY`yfڌz].uTƖH,2shvV;0M3K%xTJՃ&~59l1h<@\T*SSSZm}}}yyh4Vnwvv:T@7߉=MN#3u<[:@ϣ'&HR}acÃ=7޾_}X~1438Bjq>4Y8PK i/dkde/file59.png sb``p ҂ $_X f{8TI(o{`C5;.x,=^>pPs4- ,D yDdweK_F03aV}F[t*`B*`B5? U&"Gh&kT*UȲ9L Q"9FѨf]-慧MN`oA [>Mx6ZlV[v5w+nX^6+P&[ F"cG+eG *.0h4U{;:Z1pcج i1ڬ_T:Z1" <^87\gXū{sk +?ytum}P}tG.͏*/2,}ҩMy%[;ݳ.=PcۖE oxdS}Ӽ$Cvu+ogțҶU5c@ {eWMr2}n]uעq9Ϭ*\6:̐\2:Đ3emKYdL{`Z|8~~8A!(Ǥaq2P%cZ|ȇs@ā#[uG*NqIENDB`PK i/)'kde/file72.png sb``p ,@l$^)Oǐ9'f|c^xģ"fJ<7X48|/.y#3e˔S41vw8|_ ~.PK i/90Q^Fkde/kde.themercmێ0#x% YJ lj X8v b Bf!_# .-($F" Ą"9! ^P=m#i& y?n'a7@q_ۢhSV:j)](x,%q֋Txp3K x ?ɟŅ 02ҴokTۥ {z{{t|"U|VME _߲>JoPK 1Agtk/PK 1A"icons/PK 1AFkde/PK i/f)0 hgtk/empty.pngPK i/sDrz ?gtk/file0.pngPK i/_uLO gtk/file1.pngPK i/ Sgtk/file10.pngPK i/3:gtk/file11.pngPK i/3:gtk/file12.pngPK i/}8] {gtk/file13.pngPK i/ gtk/file14.pngPK i/T'acgtk/file15.pngPK i/+gtk/file16.pngPK i/+0 gtk/file17.pngPK i/nr gtk/file18.pngPK i/> MQ gtk/file19.pngPK i/   gtk/file2.pngPK i/A~C gtk/file20.pngPK i/B gtk/file21.pngPK i/3: gtk/file22.pngPK i/=twgtk/file23.pngPK i/MtTWgtk/file24.pngPK i/MtTWgtk/file25.pngPK i/M~[^gtk/file26.pngPK i/M~[^gtk/file27.pngPK i/M~[^gtk/file28.pngPK i/M~[^gtk/file29.pngPK i/B gtk/file3.pngPK i//X\gtk/file30.pngPK i//X\gtk/file31.pngPK i//X\gtk/file32.pngPK i//X\%gtk/file33.pngPK i/Ƥ:nqgtk/file34.pngPK i/MtTWCgtk/file35.pngPK i/MtTWgtk/file36.pngPK i/ݱwCgtk/file37.pngPK i/.gtk/file38.pngPK i/Fԏx`dgtk/file39.pngPK i/  Wgtk/file4.pngPK i/L̜qpsgtk/file40.pngPK i/2tv0gtk/file41.pngPK i/2w]agtk/file42.pngPK i/_nqYgtk/file43.pngPK i/W%psgtk/file44.pngPK i/|Simgtk/file45.pngPK i/DĎvy$gtk/file46.pngPK i/2;{}gtk/file47.pngPK i/Xcgmgtk/file48.pngPK i/rugtk/file49.pngPK i/  gtk/file5.pngPK i/mux!gtk/file50.pngPK i/KSx"gtk/file51.pngPK i/PV;#gtk/file52.pngPK i/pbS!$gtk/file53.pngPK i/Q!%gtk/file54.pngPK i/wTVR&gtk/file55.pngPK i/5SV&gtk/file56.pngPK i/"Y]Q'gtk/file57.pngPK i/ `WZ'gtk/file58.pngPK i/  Y(gtk/file6.pngPK i/B )gtk/file7.pngPK i/B *gtk/file8.pngPK i/ljXS +gtk/file9.pngPK i/DX -gtk/gtkrcPK i/?A56gtk/optionmenu.pngPK i/$_CF7gtk/optionmenu_disabled.pngPK i/Ix-^_ 9gtk/optionmenu_rollover.pngPK i/^:gtk/splitpane_downarrow.pngPK i/4;gtk/splitpane_hhandle.pngPK i/=o<gtk/splitpane_leftarrow.pngPK i/UX;=gtk/splitpane_rightarrow.pngPK i/>gtk/splitpane_uparrow.pngPK i/?gtk/splitpane_vhandle.pngPK i/qv Aicons/Computer.gifPK i/?ʴDicons/Default.gifPK i/DIFmDicons/FloppyDrive.gifPK i/"eN{wGicons/HardDrive.gifPK i/]Iicons/InternalFrame.gifPK i/v`Jicons/TreeClosed.gifPK i/ ÛbKMicons/TreeOpen.gifPK i/dOkde/file59.pngPK i/ *ZEPkde/file60.pngPK i/Qkde/file61.pngPK i/psRkde/file62.pngPK i/qsxSkde/file63.pngPK i/qIsuTkde/file64.pngPK i/i\`Tkde/file65.pngPK i/&CZ] * * Note that NanoXML is not 100% XML 1.0 compliant: *
    *
  • The parser is non-validating. *
  • The DTD is fully ignored, including <!ENTITY...>. * *
  • There is no support for mixed content (elements containing both * subelements and CDATA elements) *
*

* * You can opt to use a SAX compatible API, by including both nanoxml.jar * and nanoxml-sax.jar in your classpath and setting the property * org.xml.sax.parser to nanoxml.sax.SAXParser

* * $Revision: 1.3 $
* $Date: 2005/11/19 09:15:30 $

* * * * @author Marc De Scheemaecker < * Marc.DeScheemaecker@advalvas.be > * @created 27 avril 2002 * @see com.l2fprod.contrib.nanoxml.XMLParseException * @version 1.6 */ public class XMLElement implements Serializable { /** * The attributes given to the object. */ private Properties attributes; /** * Subobjects of the object. The subobjects are of class XMLElement * themselves. */ private Vector children; /** * The class of the object (the name indicated in the tag). */ private String tagName; /** * The #PCDATA content of the object. If there is no such content, this field * is null. */ private String contents; /** * Conversion table for &...; tags. */ private Properties conversionTable; /** * Whether to skip leading whitespace in CDATA. */ private boolean skipLeadingWhitespace; /** * The line number where the element starts. */ private int lineNr; /** * Whether the parsing is case sensitive. */ private boolean ignoreCase; /** * Major version of NanoXML. */ public final static int NANOXML_MAJOR_VERSION = 1; /** * Minor version of NanoXML. */ public final static int NANOXML_MINOR_VERSION = 6; /** * Serialization serial version ID. */ final static long serialVersionUID = 6685035139346394777L; /** * Creates a new XML element. The following settings are used: *

*
Conversion table
*
Minimal XML conversions: &amp; &lt; &gt; * &apos; &quot;
*
Skip whitespace in contents
*
false
*
Ignore Case
*
true
*
* * * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(boolean) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties,boolean) */ public XMLElement() { this(new Properties(), false, true, true); } /** * Creates a new XML element. The following settings are used: *
*
Conversion table
*
conversionTable combined with the minimal XML conversions: * &amp; &lt; &gt; * &apos; &quot;
*
Skip whitespace in contents
*
false
*
Ignore Case
*
true
*
* * * @param conversionTable Description of Parameter * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement() * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(boolean) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties,boolean) */ public XMLElement(Properties conversionTable) { this(conversionTable, false, true, true); } /** * Creates a new XML element. The following settings are used: *
*
Conversion table
*
Minimal XML conversions: &amp; &lt; &gt; * &apos; &quot;
*
Skip whitespace in contents
*
skipLeadingWhitespace
*
Ignore Case
*
true
*
* * * @param skipLeadingWhitespace Description of Parameter * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement() * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties,boolean) */ public XMLElement(boolean skipLeadingWhitespace) { this(new Properties(), skipLeadingWhitespace, true, true); } /** * Creates a new XML element. The following settings are used: *
*
Conversion table
*
conversionTable combined with the minimal XML conversions: * &amp; &lt; &gt; * &apos; &quot;
*
Skip whitespace in contents
*
skipLeadingWhitespace
*
Ignore Case
*
true
*
* * * @param conversionTable Description of Parameter * @param skipLeadingWhitespace Description of Parameter * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement() * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(boolean) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties) */ public XMLElement(Properties conversionTable, boolean skipLeadingWhitespace) { this(conversionTable, skipLeadingWhitespace, true, true); } /** * Creates a new XML element. The following settings are used: *
*
Conversion table
*
conversionTable , eventually combined with the minimal XML * conversions: &amp; &lt; &gt; * &apos; &quot; (depending on * fillBasicConversionTable )
*
Skip whitespace in contents
*
skipLeadingWhitespace
*
Ignore Case
*
ignoreCase
*
*

* * This constructor should only be called from XMLElement itself to * create child elements. * * @param conversionTable Description of Parameter * @param skipLeadingWhitespace Description of Parameter * @param ignoreCase Description of Parameter * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement() * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(boolean) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties,boolean) */ public XMLElement(Properties conversionTable, boolean skipLeadingWhitespace, boolean ignoreCase) { this(conversionTable, skipLeadingWhitespace, true, ignoreCase); } /** * Creates a new XML element. The following settings are used: *

*
Conversion table
*
conversionTable , eventually combined with the minimal XML * conversions: &amp; &lt; &gt; * &apos; &quot; (depending on * fillBasicConversionTable )
*
Skip whitespace in contents
*
skipLeadingWhitespace
*
Ignore Case
*
ignoreCase
*
*

* * This constructor should only be called from XMLElement itself to * create child elements. * * @param conversionTable Description of Parameter * @param skipLeadingWhitespace Description of Parameter * @param fillBasicConversionTable Description of Parameter * @param ignoreCase Description of Parameter * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement() * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(boolean) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties) * @see com.l2fprod.contrib.nanoxml.XMLElement#XMLElement(java.util.Properties,boolean) */ protected XMLElement(Properties conversionTable, boolean skipLeadingWhitespace, boolean fillBasicConversionTable, boolean ignoreCase) { this.ignoreCase = ignoreCase; this.skipLeadingWhitespace = skipLeadingWhitespace; this.tagName = null; this.contents = ""; this.attributes = new Properties(); this.children = new Vector(); this.conversionTable = conversionTable; this.lineNr = 0; if (fillBasicConversionTable) { this.conversionTable.put("lt", "<"); this.conversionTable.put("gt", ">"); this.conversionTable.put("quot", "\""); this.conversionTable.put("apos", "'"); this.conversionTable.put("amp", "&"); } } /** * Changes the content string. * * @param content The new content string. */ public void setContent(String content) { this.contents = content; } /** * Changes the tag name. * * @param tagName The new tag name. */ public void setTagName(String tagName) { this.tagName = tagName; } /** * Returns the subobjects of the object. * * @return The Children value */ public Vector getChildren() { return this.children; } /** * Returns the #PCDATA content of the object. If there is no such content, * null is returned. * * @return The Contents value */ public String getContents() { return this.contents; } /** * Returns the line nr on which the element is found. * * @return The LineNr value */ public int getLineNr() { return this.lineNr; } /** * Returns a property by looking up a key in a hashtable. If the property * doesn't exist, the value corresponding to defaultValue is returned. * * @param key Description of Parameter * @param valueSet Description of Parameter * @param defaultValue Description of Parameter * @return The IntProperty value */ public int getIntProperty(String key, Hashtable valueSet, String defaultValue) { String val = this.attributes.getProperty(key); Integer result; if (this.ignoreCase) { key = key.toUpperCase(); } if (val == null) { val = defaultValue; } try { result = (Integer) (valueSet.get(val)); } catch (ClassCastException e) { throw this.invalidValueSet(key); } if (result == null) { throw this.invalidValue(key, val, this.lineNr); } return result.intValue(); } /** * Returns a property of the object. If there is no such property, this method * returns null. * * @param key Description of Parameter * @return The Property value */ public String getProperty(String key) { if (this.ignoreCase) { key = key.toUpperCase(); } return this.attributes.getProperty(key); } /** * Returns a property of the object. If the property doesn't exist, * defaultValue is returned. * * @param key Description of Parameter * @param defaultValue Description of Parameter * @return The Property value */ public String getProperty(String key, String defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } return this.attributes.getProperty(key, defaultValue); } /** * Returns an integer property of the object. If the property doesn't exist, * defaultValue is returned. * * @param key Description of Parameter * @param defaultValue Description of Parameter * @return The Property value */ public int getProperty(String key, int defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } String val = this.attributes.getProperty(key); if (val == null) { return defaultValue; } else { try { return Integer.parseInt(val); } catch (NumberFormatException e) { throw this.invalidValue(key, val, this.lineNr); } } } /** * Returns a floating point property of the object. If the property doesn't * exist, defaultValue is returned. * * @param key Description of Parameter * @param defaultValue Description of Parameter * @return The Property value */ public double getProperty(String key, double defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } String val = this.attributes.getProperty(key); if (val == null) { return defaultValue; } else { try { return Double.valueOf(val).doubleValue(); } catch (NumberFormatException e) { throw this.invalidValue(key, val, this.lineNr); } } } /** * Returns a boolean property of the object. If the property is missing, * defaultValue is returned. * * @param key Description of Parameter * @param trueValue Description of Parameter * @param falseValue Description of Parameter * @param defaultValue Description of Parameter * @return The Property value */ public boolean getProperty(String key, String trueValue, String falseValue, boolean defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } String val = this.attributes.getProperty(key); if (val == null) { return defaultValue; } else if (val.equals(trueValue)) { return true; } else if (val.equals(falseValue)) { return false; } else { throw this.invalidValue(key, val, this.lineNr); } } /** * Returns a property by looking up a key in the hashtable valueSet If * the property doesn't exist, the value corresponding to defaultValue * is returned. * * @param key Description of Parameter * @param valueSet Description of Parameter * @param defaultValue Description of Parameter * @return The Property value */ public Object getProperty(String key, Hashtable valueSet, String defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } String val = this.attributes.getProperty(key); if (val == null) { val = defaultValue; } Object result = valueSet.get(val); if (result == null) { throw this.invalidValue(key, val, this.lineNr); } return result; } /** * Returns a property by looking up a key in the hashtable valueSet . * If the property doesn't exist, the value corresponding to defaultValue * is returned. * * @param key Description of Parameter * @param valueSet Description of Parameter * @param defaultValue Description of Parameter * @return The StringProperty value */ public String getStringProperty(String key, Hashtable valueSet, String defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } String val = this.attributes.getProperty(key); String result; if (val == null) { val = defaultValue; } try { result = (String) (valueSet.get(val)); } catch (ClassCastException e) { throw this.invalidValueSet(key); } if (result == null) { throw this.invalidValue(key, val, this.lineNr); } return result; } /** * Returns a property by looking up a key in the hashtable valueSet . * If the value is not defined in the hashtable, the value is considered to be * an integer. If the property doesn't exist, the value corresponding to * defaultValue is returned. * * @param key Description of Parameter * @param valueSet Description of Parameter * @param defaultValue Description of Parameter * @return The SpecialIntProperty value */ public int getSpecialIntProperty(String key, Hashtable valueSet, String defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } String val = this.attributes.getProperty(key); Integer result; if (val == null) { val = defaultValue; } try { result = (Integer) (valueSet.get(val)); } catch (ClassCastException e) { throw this.invalidValueSet(key); } if (result == null) { try { return Integer.parseInt(val); } catch (NumberFormatException e) { throw this.invalidValue(key, val, this.lineNr); } } return result.intValue(); } /** * Returns a property by looking up a key in the hashtable valueSet . * If the value is not defined in the hashtable, the value is considered to be * a floating point number. If the property doesn't exist, the value * corresponding to defaultValue is returned. * * @param key Description of Parameter * @param valueSet Description of Parameter * @param defaultValue Description of Parameter * @return The SpecialDoubleProperty value */ public double getSpecialDoubleProperty(String key, Hashtable valueSet, String defaultValue) { if (this.ignoreCase) { key = key.toUpperCase(); } String val = this.attributes.getProperty(key); Double result; if (val == null) { val = defaultValue; } try { result = (Double) (valueSet.get(val)); } catch (ClassCastException e) { throw this.invalidValueSet(key); } if (result == null) { try { result = Double.valueOf(val); } catch (NumberFormatException e) { throw this.invalidValue(key, val, this.lineNr); } } return result.doubleValue(); } /** * Returns the class (i.e. the name indicated in the tag) of the object. * * @return The TagName value */ public String getTagName() { return this.tagName; } /** * Adds a subobject. * * @param child The feature to be added to the Child attribute */ public void addChild(XMLElement child) { this.children.addElement(child); } /** * Adds a property. If the element is case insensitive, the property name is * capitalized. * * @param key The feature to be added to the Property attribute * @param value The feature to be added to the Property attribute */ public void addProperty(String key, Object value) { if (this.ignoreCase) { key = key.toUpperCase(); } this.attributes.put(key, value.toString()); } /** * Adds a property. If the element is case insensitive, the property name is * capitalized. * * @param key The feature to be added to the Property attribute * @param value The feature to be added to the Property attribute */ public void addProperty(String key, int value) { if (this.ignoreCase) { key = key.toUpperCase(); } this.attributes.put(key, Integer.toString(value)); } /** * Adds a property. If the element is case insensitive, the property name is * capitalized. * * @param key The feature to be added to the Property attribute * @param value The feature to be added to the Property attribute */ public void addProperty(String key, double value) { if (this.ignoreCase) { key = key.toUpperCase(); } this.attributes.put(key, Double.toString(value)); } /** * Returns the number of subobjects of the object. * * @return Description of the Returned Value */ public int countChildren() { return this.children.size(); } /** * Enumerates the attribute names. * * @return Description of the Returned Value */ public Enumeration enumeratePropertyNames() { return this.attributes.keys(); } /** * Enumerates the subobjects of the object. * * @return Description of the Returned Value */ public Enumeration enumerateChildren() { return this.children.elements(); } /** * Reads an XML definition from a java.io.Reader and parses it. * * @param reader Description of Parameter * @exception IOException Description of Exception * @exception XMLParseException Description of Exception */ public void parseFromReader(Reader reader) throws IOException, XMLParseException { this.parseFromReader(reader, 1); } /** * Reads an XML definition from a java.io.Reader and parses it. * * @param reader Description of Parameter * @param startingLineNr Description of Parameter * @exception IOException Description of Exception * @exception XMLParseException Description of Exception */ public void parseFromReader(Reader reader, int startingLineNr) throws IOException, XMLParseException { int blockSize = 4096; char[] input = null; int size = 0; for (; ; ) { if (input == null) { input = new char[blockSize]; } else { char[] oldInput = input; input = new char[input.length + blockSize]; System.arraycopy(oldInput, 0, input, 0, oldInput.length); } int charsRead = reader.read(input, size, blockSize); if (charsRead < 0) { break; } size += charsRead; } this.parseCharArray(input, 0, size, startingLineNr); } /** * Parses an XML definition. * * @param string Description of Parameter * @exception XMLParseException Description of Exception */ public void parseString(String string) throws XMLParseException { this.parseCharArray(string.toCharArray(), 0, string.length(), 1); } /** * Parses an XML definition starting at offset . * * @param string Description of Parameter * @param offset Description of Parameter * @return the offset of the string following * the XML data * @exception XMLParseException Description of Exception */ public int parseString(String string, int offset) throws XMLParseException { return this.parseCharArray(string.toCharArray(), offset, string.length(), 1); } /** * Parses an XML definition starting at offset . * * @param string Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @return the offset of the string following * the XML data (<= end) * @exception XMLParseException Description of Exception */ public int parseString(String string, int offset, int end) throws XMLParseException { return this.parseCharArray(string.toCharArray(), offset, end, 1); } /** * Parses an XML definition starting at offset . * * @param string Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param startingLineNr Description of Parameter * @return the offset of the string following * the XML data (<= end) * @exception XMLParseException Description of Exception */ public int parseString(String string, int offset, int end, int startingLineNr) throws XMLParseException { return this.parseCharArray(string.toCharArray(), offset, end, startingLineNr); } /** * Parses an XML definition starting at offset . * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @return the offset of the array following the * XML data (<= end) * @exception XMLParseException Description of Exception */ public int parseCharArray(char[] input, int offset, int end) throws XMLParseException { return this.parseCharArray(input, offset, end, 1); } /** * Parses an XML definition starting at offset . * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param startingLineNr Description of Parameter * @return the offset of the array following the * XML data (<= end) * @exception XMLParseException Description of Exception */ public int parseCharArray(char[] input, int offset, int end, int startingLineNr) throws XMLParseException { int[] lineNr = new int[1]; lineNr[0] = startingLineNr; return this.parseCharArray(input, offset, end, lineNr); } /** * Removes a child object. If the object is not a child, nothing happens. * * @param child Description of Parameter */ public void removeChild(XMLElement child) { this.children.removeElement(child); } /** * Removes an attribute. * * @param key Description of Parameter */ public void removeChild(String key) { if (this.ignoreCase) { key = key.toUpperCase(); } this.attributes.remove(key); } /** * Writes the XML element to a string. * * @return Description of the Returned Value */ public String toString() { StringWriter writer = new StringWriter(); this.write(writer); return writer.toString(); } /** * Writes the XML element to a writer. * * @param writer Description of Parameter */ public void write(Writer writer) { this.write(writer, 0); } /** * Writes the XML element to a writer. * * @param writer Description of Parameter * @param indent Description of Parameter */ public void write(Writer writer, int indent) { PrintWriter out = new PrintWriter(writer); for (int i = 0; i < indent; i++) { out.print(' '); } if (this.tagName == null) { this.writeEncoded(out, this.contents); return; } out.print('<'); out.print(this.tagName); if (!this.attributes.isEmpty()) { Enumeration enumeration = this.attributes.keys(); while (enumeration.hasMoreElements()) { out.print(' '); String key = (String) (enumeration.nextElement()); String value = (String) (this.attributes.get(key)); out.print(key); out.print("=\""); this.writeEncoded(out, value); out.print('"'); } } if ((this.contents != null) && (this.contents.length() > 0)) { if (this.skipLeadingWhitespace) { out.println('>'); for (int i = 0; i < indent + 4; i++) { out.print(' '); } out.println(this.contents); for (int i = 0; i < indent; i++) { out.print(' '); } } else { out.print('>'); this.writeEncoded(out, this.contents); } out.print("'); } else if (this.children.isEmpty()) { out.println("/>"); } else { out.println('>'); Enumeration enumeration = this.enumerateChildren(); while (enumeration.hasMoreElements()) { XMLElement child = (XMLElement) (enumeration.nextElement()); child.write(writer, indent + 4); } for (int i = 0; i < indent; i++) { out.print(' '); } out.print("'); } } /** * !!! Searches the content for child objects. If such objects exist, the * content is reduced to null. * * @param input Description of Parameter * @param contentOffset Description of Parameter * @param contentSize Description of Parameter * @param contentLineNr Description of Parameter * @exception XMLParseException Description of Exception * @see com.l2fprod.contrib.nanoxml.XMLElement#parseCharArray(char[], int, int, int[]) */ protected void scanChildren(char[] input, int contentOffset, int contentSize, int contentLineNr) throws XMLParseException { int end = contentOffset + contentSize; int offset = contentOffset; int lineNr[] = new int[1]; lineNr[0] = contentLineNr; while (offset < end) { try { offset = this.skipWhitespace(input, offset, end, lineNr); } catch (XMLParseException e) { return; } if ((input[offset] != '<') || ((input[offset + 1] == '!') && (input[offset + 2] == '['))) { return; } XMLElement child = this.createAnotherElement(); offset = child.parseCharArray(input, offset, end, lineNr); this.children.addElement(child); } } /** * Creates a new XML element. * * @return Description of the Returned Value */ protected XMLElement createAnotherElement() { return new XMLElement(this.conversionTable, this.skipLeadingWhitespace, false, this.ignoreCase); } /** * Skips a tag that don't contain any useful data: <?...?>, <!...> * and comments. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param lineNr Description of Parameter * @return the position after the tag */ protected int skipBogusTag(char[] input, int offset, int end, int[] lineNr) { int level = 1; while (offset < end) { char ch = input[offset++]; switch (ch) { case '\r': if ((offset < end) && (input[offset] == '\n')) { offset++; } lineNr[0]++; break; case '\n': lineNr[0]++; break; case '<': level++; break; case '>': level--; if (level == 0) { return offset; } break; default: } } throw this.unexpectedEndOfData(lineNr[0]); } /** * Converts &...; sequences to "normal" chars. * * @param s Description of Parameter * @param lineNr Description of Parameter * @return Description of the Returned Value */ protected String decodeString(String s, int lineNr) { StringBuffer result = new StringBuffer(s.length()); int index = 0; while (index < s.length()) { int index2 = (s + '&').indexOf('&', index); int index3 = (s + "").indexOf("]]>", index3 + 9); result.append(s.substring(index, index3)); result.append(s.substring(index3 + 9, index4)); index = index4 + 2; } index++; } return result.toString(); } /** * Writes a string encoded to a writer. * * @param out Description of Parameter * @param str Description of Parameter */ protected void writeEncoded(PrintWriter out, String str) { for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); switch (ch) { case '<': out.write("<"); break; case '>': out.write(">"); break; case '&': out.write("&"); break; case '"': out.write("""); break; case '\'': out.write("'"); break; case '\r': case '\n': out.write(ch); break; default: if (((int) ch < 32) || ((int) ch > 126)) { out.write("&#x"); out.write(Integer.toString((int) ch, 16)); out.write(';'); } else { out.write(ch); } } } } /** * Checks whether a character may be part of an identifier. * * @param ch Description of Parameter * @return The IdentifierChar value */ private boolean isIdentifierChar(char ch) { return (((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')) || ((ch >= '0') && (ch <= '9')) || (".-_:".indexOf(ch) >= 0)); } /** * Parses an XML definition starting at offset . * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param currentLineNr Description of Parameter * @return the offset of the array following the * XML data (<= end) * @exception XMLParseException Description of Exception */ private int parseCharArray(char[] input, int offset, int end, int[] currentLineNr) throws XMLParseException { this.lineNr = currentLineNr[0]; this.tagName = null; this.contents = null; this.attributes = new Properties(); this.children = new Vector(); try { offset = this.skipWhitespace(input, offset, end, currentLineNr); } catch (XMLParseException e) { return offset; } offset = this.skipPreamble(input, offset, end, currentLineNr); offset = this.scanTagName(input, offset, end, currentLineNr); this.lineNr = currentLineNr[0]; offset = this.scanAttributes(input, offset, end, currentLineNr); int[] contentOffset = new int[1]; int[] contentSize = new int[1]; int contentLineNr = currentLineNr[0]; offset = this.scanContent(input, offset, end, contentOffset, contentSize, currentLineNr); if (contentSize[0] > 0) { this.scanChildren(input, contentOffset[0], contentSize[0], contentLineNr); if (this.children.size() > 0) { this.contents = null; } else { this.processContents(input, contentOffset[0], contentSize[0], contentLineNr); for (int i = 0; i < contentSize[0]; i++) { if (input[contentOffset[0] + i] > ' ') { return offset; } } this.contents = null; } } return offset; } /** * Decodes the entities in the contents and, if skipLeadingWhitespace is * true, removes extraneous whitespaces after newlines and * convert those newlines into spaces. * * @param input Description of Parameter * @param contentOffset Description of Parameter * @param contentSize Description of Parameter * @param contentLineNr Description of Parameter * @exception XMLParseException Description of Exception * @see com.l2fprod.contrib.nanoxml.XMLElement#decodeString */ private void processContents(char[] input, int contentOffset, int contentSize, int contentLineNr) throws XMLParseException { int[] lineNr = new int[1]; lineNr[0] = contentLineNr; if (!this.skipLeadingWhitespace) { String str = new String(input, contentOffset, contentSize); this.contents = this.decodeString(str, lineNr[0]); return; } StringBuffer result = new StringBuffer(contentSize); int end = contentSize + contentOffset; for (int i = contentOffset; i < end; i++) { char ch = input[i]; // The end of the contents is always a < character, so there's // no danger for bounds violation while ((ch == '\r') || (ch == '\n')) { lineNr[0]++; result.append(ch); i++; ch = input[i]; if (ch != '\n') { result.append(ch); } do { i++; ch = input[i]; } while ((ch == ' ') || (ch == '\t')); } if (i < end) { result.append(ch); } } this.contents = this.decodeString(result.toString(), lineNr[0]); } /** * Scans the attributes of the object. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param lineNr Description of Parameter * @return the offset in the string following * the attributes, so that input[offset] in { '/', '>' } * @exception XMLParseException Description of Exception * @see com.l2fprod.contrib.nanoxml.XMLElement#scanOneAttribute */ private int scanAttributes(char[] input, int offset, int end, int[] lineNr) throws XMLParseException { // String key; // String value; for (; ; ) { offset = this.skipWhitespace(input, offset, end, lineNr); char ch = input[offset]; if ((ch == '/') || (ch == '>')) { break; } offset = this.scanOneAttribute(input, offset, end, lineNr); } return offset; } /** * Scans the content of the object. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param contentOffset Description of Parameter * @param contentSize Description of Parameter * @param lineNr Description of Parameter * @return the offset after the XML element; * contentOffset points to the start of the content section; contentSize * is the size of the content section * @exception XMLParseException Description of Exception */ private int scanContent(char[] input, int offset, int end, int[] contentOffset, int[] contentSize, int[] lineNr) throws XMLParseException { if (input[offset] == '/') { contentSize[0] = 0; if (input[offset + 1] != '>') { throw this.expectedInput("'>'", lineNr[0]); } return offset + 2; } if (input[offset] != '>') { throw this.expectedInput("'>'", lineNr[0]); } if (this.skipLeadingWhitespace) { offset = this.skipWhitespace(input, offset + 1, end, lineNr); } else { offset++; } // int begin = offset; contentOffset[0] = offset; int level = 0; char[] tag = this.tagName.toCharArray(); end -= (tag.length + 2); while ((offset < end) && (level >= 0)) { if (input[offset] == '<') { boolean ok = true; if ((offset < (end - 1)) && (input[offset + 1] == '!') && (input[offset + 2] == '[')) { offset++; continue; } for (int i = 0; ok && (i < tag.length); i++) { ok &= (input[offset + (i + 1)] == tag[i]); } ok &= !this.isIdentifierChar(input[offset + tag.length + 1]); if (ok) { while ((offset < end) && (input[offset] != '>')) { offset++; } if (input[offset - 1] != '/') { level++; } continue; } else if (input[offset + 1] == '/') { ok = true; for (int i = 0; ok && (i < tag.length); i++) { ok &= (input[offset + (i + 2)] == tag[i]); } if (ok) { contentSize[0] = offset - contentOffset[0]; offset += tag.length + 2; try { offset = this.skipWhitespace(input, offset, end + tag.length + 2, lineNr); } catch (XMLParseException e) { // ignore } if (input[offset] == '>') { level--; offset++; } continue; } } } if (input[offset] == '\r') { lineNr[0]++; if ((offset != end) && (input[offset + 1] == '\n')) { offset++; } } else if (input[offset] == '\n') { lineNr[0]++; } offset++; } if (level >= 0) { throw this.unexpectedEndOfData(lineNr[0]); } if (this.skipLeadingWhitespace) { int i = contentOffset[0] + contentSize[0] - 1; while ((contentSize[0] >= 0) && (input[i] <= ' ')) { i--; contentSize[0]--; } } return offset; } /** * Scans an identifier. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @return the identifier, or null if offset doesn't point * to an identifier */ private String scanIdentifier(char[] input, int offset, int end) { int begin = offset; while ((offset < end) && (this.isIdentifierChar(input[offset]))) { offset++; } if ((offset == end) || (offset == begin)) { return null; } else { return new String(input, begin, offset - begin); } } /** * Scans one attribute of an object. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param lineNr Description of Parameter * @return the offset after the attribute * @exception XMLParseException Description of Exception */ private int scanOneAttribute(char[] input, int offset, int end, int[] lineNr) throws XMLParseException { String key; String value; key = this.scanIdentifier(input, offset, end); if (key == null) { throw this.syntaxError("an attribute key", lineNr[0]); } offset = this.skipWhitespace(input, offset + key.length(), end, lineNr); if (this.ignoreCase) { key = key.toUpperCase(); } if (input[offset] != '=') { throw this.valueMissingForAttribute(key, lineNr[0]); } offset = this.skipWhitespace(input, offset + 1, end, lineNr); value = this.scanString(input, offset, end, lineNr); if (value == null) { throw this.syntaxError("an attribute value", lineNr[0]); } if ((value.charAt(0) == '"') || (value.charAt(0) == '\'')) { value = value.substring(1, (value.length() - 1)); offset += 2; } this.attributes.put(key, this.decodeString(value, lineNr[0])); return offset + value.length(); } /** * Scans a string. Strings are either identifiers, or text delimited by double * quotes. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param lineNr Description of Parameter * @return the string found, without delimiting * double quotes; or null if offset didn't point to a valid string * @exception XMLParseException Description of Exception * @see com.l2fprod.contrib.nanoxml.XMLElement#scanIdentifier */ private String scanString(char[] input, int offset, int end, int[] lineNr) throws XMLParseException { char delim = input[offset]; if ((delim == '"') || (delim == '\'')) { int begin = offset; offset++; while ((offset < end) && (input[offset] != delim)) { if (input[offset] == '\r') { lineNr[0]++; if ((offset != end) && (input[offset + 1] == '\n')) { offset++; } } else if (input[offset] == '\n') { lineNr[0]++; } offset++; } if (offset == end) { return null; } else { return new String(input, begin, offset - begin + 1); } } else { return this.scanIdentifier(input, offset, end); } } /** * Scans the class (tag) name of the object. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param lineNr Description of Parameter * @return the position after the tag name * @exception XMLParseException Description of Exception */ private int scanTagName(char[] input, int offset, int end, int[] lineNr) throws XMLParseException { this.tagName = this.scanIdentifier(input, offset, end); if (this.tagName == null) { throw this.syntaxError("a tag name", lineNr[0]); } return offset + this.tagName.length(); } /** * Skips a tag that don't contain any useful data: <?...?>, <!...> * and comments. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param lineNr Description of Parameter * @return the position after the tag * @exception XMLParseException Description of Exception */ private int skipPreamble(char[] input, int offset, int end, int[] lineNr) throws XMLParseException { char ch; do { offset = this.skipWhitespace(input, offset, end, lineNr); if (input[offset] != '<') { this.expectedInput("'<'", lineNr[0]); } offset++; if (offset >= end) { throw this.unexpectedEndOfData(lineNr[0]); } ch = input[offset]; if ((ch == '!') || (ch == '?')) { offset = this.skipBogusTag(input, offset, end, lineNr); } } while (!isIdentifierChar(ch)); return offset; } /** * Skips whitespace characters. * * @param input Description of Parameter * @param offset Description of Parameter * @param end Description of Parameter * @param lineNr Description of Parameter * @return the position after the whitespace */ private int skipWhitespace(char[] input, int offset, int end, int[] lineNr) { int startLine = lineNr[0]; while (offset < end) { if (((offset + 6) < end) && (input[offset + 3] == '-') && (input[offset + 2] == '-') && (input[offset + 1] == '!') && (input[offset] == '<')) { offset += 4; while ((input[offset] != '-') || (input[offset + 1] != '-') || (input[offset + 2] != '>')) { if ((offset + 2) >= end) { throw this.unexpectedEndOfData(startLine); } offset++; } offset += 3; } else if (input[offset] == '\r') { lineNr[0]++; if ((offset != end) && (input[offset + 1] == '\n')) { offset++; } } else if (input[offset] == '\n') { lineNr[0]++; } else if (input[offset] > ' ') { break; } offset++; } if (offset == end) { throw this.unexpectedEndOfData(startLine); } return offset; } /** * Creates a parse exception for when an invalid valueset is given to a * method. * * @param key Description of Parameter * @return Description of the Returned Value */ private XMLParseException invalidValueSet(String key) { String msg = "Invalid value set (key = \"" + key + "\")"; return new XMLParseException(this.getTagName(), msg); } /** * Creates a parse exception for when an invalid value is given to a method. * * @param key Description of Parameter * @param value Description of Parameter * @param lineNr Description of Parameter * @return Description of the Returned Value */ private XMLParseException invalidValue(String key, String value, int lineNr) { String msg = "Attribute \"" + key + "\" does not contain a valid " + "value (\"" + value + "\")"; return new XMLParseException(this.getTagName(), lineNr, msg); } /** * The end of the data input has been reached. * * @param lineNr Description of Parameter * @return Description of the Returned Value */ private XMLParseException unexpectedEndOfData(int lineNr) { String msg = "Unexpected end of data reached"; return new XMLParseException(this.getTagName(), lineNr, msg); } /** * A syntax error occured. * * @param context Description of Parameter * @param lineNr Description of Parameter * @return Description of the Returned Value */ private XMLParseException syntaxError(String context, int lineNr) { String msg = "Syntax error while parsing " + context; return new XMLParseException(this.getTagName(), lineNr, msg); } /** * A character has been expected. * * @param charSet Description of Parameter * @param lineNr Description of Parameter * @return Description of the Returned Value */ private XMLParseException expectedInput(String charSet, int lineNr) { String msg = "Expected: " + charSet; return new XMLParseException(this.getTagName(), lineNr, msg); } /** * A value is missing for an attribute. * * @param key Description of Parameter * @param lineNr Description of Parameter * @return Description of the Returned Value */ private XMLParseException valueMissingForAttribute(String key, int lineNr) { String msg = "Value missing for attribute with key \"" + key + "\""; return new XMLParseException(this.getTagName(), lineNr, msg); } } skinlf-6.7/src/com/l2fprod/contrib/nanoxml/XMLParseException.java0000644000175000017500000000773010460410016025017 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.contrib.nanoxml; /** * An XMLParseException is thrown when an error occures while parsing an XML * string.

* * $Revision: 1.2 $
* $Date: 2005/11/19 09:15:30 $

* * * * @author Marc De Scheemaecker < * Marc.DeScheemaecker@advalvas.be > * @created 27 avril 2002 * @see com.l2fprod.contrib.nanoxml.XMLElement * @version 1.6 */ public class XMLParseException extends RuntimeException { /** * Where the error occurred, or -1 if the line number is unknown. */ private int lineNr; /** * Creates an exception. * * @param tag The name of the tag where the error is located. * @param message A message describing what went wrong. */ public XMLParseException(String tag, String message) { super("XML Parse Exception during parsing of " + ((tag == null) ? "the XML definition" : ("a " + tag + "-tag")) + ": " + message); this.lineNr = -1; } /** * Creates an exception. * * @param tag The name of the tag where the error is located. * @param lineNr The number of the line in the input. * @param message A message describing what went wrong. */ public XMLParseException(String tag, int lineNr, String message) { super("XML Parse Exception during parsing of " + ((tag == null) ? "the XML definition" : ("a " + tag + "-tag")) + " at line " + lineNr + ": " + message); this.lineNr = lineNr; } /** * Where the error occurred, or -1 if the line number is unknown. * * @return The LineNr value */ public int getLineNr() { return this.lineNr; } } skinlf-6.7/src/com/l2fprod/gui/0000755000175000017500000000000010460410034016303 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/border/0000755000175000017500000000000010460410034017560 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/border/ActiveBorder.java0000644000175000017500000000652510460410014023002 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.border; import java.awt.*; import javax.swing.border.*; /** * ActiveBorder.
* * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/13 20:49:11 $ */ public class ActiveBorder implements Border { private Border enabledBorder; private Border disabledBorder; public ActiveBorder(Border p_EnabledBorder, Border p_DisabledBorder) { enabledBorder = p_EnabledBorder; disabledBorder = p_DisabledBorder; } public Insets getBorderInsets(Component c) { return c.isEnabled()? enabledBorder.getBorderInsets(c): disabledBorder.getBorderInsets(c); } public boolean isBorderOpaque() { return true; } public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (c.isEnabled()) { enabledBorder.paintBorder(c, g, x, y, width, height); } else { disabledBorder.paintBorder(c, g, x, y, width, height); } } } skinlf-6.7/src/com/l2fprod/gui/border/LineBorder.java0000644000175000017500000000724410460410014022455 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.border; import java.awt.Color; /** * LineBorder.
* This class extends the standard line border but allows the user to customize * the LineBorder roundedCorners variable which was not public in jdk1.2.2. * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/13 20:49:11 $ */ public class LineBorder extends javax.swing.border.LineBorder { /** * Creates a line border with the specified color and a thickness = 1. * * @param color the color for the border */ public LineBorder(Color color) { super(color); } /** * Creates a line border with the specified color and thickness. * * @param color the color of the border * @param thickness the thickness of the border */ public LineBorder(Color color, int thickness) { super(color, thickness); } /** * Creates a line border with the specified color, thickness, and corner * shape. * * @param color the color of the border * @param thickness the thickness of the border * @param roundedCorners whether or not border corners should be round */ public LineBorder(Color color, int thickness, boolean roundedCorners) { super(color, thickness); this.roundedCorners = roundedCorners; } } skinlf-6.7/src/com/l2fprod/gui/icon/0000755000175000017500000000000010460410034017233 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/icon/ArrowIcon.java0000644000175000017500000001306310460410014022002 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.icon; import java.awt.*; import javax.swing.*; public class ArrowIcon implements Icon, SwingConstants { private static final int DEFAULT_SIZE = 5; private int size; private int direction; public ArrowIcon(int direction) { this(DEFAULT_SIZE, direction); } public ArrowIcon(int size, int direction) { this.size = size; this.direction = direction; } public void paintIcon(Component c, Graphics g, int x, int y) { if (direction == NORTH || direction == SOUTH) { paintTriangle(g, x, y, getIconWidth(), getIconHeight(), direction, c.isEnabled()); } else if (direction == WEST || direction==EAST) { paintTriangle(g, x, y, getIconWidth(), getIconHeight(), direction, c.isEnabled()); } } public int getIconWidth() { return size; } public int getIconHeight() { return size; } private void paintTriangle(Graphics g, int x, int y, int width, int height, int direction, boolean isEnabled) { paintArrow(g, size, x, y, width, height, direction, isEnabled); } public static void paintArrow(Graphics g, int size, int x, int y, int width, int height, int direction, boolean isEnabled) { Color oldColor = g.getColor(); int midW, midH, i, j, maxSize; j = 0; maxSize = Math.max(size, 2); midW = width / 2; midH = height / 2; g.translate(x, y); if(isEnabled) g.setColor(UIManager.getColor("controlDkShadow")); else g.setColor(UIManager.getColor("controlShadow")); switch(direction) { case NORTH: for(i = 0; i < maxSize; i++) { g.drawLine(midW-i, i, midW+i, i); } if(!isEnabled) { g.setColor(UIManager.getColor("controlLtHighlight")); g.drawLine(midW-i+2, i, midW+i, i); } break; case SOUTH: if(!isEnabled) { g.translate(1, 1); g.setColor(UIManager.getColor("controlLtHighlight")); for(i = maxSize-1; i >= 0; i--) { g.drawLine(midW-i, j, midW+i, j); j++; } g.translate(-1, -1); g.setColor(UIManager.getColor("controlShadow")); } j = 0; for(i = maxSize-1; i >= 0; i--) { g.drawLine(midW-i, j, midW+i, j); j++; } break; case WEST: for(i = 0; i < maxSize; i++) { g.drawLine(i, midH-i, i, midH+i); } if(!isEnabled) { g.setColor(UIManager.getColor("controlLtHighlight")); g.drawLine(i, midH-i+2, i, midH+i); } break; case EAST: if(!isEnabled) { g.translate(1, 1); g.setColor(UIManager.getColor("controlLtHighlight")); for(i = maxSize-1; i >= 0; i--) { g.drawLine(j, midH-i, j, midH+i); j++; } g.translate(-1, -1); g.setColor(UIManager.getColor("controlShadow")); } j = 0; for(i = maxSize-1; i >= 0; i--) { g.drawLine(j, midH-i, j, midH+i); j++; } break; } g.translate(-x, -y); g.setColor(oldColor); } } skinlf-6.7/src/com/l2fprod/gui/nativeskin/0000755000175000017500000000000010460410034020456 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/nativeskin/win32/0000755000175000017500000000000010460410034021420 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/nativeskin/win32/Win32NativeSkin.java0000644000175000017500000002662710460410012025172 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.nativeskin.win32; import java.awt.*; import java.awt.image.PixelGrabber; import com.l2fprod.gui.nativeskin.*; import com.l2fprod.gui.region.*; import com.l2fprod.util.AccessUtils; import com.l2fprod.util.OS; /** * Win32 Implementation.
* * @author $Author: l2fprod $ * @author Herve Lemaitre (setWindowImageRegion0) * @created 27 avril 2002 * @version $Revision: 1.4 $, $Date: 2004/08/10 18:38:13 $ */ public final class Win32NativeSkin extends NativeSkin { public void setWindowTransparency(Window window, int transparency) { setWindowTransparency0(getHWND(window), transparency); } /** * Sets the WindowRegion attribute of the Win32RegionBuilder object * * @param window The new WindowRegion value * @param region The new WindowRegion value * @param redraw The new WindowRegion value */ public void setWindowRegion(Window window, Region region, boolean redraw) { setWindowRegion(getHWND(window), region, redraw); } public void setWindowRegion(int handle, Region region, boolean redraw) { if (region instanceof ImageRegion) { region = createRegion(((ImageRegion) region).getImage(), ((ImageRegion) region).getImage().getWidth(null), ((ImageRegion) region).getImage().getHeight(null)); } setWindowRegion0(handle, ((Win32Region) region).nativeHandle, redraw); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ public Region createEllipticRegion(int x1, int y1, int x2, int y2) { return new Win32Region(createEllipticRegion0(x1, y1, x2, y2)); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ public Region createRectangleRegion(int x1, int y1, int x2, int y2) { return new Win32Region(createRectangleRegion0(x1, y1, x2, y2)); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @param x3 Description of Parameter * @param y3 Description of Parameter * @return Description of the Returned Value */ public Region createRoundRectangleRegion(int x1, int y1, int x2, int y2, int x3, int y3) { return new Win32Region(createRoundRectangleRegion0(x1, y1, x2, y2, x3, y3)); } /** * Description of the Method * * @param xpoints Description of Parameter * @param ypoints Description of Parameter * @param fillMode Description of Parameter * @return Description of the Returned Value */ public Region createPolygonRegion(int[] xpoints, int[] ypoints, int fillMode) { if (xpoints == null || ypoints == null || (xpoints.length != ypoints.length)) { throw new IllegalArgumentException("xpoints and ypoints must be != null and size must not differ"); } return new Win32Region(createPolygonRegion0(xpoints, ypoints, fillMode)); } /** * Description of the Method * * @param region1 Description of Parameter * @param region2 Description of Parameter * @param combineMode Description of Parameter * @return Description of the Returned Value */ public Region combineRegions(Region region1, Region region2, int combineMode) { return new Win32Region(combineRegions0(((Win32Region) region1).nativeHandle, ((Win32Region) region2).nativeHandle, combineMode)); } public void setAlwaysOnTop(Window window, boolean enable) { setAlwaysOnTop0(getHWND(window), enable); } /** * Description of the Method * * @param image Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @return Description of the Returned Value */ public Region createRegion(Image image, int width, int height) { int[] pixels = new int[width * height]; PixelGrabber pg = new PixelGrabber(image, 0, 0, width, height, pixels, 0, width); try { pg.grabPixels(); } catch (InterruptedException e) { System.err.println("interrupted waiting for pixels!"); e.printStackTrace(); } return new Win32Region(createRegion0(pixels, width, height)); } /** * Sets the WindowRegion0 attribute of the Win32RegionBuilder class * * @param hwnd The new WindowRegion0 value * @param region The new WindowRegion0 value * @param redraw The new WindowRegion0 value */ private native static void setWindowRegion0(int hwnd, long region, boolean redraw); /** * Gets the HWND attribute of the Win32RegionBuilder class * * @param window Description of Parameter * @return The HWND value */ private static int getHWND(Window window) { if (window.getPeer() == null) { window.addNotify(); } if (OS.isOneDotFourOrMore()) { return getHWND0(window); } else { try { Object drawingSurfaceInfo; int hwnd = 0; // Get the drawing surface // drawingSurfaceInfo = // ((sun.awt.DrawingSurface) (window.getPeer())).getDrawingSurfaceInfo(); drawingSurfaceInfo = Class.forName("sun.awt.DrawingSurface"). getMethod("getDrawingSurfaceInfo", null). invoke(window.getPeer(), null); if (null != drawingSurfaceInfo) { // drawingSurfaceInfo.lock(); AccessUtils.invoke(drawingSurfaceInfo, "lock", null, null); // Get the Win32 specific information // win32DrawingSurface = // (sun.awt.Win32DrawingSurface) drawingSurfaceInfo.getSurface(); Object win32DrawingSurface = AccessUtils.invoke(drawingSurfaceInfo, "getSurface", null, null); // hwnd = win32DrawingSurface.getHWnd(); hwnd = AccessUtils.getAsInt(win32DrawingSurface, "getHWnd"); // drawingSurfaceInfo.unlock(); AccessUtils.invoke(drawingSurfaceInfo, "unlock", null, null); } return hwnd; } catch (Throwable throwable) { throwable.printStackTrace(); throw new Error(throwable); } } } /** * Get the Windows handle of window using native code. * * @param window a Window value * @return an int value */ private native static int getHWND0(Window window); private native static void setWindowTransparency0(int hwnd, int transparency); /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ private native static long createEllipticRegion0(int x1, int y1, int x2, int y2); /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ private native static long createRectangleRegion0(int x1, int y1, int x2, int y2); /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @param x3 Description of Parameter * @param y3 Description of Parameter * @return Description of the Returned Value */ private native static long createRoundRectangleRegion0(int x1, int y1, int x2, int y2, int x3, int y3); /** * Description of the Method * * @param xpoints Description of Parameter * @param ypoints Description of Parameter * @param fillMode Description of Parameter * @return Description of the Returned Value */ private native static long createPolygonRegion0(int[] xpoints, int[] ypoints, int fillMode); /** * Description of the Method * * @param region1 Description of Parameter * @param region2 Description of Parameter * @param combineMode Description of Parameter * @return Description of the Returned Value */ private native static long combineRegions0(long region1, long region2, int combineMode); /** * Description of the Method * * @param pixels Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @return Description of the Returned Value */ private native static long createRegion0(int[] pixels, int width, int height); private native static void setAlwaysOnTop0(int handle, boolean enable); } skinlf-6.7/src/com/l2fprod/gui/nativeskin/win32/Win32Region.java0000644000175000017500000000573010460410014024334 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.nativeskin.win32; import com.l2fprod.gui.region.Region; /** * Created on 21/12/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:45:10 $ */ final class Win32Region extends Region { long nativeHandle; /** * Constructor for the Win32Region object */ Win32Region() { super(); } /** * Constructor for the Win32Region object * * @param nativeHandle Description of Parameter */ Win32Region(long nativeHandle) { this.nativeHandle = nativeHandle; } } skinlf-6.7/src/com/l2fprod/gui/nativeskin/x11/0000755000175000017500000000000010460410034021067 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/nativeskin/x11/X11NativeSkin.java0000644000175000017500000001114010460410014024272 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.nativeskin.x11; import java.awt.*; import com.l2fprod.gui.region.*; import com.l2fprod.gui.nativeskin.NativeSkin; /** * X11 Implementation.
* * * @author Herve Lemaitre * @created 27 avril 2002 * @version $Revision: 1.2 $ */ public final class X11NativeSkin extends NativeSkin { /** * Sets the WindowRegion attribute of the X11NativeSkin object * * @param window The new WindowRegion value * @param region The new WindowRegion value * @param redraw The new WindowRegion value */ public void setWindowRegion(Window window, Region region, boolean redraw) { /* * if (region instanceof ImageRegion) { * / grab pixel of the image * int width = ((ImageRegion)region).getImage().getWidth(null); * int height = ((ImageRegion)region).getImage().getHeight(null); * int[] pixels = new int[width * height]; * PixelGrabber pg = new PixelGrabber(((ImageRegion)region).getImage(), 0, 0, width, height, * pixels, 0, width); * try { * pg.grabPixels(); * } catch (InterruptedException e) { * System.err.println("interrupted waiting for pixels!"); * e.printStackTrace(); * } * / Get the drawing surface * DrawingSurfaceInfo drawingSurfaceInfo = * ((DrawingSurface)(window.getPeer())).getDrawingSurfaceInfo(); * if (drawingSurfaceInfo != null) { * drawingSurfaceInfo.lock(); * X11DrawingSurface x11DrawingSurface = * (X11DrawingSurface)drawingSurfaceInfo.getSurface(); * setWindowRegion0(x11DrawingSurface.getDisplay(), * x11DrawingSurface.getDrawable(), * pixels, * width, * height); * drawingSurfaceInfo.unlock(); * } * } */ } /** * Sets the WindowRegion0 attribute of the X11NativeSkin class * * @param display The new WindowRegion0 value * @param drawable The new WindowRegion0 value * @param pixels The new WindowRegion0 value * @param width The new WindowRegion0 value * @param height The new WindowRegion0 value */ private native static void setWindowRegion0(int display, int drawable, int[] pixels, int width, int height); } // end class Region skinlf-6.7/src/com/l2fprod/gui/nativeskin/NativeConstants.java0000644000175000017500000000632610460410014024451 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.nativeskin; /** * .
* * *

Copyright 2000-2002 by Castify Networks * * @author Frederic Lavigne */ public interface NativeConstants { public final static String VERSION = "6.7"; /** * Description of the Field */ public final static int REGION_AND = 1; /** * Description of the Field */ public final static int REGION_COPY = 5; /** * Description of the Field */ public final static int REGION_DIFF = 4; /** * Description of the Field */ public final static int REGION_OR = 2; /** * Description of the Field */ public final static int REGION_XOR = 3; /** * Description of the Field */ public final static int FILL_ALTERNATE = 1; /** * Description of the Field */ public final static int FILL_WINDING = 2; } skinlf-6.7/src/com/l2fprod/gui/nativeskin/NativeSkin.java0000644000175000017500000002013310460410014023371 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.nativeskin; import java.awt.Window; import java.awt.Image; import com.l2fprod.gui.region.Region; import com.l2fprod.gui.region.ImageRegion; import com.l2fprod.util.OS; /** * NativeSkin.
* SkinLF got native. This class offers methods to help developers * build Skinnable applications. */ public abstract class NativeSkin { private static NativeSkin theInstance; /** * Return true if NativeSkin is supported on this platform. * * @return true if NativeSkin is supported on this platform. */ public static boolean isSupported() { return OS.isWindows(); } /** * Get the instance of the NativeSkin for this platform. * * @return a NativeSkin value */ public static NativeSkin getInstance() { if (theInstance == null) { String impl = null; String library = null; if (OS.isOneDotFourOrMore()) { if (OS.isWindows()) { impl = "com.l2fprod.gui.nativeskin.win32.Win32NativeSkin"; library = "nativeskinwin32JAWT"; } } /* NOT YET COMPILED if (OS.isUnix()) { impl = "com.l2fprod.gui.nativeskin.x11.X11NativeSkin"; if (OS.isSolaris()) { library = "nativeskinsolaris"; } else if (OS.isLinux()) { library = "nativeskinlinux"; } } */ if (library == null) { throw new Error("NativeSkin is not yet available for your platform: " + System.getProperty("os.name")); } try { System.loadLibrary(library); theInstance = (NativeSkin) Class.forName(impl).newInstance(); } catch (Throwable th) { th.printStackTrace(); throw new Error("Error while loading the SkinRegion library: " + th.getMessage()); } } return theInstance; } /** * Set the transparency of the given Window. * * @param window a Window value * @param transparency an int value */ public void setWindowTransparency(Window window, int transparency) { throw new Error("Not Implemented"); } /** * Sets the WindowRegion attribute of the RegionBuilder object * * @param window The new WindowRegion value * @param region The new WindowRegion value * @param redraw The new WindowRegion value */ public void setWindowRegion(Window window, Region region, boolean redraw) { throw new Error("Not Implemented"); } /** * Sets the Region for the graphical object identified by * the given native handle. This method may be used with * environment such as Eclipse/SWT where it is easy * to get the native handle of any "Shell" object as it is * a public member variable. * * @param handle an int value * @param region a Region value * @param redraw a boolean value */ public void setWindowRegion(int handle, Region region, boolean redraw) { throw new Error("Not Implemented"); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ public Region createEllipticRegion(int x1, int y1, int x2, int y2) { throw new Error("Not Implemented"); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ public Region createRectangleRegion(int x1, int y1, int x2, int y2) { throw new Error("Not Implemented"); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @param x3 Description of Parameter * @param y3 Description of Parameter * @return Description of the Returned Value */ public Region createRoundRectangleRegion(int x1, int y1, int x2, int y2, int x3, int y3) { throw new Error("Not Implemented"); } /** * Description of the Method * * @param xpoints Description of Parameter * @param ypoints Description of Parameter * @param fillMode Description of Parameter * @return Description of the Returned Value */ public Region createPolygonRegion(int[] xpoints, int[] ypoints, int fillMode) { throw new Error("Not Implemented"); } /** * Description of the Method * * @param region1 Description of Parameter * @param region2 Description of Parameter * @param combineMode Description of Parameter * @return Description of the Returned Value */ public Region combineRegions(Region region1, Region region2, int combineMode) { throw new Error("Not Implemented"); } /** * Description of the Method * * @param image Description of Parameter * @return Description of the Returned Value */ public Region createRegion(Image image) { return createRegion(image, image.getWidth(null), image.getHeight(null)); } /** * Description of the Method * * @param image Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @return Description of the Returned Value */ public Region createRegion(Image image, int width, int height) { return new ImageRegion(image, width, height); } /** * Set the window to be always on top of the others. * * @param window a Window value * @param enable true to put window on top, false to restore the default behaviour */ public void setAlwaysOnTop(Window window, boolean enable) { throw new Error("Not Implemented"); } } skinlf-6.7/src/com/l2fprod/gui/plaf/0000755000175000017500000000000010460410034017225 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/skin/0000755000175000017500000000000010460410034020171 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/0000755000175000017500000000000010460410034021132 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/0000755000175000017500000000000010460410034021717 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/parser/0000755000175000017500000000000010460410034023213 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/parser/ASCII_UCodeESC_CharStream.java0000644000175000017500000003637710460410014030447 0ustar twernertwerner/* Generated By:JavaCC: Do not edit this line. ASCII_UCodeESC_CharStream.java Version 0.7pre6 */ /* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk.parser; /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (with java-like unicode escape processing). */ public final class ASCII_UCodeESC_CharStream { public static final boolean staticFlag = false; static final int hexval(char c) throws java.io.IOException { switch(c) { case '0' : return 0; case '1' : return 1; case '2' : return 2; case '3' : return 3; case '4' : return 4; case '5' : return 5; case '6' : return 6; case '7' : return 7; case '8' : return 8; case '9' : return 9; case 'a' : case 'A' : return 10; case 'b' : case 'B' : return 11; case 'c' : case 'C' : return 12; case 'd' : case 'D' : return 13; case 'e' : case 'E' : return 14; case 'f' : case 'F' : return 15; } throw new java.io.IOException(); // Should never come here } public int bufpos = -1; int bufsize; int available; int tokenBegin; private int bufline[]; private int bufcolumn[]; private int column = 0; private int line = 1; private java.io.Reader inputStream; private boolean prevCharIsCR = false; private boolean prevCharIsLF = false; private char[] nextCharBuf; private char[] buffer; private int maxNextCharInd = 0; private int nextCharInd = -1; private int inBuf = 0; private final void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; bufpos += (bufsize - tokenBegin); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; bufpos -= tokenBegin; } } catch (Throwable t) { throw new Error(t.getMessage()); } available = (bufsize += 2048); tokenBegin = 0; } private final void FillBuff() throws java.io.IOException { int i; if (maxNextCharInd == 4096) maxNextCharInd = nextCharInd = 0; try { if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { if (bufpos != 0) { --bufpos; backup(0); } else { bufline[bufpos] = line; bufcolumn[bufpos] = column; } throw e; } } private final char ReadByte() throws java.io.IOException { if (++nextCharInd >= maxNextCharInd) FillBuff(); return nextCharBuf[nextCharInd]; } public final char BeginToken() throws java.io.IOException { if (inBuf > 0) { --inBuf; return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]; } tokenBegin = 0; bufpos = -1; return readChar(); } private final void AdjustBuffSize() { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = 0; available = tokenBegin; } else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } private final void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (8 - (column & 07)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } public final char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]; } char c; if (++bufpos == available) AdjustBuffSize(); if (((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) == '\\')) { UpdateLineColumn(c); int backSlashCnt = 1; for (;;) // Read all the backslashes { if (++bufpos == available) AdjustBuffSize(); try { if ((buffer[bufpos] = c = (char)((char)0xff & ReadByte())) != '\\') { UpdateLineColumn(c); // found a non-backslash char. if ((c == 'u') && ((backSlashCnt & 1) == 1)) { if (--bufpos < 0) bufpos = bufsize - 1; break; } backup(backSlashCnt); return '\\'; } } catch(java.io.IOException e) { if (backSlashCnt > 1) backup(backSlashCnt); return '\\'; } UpdateLineColumn(c); backSlashCnt++; } // Here, we have seen an odd number of backslash's followed by a 'u' try { while ((c = (char)((char)0xff & ReadByte())) == 'u') ++column; buffer[bufpos] = c = (char)(hexval(c) << 12 | hexval((char)((char)0xff & ReadByte())) << 8 | hexval((char)((char)0xff & ReadByte())) << 4 | hexval((char)((char)0xff & ReadByte()))); column += 4; } catch(java.io.IOException e) { throw new Error("Invalid escape character at line " + line + " column " + column + "."); } if (backSlashCnt == 1) return c; else { backup(backSlashCnt - 1); return '\\'; } } else { UpdateLineColumn(c); return (c); } } /** * @deprecated * @see #getEndColumn */ public final int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public final int getLine() { return bufline[bufpos]; } public final int getEndColumn() { return bufcolumn[bufpos]; } public final int getEndLine() { return bufline[bufpos]; } public final int getBeginColumn() { return bufcolumn[tokenBegin]; } public final int getBeginLine() { return bufline[tokenBegin]; } public final void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } public ASCII_UCodeESC_CharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; nextCharBuf = new char[4096]; } public ASCII_UCodeESC_CharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; nextCharBuf = new char[4096]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; nextCharInd = bufpos = -1; } public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public ASCII_UCodeESC_CharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public final String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } public final char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } public void Done() { nextCharBuf = null; buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token.
*/ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/parser/GtkParser.java0000644000175000017500000005164010460410012025762 0ustar twernertwerner/* Generated By:JavaCC: Do not edit this line. GtkParser.java */ /* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk.parser; import java.io.File; import java.io.FileInputStream; import java.net.URL; import java.util.Hashtable; import java.util.Enumeration; import com.l2fprod.gui.plaf.skin.impl.gtk.*; import com.l2fprod.gui.plaf.skin.*; public class GtkParser implements GtkParserConstants { Hashtable styleTable, classTable; URL directory; public static void main(String[] args) throws Exception { GtkParser parser = new GtkParser(new FileInputStream(args[0])); parser.buildStructure(); } public GtkParser(String filename) throws Exception { this(new File(filename)); } public GtkParser(File file) throws Exception { this(SkinUtils.toURL(file)); } public GtkParser(URL url) throws Exception { this(url.openStream()); directory = url; /* String urlpath = url.toString(); int index = urlpath.lastIndexOf("/"); if (index != -1) directory = new URL(urlpath.substring(0, index) + "/"); else directory = new URL(urlpath + "/../"); */ //PENDING(fred): we could use directly the URL given because it could act as an url context... // need testing... } public URL getDirectory() { return directory; } /** * Sets the Directory attribute of the GtkParser object * * @param dir The new Directory value */ public void setDirectory(URL dir) { directory = dir; } public Hashtable getStyles() { return styleTable; } public Hashtable getClasses() { return classTable; } public GtkStyle getStyle(String name) { return (GtkStyle)getStyles().get(name); } public GtkClass getClass(String name) { return (GtkClass)getClasses().get(name); } final public void buildStructure() throws ParseException { styleTable = new Hashtable(); classTable = new Hashtable(); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STYLE: case CLASS: case OTHER_TOKEN: case WIDGET_CLASS: case WIDGET: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STYLE: styleDefinition(); break; case CLASS: classDefinition(); break; case OTHER_TOKEN: whatever(); break; case WIDGET_CLASS: widgetClassDefinition(); break; case WIDGET: widgetDefinition(); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } for (Enumeration e = getClasses().keys(); e.hasMoreElements(); ) { Object key = e.nextElement(); GtkClass clas = (GtkClass)getClasses().get(key); for (int i = 0, c = clas.styles.size(); i < c; i++) clas.styles.set(i, (GtkStyle)getStyles().get(clas.styles.get(i))); } } final public void whatever() throws ParseException { jj_consume_token(OTHER_TOKEN); readString(); } final public void widgetClassDefinition() throws ParseException { jj_consume_token(WIDGET_CLASS); readString(); jj_consume_token(STYLE); readString(); } final public void widgetDefinition() throws ParseException { jj_consume_token(WIDGET); readString(); jj_consume_token(STYLE); readString(); } final public void styleDefinition() throws ParseException { GtkStyle style = new GtkStyle(); style.parser = this; Token property, state = null; String value = null; jj_consume_token(STYLE); style.name = readString(); jj_consume_token(LBRACK); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FONT: ; break; default: jj_la1[2] = jj_gen; break label_2; } jj_consume_token(FONT); jj_consume_token(ASSIGN); readString(); } label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EXTRA: ; break; default: jj_la1[3] = jj_gen; break label_3; } property = jj_consume_token(EXTRA); jj_consume_token(LCROC); state = jj_consume_token(STATE_TYPE); jj_consume_token(RCROC); jj_consume_token(ASSIGN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING_LITERAL: value = readString(); break; case LBRACK: jj_consume_token(LBRACK); value="{"; value = value + readFloat() + ","; jj_consume_token(COMMA); value = value + readFloat() + ","; jj_consume_token(COMMA); value = value + readFloat(); value += "}"; jj_consume_token(RBRACK); break; default: jj_la1[4] = jj_gen; jj_consume_token(-1); throw new ParseException(); } style.setProperty(property.image + "[" + state + "]", value); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ENGINE: jj_consume_token(ENGINE); readString(); jj_consume_token(LBRACK); GtkEngine engine = new GtkEngine(); style.engine = engine; engine.style = style; label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IMAGE: ; break; default: jj_la1[5] = jj_gen; break label_4; } imageDefinition(engine); } jj_consume_token(RBRACK); break; default: jj_la1[6] = jj_gen; ; } jj_consume_token(RBRACK); styleTable.put(style.name, style); } final public void imageDefinition(GtkEngine engine) throws ParseException { GtkImage image = new GtkImage(); Token property = null; Token value = null; jj_consume_token(IMAGE); jj_consume_token(LBRACK); label_5: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FUNCTION: property = jj_consume_token(FUNCTION); jj_consume_token(ASSIGN); value = jj_consume_token(FUNCTION_TYPE); image.setProperty(property.image, value.image); break; case RECOLORABLE: property = jj_consume_token(RECOLORABLE); jj_consume_token(ASSIGN); value = jj_consume_token(BOOLEAN); image.setProperty(property.image, value.image); break; case STATE: property = jj_consume_token(STATE); jj_consume_token(ASSIGN); value = jj_consume_token(STATE_TYPE); image.setProperty(property.image, value.image); break; case DETAIL: property = jj_consume_token(DETAIL); jj_consume_token(ASSIGN); image.setProperty(property.image, readString()); break; case FILE: property = jj_consume_token(FILE); jj_consume_token(ASSIGN); image.setProperty(property.image, readString()); break; case BORDER: property = jj_consume_token(BORDER); jj_consume_token(ASSIGN); image.setProperty(property.image, borderDefinition()); break; case STRETCH: property = jj_consume_token(STRETCH); jj_consume_token(ASSIGN); value = jj_consume_token(BOOLEAN); image.setProperty(property.image, value.image); break; case OVERLAY_FILE: property = jj_consume_token(OVERLAY_FILE); jj_consume_token(ASSIGN); image.setProperty(property.image, readString()); break; case OVERLAY_BORDER: property = jj_consume_token(OVERLAY_BORDER); jj_consume_token(ASSIGN); image.setProperty(property.image, borderDefinition()); break; case OVERLAY_STRETCH: property = jj_consume_token(OVERLAY_STRETCH); jj_consume_token(ASSIGN); value = jj_consume_token(BOOLEAN); image.setProperty(property.image, value.image); break; case SHADOW: property = jj_consume_token(SHADOW); jj_consume_token(ASSIGN); value = jj_consume_token(SHADOW_TYPE); image.setProperty(property.image, value.image); break; case GAP_START_FILE: property = jj_consume_token(GAP_START_FILE); jj_consume_token(ASSIGN); image.setProperty(property.image, readString()); break; case GAP_START_BORDER: property = jj_consume_token(GAP_START_BORDER); jj_consume_token(ASSIGN); image.setProperty(property.image, borderDefinition()); break; case GAP_END_FILE: property = jj_consume_token(GAP_END_FILE); jj_consume_token(ASSIGN); image.setProperty(property.image, readString()); break; case GAP_END_BORDER: property = jj_consume_token(GAP_END_BORDER); jj_consume_token(ASSIGN); image.setProperty(property.image, borderDefinition()); break; case GAP_SIDE: property = jj_consume_token(GAP_SIDE); jj_consume_token(ASSIGN); value = jj_consume_token(DIRECTION); image.setProperty(property.image, value.image); break; case GAP_FILE: property = jj_consume_token(GAP_FILE); jj_consume_token(ASSIGN); image.setProperty(property.image, readString()); break; case GAP_BORDER: property = jj_consume_token(GAP_BORDER); jj_consume_token(ASSIGN); image.setProperty(property.image, borderDefinition()); break; case ORIENTATION: property = jj_consume_token(ORIENTATION); jj_consume_token(ASSIGN); value = jj_consume_token(ORIENTATION_TYPE); image.setProperty(property.image, value.image); break; case ARROW_DIRECTION: property = jj_consume_token(ARROW_DIRECTION); jj_consume_token(ASSIGN); value = jj_consume_token(DIRECTION); image.setProperty(property.image, value.image); break; case PROPERTY_KEY: property = jj_consume_token(PROPERTY_KEY); jj_consume_token(ASSIGN); image.setProperty(property.image, readString()); break; default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FUNCTION: case RECOLORABLE: case FILE: case BORDER: case STRETCH: case SHADOW: case STATE: case DETAIL: case GAP_SIDE: case GAP_FILE: case GAP_BORDER: case GAP_START_FILE: case GAP_START_BORDER: case GAP_END_FILE: case GAP_END_BORDER: case OVERLAY_FILE: case OVERLAY_BORDER: case OVERLAY_STRETCH: case ORIENTATION: case ARROW_DIRECTION: case PROPERTY_KEY: ; break; default: jj_la1[8] = jj_gen; break label_5; } } jj_consume_token(RBRACK); engine.addImage(image); } final public GtkBorder borderDefinition() throws ParseException { GtkBorder border = new GtkBorder(); Token tok = null; jj_consume_token(LBRACK); tok = jj_consume_token(DECIMAL_LITERAL); border.left = Integer.parseInt(tok.image); jj_consume_token(COMMA); tok = jj_consume_token(DECIMAL_LITERAL); border.right = Integer.parseInt(tok.image); jj_consume_token(COMMA); tok = jj_consume_token(DECIMAL_LITERAL); border.top = Integer.parseInt(tok.image); jj_consume_token(COMMA); tok = jj_consume_token(DECIMAL_LITERAL); border.bottom = Integer.parseInt(tok.image); jj_consume_token(RBRACK); {if (true) return border;} throw new Error("Missing return statement in function"); } final public void classDefinition() throws ParseException { GtkClass clas; jj_consume_token(CLASS); String name = readString(); clas = (GtkClass)classTable.get(name); if (clas == null) { clas = new GtkClass(); clas.setName(name); classTable.put(clas.name, clas); } jj_consume_token(STYLE); clas.addStyleName(readString()); } final public String readString() throws ParseException { String value = null; Token toks = null; toks = jj_consume_token(STRING_LITERAL); value = new String(); for (int i=1; i < toks.image.length()-1; i++) { if (toks.image.charAt(i) == '\\') { if ((toks.image.charAt(i+1) == '\\') || (toks.image.charAt(i+1) == '"')) { i++; } } value = value + toks.image.charAt(i); } {if (true) return(value);} throw new Error("Missing return statement in function"); } final public float readFloat() throws ParseException { Token toks = null; toks = jj_consume_token(DECIMAL_LITERAL); {if (true) return Float.valueOf(token.image).floatValue();} throw new Error("Missing return statement in function"); } public GtkParserTokenManager token_source; ASCII_UCodeESC_CharStream jj_input_stream; public Token token, jj_nt; private int jj_ntk; private int jj_gen; final private int[] jj_la1 = new int[9]; final private int[] jj_la1_0 = {0xc0000,0xc0000,0x20000,0x10000,0x4000,0x200000,0x100000,0xffc00000,0xffc00000,}; final private int[] jj_la1_1 = {0xe00000,0xe00000,0x0,0x0,0x20000,0x0,0x0,0x10003ff,0x10003ff,}; public GtkParser(java.io.InputStream stream) { jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1); token_source = new GtkParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 9; i++) jj_la1[i] = -1; } public void ReInit(java.io.InputStream stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 9; i++) jj_la1[i] = -1; } public GtkParser(java.io.Reader stream) { jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1); token_source = new GtkParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 9; i++) jj_la1[i] = -1; } public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 9; i++) jj_la1[i] = -1; } public GtkParser(GtkParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 9; i++) jj_la1[i] = -1; } public void ReInit(GtkParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 9; i++) jj_la1[i] = -1; } final private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } final private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private java.util.Vector jj_expentries = new java.util.Vector(); private int[] jj_expentry; private int jj_kind = -1; final public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[57]; for (int i = 0; i < 57; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 9; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<", "\" \"", "\"\\t\"", "\"\\n\"", "\"\\r\"", "\"\\f\"", "\"#\"", "", "\"/*\"", "", "\"*/\"", "\"*/\"", "", "", "", "", "", "\"font\"", "\"style\"", "\"class\"", "\"engine\"", "\"image\"", "\"function\"", "\"recolorable\"", "\"file\"", "\"border\"", "\"stretch\"", "\"shadow\"", "\"state\"", "\"detail\"", "\"gap_side\"", "\"gap_file\"", "\"gap_border\"", "\"gap_start_file\"", "\"gap_start_border\"", "\"gap_end_file\"", "\"gap_end_border\"", "\"overlay_file\"", "\"overlay_border\"", "\"overlay_stretch\"", "\"orientation\"", "\"arrow_direction\"", "", "", "", "", "", "\"[\"", "\"]\"", "\"{\"", "\"}\"", "\"=\"", "\",\"", "", "\"widget_class\"", "\"widget\"", "", }; } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/parser/GtkParserTokenManager.java0000644000175000017500000024772210460410014030270 0ustar twernertwerner/* Generated By:JavaCC: Do not edit this line. GtkParserTokenManager.java */ /* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk.parser; public class GtkParserTokenManager implements GtkParserConstants { private final int jjStopStringLiteralDfa_0(int pos, long active0) { switch (pos) { case 0: if ((active0 & 0x200000L) != 0L) { jjmatchedKind = 56; return 71; } if ((active0 & 0x100L) != 0L) return 2; if ((active0 & 0x1420000L) != 0L) { jjmatchedKind = 56; return 243; } if ((active0 & 0x2000000L) != 0L) { jjmatchedKind = 56; return 92; } if ((active0 & 0xc003fffc9c0000L) != 0L) { jjmatchedKind = 56; return 83; } return -1; case 1: if ((active0 & 0x100L) != 0L) return 0; if ((active0 & 0xc003fffffe0000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 1; return 83; } return -1; case 2: if ((active0 & 0xc003fffffe0000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 2; return 83; } return -1; case 3: if ((active0 & 0x1020000L) != 0L) return 83; if ((active0 & 0x1fc0000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } if ((active0 & 0xc003e03efc0000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 3; return 83; } return -1; case 4: if ((active0 & 0x102c0000L) != 0L) return 83; if ((active0 & 0x1fc0000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } if ((active0 & 0xc003e02ed00000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 4; return 83; } return -1; case 5: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xc000002a100000L) != 0L) return 83; if ((active0 & 0x1fc0000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } if ((active0 & 0x1e004c00000L) != 0L) { if (jjmatchedPos != 5) { jjmatchedKind = 56; jjmatchedPos = 5; } return 83; } return -1; case 6: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0x4000000L) != 0L) return 83; if ((active0 & 0x1fc0000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } if ((active0 & 0x1e000c00000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 6; return 83; } return -1; case 7: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xe000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x400000L) != 0L) return 83; if ((active0 & 0x1fc0000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } if ((active0 & 0x10000800000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 7; return 83; } return -1; case 8: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xe000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x1f00000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } if ((active0 & 0x10000800000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 8; return 83; } return -1; case 9: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xe000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x1f00000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } if ((active0 & 0x10000800000L) != 0L) { jjmatchedKind = 56; jjmatchedPos = 9; return 83; } return -1; case 10: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xe000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x10000800000L) != 0L) return 83; if ((active0 & 0x1e00000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } return -1; case 11: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xe000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x1e00000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } return -1; case 12: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xc000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x1600000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } return -1; case 13: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0xc000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x1600000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } return -1; case 14: if ((active0 & 0x20000000000L) != 0L) { if (jjmatchedPos < 4) { jjmatchedKind = 56; jjmatchedPos = 4; } return -1; } if ((active0 & 0x8000000000L) != 0L) { if (jjmatchedPos < 6) { jjmatchedKind = 56; jjmatchedPos = 6; } return -1; } if ((active0 & 0x400000000L) != 0L) { if (jjmatchedPos < 2) { jjmatchedKind = 56; jjmatchedPos = 2; } return -1; } return -1; default : return -1; } } private final int jjStartNfa_0(int pos, long active0) { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } private final int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } private final int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } private final int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 35: return jjStopAtPos(0, 6); case 44: return jjStopAtPos(0, 52); case 47: return jjMoveStringLiteralDfa1_0(0x100L); case 61: return jjStopAtPos(0, 51); case 91: return jjStopAtPos(0, 47); case 93: return jjStopAtPos(0, 48); case 97: return jjMoveStringLiteralDfa1_0(0x20000000000L); case 98: return jjMoveStringLiteralDfa1_0(0x2000000L); case 99: return jjMoveStringLiteralDfa1_0(0x80000L); case 100: return jjMoveStringLiteralDfa1_0(0x20000000L); case 101: return jjMoveStringLiteralDfa1_0(0x100000L); case 102: return jjMoveStringLiteralDfa1_0(0x1420000L); case 103: return jjMoveStringLiteralDfa1_0(0x1fc0000000L); case 105: return jjMoveStringLiteralDfa1_0(0x200000L); case 111: return jjMoveStringLiteralDfa1_0(0x1e000000000L); case 114: return jjMoveStringLiteralDfa1_0(0x800000L); case 115: return jjMoveStringLiteralDfa1_0(0x1c040000L); case 119: return jjMoveStringLiteralDfa1_0(0xc0000000000000L); case 123: return jjStopAtPos(0, 49); case 125: return jjStopAtPos(0, 50); default : return jjMoveNfa_0(3, 0); } } private final int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch(curChar) { case 42: if ((active0 & 0x100L) != 0L) return jjStartNfaWithStates_0(1, 8, 0); break; case 97: return jjMoveStringLiteralDfa2_0(active0, 0x1fc0000000L); case 101: return jjMoveStringLiteralDfa2_0(active0, 0x20800000L); case 104: return jjMoveStringLiteralDfa2_0(active0, 0x8000000L); case 105: return jjMoveStringLiteralDfa2_0(active0, 0xc0000001000000L); case 108: return jjMoveStringLiteralDfa2_0(active0, 0x80000L); case 109: return jjMoveStringLiteralDfa2_0(active0, 0x200000L); case 110: return jjMoveStringLiteralDfa2_0(active0, 0x100000L); case 111: return jjMoveStringLiteralDfa2_0(active0, 0x2020000L); case 114: return jjMoveStringLiteralDfa2_0(active0, 0x30000000000L); case 116: return jjMoveStringLiteralDfa2_0(active0, 0x14040000L); case 117: return jjMoveStringLiteralDfa2_0(active0, 0x400000L); case 118: return jjMoveStringLiteralDfa2_0(active0, 0xe000000000L); default : break; } return jjStartNfa_0(0, active0); } private final int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); return 2; } switch(curChar) { case 97: return jjMoveStringLiteralDfa3_0(active0, 0x18280000L); case 99: return jjMoveStringLiteralDfa3_0(active0, 0x800000L); case 100: return jjMoveStringLiteralDfa3_0(active0, 0xc0000000000000L); case 101: return jjMoveStringLiteralDfa3_0(active0, 0xe000000000L); case 103: return jjMoveStringLiteralDfa3_0(active0, 0x100000L); case 105: return jjMoveStringLiteralDfa3_0(active0, 0x10000000000L); case 108: return jjMoveStringLiteralDfa3_0(active0, 0x1000000L); case 110: return jjMoveStringLiteralDfa3_0(active0, 0x420000L); case 112: return jjMoveStringLiteralDfa3_0(active0, 0x1fc0000000L); case 114: return jjMoveStringLiteralDfa3_0(active0, 0x20006000000L); case 116: return jjMoveStringLiteralDfa3_0(active0, 0x20000000L); case 121: return jjMoveStringLiteralDfa3_0(active0, 0x40000L); default : break; } return jjStartNfa_0(1, active0); } private final int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); return 3; } switch(curChar) { case 95: return jjMoveStringLiteralDfa4_0(active0, 0x1fc0000000L); case 97: return jjMoveStringLiteralDfa4_0(active0, 0x20000000L); case 99: return jjMoveStringLiteralDfa4_0(active0, 0x400000L); case 100: return jjMoveStringLiteralDfa4_0(active0, 0xa000000L); case 101: if ((active0 & 0x1000000L) != 0L) return jjStartNfaWithStates_0(3, 24, 83); return jjMoveStringLiteralDfa4_0(active0, 0x10004000000L); case 103: return jjMoveStringLiteralDfa4_0(active0, 0xc0000000200000L); case 105: return jjMoveStringLiteralDfa4_0(active0, 0x100000L); case 108: return jjMoveStringLiteralDfa4_0(active0, 0x40000L); case 111: return jjMoveStringLiteralDfa4_0(active0, 0x20000800000L); case 114: return jjMoveStringLiteralDfa4_0(active0, 0xe000000000L); case 115: return jjMoveStringLiteralDfa4_0(active0, 0x80000L); case 116: if ((active0 & 0x20000L) != 0L) return jjStartNfaWithStates_0(3, 17, 83); return jjMoveStringLiteralDfa4_0(active0, 0x10000000L); default : break; } return jjStartNfa_0(2, active0); } private final int jjMoveStringLiteralDfa4_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); return 4; } switch(curChar) { case 98: return jjMoveStringLiteralDfa5_0(active0, 0x100000000L); case 101: if ((active0 & 0x40000L) != 0L) return jjStartNfaWithStates_0(4, 18, 83); else if ((active0 & 0x200000L) != 0L) return jjStartNfaWithStates_0(4, 21, 83); else if ((active0 & 0x10000000L) != 0L) return jjStartNfaWithStates_0(4, 28, 83); return jjMoveStringLiteralDfa5_0(active0, 0xc0001802000000L); case 102: return jjMoveStringLiteralDfa5_0(active0, 0x80000000L); case 105: return jjMoveStringLiteralDfa5_0(active0, 0x20000000L); case 108: return jjMoveStringLiteralDfa5_0(active0, 0xe000800000L); case 110: return jjMoveStringLiteralDfa5_0(active0, 0x10000100000L); case 111: return jjMoveStringLiteralDfa5_0(active0, 0x8000000L); case 115: if ((active0 & 0x80000L) != 0L) return jjStartNfaWithStates_0(4, 19, 83); return jjMoveStringLiteralDfa5_0(active0, 0x640000000L); case 116: return jjMoveStringLiteralDfa5_0(active0, 0x4400000L); case 119: return jjMoveStringLiteralDfa5_0(active0, 0x20000000000L); default : break; } return jjStartNfa_0(3, active0); } private final int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch(curChar) { case 95: return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L); case 97: return jjMoveStringLiteralDfa6_0(active0, 0xe000000000L); case 99: return jjMoveStringLiteralDfa6_0(active0, 0x4000000L); case 101: if ((active0 & 0x100000L) != 0L) return jjStartNfaWithStates_0(5, 20, 83); break; case 105: return jjMoveStringLiteralDfa6_0(active0, 0xc0400000L); case 108: if ((active0 & 0x20000000L) != 0L) return jjStartNfaWithStates_0(5, 29, 83); break; case 110: return jjMoveStringLiteralDfa6_0(active0, 0x1800000000L); case 111: return jjMoveStringLiteralDfa6_0(active0, 0x100800000L); case 114: if ((active0 & 0x2000000L) != 0L) return jjStartNfaWithStates_0(5, 25, 83); break; case 116: if ((active0 & 0x80000000000000L) != 0L) { jjmatchedKind = 55; jjmatchedPos = 5; } return jjMoveStringLiteralDfa6_0(active0, 0x40010600000000L); case 119: if ((active0 & 0x8000000L) != 0L) return jjStartNfaWithStates_0(5, 27, 83); break; default : break; } return jjStartNfa_0(4, active0); } private final int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); return 6; } switch(curChar) { case 95: return jjMoveStringLiteralDfa7_0(active0, 0x40000000000000L); case 97: return jjMoveStringLiteralDfa7_0(active0, 0x10600000000L); case 100: return jjMoveStringLiteralDfa7_0(active0, 0x21840000000L); case 104: if ((active0 & 0x4000000L) != 0L) return jjStartNfaWithStates_0(6, 26, 83); break; case 108: return jjMoveStringLiteralDfa7_0(active0, 0x80000000L); case 111: return jjMoveStringLiteralDfa7_0(active0, 0x400000L); case 114: return jjMoveStringLiteralDfa7_0(active0, 0x100800000L); case 121: return jjMoveStringLiteralDfa7_0(active0, 0xe000000000L); default : break; } return jjStartNfa_0(5, active0); } private final int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0); return 7; } switch(curChar) { case 95: return jjMoveStringLiteralDfa8_0(active0, 0xf800000000L); case 97: return jjMoveStringLiteralDfa8_0(active0, 0x800000L); case 99: return jjMoveStringLiteralDfa8_0(active0, 0x40000000000000L); case 100: return jjMoveStringLiteralDfa8_0(active0, 0x100000000L); case 101: if ((active0 & 0x40000000L) != 0L) return jjStopAtPos(7, 30); else if ((active0 & 0x80000000L) != 0L) return jjStopAtPos(7, 31); break; case 105: return jjMoveStringLiteralDfa8_0(active0, 0x20000000000L); case 110: if ((active0 & 0x400000L) != 0L) return jjStartNfaWithStates_0(7, 22, 83); break; case 114: return jjMoveStringLiteralDfa8_0(active0, 0x600000000L); case 116: return jjMoveStringLiteralDfa8_0(active0, 0x10000000000L); default : break; } return jjStartNfa_0(6, active0); } private final int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(6, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0); return 8; } switch(curChar) { case 98: return jjMoveStringLiteralDfa9_0(active0, 0x5000800000L); case 101: return jjMoveStringLiteralDfa9_0(active0, 0x100000000L); case 102: return jjMoveStringLiteralDfa9_0(active0, 0x2800000000L); case 105: return jjMoveStringLiteralDfa9_0(active0, 0x10000000000L); case 108: return jjMoveStringLiteralDfa9_0(active0, 0x40000000000000L); case 114: return jjMoveStringLiteralDfa9_0(active0, 0x20000000000L); case 115: return jjMoveStringLiteralDfa9_0(active0, 0x8000000000L); case 116: return jjMoveStringLiteralDfa9_0(active0, 0x600000000L); default : break; } return jjStartNfa_0(7, active0); } private final int jjMoveStringLiteralDfa9_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(7, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0); return 9; } switch(curChar) { case 95: return jjMoveStringLiteralDfa10_0(active0, 0x600000000L); case 97: return jjMoveStringLiteralDfa10_0(active0, 0x40000000000000L); case 101: return jjMoveStringLiteralDfa10_0(active0, 0x20000000000L); case 105: return jjMoveStringLiteralDfa10_0(active0, 0x2800000000L); case 108: return jjMoveStringLiteralDfa10_0(active0, 0x800000L); case 111: return jjMoveStringLiteralDfa10_0(active0, 0x15000000000L); case 114: if ((active0 & 0x100000000L) != 0L) return jjStopAtPos(9, 32); break; case 116: return jjMoveStringLiteralDfa10_0(active0, 0x8000000000L); default : break; } return jjStartNfa_0(8, active0); } private final int jjMoveStringLiteralDfa10_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(8, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(9, active0); return 10; } switch(curChar) { case 98: return jjMoveStringLiteralDfa11_0(active0, 0x400000000L); case 99: return jjMoveStringLiteralDfa11_0(active0, 0x20000000000L); case 101: if ((active0 & 0x800000L) != 0L) return jjStartNfaWithStates_0(10, 23, 83); break; case 102: return jjMoveStringLiteralDfa11_0(active0, 0x200000000L); case 108: return jjMoveStringLiteralDfa11_0(active0, 0x2800000000L); case 110: if ((active0 & 0x10000000000L) != 0L) return jjStartNfaWithStates_0(10, 40, 83); break; case 114: return jjMoveStringLiteralDfa11_0(active0, 0xd000000000L); case 115: return jjMoveStringLiteralDfa11_0(active0, 0x40000000000000L); default : break; } return jjStartNfa_0(9, active0); } private final int jjMoveStringLiteralDfa11_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(9, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(10, active0); return 11; } switch(curChar) { case 100: return jjMoveStringLiteralDfa12_0(active0, 0x5000000000L); case 101: if ((active0 & 0x800000000L) != 0L) return jjStopAtPos(11, 35); else if ((active0 & 0x2000000000L) != 0L) return jjStopAtPos(11, 37); return jjMoveStringLiteralDfa12_0(active0, 0x8000000000L); case 105: return jjMoveStringLiteralDfa12_0(active0, 0x200000000L); case 111: return jjMoveStringLiteralDfa12_0(active0, 0x400000000L); case 115: if ((active0 & 0x40000000000000L) != 0L) return jjStopAtPos(11, 54); break; case 116: return jjMoveStringLiteralDfa12_0(active0, 0x20000000000L); default : break; } return jjStartNfa_0(10, active0); } private final int jjMoveStringLiteralDfa12_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(10, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(11, active0); return 12; } switch(curChar) { case 101: return jjMoveStringLiteralDfa13_0(active0, 0x5000000000L); case 105: return jjMoveStringLiteralDfa13_0(active0, 0x20000000000L); case 108: return jjMoveStringLiteralDfa13_0(active0, 0x200000000L); case 114: return jjMoveStringLiteralDfa13_0(active0, 0x400000000L); case 116: return jjMoveStringLiteralDfa13_0(active0, 0x8000000000L); default : break; } return jjStartNfa_0(11, active0); } private final int jjMoveStringLiteralDfa13_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(11, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(12, active0); return 13; } switch(curChar) { case 99: return jjMoveStringLiteralDfa14_0(active0, 0x8000000000L); case 100: return jjMoveStringLiteralDfa14_0(active0, 0x400000000L); case 101: if ((active0 & 0x200000000L) != 0L) return jjStopAtPos(13, 33); break; case 111: return jjMoveStringLiteralDfa14_0(active0, 0x20000000000L); case 114: if ((active0 & 0x1000000000L) != 0L) return jjStopAtPos(13, 36); else if ((active0 & 0x4000000000L) != 0L) return jjStopAtPos(13, 38); break; default : break; } return jjStartNfa_0(12, active0); } private final int jjMoveStringLiteralDfa14_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(12, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(13, active0); return 14; } switch(curChar) { case 101: return jjMoveStringLiteralDfa15_0(active0, 0x400000000L); case 104: if ((active0 & 0x8000000000L) != 0L) return jjStopAtPos(14, 39); break; case 110: if ((active0 & 0x20000000000L) != 0L) return jjStopAtPos(14, 41); break; default : break; } return jjStartNfa_0(13, active0); } private final int jjMoveStringLiteralDfa15_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(13, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(14, active0); return 15; } switch(curChar) { case 114: if ((active0 & 0x400000000L) != 0L) return jjStopAtPos(15, 34); break; default : break; } return jjStartNfa_0(14, active0); } private final void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private final void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private final void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } private final void jjCheckNAddStates(int start, int end) { do { jjCheckNAdd(jjnextStates[start]); } while (start++ != end); } private final void jjCheckNAddStates(int start) { jjCheckNAdd(jjnextStates[start]); jjCheckNAdd(jjnextStates[start + 1]); } static final long[] jjbitVec0 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private final int jjMoveNfa_0(int startState, int curPos) { int[] nextStates; int startsAt = 0; jjnewStateCnt = 243; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; MatchLoop: do { switch(jjstateSet[--i]) { case 3: if ((0x3ff000000000000L & l) != 0L) { if (kind > 13) kind = 13; jjCheckNAddTwoStates(4, 5); } else if (curChar == 34) jjCheckNAddStates(0, 2); else if (curChar == 47) jjstateSet[jjnewStateCnt++] = 2; break; case 0: if (curChar == 42) jjstateSet[jjnewStateCnt++] = 1; break; case 1: if ((0xffff7fffffffffffL & l) != 0L && kind > 7) kind = 7; break; case 2: if (curChar == 42) jjstateSet[jjnewStateCnt++] = 0; break; case 4: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 13) kind = 13; jjCheckNAddTwoStates(4, 5); break; case 5: if (curChar == 46) jjCheckNAdd(6); break; case 6: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 13) kind = 13; jjCheckNAdd(6); break; case 7: if (curChar == 34) jjCheckNAddStates(0, 2); break; case 8: if ((0xfffffffbffffdbffL & l) != 0L) jjCheckNAddStates(0, 2); break; case 10: if ((0x8400000000L & l) != 0L) jjCheckNAddStates(0, 2); break; case 11: if (curChar == 34 && kind > 14) kind = 14; break; case 12: if ((0xff000000000000L & l) != 0L) jjCheckNAddStates(3, 6); break; case 13: if ((0xff000000000000L & l) != 0L) jjCheckNAddStates(0, 2); break; case 14: if ((0xf000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 15; break; case 15: if ((0xff000000000000L & l) != 0L) jjCheckNAdd(13); break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { case 92: if ((0x7fffffe00000000L & l) != 0L) { if (kind > 56) kind = 56; jjCheckNAdd(83); } if (curChar == 97) jjstateSet[jjnewStateCnt++] = 94; else if (curChar == 103) { if (kind > 16) kind = 16; } if (curChar == 103) jjstateSet[jjnewStateCnt++] = 91; break; case 71: if ((0x7fffffe00000000L & l) != 0L) { if (kind > 56) kind = 56; jjCheckNAdd(83); } if (curChar == 110) jjstateSet[jjnewStateCnt++] = 70; break; case 243: if ((0x7fffffe00000000L & l) != 0L) { if (kind > 56) kind = 56; jjCheckNAdd(83); } if (curChar == 103) { if (kind > 16) kind = 16; } break; case 3: if ((0x7fffffe00000000L & l) != 0L) { if (kind > 56) kind = 56; jjCheckNAdd(83); } else if (curChar == 69) jjAddStates(7, 10); else if (curChar == 66) jjAddStates(11, 13); else if (curChar == 72) jjAddStates(14, 16); else if (curChar == 83) jjAddStates(17, 20); else if (curChar == 73) jjCheckNAddTwoStates(157, 158); else if (curChar == 86) jjAddStates(21, 22); else if (curChar == 79) jjAddStates(23, 24); else if (curChar == 65) jjAddStates(25, 26); else if (curChar == 70) jjAddStates(27, 29); else if (curChar == 84) jjAddStates(30, 32); else if (curChar == 85) jjCheckNAdd(53); else if (curChar == 82) jjstateSet[jjnewStateCnt++] = 51; else if (curChar == 76) jjstateSet[jjnewStateCnt++] = 47; else if (curChar == 68) jjstateSet[jjnewStateCnt++] = 43; else if (curChar == 80) jjstateSet[jjnewStateCnt++] = 39; else if (curChar == 78) jjstateSet[jjnewStateCnt++] = 31; else if (curChar == 67) jjstateSet[jjnewStateCnt++] = 25; if (curChar == 98) jjCheckNAddStates(33, 35); else if (curChar == 112) jjstateSet[jjnewStateCnt++] = 81; else if (curChar == 105) jjstateSet[jjnewStateCnt++] = 71; else if (curChar == 109) jjstateSet[jjnewStateCnt++] = 64; else if (curChar == 116) jjstateSet[jjnewStateCnt++] = 20; else if (curChar == 102) jjCheckNAdd(16); break; case 1: if (kind > 7) kind = 7; break; case 8: if ((0xffffffffefffffffL & l) != 0L) jjCheckNAddStates(0, 2); break; case 9: if (curChar == 92) jjAddStates(36, 38); break; case 10: if ((0x14404410000000L & l) != 0L) jjCheckNAddStates(0, 2); break; case 16: if (curChar == 103 && kind > 16) kind = 16; break; case 17: if (curChar == 102) jjCheckNAdd(16); break; case 18: if (curChar == 116 && kind > 16) kind = 16; break; case 19: if (curChar == 120) jjstateSet[jjnewStateCnt++] = 18; break; case 20: if (curChar == 101) jjstateSet[jjnewStateCnt++] = 19; break; case 21: if (curChar == 116) jjstateSet[jjnewStateCnt++] = 20; break; case 22: if (curChar == 75 && kind > 42) kind = 42; break; case 23: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 22; break; case 24: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 23; break; case 25: if (curChar == 72) jjstateSet[jjnewStateCnt++] = 24; break; case 26: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 25; break; case 27: if (curChar == 76 && kind > 43) kind = 43; break; case 28: if (curChar == 65) jjstateSet[jjnewStateCnt++] = 27; break; case 29: if (curChar == 77) jjstateSet[jjnewStateCnt++] = 28; break; case 30: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 29; break; case 31: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 30; break; case 32: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 31; break; case 33: if (curChar == 84 && kind > 43) kind = 43; break; case 34: if (curChar == 72) jjstateSet[jjnewStateCnt++] = 33; break; case 35: if (curChar == 71) jjstateSet[jjnewStateCnt++] = 34; break; case 36: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 35; break; case 37: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 36; break; case 38: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 37; break; case 39: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 38; break; case 40: if (curChar == 80) jjstateSet[jjnewStateCnt++] = 39; break; case 41: if (curChar == 78 && kind > 46) kind = 46; break; case 42: if (curChar == 87) jjstateSet[jjnewStateCnt++] = 41; break; case 43: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 42; break; case 44: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 43; break; case 45: if (curChar == 84 && kind > 46) kind = 46; break; case 46: if (curChar == 70) jjCheckNAdd(45); break; case 47: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 46; break; case 48: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 47; break; case 49: if (curChar == 72) jjCheckNAdd(45); break; case 50: if (curChar == 71) jjstateSet[jjnewStateCnt++] = 49; break; case 51: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 50; break; case 52: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 51; break; case 53: if (curChar == 80 && kind > 46) kind = 46; break; case 54: if (curChar == 85) jjCheckNAdd(53); break; case 55: if (curChar == 104 && kind > 53) kind = 53; break; case 56: case 73: if (curChar == 116) jjCheckNAdd(55); break; case 57: if (curChar == 97) jjstateSet[jjnewStateCnt++] = 56; break; case 58: if (curChar == 112) jjstateSet[jjnewStateCnt++] = 57; break; case 59: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 58; break; case 60: if (curChar == 101) jjstateSet[jjnewStateCnt++] = 59; break; case 61: if (curChar == 108) jjstateSet[jjnewStateCnt++] = 60; break; case 62: if (curChar == 117) jjstateSet[jjnewStateCnt++] = 61; break; case 63: if (curChar == 100) jjstateSet[jjnewStateCnt++] = 62; break; case 64: if (curChar == 111) jjstateSet[jjnewStateCnt++] = 63; break; case 65: if (curChar == 109) jjstateSet[jjnewStateCnt++] = 64; break; case 66: if (curChar == 101 && kind > 53) kind = 53; break; case 67: if (curChar == 100) jjstateSet[jjnewStateCnt++] = 66; break; case 68: if (curChar == 117) jjstateSet[jjnewStateCnt++] = 67; break; case 69: if (curChar == 108) jjstateSet[jjnewStateCnt++] = 68; break; case 70: if (curChar == 99) jjstateSet[jjnewStateCnt++] = 69; break; case 72: if (curChar == 105) jjstateSet[jjnewStateCnt++] = 71; break; case 74: if (curChar == 97) jjstateSet[jjnewStateCnt++] = 73; break; case 75: if (curChar == 112) jjstateSet[jjnewStateCnt++] = 74; break; case 76: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 75; break; case 77: if (curChar == 112) jjstateSet[jjnewStateCnt++] = 76; break; case 78: if (curChar == 97) jjstateSet[jjnewStateCnt++] = 77; break; case 79: if (curChar == 109) jjstateSet[jjnewStateCnt++] = 78; break; case 80: if (curChar == 120) jjstateSet[jjnewStateCnt++] = 79; break; case 81: if (curChar == 105) jjstateSet[jjnewStateCnt++] = 80; break; case 82: if (curChar == 112) jjstateSet[jjnewStateCnt++] = 81; break; case 83: if ((0x7fffffe00000000L & l) == 0L) break; if (kind > 56) kind = 56; jjCheckNAdd(83); break; case 84: if (curChar == 98) jjCheckNAddStates(33, 35); break; case 85: if (curChar == 112 && kind > 16) kind = 16; break; case 86: if (curChar == 97) jjstateSet[jjnewStateCnt++] = 85; break; case 87: if (curChar == 109) jjstateSet[jjnewStateCnt++] = 86; break; case 88: if (curChar == 120) jjstateSet[jjnewStateCnt++] = 87; break; case 89: if (curChar == 105) jjstateSet[jjnewStateCnt++] = 88; break; case 90: if (curChar == 112) jjstateSet[jjnewStateCnt++] = 89; break; case 91: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 90; break; case 93: if (curChar == 101 && kind > 16) kind = 16; break; case 94: if (curChar == 115) jjstateSet[jjnewStateCnt++] = 93; break; case 95: if (curChar == 97) jjstateSet[jjnewStateCnt++] = 94; break; case 96: if (curChar == 84) jjAddStates(30, 32); break; case 97: if (curChar == 69 && kind > 15) kind = 15; break; case 98: if (curChar == 85) jjCheckNAdd(97); break; case 99: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 98; break; case 100: if (curChar == 66 && kind > 42) kind = 42; break; case 101: if (curChar == 65) jjstateSet[jjnewStateCnt++] = 100; break; case 102: if (curChar == 79) jjCheckNAdd(53); break; case 103: if (curChar == 70) jjAddStates(27, 29); break; case 104: if (curChar == 83) jjCheckNAdd(97); break; case 105: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 104; break; case 106: if (curChar == 65) jjstateSet[jjnewStateCnt++] = 105; break; case 107: if (curChar == 88 && kind > 42) kind = 42; break; case 108: case 202: if (curChar == 79) jjCheckNAdd(107); break; case 109: if (curChar == 66) jjstateSet[jjnewStateCnt++] = 108; break; case 110: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 109; break; case 111: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 110; break; case 112: if (curChar == 65) jjstateSet[jjnewStateCnt++] = 111; break; case 113: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 112; break; case 114: if (curChar == 83 && kind > 42) kind = 42; break; case 115: if (curChar == 85) jjstateSet[jjnewStateCnt++] = 114; break; case 116: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 115; break; case 117: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 116; break; case 118: if (curChar == 65) jjAddStates(25, 26); break; case 119: if (curChar == 87 && kind > 42) kind = 42; break; case 120: case 160: if (curChar == 79) jjCheckNAdd(119); break; case 121: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 120; break; case 122: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 121; break; case 123: if (curChar == 69 && kind > 43) kind = 43; break; case 124: case 149: if (curChar == 86) jjCheckNAdd(123); break; case 125: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 124; break; case 126: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 125; break; case 127: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 126; break; case 128: if (curChar == 79) jjAddStates(23, 24); break; case 129: if (curChar == 78 && kind > 42) kind = 42; break; case 130: case 214: case 221: if (curChar == 79) jjCheckNAdd(129); break; case 131: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 130; break; case 132: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 131; break; case 133: if (curChar == 80) jjstateSet[jjnewStateCnt++] = 132; break; case 134: if (curChar == 84 && kind > 44) kind = 44; break; case 135: case 235: if (curChar == 85) jjCheckNAdd(134); break; case 136: if (curChar == 86) jjAddStates(21, 22); break; case 137: if (curChar == 69 && kind > 42) kind = 42; break; case 138: case 190: if (curChar == 78) jjCheckNAdd(137); break; case 139: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 138; break; case 140: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 139; break; case 141: if (curChar == 76 && kind > 45) kind = 45; break; case 142: case 193: if (curChar == 65) jjCheckNAdd(141); break; case 143: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 142; break; case 144: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 143; break; case 145: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 144; break; case 146: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 145; break; case 147: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 146; break; case 148: if (curChar == 73) jjCheckNAddTwoStates(157, 158); break; case 150: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 149; break; case 151: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 150; break; case 152: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 151; break; case 153: if (curChar == 83) jjstateSet[jjnewStateCnt++] = 152; break; case 154: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 153; break; case 155: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 154; break; case 156: if (curChar == 83) jjstateSet[jjnewStateCnt++] = 155; break; case 157: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 156; break; case 158: if (curChar == 78 && kind > 44) kind = 44; break; case 159: if (curChar == 83) jjAddStates(17, 20); break; case 161: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 160; break; case 162: if (curChar == 65) jjstateSet[jjnewStateCnt++] = 161; break; case 163: if (curChar == 72) jjstateSet[jjnewStateCnt++] = 162; break; case 164: if (curChar == 80 && kind > 42) kind = 42; break; case 165: case 203: if (curChar == 65) jjCheckNAdd(164); break; case 166: if (curChar == 71) jjstateSet[jjnewStateCnt++] = 165; break; case 167: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 166; break; case 168: if (curChar == 87) jjstateSet[jjnewStateCnt++] = 167; break; case 169: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 168; break; case 170: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 169; break; case 171: if (curChar == 65) jjstateSet[jjnewStateCnt++] = 170; break; case 172: if (curChar == 72) jjstateSet[jjnewStateCnt++] = 171; break; case 173: if (curChar == 82 && kind > 42) kind = 42; break; case 174: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 173; break; case 175: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 174; break; case 176: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 175; break; case 177: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 176; break; case 178: if (curChar == 68 && kind > 43) kind = 43; break; case 179: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 178; break; case 180: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 179; break; case 181: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 180; break; case 182: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 181; break; case 183: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 182; break; case 184: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 183; break; case 185: if (curChar == 72) jjAddStates(14, 16); break; case 186: if (curChar == 76) jjCheckNAdd(137); break; case 187: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 186; break; case 188: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 187; break; case 189: if (curChar == 65) jjstateSet[jjnewStateCnt++] = 188; break; case 191: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 190; break; case 192: if (curChar == 76) jjstateSet[jjnewStateCnt++] = 191; break; case 194: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 193; break; case 195: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 194; break; case 196: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 195; break; case 197: if (curChar == 90) jjstateSet[jjnewStateCnt++] = 196; break; case 198: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 197; break; case 199: if (curChar == 82) jjstateSet[jjnewStateCnt++] = 198; break; case 200: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 199; break; case 201: if (curChar == 66) jjAddStates(11, 13); break; case 204: if (curChar == 71) jjstateSet[jjnewStateCnt++] = 203; break; case 205: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 204; break; case 206: if (curChar == 88) jjstateSet[jjnewStateCnt++] = 205; break; case 207: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 206; break; case 208: if (curChar == 77 && kind > 46) kind = 46; break; case 209: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 208; break; case 210: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 209; break; case 211: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 210; break; case 212: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 211; break; case 213: if (curChar == 69) jjAddStates(7, 10); break; case 215: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 214; break; case 216: if (curChar == 83) jjstateSet[jjnewStateCnt++] = 215; break; case 217: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 216; break; case 218: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 217; break; case 219: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 218; break; case 220: if (curChar == 88) jjstateSet[jjnewStateCnt++] = 219; break; case 222: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 221; break; case 223: if (curChar == 83) jjstateSet[jjnewStateCnt++] = 222; break; case 224: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 223; break; case 225: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 224; break; case 226: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 225; break; case 227: if (curChar == 88) jjstateSet[jjnewStateCnt++] = 226; break; case 228: if (curChar == 73) jjCheckNAdd(158); break; case 229: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 228; break; case 230: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 229; break; case 231: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 230; break; case 232: if (curChar == 72) jjstateSet[jjnewStateCnt++] = 231; break; case 233: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 232; break; case 234: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 233; break; case 236: if (curChar == 79) jjstateSet[jjnewStateCnt++] = 235; break; case 237: if (curChar == 95) jjstateSet[jjnewStateCnt++] = 236; break; case 238: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 237; break; case 239: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 238; break; case 240: if (curChar == 72) jjstateSet[jjnewStateCnt++] = 239; break; case 241: if (curChar == 67) jjstateSet[jjnewStateCnt++] = 240; break; case 242: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 241; break; default : break; } } while(i != startsAt); } else { int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { case 1: if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 7) kind = 7; break; case 8: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(0, 2); break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 243 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private final int jjMoveStringLiteralDfa0_3() { switch(curChar) { case 42: return jjMoveStringLiteralDfa1_3(0x800L); default : return 1; } } private final int jjMoveStringLiteralDfa1_3(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 1; } switch(curChar) { case 47: if ((active0 & 0x800L) != 0L) return jjStopAtPos(1, 11); break; default : return 2; } return 2; } private final int jjMoveStringLiteralDfa0_1() { return jjMoveNfa_1(0, 0); } private final int jjMoveNfa_1(int startState, int curPos) { int[] nextStates; int startsAt = 0; jjnewStateCnt = 3; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; MatchLoop: do { switch(jjstateSet[--i]) { case 0: if ((0x2400L & l) != 0L) { if (kind > 9) kind = 9; } if (curChar == 13) jjstateSet[jjnewStateCnt++] = 1; break; case 1: if (curChar == 10 && kind > 9) kind = 9; break; case 2: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 1; break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { default : break; } } while(i != startsAt); } else { int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private final int jjMoveStringLiteralDfa0_2() { switch(curChar) { case 42: return jjMoveStringLiteralDfa1_2(0x400L); default : return 1; } } private final int jjMoveStringLiteralDfa1_2(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 1; } switch(curChar) { case 47: if ((active0 & 0x400L) != 0L) return jjStopAtPos(1, 10); break; default : return 2; } return 2; } static final int[] jjnextStates = { 8, 9, 11, 8, 9, 13, 11, 220, 227, 234, 242, 202, 207, 212, 189, 192, 200, 163, 172, 177, 184, 140, 147, 133, 135, 122, 127, 106, 113, 117, 99, 101, 102, 92, 16, 95, 10, 12, 14, }; private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec2[i2] & l2) != 0L); default : if ((jjbitVec0[i1] & l1) != 0L) return true; return false; } } public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "\146\157\156\164", "\163\164\171\154\145", "\143\154\141\163\163", "\145\156\147\151\156\145", "\151\155\141\147\145", "\146\165\156\143\164\151\157\156", "\162\145\143\157\154\157\162\141\142\154\145", "\146\151\154\145", "\142\157\162\144\145\162", "\163\164\162\145\164\143\150", "\163\150\141\144\157\167", "\163\164\141\164\145", "\144\145\164\141\151\154", "\147\141\160\137\163\151\144\145", "\147\141\160\137\146\151\154\145", "\147\141\160\137\142\157\162\144\145\162", "\147\141\160\137\163\164\141\162\164\137\146\151\154\145", "\147\141\160\137\163\164\141\162\164\137\142\157\162\144\145\162", "\147\141\160\137\145\156\144\137\146\151\154\145", "\147\141\160\137\145\156\144\137\142\157\162\144\145\162", "\157\166\145\162\154\141\171\137\146\151\154\145", "\157\166\145\162\154\141\171\137\142\157\162\144\145\162", "\157\166\145\162\154\141\171\137\163\164\162\145\164\143\150", "\157\162\151\145\156\164\141\164\151\157\156", "\141\162\162\157\167\137\144\151\162\145\143\164\151\157\156", null, null, null, null, null, "\133", "\135", "\173", "\175", "\75", "\54", null, "\167\151\144\147\145\164\137\143\154\141\163\163", "\167\151\144\147\145\164", null, }; public static final String[] lexStateNames = { "DEFAULT", "IN_SINGLE_LINE_COMMENT", "IN_FORMAL_COMMENT", "IN_MULTI_LINE_COMMENT", }; public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1, 1, 2, 3, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { 0x1ffffffffffe001L, }; static final long[] jjtoSkip = { 0xe3eL, }; static final long[] jjtoSpecial = { 0xe00L, }; static final long[] jjtoMore = { 0x11c0L, }; private ASCII_UCodeESC_CharStream input_stream; private final int[] jjrounds = new int[243]; private final int[] jjstateSet = new int[486]; StringBuffer image; int jjimageLen; int lengthOfMatch; protected char curChar; public GtkParserTokenManager(ASCII_UCodeESC_CharStream stream) { if (ASCII_UCodeESC_CharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } public GtkParserTokenManager(ASCII_UCodeESC_CharStream stream, int lexState) { this(stream); SwitchTo(lexState); } public void ReInit(ASCII_UCodeESC_CharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private final void ReInitRounds() { int i; jjround = 0x80000001; for (i = 243; i-- > 0;) jjrounds[i] = 0x80000000; } public void ReInit(ASCII_UCodeESC_CharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } public void SwitchTo(int lexState) { if (lexState >= 4 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } private final Token jjFillToken() { Token t = Token.newToken(jjmatchedKind); t.kind = jjmatchedKind; String im = jjstrLiteralImages[jjmatchedKind]; t.image = (im == null) ? input_stream.GetImage() : im; t.beginLine = input_stream.getBeginLine(); t.beginColumn = input_stream.getBeginColumn(); t.endLine = input_stream.getEndLine(); t.endColumn = input_stream.getEndColumn(); return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; public final Token getNextToken() { int kind; Token specialToken = null; Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; } image = null; jjimageLen = 0; for (;;) { switch(curLexState) { case 0: try { while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) curChar = input_stream.BeginToken(); } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); break; case 1: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_1(); if (jjmatchedPos == 0 && jjmatchedKind > 12) { jjmatchedKind = 12; } break; case 2: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_2(); if (jjmatchedPos == 0 && jjmatchedKind > 12) { jjmatchedKind = 12; } break; case 3: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_3(); if (jjmatchedPos == 0 && jjmatchedKind > 12) { jjmatchedKind = 12; } break; } if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; return matchedToken; } else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); if (specialToken == null) specialToken = matchedToken; else { matchedToken.specialToken = specialToken; specialToken = (specialToken.next = matchedToken); } SkipLexicalActions(matchedToken); } else SkipLexicalActions(null); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; continue EOFLoop; } MoreLexicalActions(); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; curPos = 0; jjmatchedKind = 0x7fffffff; try { curChar = input_stream.readChar(); continue; } catch (java.io.IOException e1) { } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } } final void SkipLexicalActions(Token matchedToken) { switch(jjmatchedKind) { default : break; } } final void MoreLexicalActions() { jjimageLen += (lengthOfMatch = jjmatchedPos + 1); switch(jjmatchedKind) { case 7 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen))); else image.append(input_stream.GetSuffix(jjimageLen)); jjimageLen = 0; input_stream.backup(1); break; default : break; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/parser/ParseException.java0000644000175000017500000002136210460410014027011 0ustar twernertwerner/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */ /* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk.parser; /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends Exception { /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. The boolean * flag "specialConstructor" is also set to true to indicate that * this constructor was used to create this object. * This constructor calls its super class with the empty string * to force the "toString" method of parent class "Throwable" to * print the error message in the form: * ParseException: */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(""); specialConstructor = true; currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); specialConstructor = false; } public ParseException(String message) { super(message); specialConstructor = false; } /** * This variable determines which constructor was used to create * this object and thereby affects the semantics of the * "getMessage" method (see below). */ protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * This method has the standard behavior when this object has been * created using the standard constructors. Otherwise, it uses * "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser), then this method is called during the printing * of the final stack trace, and hence the correct error message * gets displayed. */ public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected += tokenImage[expectedTokenSequences[i][j]] + " "; } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected += "..."; } expected += eol + " "; } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += add_escapes(tok.image); tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected; return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ protected String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/parser/Token.java0000644000175000017500000001204510460410014025136 0ustar twernertwerner/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */ /* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk.parser; /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** * beginLine and beginColumn describe the position of the first character * of this token; endLine and endColumn describe the position of the * last character of this token. */ public int beginLine, beginColumn, endLine, endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * Returns the image. */ public final String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simlpy add something like : * * case MyParserConstants.ID : return new IDToken(); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. */ public static final Token newToken(int ofKind) { switch(ofKind) { default : return new Token(); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/parser/TokenMgrError.java0000644000175000017500000001513710460410014026623 0ustar twernertwerner/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */ /* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk.parser; public class TokenMgrError extends Error { /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occured. */ static final int LEXICAL_ERROR = 0; /** * An attempt wass made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their espaced (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexicl error * curLexState : lexical state in which this error occured * errorLine : line number when the error occured * errorColumn : column number when the error occured * errorAfter : prefix that was seen before this error occured * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ public TokenMgrError() { } public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/ArrowButton.java0000644000175000017500000001142410460410014025050 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import java.awt.*; import javax.swing.*; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.*; import com.l2fprod.gui.plaf.skin.*; import com.l2fprod.util.ImageUtils; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:54:43 $ */ final class ArrowButton { DefaultButton normal, focus, pressed; /** * Constructor for the ArrowButton object * * @param parser Description of Parameter * @param direction Description of Parameter * @exception Exception Description of Exception */ public ArrowButton(GtkParser parser, String direction) throws Exception { normal = GtkUtils.newButton(parser, "arrows", new String[]{"function", "state", "arrow_direction"}, new String[]{"ARROW", "NORMAL", direction}); normal.setCenterFill(ImageUtils.PAINT_STRETCH); focus = GtkUtils.newButton(parser, "arrows", new String[]{"function", "state", "arrow_direction"}, new String[]{"ARROW", "PRELIGHT", direction}); focus.setCenterFill(ImageUtils.PAINT_STRETCH); pressed = GtkUtils.newButton(parser, "arrows", new String[]{"function", "shadow", "arrow_direction"}, new String[]{"ARROW", "IN", direction}); pressed.setCenterFill(ImageUtils.PAINT_STRETCH); } /** * Gets the Width attribute of the ArrowButton object * * @return The Width value */ public int getWidth() { return normal.getWidth(); } /** * Gets the Height attribute of the ArrowButton object * * @return The Height value */ public int getHeight() { return normal.getHeight(); } /** * Gets the PreferredSize attribute of the ArrowButton object * * @return The PreferredSize value */ public Dimension getPreferredSize() { return new java.awt.Dimension(getWidth(), getHeight()); } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter */ public void paint(Graphics g, AbstractButton b) { ButtonModel model = b.getModel(); if (b.isEnabled() == false) { normal.paint(g, b); } else if (model.isArmed() && model.isPressed()) { pressed.paint(g, b); } else if (model.isRollover() && (focus != null)) { focus.paint(g, b); } else { normal.paint(g, b); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkBorder.java0000644000175000017500000000650510460410014024451 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:48:36 $ */ public final class GtkBorder { /** * Description of the Field */ public int top, right, bottom, left; /** * Constructor for the GtkBorder object * * @param top Description of Parameter * @param right Description of Parameter * @param bottom Description of Parameter * @param left Description of Parameter */ public GtkBorder(int top, int right, int bottom, int left) { this.top = top; this.right = right; this.bottom = bottom; this.left = left; } /** * Constructor for the GtkBorder object */ public GtkBorder() { } /** * Description of the Method * * @return Description of the Returned Value */ public String toString() { return "{ " + top + ", " + right + ", " + bottom + ", " + left + " }"; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkButton.java0000644000175000017500000002222610460410012024503 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.*; import com.l2fprod.util.ImageUtils; import com.l2fprod.gui.plaf.skin.*; import com.l2fprod.gui.plaf.skin.impl.*; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2003/12/06 21:48:36 $ */ final class GtkButton extends AbstractSkinButton implements SkinButton { DefaultButton checkIN, checkOUT; DefaultButton optionIN, optionOUT; Icon disabledCheckIN, disabledCheckOUT; Icon disabledOptionIN, disabledOptionOUT; DefaultButton disabledButton, pressedButton, normalButton, rolloverButton; DefaultButton disabledButtonIN; DefaultButton toggleIN, toggleOUT, toggleRollover; /** * Constructor for the GtkButton object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkButton(GtkParser parser) throws Exception { normalButton = GtkUtils.newButton(parser, "GtkButton", new String[]{"function", "state", "shadow"}, new String[]{"BOX", "NORMAL", "OUT"}); pressedButton = GtkUtils.newButton(parser, "GtkButton", new String[]{"function", "state", "shadow"}, new String[]{"BOX", "ACTIVE", "IN"}); /* * focusButton = GtkUtils.newButton(parser, "GtkButton", * new String[]{"function", "state", "shadow"}, * new String[]{"BOX", "SELECTED", "IN"}); * if (focusButton == null) focusButton=pressedButton; */ disabledButton = GtkUtils.newButton(parser, "GtkButton", new String[]{"function", "state", "shadow"}, new String[]{"BOX", "INSENSITIVE", "OUT"}); disabledButtonIN = GtkUtils.newButton(parser, "GtkButton", new String[]{"function", "state", "shadow"}, new String[]{"BOX", "INSENSITIVE", "IN"}); rolloverButton = GtkUtils.newButton(parser, "GtkButton", new String[]{"function", "state"}, new String[]{"BOX", "PRELIGHT"}); // toggle button toggleIN = GtkUtils.newButton(parser, "GtkToggleButton", new String[]{"function", "shadow"}, new String[]{"BOX", "IN"}); toggleOUT = GtkUtils.newButton(parser, "GtkToggleButton", new String[]{"function", "shadow", "state"}, new String[]{"BOX", "OUT", null}); //, false, true); toggleRollover = GtkUtils.newButton(parser, "GtkToggleButton", new String[]{"function", "state"}, new String[]{"BOX", "PRELIGHT"}); checkIN = GtkUtils.newButton(parser, "GtkCheckButton", new String[]{"function", "shadow"}, new String[]{"CHECK", "IN"}); disabledCheckIN = ImageUtils.getDisabledIcon(checkIN.center); checkOUT = GtkUtils.newButton(parser, "GtkCheckButton", new String[]{"function", "shadow"}, new String[]{"CHECK", "OUT"}); disabledCheckOUT = ImageUtils.getDisabledIcon(checkOUT.center); optionIN = GtkUtils.newButton(parser, "GtkRadioButton", new String[]{"function", "shadow"}, new String[]{"OPTION", "IN"}); disabledOptionIN = ImageUtils.getDisabledIcon(optionIN.center); optionOUT = GtkUtils.newButton(parser, "GtkRadioButton", new String[]{"function", "shadow"}, new String[]{"OPTION", "OUT"}); disabledOptionOUT = ImageUtils.getDisabledIcon(optionOUT.center); } /** * Gets the CheckBoxIconSize attribute of the GtkButton object * * @return The CheckBoxIconSize value */ public Dimension getCheckBoxIconSize() { if (checkIN != null) { return new Dimension(checkIN.getIconWidth(), checkIN.getIconHeight()); } else { return new Dimension(13, 13); } } /** * Gets the RadioButtonIconSize attribute of the GtkButton object * * @return The RadioButtonIconSize value */ public Dimension getRadioButtonIconSize() { if (optionIN != null) { return new Dimension(optionIN.getIconWidth(), optionIN.getIconHeight()); } else { return new Dimension(13, 13); } } /** * Gets the RadioIcon attribute of the GtkButton object * * @param b Description of Parameter * @return The RadioIcon value */ public javax.swing.Icon getRadioIcon(javax.swing.AbstractButton b) { ButtonModel model = b.getModel(); if ((b instanceof JRadioButton) || (b instanceof JRadioButtonMenuItem)) { if (model.isSelected() || (model.isPressed() && model.isArmed())) { return b.isEnabled() ? optionIN : disabledOptionIN; //} else //return optionOUT; } else if (model.isEnabled() == false) { if (model.isSelected()) { return b.isEnabled() ? optionOUT : disabledOptionOUT; } else { return b.isEnabled() ? optionOUT : disabledOptionOUT; } } else { return b.isEnabled() ? optionOUT : disabledOptionOUT; } } else if ((b instanceof JCheckBox) || (b instanceof JCheckBoxMenuItem)) { if (model.isSelected() || (model.isPressed() && model.isArmed())) { return b.isEnabled() ? checkIN : disabledCheckIN; } else if (model.isEnabled() == false) { if (model.isSelected()) { return b.isEnabled() ? checkOUT : disabledCheckOUT; } else { return b.isEnabled() ? checkOUT : disabledCheckOUT; } } else { return b.isEnabled() ? checkOUT : disabledCheckOUT; } } else { return null; } } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return true; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return true; } protected boolean paintDisabledButton(Graphics g, AbstractButton b) { disabledButton.paint(g, b); return true; } protected boolean paintPressedToggle(Graphics g, AbstractButton b) { toggleIN.paint(g, b); return true; } protected boolean paintRolloverToggle(Graphics g, AbstractButton b) { toggleRollover.paint(g, b); return true; } protected boolean paintToggle(Graphics g, AbstractButton b) { toggleOUT.paint(g, b); return true; } protected boolean paintPressedButton(Graphics g, AbstractButton b) { pressedButton.paint(g, b); return true; } protected boolean paintRolloverButton(Graphics g, AbstractButton b) { rolloverButton.paint(g, b); return true; } protected boolean paintNormalButton(Graphics g, AbstractButton b) { normalButton.paint(g, b); return true; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkClass.java0000644000175000017500000000714510460410014024302 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import java.util.ArrayList; import java.util.List; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:48:36 $ */ public final class GtkClass { public String name; public List styles; /** * Constructor for the GtkClass object */ public GtkClass() { styles = new ArrayList(); } /** * Sets the Name attribute of the GtkClass object * * @param s The new Name value */ public void setName(String s) { name = s; } /** * Gets the Style attribute of the GtkClass object * * @return The Style value */ public GtkStyle getStyle() { return (GtkStyle) styles.get(0); } /** * Gets the Styles attribute of the GtkClass object * * @return The Styles value */ public GtkStyle[] getStyles() { return (GtkStyle[])styles.toArray(new GtkStyle[styles.size()]); } /** * Adds a feature to the StyleName attribute of the GtkClass object * * @param stylename The feature to be added to the StyleName attribute */ public void addStyleName(String stylename) { if (styles.contains(stylename) == false) { styles.add(stylename); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkDefaultButton.java0000644000175000017500000001027710460410014026015 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.icon.ArrowIcon; import com.l2fprod.gui.plaf.skin.DefaultButton; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import javax.swing.SwingConstants; final class GtkDefaultButton extends DefaultButton { /** mainly used by optionmenu */ boolean hasArrow = true; public GtkDefaultButton(Image bitmap, int imageWidth, int imageHeight, int topHeight, int rightWidth, int bottomHeight, int leftWidth) { super(bitmap, imageWidth, imageHeight, topHeight, rightWidth, bottomHeight, leftWidth, false); } public GtkDefaultButton(Image bitmap, Image gap, Image gap_start, Image gap_end, int imageWidth, int imageHeight, int topHeight, int rightWidth, int bottomHeight, int leftWidth) { super(bitmap, gap, gap_start, gap_end, imageWidth, imageHeight, topHeight, rightWidth, bottomHeight, leftWidth); } public GtkDefaultButton(Image top, Image bottom, Image left, Image right, Image topLeft, Image topRight, Image bottomLeft, Image bottomRight) { super(top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight); } public GtkDefaultButton(Image bitmap, int imageWidth, int imageHeight, int topHeight, int rightWidth, int bottomHeight, int leftWidth, boolean tile) { super(bitmap, imageWidth, imageHeight, topHeight, rightWidth, bottomHeight, leftWidth, tile); } public void paint(Graphics g, Component c) { super.paint(g, c); if (!hasArrow) { ArrowIcon.paintArrow(g, 5, c.getWidth() - rightWidth, c.getHeight() / 2 - 3, rightWidth, c.getHeight(), SwingConstants.SOUTH, c.isEnabled()); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkEngine.java0000644000175000017500000001107210460410012024432 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2003/12/06 21:48:36 $ */ public final class GtkEngine { /** * Description of the Field */ public GtkStyle style; java.util.Vector images = new java.util.Vector(); /** * Gets the Images attribute of the GtkEngine object * * @return The Images value */ public java.util.Vector getImages() { return images; } /** * Adds a feature to the Image attribute of the GtkEngine object * * @param image The feature to be added to the Image attribute */ public void addImage(GtkImage image) { images.addElement(image); image.style = style; } /** * Description of the Method * * @param keys Description of Parameter * @param values Description of Parameter * @return Description of the Returned Value */ public GtkImage findImage(Object[] keys, Object[] values) { return findImage(keys, values, false); } /** * Description of the Method * * @param keys Description of Parameter * @param values Description of Parameter * @param exactMatch Description of Parameter * @return Description of the Returned Value */ public GtkImage findImage(Object[] keys, Object[] values, boolean exactMatch) { GtkImage image = null; int imageMatchKeys = 0; for (int i = 0, c = images.size(); i < c; i++) { GtkImage currentImage = (GtkImage) images.elementAt(i); int j = 0; while ((j < keys.length) && ((values[j] == null && currentImage.getProperty(keys[j]) == null) || (values[j] != null) && values[j].equals(currentImage.getProperty(keys[j])))) { j++; } if (j == keys.length) { image = currentImage; imageMatchKeys = j; break; } else if (j>0 && j>= imageMatchKeys) { image = currentImage; imageMatchKeys = j; } } if (exactMatch) { if (imageMatchKeys < keys.length) { return null; } else { return image; } } else { return image; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkImage.java0000644000175000017500000001521710460410016024260 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.plaf.skin.SkinUtils; import java.awt.Image; import java.net.URL; import java.util.Enumeration; import javax.swing.tree.TreeNode; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:48:36 $ */ public class GtkImage extends GtkProps implements TreeNode { GtkStyle style; Image preloaded; /** * Sets the Preview attribute of the GtkImage object * * @param image The new Preview value */ public void setPreview(Image image) { preloaded = image; } /** * Gets the Preview attribute of the GtkImage object * * @param w Description of Parameter * @param h Description of Parameter * @return The Preview value * @exception Exception Description of Exception */ public Image getPreview(int w, int h) throws Exception { if (preloaded == null) { preloaded = getImage(style.getParser().getDirectory()); if (preloaded != null) { preloaded = preloaded.getScaledInstance(w, h, 0); } } return preloaded; } /** * Gets the Filename attribute of the GtkImage object * * @return The Filename value */ public String getFilename() { String filename = (String) getProperty("file"); if (filename != null) { return filename; } filename = (String) getProperty("overlay_file"); return filename; } /** * Gets the Image attribute of the GtkImage object * * @param skinDirectory Description of Parameter * @return The Image value * @exception Exception Description of Exception */ public Image getImage(URL skinDirectory) throws Exception { Image im = null; im = getImage(skinDirectory, "file"); if (im == null) { im = getImage(skinDirectory, "overlay_file"); } return im; } /** * Gets the OverlayImage attribute of the GtkImage object * * @param skinDirectory Description of Parameter * @return The OverlayImage value * @exception Exception Description of Exception */ public Image getOverlayImage(URL skinDirectory) throws Exception { return getImage(skinDirectory, "overlay_file"); } /** * Gets the Image attribute of the GtkImage object * * @param skinDirectory Description of Parameter * @param prop Description of Parameter * @return The Image value * @exception Exception Description of Exception */ public Image getImage(URL skinDirectory, String prop) throws Exception { String filename = (String) getProperty(prop); if (filename == null) { return null; } return SkinUtils.loadImage(new URL(skinDirectory, filename)); } /** * Gets the AllowsChildren attribute of the GtkImage object * * @return The AllowsChildren value */ public boolean getAllowsChildren() { return false; } /** * Gets the ChildAt attribute of the GtkImage object * * @param childIndex Description of Parameter * @return The ChildAt value */ public TreeNode getChildAt(int childIndex) { return null; } /** * Gets the ChildCount attribute of the GtkImage object * * @return The ChildCount value */ public int getChildCount() { return 0; } /** * Gets the Index attribute of the GtkImage object * * @param node Description of Parameter * @return The Index value */ public int getIndex(TreeNode node) { return -1; } /** * Gets the Parent attribute of the GtkImage object * * @return The Parent value */ public TreeNode getParent() { return style; } /** * Gets the Leaf attribute of the GtkImage object * * @return The Leaf value */ public boolean isLeaf() { return false; } /** * Description of the Method * * @return Description of the Returned Value */ public Enumeration children() { throw new Error("Not implemented"); } /** * Description of the Method * * @return Description of the Returned Value */ public String toString() { return getProperties().toString(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkListCellRenderer.java0000644000175000017500000001062610460410014026435 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import java.awt.Component; import java.awt.Graphics; import javax.swing.DefaultListCellRenderer; import javax.swing.JList; import com.l2fprod.gui.plaf.skin.DefaultButton; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class GtkListCellRenderer extends DefaultListCellRenderer implements javax.swing.plaf.UIResource { boolean isSelected; boolean cellHasFocus; transient DefaultButton itemSelected, itemUnselected; /** * Constructor for the GtkListCellRenderer object */ public GtkListCellRenderer(DefaultButton itemSelected, DefaultButton itemUnselected) { setOpaque(false); this.itemSelected = itemSelected; this.itemUnselected = itemUnselected; } /** * Gets the ListCellRendererComponent attribute of the GtkListCellRenderer * object * * @param list Description of Parameter * @param value Description of Parameter * @param index Description of Parameter * @param isSelected Description of Parameter * @param cellHasFocus Description of Parameter * @return The ListCellRendererComponent value */ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { this.isSelected = isSelected; this.cellHasFocus = cellHasFocus; return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); } /** * Description of the Method * * @param g Description of Parameter */ protected void paintComponent(Graphics g) { if (isSelected) { itemSelected.paint(g, this); } else { itemUnselected.paint(g, this); } // else if (cellHasFocus) // itemUnselected.paint(g, this); super.paintComponent(g); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkPersonality.java0000644000175000017500000003055110460410014025543 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import java.awt.Image; import javax.swing.*; import javax.swing.border.*; import javax.swing.plaf.BorderUIResource; import javax.swing.table.*; import com.l2fprod.gui.plaf.skin.*; import com.l2fprod.gui.plaf.skin.impl.*; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.*; import com.l2fprod.util.ImageUtils; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.6 $, $Date: 2005/11/19 09:21:24 $ */ final class GtkPersonality extends AbstractSkinPersonality { Image background; int backgroundPaintMode; DefaultButton menu; // Border menuBorder; Border menuBarBorder; Border toolBarBorder; DefaultButton menuitemSelected; DefaultButton menuBackground; DefaultButton itemSelected, itemUnselected; DefaultButton comboBox; DefaultButton rolloverComboBox; DefaultButton disabledComboBox; DefaultButton focus; java.awt.Insets comboBoxInsets = new java.awt.Insets(1, 4, 1, 4); static int MINIMAL_SIZE = 50; /** * Constructor for the GtkPersonality object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkPersonality(GtkParser parser) throws Exception { if (parser.getClass("GtkWindow") != null) { GtkStyle windowStyle = parser.getClass("GtkWindow").getStyle(); GtkImage image = windowStyle.getEngine().findImage(new String[]{"function"}, new String[]{"FLAT_BOX"}); backgroundPaintMode = "TRUE".equals(image.getProperty("stretch")) ? ImageUtils.PAINT_STRETCH : ImageUtils.PAINT_TILE; background = image.getImage(parser.getDirectory()); if (background != null && backgroundPaintMode == ImageUtils.PAINT_TILE) { int width = background.getWidth(ImageUtils.producer); int height = background.getHeight(ImageUtils.producer); int factor = Math.max(MINIMAL_SIZE / height, MINIMAL_SIZE / width); if (factor > 1) { background = ImageUtils.buildTile(background, factor); } } background = ImageUtils.toBufferedImage(background); } menuBackground = GtkUtils.newButton(parser, "GtkMenu", new String[]{"function"}, new String[]{"BOX"}); /* * DefaultButton menuBorderImage = GtkUtils.newButton(parser, "GtkMenu", * new String[]{"function"}, * new String[]{"BOX"}, true); * menuBorder = new SkinBorder(new ImageIcon(menuBorderImage.top), * new ImageIcon(menuBorderImage.bottom), * new ImageIcon(menuBorderImage.left), * new ImageIcon(menuBorderImage.right), * new ImageIcon(menuBorderImage.topleft), * new ImageIcon(menuBorderImage.topright), * new ImageIcon(menuBorderImage.bottomleft), * new ImageIcon(menuBorderImage.bottomright)); */ toolBarBorder = GtkUtils.newButton(parser, "GtkToolbar", new String[]{"function"}, new String[]{"BOX"}, false, true, false, false); if (toolBarBorder != null) { toolBarBorder = new BorderUIResource(toolBarBorder); } menuBarBorder = GtkUtils.newButton(parser, "GtkMenuBar", new String[]{"function"}, new String[]{"BOX"}, false, true, false, false); if (menuBarBorder != null) { menuBarBorder = new BorderUIResource(menuBarBorder); } menuitemSelected = GtkUtils.newButton(parser, "GtkMenuItem", new String[]{"function"}, new String[]{"BOX"}); itemUnselected = GtkUtils.newButton(parser, "GtkListItem", new String[]{"function", "state"}, new String[]{"FLAT_BOX", "INSENSITIVE"}); itemSelected = GtkUtils.newButton(parser, "GtkListItem", new String[]{"function", "state"}, new String[]{"FLAT_BOX", null}); comboBox = GtkUtils.newButton(parser, "GtkOptionMenu", new String[]{"function", "state"}, new String[]{"BOX", null}, false, true, false, false); if (comboBox == null) { comboBox = GtkUtils.newButton(parser, "GtkOptionMenu", new String[]{"function"}, new String[]{"TAB"}, false, true, true, false); } rolloverComboBox = GtkUtils.newButton(parser, "GtkOptionMenu", new String[]{"function", "state"}, new String[]{"BOX", "PRELIGHT"}, false, true, false, false); disabledComboBox = GtkUtils.newButton(parser, "GtkOptionMenu", new String[]{"function", "state"}, new String[]{"BOX", "INSENSITIVE"}, false, true, false, false); focus = GtkUtils.newButton(parser, "default", new String[]{"function"}, new String[]{"FOCUS"}, true); if (focus != null) { focus.setCenterFill(ImageUtils.PAINT_NONE); } } /** * Gets the ComboBoxInsets attribute of the GtkPersonality object * * @return The ComboBoxInsets value */ public java.awt.Insets getComboBoxInsets() { if (comboBox != null) { return comboBox.getInsets(); } else { return comboBoxInsets; } } /** * Gets the ComboBoxPreferredSize attribute of the GtkPersonality object * * @param c Description of Parameter * @return The ComboBoxPreferredSize value */ public java.awt.Dimension getComboBoxPreferredSize(javax.swing.JComboBox c) { if (comboBox != null) { return comboBox.getMinimumSize(); } else { return null; } } /** * Gets the TableHeaderRenderer attribute of the GtkPersonality object * * @return The TableHeaderRenderer value */ public TableCellRenderer getTableHeaderRenderer() { if (itemSelected != null && itemUnselected != null) { return new GtkTableHeaderRenderer(itemSelected, itemUnselected); } else { return new DefaultTableCellRenderer.UIResource(); } } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return true; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { if (c instanceof JMenuBar && menuBarBorder != null) { c.setBorder(menuBarBorder); } if (c instanceof JToolBar && toolBarBorder != null) { c.setBorder(toolBarBorder); } return true; } public void uninstallSkin(JComponent c) { } /** * Paint the given component with a background. * There is no logic in this method, it only checks if * the menu background or the global background should be used. * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintDialog(java.awt.Graphics g, java.awt.Component c) { if (c instanceof JPopupMenu && menuBackground != null) { menuBackground.paint(g, c); } else { JComponent component = (JComponent)c; if (background != null) { java.awt.Rectangle rect = component.getVisibleRect(); ImageUtils.paint(component, g, background, rect.x, rect.y, rect.width, rect.height, true, backgroundPaintMode); } } return true; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintFocus(java.awt.Graphics g, javax.swing.JComponent c) { /* * removed for now, some components were very ugly with focus painted * if (focus != null) { * focus.paint(g, c); * return true; * } else { * return false; * } */ return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintMenu(java.awt.Graphics g, javax.swing.JMenu c) { /* * if (menu != null) { * if (c.isTopLevelMenu()) { * if (c.isArmed() || (c instanceof JMenu && c.getModel().isSelected())) { * menu.paint(g, c); * return true; * } else { * return paintDialog(g, c); * } * } else { * return paintMenuItem(g, c); * } * } else */ return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintMenuItem(java.awt.Graphics g, javax.swing.JMenuItem c) { if (menuitemSelected != null) { if (c.isArmed() || (c instanceof JMenu && c.getModel().isSelected())) { menuitemSelected.paint(g, c); } /* * else { * paintDialog(g, c); * } */ return true; } else { return false; } } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param bounds Description of Parameter * @param hasFocus Description of Parameter * @return Description of the Returned Value */ public boolean paintComboBox(java.awt.Graphics g, javax.swing.JComboBox c, java.awt.Rectangle bounds, boolean hasFocus, boolean isRollover) { if (!c.isEnabled() && disabledComboBox != null) { disabledComboBox.paint(g, c); return true; } if (isRollover && rolloverComboBox != null) { rolloverComboBox.paint(g, c); return true; } if (comboBox != null) { comboBox.paint(g, c); return true; } return false; } /** * @return Description of the Returned Value * @deprecated use getTableHeaderRenderer. */ public TableCellRenderer createTableHeaderRenderer() { return getTableHeaderRenderer(); } /** * Description of the Method * * @return Description of the Returned Value */ public ListCellRenderer createListCellRenderer() { if (itemSelected != null && itemUnselected != null) { return new GtkListCellRenderer(itemSelected, itemUnselected); } else { return new DefaultListCellRenderer.UIResource(); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkProgress.java0000644000175000017500000000714710460410014025043 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import javax.swing.SwingConstants; import com.l2fprod.gui.plaf.skin.impl.*; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.5 $, $Date: 2005/11/19 09:20:13 $ */ final class GtkProgress extends AbstractSkinProgress implements SwingConstants { /** * Constructor for the GtkProgress object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkProgress(GtkParser parser) throws Exception { //PENDING(fred): progress needs to be improved with vertical and horizontal progress progressBarHorizontal = GtkUtils.newButton(parser, "GtkProgressBar", new String[]{"function", "detail"}, new String[]{"BOX", "bar"}, false, true, true, false); progressBarBackHorizontal = GtkUtils.newButton(parser, "GtkProgressBar", new String[]{"function", "detail"}, new String[]{"BOX", "trough"}, false, true, true, false); progressBarVertical = progressBarHorizontal. rotateCounterClockWise(); progressBarBackVertical = progressBarBackHorizontal. rotateCounterClockWise(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkProps.java0000644000175000017500000000724110460410012024333 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:45 $ */ public class GtkProps { java.util.Hashtable properties; java.util.Vector keys; /** * Constructor for the GtkProps object */ public GtkProps() { properties = new java.util.Hashtable(); keys = new java.util.Vector(); } /** * Sets the Property attribute of the GtkProps object * * @param key The new Property value * @param value The new Property value */ public void setProperty(String key, Object value) { properties.put(key, value); if (!keys.contains(key)) { keys.addElement(key); } } /** * Gets the Property attribute of the GtkProps object * * @param key Description of Parameter * @return The Property value */ public Object getProperty(Object key) { return properties.get(key); } /** * Gets the Properties attribute of the GtkProps object * * @return The Properties value */ public java.util.Hashtable getProperties() { return properties; } /** * Gets the Keys attribute of the GtkProps object * * @return The Keys value */ public java.util.Vector getKeys() { return keys; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkScrollbar.java0000644000175000017500000002271010460410014025153 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.plaf.skin.DefaultButton; import com.l2fprod.gui.plaf.skin.SkinScrollbar; import com.l2fprod.gui.plaf.skin.impl.AbstractSkinScrollbar; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.GtkParser; import com.l2fprod.util.ImageUtils; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; import javax.swing.JComponent; import javax.swing.JScrollBar; import javax.swing.SwingConstants; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.4 $, $Date: 2005/11/19 09:20:02 $ */ final class GtkScrollbar extends AbstractSkinScrollbar implements SkinScrollbar, SwingConstants { DefaultButton h_track, v_track; DefaultButton h_thumb, v_thumb; DefaultButton h_handle, v_handle; ArrowButton up, down, left, right; Dimension minimumThumbSize; /** * Constructor for the GtkScrollbar object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkScrollbar(GtkParser parser) throws Exception { h_thumb = GtkUtils.newButton(parser, "GtkScrollbar", new String[]{"function", "detail", "orientation", "state"}, new String[]{"BOX", "slider", "HORIZONTAL", "NORMAL"}, false, true, true, false); v_thumb = GtkUtils.newButton(parser, "GtkScrollbar", new String[]{"function", "detail", "orientation"}, new String[]{"BOX", "slider", "VERTICAL"}, false, true, true, false); h_track = GtkUtils.newButton(parser, "GtkScrollbar", new String[]{"function", "detail", "orientation"}, new String[]{"BOX", "trough", "HORIZONTAL"}, false, true, true, false); v_track = GtkUtils.newButton(parser, "GtkScrollbar", new String[]{"function", "detail", "orientation"}, new String[]{"BOX", "trough", "VERTICAL"}, false, true, true, false); h_handle = GtkUtils.newButton(parser, "default", new String[]{"function", "orientation"}, new String[]{"HANDLE", "HORIZONTAL"}, true, true); if (h_handle != null) { h_handle.setCenterFill(ImageUtils.PAINT_STRETCH); } v_handle = GtkUtils.newButton(parser, "default", new String[]{"function", "orientation"}, new String[]{"HANDLE", "VERTICAL"}, true, true); if (v_handle != null) { v_handle.setCenterFill(ImageUtils.PAINT_STRETCH); } up = new ArrowButton(parser, "UP"); down = new ArrowButton(parser, "DOWN"); left = new ArrowButton(parser, "LEFT"); right = new ArrowButton(parser, "RIGHT"); minimumThumbSize = new Dimension(h_thumb.getInsets().left + (h_handle != null ? h_handle.getWidth() : 0) + h_thumb.getInsets().right, v_thumb.getInsets().top + (v_handle != null ? v_handle.getHeight() : 0) + v_thumb.getInsets().bottom); } /** * Gets the PreferredSize attribute of the GtkScrollbar object * * @param scrollbar Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JScrollBar scrollbar) { return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(Math.max(10, Math.max(up.getWidth(), v_thumb.getWidth())), 48) : new Dimension(48, Math.max(10, Math.max(left.getHeight(), h_thumb.getHeight()))); } /** * Gets the MinimumThumbSize attribute of the GtkScrollbar object * * @return The MinimumThumbSize value */ public Dimension getMinimumThumbSize() { return minimumThumbSize; } /** * Gets the ArrowPreferredSize attribute of the GtkScrollbar object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ public Dimension getArrowPreferredSize(int direction) { switch (direction) { case NORTH: return up.getPreferredSize(); case SOUTH: return down.getPreferredSize(); case WEST: return left.getPreferredSize(); case EAST: return right.getPreferredSize(); default: throw new Error("Invalid direction " + direction); } } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return true; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return true; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ public boolean paintArrow(java.awt.Graphics g, javax.swing.AbstractButton b, int direction) { switch (direction) { case NORTH: up.paint(g, b); break; case SOUTH: down.paint(g, b); break; case WEST: left.paint(g, b); break; case EAST: right.paint(g, b); } return true; } // track is under thumb /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintTrack(Graphics g, JScrollBar scrollbar, Rectangle trackBounds) { if (h_track != null) { if (scrollbar.getOrientation() == HORIZONTAL) { h_track.paint(g, 0, 0, trackBounds.width, trackBounds.height, scrollbar); } else { v_track.paint(g, 0, 0, trackBounds.width, trackBounds.height, scrollbar); } return true; } return false; } // thumb is the variable area /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(Graphics g, JScrollBar scrollbar, Rectangle thumbBounds) { // the UI translate the graphics to thumbBounds.x and .y if (h_thumb != null) { if (scrollbar.getOrientation() == HORIZONTAL) { h_thumb.paint(g, 0, 0, thumbBounds.width, thumbBounds.height, scrollbar); // paint the handle only if there is room for it if (h_handle != null && h_handle.getWidth() < thumbBounds.width) { h_handle.paint(g, Math.max(0, (thumbBounds.width - h_handle.getWidth()) / 2), (thumbBounds.height - h_handle.getHeight()) / 2, Math.min(thumbBounds.width, h_handle.getWidth()), h_handle.getHeight(), scrollbar); } } else { v_thumb.paint(g, 0, 0, thumbBounds.width, thumbBounds.height, scrollbar); // paint the handle only if there is room for it if (v_handle != null && v_handle.getHeight() < thumbBounds.height) { v_handle.paint(g, (thumbBounds.width - v_handle.getWidth()) / 2, Math.max(0, (thumbBounds.height - v_handle.getHeight()) / 2), v_handle.getWidth(), Math.min(thumbBounds.height, v_handle.getHeight()), scrollbar); } } return true; } return false; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkSeparator.java0000644000175000017500000000767010460410014025200 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.plaf.skin.DefaultButton; import com.l2fprod.gui.plaf.skin.impl.AbstractSkinSeparator; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.GtkParser; /** * Skin Separator.
* * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:50:13 $ */ final class GtkSeparator extends AbstractSkinSeparator { DefaultButton hline; DefaultButton vline; public GtkSeparator(GtkParser parser) throws Exception{ hline = GtkUtils.newButton(parser, "default", new String[]{"function"}, new String[]{"HLINE"}); vline = GtkUtils.newButton(parser, "default", new String[]{"function"}, new String[]{"VLINE"}); } public boolean status() { return (hline != null) && (vline != null); } public boolean paint(java.awt.Graphics g, javax.swing.JSeparator separator) { if (javax.swing.JSeparator.HORIZONTAL == separator.getOrientation()) { hline.paint(g, separator); } else { vline.paint(g, separator); } return true; } public java.awt.Dimension getPreferredSize(javax.swing.JSeparator separator, java.awt.Dimension uiPreferredSize) { if (javax.swing.JSeparator.HORIZONTAL == separator.getOrientation()) { uiPreferredSize.height = hline.getHeight(); } else { uiPreferredSize.width = vline.getWidth(); } return uiPreferredSize; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkSkin.java0000644000175000017500000002724110460410014024140 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.plaf.*; import com.l2fprod.gui.border.*; import com.l2fprod.gui.plaf.skin.*; import com.l2fprod.gui.plaf.skin.impl.AbstractSkin; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.*; /** * GTK (The Gimp Toolkit) Skin Support.
* GtkSkin can be used in conjunction with a gtkrc file.
* You can find skins at: *

  • gtk.themes.org
    *
    * Simply extract the skin file in a directory and use:
    *
    * * SkinLookAndFeel.setSkin(new GtkSkin("c:\downloads\myskin\gtk\gtkrc"));
    * UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); *

    *
    * to enable skins in your application !
    *
    *
    *
    * Created on 28/01/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:50:13 $ */ public final class GtkSkin extends AbstractSkin { String[] colors; static String[] swingToGtk = { "desktop", "", "activeCaption", "", "activeCaptionText", "", "activeCaptionBorder", "", "inactiveCaption", "", "inactiveCaptionText", "", "inactiveCaptionBorder", "", "window", "window.bg[NORMAL]", "windowBorder", "window.bg[NORMAL]", "windowText", "window.fg[NORMAL]", "menu", "menu.bg[NORMAL]", "menuPressedItemB", "bg[ACTIVE]", "menuPressedItemF", "fg[ACTIVE]", "menuText", "fg[NORMAL]", "text", "bg[NORMAL]", "textText", "fg[NORMAL]", "textHighlight", "bg[SELECTED]", "textHighlightText", "fg[SELECTED]", "textInactiveText", "fg[INSENSITIVE]", "control", "button.bg[NORMAL]", "controlText", "button.fg[NORMAL]", "controlHighlight", "", "controlLtHighlight", "", "controlShadow", "", "controlDkShadow", "", "scrollbar", "", "info", "", "infoText", "", }; /** * Construct a new GtkSkin using the given filename * * @param filename path to a gtk skin (gtkrc) file * @exception Exception Description of Exception */ public GtkSkin(String filename) throws Exception { this(SkinUtils.toURL(new File(filename))); } /** * Construct a new GtkSkin using the given url * * @param url path to a gtk skin (gtkrc) file * @exception Exception Description of Exception */ public GtkSkin(java.net.URL url) throws Exception { GtkParser parser = new GtkParser(url); parser.buildStructure(); init(parser); } /** * Constructor for the GtkSkin object * * @param url Description of Parameter * @param input Description of Parameter * @exception Exception Description of Exception */ public GtkSkin(java.net.URL url, java.io.InputStream input) throws Exception { GtkParser parser = new GtkParser(input); parser.setDirectory(url); parser.buildStructure(); init(parser); } /** * Constructor for the GtkSkin object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkSkin(GtkParser parser) throws Exception { init(parser); } /** * Gets the Personality attribute of the GtkSkin object * * @return The Personality value */ public SkinPersonality getPersonality() { return personality; } /** * Gets the Button attribute of the GtkSkin object * * @return The Button value */ public SkinButton getButton() { return button; } /** * Gets the Frame attribute of the GtkSkin object * * @return The Frame value */ public SkinFrame getFrame() { return null; } /** * Gets the Tab attribute of the GtkSkin object * * @return The Tab value */ public SkinTab getTab() { return tab; } /** * Gets the Progress attribute of the GtkSkin object * * @return The Progress value */ public SkinProgress getProgress() { return progress; } /** * Gets the Colors attribute of the GtkSkin object * * @return The Colors value */ public String[] getColors() { return colors; } /** * Gets the Scrollbar attribute of the GtkSkin object * * @return The Scrollbar value */ public SkinScrollbar getScrollbar() { return scrollbar; } /** * Gets the SplitPane attribute of the GtkSkin object * * @return The SplitPane value */ public SkinSplitPane getSplitPane() { return splitpane; } /** * Gets the Slider attribute of the GtkSkin object * * @return The Slider value */ public SkinSlider getSlider() { return slider; } /** * Description of the Method * * @param parser Description of Parameter * @exception Exception Description of Exception */ private void init(GtkParser parser) throws Exception { personality = new GtkPersonality(parser); button = new GtkButton(parser); tab = new GtkTab(parser); progress = new GtkProgress(parser); scrollbar = new GtkScrollbar(parser); splitpane = new GtkSplitPane(parser); slider = new GtkSlider(parser); separator = new GtkSeparator(parser); java.util.Vector colorList = new java.util.Vector(); for (int i = 0; i < swingToGtk.length; i = i + 2) { String colorName = swingToGtk[i + 1]; String color = null; if ("".equals(colorName)) { continue; } int index = colorName.indexOf("."); if (index != -1) { if (parser.getStyle(colorName.substring(0, index)) != null) { color = (String) parser.getStyle(colorName.substring(0, index)).getProperty(colorName.substring(index + 1)); } if (color == null) { colorName = colorName.substring(index + 1); } } if (color == null) { color = (String) parser.getStyle("default").getProperty(colorName); } if (color != null) { colorList.addElement(swingToGtk[i]); colorList.addElement(SkinUtils.decodeColor(color)); } } colors = new String[colorList.size()]; colorList.copyInto(colors); disabledTextBorder = GtkUtils.newButton(parser, "default", new String[]{"function", "state", "detail"}, new String[]{"FLAT_BOX", "INSENSITIVE", "text"}, true); textBorder = GtkUtils.newButton(parser, "default", new String[]{"function", "state", "detail"}, new String[]{"FLAT_BOX", null, "text"}, true); if (disabledTextBorder != null && textBorder != null) { textBorder = new BorderUIResource(new ActiveBorder(textBorder, disabledTextBorder)); } /* NEED MORE WORK ON TOOLTIP tooltipBorder = GtkUtils.newButton(parser, "default", new String[]{"function", "detail"}, new String[]{"FLAT_BOX", "tooltip"}); */ } javax.swing.border.Border textBorder; javax.swing.border.Border disabledTextBorder; /* NEED MORE WORK ON TOOLTIP javax.swing.border.Border tooltipBorder; */ public void initComponentDefaults(UIDefaults table) { // set border on components but based on property (for now) if (Boolean.TRUE.equals(UIManager.get("EnableBorders"))) { if (textBorder != null) { table.put("TextField.border", textBorder); table.put("PasswordField.border", textBorder); table.put("ScrollPane.border", textBorder); table.put("Spinner.border", textBorder); // table.put("ComboBox.border", textBorder); } /* NEED MORE WORK ON TOOLTIP if (tooltipBorder != null) { table.put("ToolTip.border", tooltipBorder); } */ } } /** * Get the user's current GTK skin location.
    * This could be used on a Linux platform. It looks for the user theme in the * ~/.gtkrc user file. * * @return the skin location or null if the * user's current skin can't be found * @exception GtkSkinNotFoundException Description of Exception */ public static String getDefaultSkinLocation() throws GtkSkinNotFoundException { String home = System.getProperty("user.home"); if (home == null) { return null; } String gtkrc = home + File.separator + ".gtkrc"; File f = new File(gtkrc); if (!f.exists()) { throw new GtkSkinNotFoundException(); } try { BufferedReader br = new BufferedReader(new FileReader(f)); String s = br.readLine(); while (s != null) { if (s.indexOf("gtkrc") != -1) { String s2 = s.substring(9, s.length() - 1); File f2 = new File(s2); if (f2.exists()) { return f2.getCanonicalPath(); } } s = br.readLine(); } } catch (Exception e) { throw new GtkSkinNotFoundException(); } throw new GtkSkinNotFoundException(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkSkinNotFoundException.java0000644000175000017500000000520510460410016027472 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; /** * Created on 18/02/2001 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:45 $ */ public class GtkSkinNotFoundException extends RuntimeException { } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkSlider.java0000644000175000017500000001511410460410014024452 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.plaf.skin.DefaultButton; import com.l2fprod.gui.plaf.skin.SkinSlider; import com.l2fprod.gui.plaf.skin.impl.AbstractSkinSlider; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.GtkParser; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; import javax.swing.JComponent; import javax.swing.JSlider; import javax.swing.SwingConstants; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:50:13 $ */ final class GtkSlider extends AbstractSkinSlider implements SkinSlider, SwingConstants { DefaultButton h_track, v_track; DefaultButton h_thumb, v_thumb; /** * Constructor for the GtkSlider object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkSlider(GtkParser parser) throws Exception { h_thumb = GtkUtils.newButton(parser, "GtkRange", new String[]{"function", "orientation"}, new String[]{"SLIDER", "HORIZONTAL"}, true); v_thumb = GtkUtils.newButton(parser, "GtkRange", new String[]{"function", "orientation"}, new String[]{"SLIDER", "VERTICAL"}, true); h_track = GtkUtils.newButton(parser, "GtkRange", new String[]{"function", "detail", "orientation"}, new String[]{"BOX", "trough", "HORIZONTAL"}); v_track = GtkUtils.newButton(parser, "GtkRange", new String[]{"function", "detail", "orientation"}, new String[]{"BOX", "trough", "VERTICAL"}); } /** * Gets the PreferredSize attribute of the GtkSlider object * * @param slider Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JSlider slider, java.awt.Dimension uiPreferredSize) { if (slider.getOrientation() == HORIZONTAL) { uiPreferredSize.height = Math.max(uiPreferredSize.height, h_thumb.getHeight()); } else { uiPreferredSize.width = Math.max(uiPreferredSize.width, v_thumb.getWidth()); } return uiPreferredSize; } public Dimension getThumbSize(JSlider slider) { if (h_thumb != null) { if (slider.getOrientation() == HORIZONTAL) { return h_thumb.getPreferredSize(); } else { return v_thumb.getPreferredSize(); } } else { return null; } } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return true; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { c.setOpaque(false); return true; } /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintTrack(Graphics g, JSlider slider, Rectangle trackBounds) { if (h_track != null) { if (slider.getOrientation() == HORIZONTAL) { h_track.paint(g, 0, 0, trackBounds.width, trackBounds.height, slider); } else { v_track.paint(g, 0, 0, trackBounds.width, trackBounds.height, slider); } return true; } else { return false; } } /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(Graphics g, JSlider slider, Rectangle thumbBounds) { // the UI translate the graphics to thumbBounds.x and .y if (h_thumb != null) { if (slider.getOrientation() == HORIZONTAL) { h_thumb.paint(g, 0, 0, h_thumb.getWidth(), h_thumb.getHeight(), slider); } else { v_thumb.paint(g, 0, 0, v_thumb.getWidth(), v_thumb.getHeight(), slider); } return true; } else { return false; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkSplitPane.java0000644000175000017500000002216110460410014025127 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import javax.swing.JSplitPane; import javax.swing.SwingConstants; import javax.swing.JComponent; import com.l2fprod.gui.plaf.skin.*; import com.l2fprod.gui.plaf.skin.impl.*; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:50:13 $ */ final class GtkSplitPane extends AbstractSkinSplitPane implements SkinSplitPane, SwingConstants { DefaultButton h_gutter, v_gutter; DefaultButton h_thumb, v_thumb; DefaultButton up, down, left, right; /** * Constructor for the GtkSplitPane object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkSplitPane(GtkParser parser) throws Exception { h_gutter = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "orientation"}, new String[]{"BOX", "HORIZONTAL"}); v_gutter = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "orientation"}, new String[]{"BOX", "VERTICAL"}); h_thumb = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "orientation"}, new String[]{"HANDLE", "HORIZONTAL"}); if (h_thumb == null) { h_thumb = h_gutter; } v_thumb = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "orientation"}, new String[]{"HANDLE", "VERTICAL"}); if (v_thumb == null) { v_thumb = v_gutter; } up = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "arrow_direction"}, new String[]{"ARROW", "UP"}); down = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "arrow_direction"}, new String[]{"ARROW", "DOWN"}); left = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "arrow_direction"}, new String[]{"ARROW", "LEFT"}); right = GtkUtils.newButton(parser, "GtkPaned", new String[]{"function", "arrow_direction"}, new String[]{"ARROW", "RIGHT"}); } /** * Gets the PreferredSize attribute of the GtkSplitPane object * * @param splitpane Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JSplitPane splitpane) { Insets insets = splitpane.getInsets(); int width = 0; int height = 0; if (splitpane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { width = Math.max(Math.max(up.getWidth(), down.getWidth()), 10); height = splitpane.getHeight() + insets.top + insets.bottom; } else { height = Math.max(Math.max(left.getHeight(), right.getHeight()), 10); width = splitpane.getWidth() + insets.left + insets.right; } Dimension d = new Dimension(width, height); return (d); //return (splitpane.getOrientation() == JSplitPane.VERTICAL_SPLIT) // ? new Dimension(Math.max(10, Math.min(up.getWidth(), v_thumb.getWidth())), 48) // : new Dimension(48, Math.max(10, Math.min(left.getHeight(), h_thumb.getHeight()))); } /** * Gets the ArrowPreferredSize attribute of the GtkSplitPane object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ public Dimension getArrowPreferredSize(int direction) { switch (direction) { case NORTH: return new Dimension(up.getWidth(), up.getHeight()); case SOUTH: return new Dimension(down.getWidth(), down.getHeight()); case WEST: return new Dimension(left.getWidth(), left.getHeight()); case EAST: return new Dimension(right.getWidth(), right.getHeight()); default: throw new Error("Invalid direction " + direction); } } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return true; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return true; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ public boolean paintArrow(java.awt.Graphics g, javax.swing.AbstractButton b, int direction) { java.awt.Dimension size = b.getSize(); switch (direction) { case NORTH: down.paint(g, 0, 0, size.width, size.height, b); break; case SOUTH: up.paint(g, 0, 0, size.width, size.height, b); break; case WEST: left.paint(g, 0, 0, size.width, size.height, b); break; case EAST: right.paint(g, 0, 0, size.width, size.height, b); } return true; } // track is under thumb /** * Description of the Method * * @param g Description of Parameter * @param splitpane Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ public boolean paintGutter(Graphics g, JSplitPane splitpane, Dimension d) { if (splitpane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { h_gutter.paint(g, 0, 0, d.width, d.height, splitpane); return true; } else { v_gutter.paint(g, 0, 0, d.width, d.height, splitpane); return true; } } // thumb is the variable area /** * Description of the Method * * @param g Description of Parameter * @param splitpane Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(Graphics g, JSplitPane splitpane, Dimension d) { // the UI translate the graphics to thumbBounds.x and .y if (splitpane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT && h_thumb != null) { h_thumb.paint(g, Math.max(0, (d.width - h_thumb.getWidth()) / 2), (d.height - h_thumb.getHeight()) / 2, Math.min(d.width, h_thumb.getWidth()), h_thumb.getHeight(), splitpane); } else if (splitpane.getOrientation() == JSplitPane.VERTICAL_SPLIT && v_thumb != null) { v_thumb.paint(g, (d.width - v_thumb.getWidth()) / 2, Math.max(0, (d.height - v_thumb.getHeight()) / 2), v_thumb.getWidth(), Math.min(d.height, v_thumb.getHeight()), splitpane); } else { return false; } return true; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkStyle.java0000644000175000017500000001367010460410014024335 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import javax.swing.tree.TreeNode; import java.util.Enumeration; import javax.swing.tree.MutableTreeNode; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:50:13 $ */ public final class GtkStyle extends GtkProps implements MutableTreeNode { /** * Description of the Field */ public String name; /** * Description of the Field */ public GtkEngine engine; /** * Description of the Field */ public MutableTreeNode parent; /** * Description of the Field */ public GtkParser parser; /** * Sets the Parent attribute of the GtkStyle object * * @param newParent The new Parent value */ public void setParent(MutableTreeNode newParent) { this.parent = newParent; } /** * Sets the UserObject attribute of the GtkStyle object * * @param object The new UserObject value */ public void setUserObject(Object object) { } /** * Gets the Engine attribute of the GtkStyle object * * @return The Engine value */ public GtkEngine getEngine() { return engine; } /** * Gets the Parser attribute of the GtkStyle object * * @return The Parser value */ public GtkParser getParser() { return parser; } /** * Gets the AllowsChildren attribute of the GtkStyle object * * @return The AllowsChildren value */ public boolean getAllowsChildren() { return true; } /** * Gets the ChildAt attribute of the GtkStyle object * * @param childIndex Description of Parameter * @return The ChildAt value */ public TreeNode getChildAt(int childIndex) { return (TreeNode) engine.getImages().elementAt(childIndex); } /** * Gets the ChildCount attribute of the GtkStyle object * * @return The ChildCount value */ public int getChildCount() { if (engine == null) { return 0; } else { return engine.getImages().size(); } } /** * Gets the Index attribute of the GtkStyle object * * @param node Description of Parameter * @return The Index value */ public int getIndex(TreeNode node) { return engine.getImages().indexOf(node); } /** * Gets the Parent attribute of the GtkStyle object * * @return The Parent value */ public TreeNode getParent() { return parent; } /** * Gets the Leaf attribute of the GtkStyle object * * @return The Leaf value */ public boolean isLeaf() { return false; } /** * Description of the Method * * @return Description of the Returned Value */ public Enumeration children() { throw new Error("Not implemented"); } /** * Description of the Method * * @return Description of the Returned Value */ public String toString() { return name; } /** * Description of the Method * * @param child Description of Parameter * @param index Description of Parameter */ public void insert(MutableTreeNode child, int index) { } /** * Description of the Method * * @param index Description of Parameter */ public void remove(int index) { } /** * Description of the Method * * @param node Description of Parameter */ public void remove(MutableTreeNode node) { } /** * Description of the Method */ public void removeFromParent() { } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkTab.java0000644000175000017500000002177710460410014023752 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.plaf.skin.DefaultButton; import com.l2fprod.gui.plaf.skin.SkinTab; import com.l2fprod.gui.plaf.skin.impl.AbstractSkinTab; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.GtkParser; import com.l2fprod.util.ImageUtils; import javax.swing.JComponent; import javax.swing.SwingConstants; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.5 $, $Date: 2005/11/19 09:18:06 $ */ final class GtkTab extends AbstractSkinTab implements SkinTab { DefaultButton selected_top, unselected_top; DefaultButton selected_bottom, unselected_bottom; DefaultButton selected_left, unselected_left; DefaultButton selected_right, unselected_right; DefaultButton border; /** * Constructor for the GtkTab object * * @param parser Description of Parameter * @exception Exception Description of Exception */ public GtkTab(GtkParser parser) throws Exception { unselected_top = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", "ACTIVE", "BOTTOM"}, false, false, false, false); selected_top = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", null, "BOTTOM"}, false, true, true, false); unselected_bottom = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", "ACTIVE", "TOP"}, false, true, false, false); selected_bottom = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", null, "TOP"}, false, true, false, false); unselected_left = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", "ACTIVE", "LEFT"}, false, true, false, false); selected_left = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", null, "LEFT"}, false, true, false, false); unselected_right = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", "ACTIVE", "RIGHT"}, false, true, false, false); selected_right = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "state", "gap_side"}, new String[]{"EXTENSION", null, "RIGHT"}, false, true, false, false); if (unselected_bottom == null) { unselected_bottom = unselected_top.getTopToBottom(); } if (selected_bottom == null) { selected_bottom = selected_top.getTopToBottom(); } if (unselected_left == null) { unselected_left = unselected_top.rotateCounterClockWise(); } if (selected_left == null) { selected_left = selected_top.rotateCounterClockWise(); } if (unselected_right == null) { unselected_right = unselected_top.rotateClockWise(); } if (selected_right == null) { selected_right = selected_top.rotateClockWise(); } border = GtkUtils.newButton(parser, "GtkNotebook", new String[]{"function", "gap_side"}, new String[]{"BOX_GAP", "TOP"}, false, true, false, true); if (border != null) { border.center = null; } } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return selected_top != null; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return true; } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param isSelected Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ public boolean paintTab(java.awt.Graphics g, int tabPlacement, boolean isSelected, int x, int y, int w, int h) { if (isSelected) { //HACK: set the height smaller, so that the tab is placed exactly on the content border h -= 2; switch (tabPlacement) { case SwingConstants.TOP: selected_top.paint(g, x, y, w, h, ImageUtils.producer); break; case SwingConstants.BOTTOM: selected_bottom.paint(g, x, y, w, h, ImageUtils.producer); break; case SwingConstants.LEFT: selected_left.paint(g, x, y, w, h, ImageUtils.producer); break; case SwingConstants.RIGHT: selected_right.paint(g, x, y, w, h, ImageUtils.producer); break; default: selected_top.paint(g, x, y, w, h, ImageUtils.producer); } } else { // HACK: set the width greater, so that the unselected tabs are placed exactly side by side w += 1; switch (tabPlacement) { case SwingConstants.TOP: unselected_top.paint(g, x, y, w, h, ImageUtils.producer); break; case SwingConstants.BOTTOM: unselected_bottom.paint(g, x, y, w, h, ImageUtils.producer); break; case SwingConstants.LEFT: unselected_left.paint(g, x, y, w, h, ImageUtils.producer); break; case SwingConstants.RIGHT: unselected_right.paint(g, x, y, w, h, ImageUtils.producer); break; default: unselected_top.paint(g, x, y, w, h, ImageUtils.producer); } } return true; } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param selectedIndex Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ public boolean paintContent(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { if (border != null) { border.paint(g, x, y, w, h, ImageUtils.producer); return true; } else { return false; } } public boolean paintGap(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { if (border != null) { border.paintGap(g, x, y, w, ImageUtils.producer); return true; } else { return false; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkTableHeaderRenderer.java0000644000175000017500000001121510460410014027055 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.plaf.skin.DefaultButton; import java.awt.Component; import java.awt.Graphics; import java.awt.Insets; import javax.swing.JTable; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class GtkTableHeaderRenderer extends DefaultTableCellRenderer implements javax.swing.plaf.UIResource { boolean isSelected; boolean hasFocus; transient DefaultButton itemSelected, itemUnselected; /** * Constructor for the GtkTableHeaderRenderer object */ public GtkTableHeaderRenderer( DefaultButton itemSelected, DefaultButton itemUnselected) { setOpaque(false); this.itemSelected = itemSelected; this.itemUnselected = itemUnselected; } /** * Gets the TableCellRendererComponent attribute of the * GtkTableHeaderRenderer object * * @param table Description of Parameter * @param value Description of Parameter * @param isSelected Description of Parameter * @param hasFocus Description of Parameter * @param row Description of Parameter * @param column Description of Parameter * @return The TableCellRendererComponent value */ public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (table != null) { JTableHeader header = table.getTableHeader(); if (header != null) { setForeground(header.getForeground()); setBackground(header.getBackground()); setFont(header.getFont()); } } this.isSelected = isSelected; this.hasFocus = hasFocus; setText((value == null) ? "" : value.toString()); Insets insets; if (isSelected || hasFocus) { insets = itemSelected.getInsets(); } else { insets = itemUnselected.getInsets(); } setBorder(new EmptyBorder(insets)); return this; } /** * Description of the Method * * @param g Description of Parameter */ protected void paintComponent(Graphics g) { if (isSelected || hasFocus) { itemSelected.paint(g, this); } else { itemUnselected.paint(g, this); } super.paintComponent(g); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/gtk/GtkUtils.java0000644000175000017500000002315410460410014024333 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.gtk; import com.l2fprod.gui.plaf.skin.impl.gtk.parser.GtkParser; import com.l2fprod.util.ImageUtils; import java.awt.Image; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.5 $, $Date: 2005/11/19 09:18:26 $ */ final class GtkUtils { /** * Description of the Field */ public final static boolean DEBUG = "true".equals(com.l2fprod.util.AccessUtils.getProperty("debug.gtk")); /** * Description of the Method * * @param parser Description of Parameter * @param style Description of Parameter * @param keys Description of Parameter * @param values Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public static GtkDefaultButton newButton(GtkParser parser, String style, String[] keys, String[] values) throws Exception { return newButton(parser, style, keys, values, false, false, true, false); } /** * Description of the Method * * @param parser Description of Parameter * @param style Description of Parameter * @param keys Description of Parameter * @param values Description of Parameter * @param useOverlay Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public static GtkDefaultButton newButton(GtkParser parser, String style, String[] keys, String[] values, boolean useOverlay) throws Exception { return newButton(parser, style, keys, values, useOverlay, false, true, false); } public static GtkDefaultButton newButton(GtkParser parser, String style, String[] keys, String[] values, boolean useOverlay, boolean exactMatch) throws Exception { return newButton(parser, style, keys, values, useOverlay, exactMatch, true, false); } /** * Description of the Method * * @param parser Description of Parameter * @param style Description of Parameter * @param keys Description of Parameter * @param values Description of Parameter * @param useOverlay Description of Parameter * @param exactMatch Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public static GtkDefaultButton newButton(GtkParser parser, String style, String[] keys, String[] values, boolean useOverlay, boolean exactMatch, boolean useDefault, boolean useGap) throws Exception { if (DEBUG) { System.out.println("Looking in " + style + " for "); for (int i = 0, c = keys.length; i < c; i++) { System.out.println("\t" + keys[i] + " = " + values[i]); } } try { GtkDefaultButton button = null; // parser.getClass(style).getStyles GtkStyle[] styles; if (parser.getClass(style) == null) { styles = new GtkStyle[]{parser.getStyle(style)}; } else { if (DEBUG) { System.out.println("style " + style + " exists as class"); } styles = parser.getClass(style).getStyles(); } if (DEBUG) { System.out.println("Style " + style + " (count:" + styles.length + ")"); } for (int i = 0, c = styles.length; i < c; i++) { GtkStyle gtkstyle = styles[i]; if (DEBUG) { System.out.println("\tSub: " + styles[i]); } if (gtkstyle != null) { GtkImage image = gtkstyle.getEngine().findImage(keys, values, exactMatch); if (DEBUG) { System.out.println("\t\tImage is " + image); } if (image != null) { Image bitmap = null; Image gap = null; Image gap_start = null; Image gap_end = null; GtkBorder border = (GtkBorder) image.getProperty(useOverlay ? "overlay_border" : "border"); if (useOverlay && border == null) { border = (GtkBorder) image.getProperty("border"); } if (useOverlay == false && border == null) { border = (GtkBorder) image.getProperty("overlay_border"); } if (border == null) { border = new GtkBorder(0, 0, 0, 0); } bitmap = image.getImage(parser.getDirectory(), useOverlay ? "overlay_file" : "file"); if (useOverlay && bitmap == null) { bitmap = image.getImage(parser.getDirectory(), "file"); } if (useOverlay == false && bitmap == null) { bitmap = image.getImage(parser.getDirectory(), "overlay_file"); } if(useGap) { gap = image.getImage(parser.getDirectory(), "gap_file"); gap_start = image.getImage(parser.getDirectory(), "gap_start_file"); gap_end = image.getImage(parser.getDirectory(), "gap_end_file"); } button = new GtkDefaultButton(bitmap, gap, gap_start, gap_end, bitmap.getWidth(ImageUtils.producer), bitmap.getHeight(ImageUtils.producer), border.top, border.right, border.bottom, border.left); button.setCenterFill("TRUE".equals(image.getProperty(useOverlay ? "overlay_stretch" : "stretch")) ? ImageUtils.PAINT_STRETCH : ImageUtils.PAINT_TILE); // use by combobox to know if arrow has to be painted // big hack here! button.hasArrow = !"false".equals(image.getProperty("arrow")); break; } } } // if the button is still null and style != default // try more general style, this can give unpredictable result, // keys must be sorted by importance if (button == null && (!"default".equals(style)) && useDefault) { button = newButton(parser, "default", keys, values, false, true, false, false); int length = keys.length; while ((length > 0) && (button == null)) { length--; String[] subkeys = new String[length]; System.arraycopy(keys, 0, subkeys, 0, length); button = newButton(parser, "default", subkeys, values, false, true, false, false); } // if the button is still null, our latest try is exactMatch in default if (button == null) { if (DEBUG) { System.out.println("defaulting to exactMatch"); } button = newButton(parser, "default", keys, values, false, true); } } if (DEBUG && button == null) { System.out.println("button not found for " + style); System.out.println("image {"); for (int i = 0, c = keys.length; i < c; i++) { System.out.println("\t" + keys[i] + " = " + values[i]); } System.out.println("}"); Thread.dumpStack(); } return button; } catch (java.io.FileNotFoundException e) { // can be thrown if the image specified in gtkrc points to a wrong file return null; } catch (RuntimeException e) { return null; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/kde/0000755000175000017500000000000010460410034021675 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/kde/KdeFrame.java0000644000175000017500000004104110460410012024212 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.kde; import com.l2fprod.gui.plaf.skin.DefaultButton; import com.l2fprod.gui.plaf.skin.SkinTitlePane; import com.l2fprod.gui.plaf.skin.SkinUtils; import com.l2fprod.gui.plaf.skin.SkinWindowButton; import com.l2fprod.gui.plaf.skin.impl.AbstractSkinFrame; import com.l2fprod.util.IniFile; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image; import java.awt.Insets; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.plaf.BorderUIResource; /** * @author $Author: zombi $ * @created 27 avril 2002 * @version $Revision: 1.8 $, $Date: 2005/07/02 21:47:30 $ */ final class KdeFrame extends AbstractSkinFrame { DefaultButton topSelected, topUnselected; int topHeight = 17; java.util.Vector buttonList; int textShiftLeft = SkinTitlePane.ICON_OFFSET, textShiftRight = 0; int textAlignment = LEFT; boolean textAbsolutePosition = false; boolean pixmapUnderTitle = false; boolean titleFrameShaded = false; Border border; final static String[] TEXT_ALIGNMENTS = { "left", "middle", "right" }; final static int LEFT = 0; final static int MIDDLE = 1; final static int RIGHT = 2; /** * Constructor for the KdeFrame object * * @param ini Description of Parameter * @param skinURL Description of Parameter * @exception Exception Description of Exception */ public KdeFrame(IniFile ini, URL skinURL) throws Exception { String path = ini.getKeyValue("Window Titlebar", "TitlebarPixmapActive"); if (path != null) { Image image = SkinUtils.loadImage(new URL(skinURL, path)); Insets border; if (ini.getKeyValue("Window Titlebar", "TitlebarPixmapActiveBorder") != null) { border = SkinUtils.stringToInsets(ini.getKeyValue("Window Titlebar", "TitlebarPixmapActiveBorder")); } else { border = new Insets(ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveTop"), ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveLeft"), ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveBottom"), ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveRight")); } topSelected = new DefaultButton(image, image.getWidth(null), image.getHeight(null), border.top, border.right, border.bottom, border.left); topHeight = topSelected.getHeight(); } path = ini.getKeyValue("Window Titlebar", "TitlebarPixmapInactive"); if (path != null) { Image image = SkinUtils.loadImage(new URL(skinURL, path)); Insets border; if (ini.getKeyValue("Window Titlebar", "TitlebarPixmapActiveBorder") != null) { border = SkinUtils.stringToInsets(ini.getKeyValue("Window Titlebar", "TitlebarPixmapActiveBorder")); } else { border = new Insets(ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveTop"), ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveLeft"), ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveBottom"), ini.getKeyIntValue("Window Titlebar", "TitlebarPixmapActiveRight")); } topUnselected = new DefaultButton(image, image.getWidth(null), image.getHeight(null), border.top, border.right, border.bottom, border.left); // topUnselected = SkinUtils.loadImage(new URL(skinURL, path)); topHeight = Math.max(topHeight, topUnselected.getHeight()); } pixmapUnderTitle = "yes".equals(ini.getKeyValue("Window Titlebar", "PixmapUnderTitleText")); titleFrameShaded = "yes".equals(ini.getKeyValue("Window Titlebar", "TitleFrameShaded")); String textAlignmentValue = ini.getKeyValue("Window Titlebar", "TitleAlignment"); if (textAlignmentValue != null) { textAlignmentValue = textAlignmentValue.toLowerCase(); for (int i = 0, c = TEXT_ALIGNMENTS.length; i < c; i++) { if (TEXT_ALIGNMENTS[i].equals(textAlignmentValue)) { textAlignment = i; break; } } } buttonList = new java.util.Vector(); textAbsolutePosition = "yes".equals(ini.getKeyValue("Window Titlebar", "TitleAbsolutePosition")); final String letters = "ABCDEF"; if (ini.getSection("Window Button Layout") == null) { ini.addSection("Window Button Layout"); ini.setKeyValue("Window Button Layout", "ButtonA", "Off"); ini.setKeyValue("Window Button Layout", "ButtonB", "Off"); ini.setKeyValue("Window Button Layout", "ButtonC", "Off"); ini.setKeyValue("Window Button Layout", "ButtonD", "Minimize"); ini.setKeyValue("Window Button Layout", "ButtonE", "Maximize"); ini.setKeyValue("Window Button Layout", "ButtonF", "Close"); } for (int i = 0, c = letters.length(); i < c; i++) { String button = ini.getKeyValue("Window Button Layout", "Button" + letters.charAt(i)); if ((button != null) && ("Off".equalsIgnoreCase(button) == false)) { FrameButton fb = new FrameButton(ini, skinURL, button); int align = ini.getKeyIntValue("Window Button Layout", "Button"+letters.charAt(i)+"Align",-1); if (align==-1) { align = (i < c / 2) ? SkinTitlePane.ALIGN_TOP_LEFT : SkinTitlePane.ALIGN_TOP_RIGHT; } fb.setAlign(align); fb.setEnabled(ini.getKeyBooleanValue("Window Button Layout", "Button"+letters.charAt(i)+"Enabled",true)); fb.setTooltip(ini.getKeyValue("Window Button Layout", "Button"+letters.charAt(i)+"Tooltip")); if (fb.selectedIcon != null) { if (align== SkinTitlePane.ALIGN_TOP_LEFT) { textShiftLeft += fb.selectedIcon.getIconWidth(); } else { textShiftRight += fb.selectedIcon.getIconWidth(); } topHeight = Math.max(topHeight, fb.selectedIcon.getIconHeight()); } buttonList.addElement(fb); } } textShiftLeft += 4; textShiftRight += 4; if ((ini.getSection("Window Border") != null) && (ini.getSection("Window Border").size() > 0)) { border = new BorderUIResource(new KdeFrameBorder(ini, skinURL)); UIManager.put("InternalFrame.border", border); } else { //border = UIManager.getBorder("InternalFrame.border"); } } /** * Gets the TopPreferredSize attribute of the KdeFrame object * * @return The TopPreferredSize value */ public Dimension getTopPreferredSize() { return new Dimension(textShiftLeft + textShiftRight + 50, topHeight); } /** * Gets the WindowButtons attribute of the KdeFrame object * * @param align Description of Parameter * @return The WindowButtons value */ public SkinWindowButton[] getWindowButtons(int align) { java.util.Vector buttons = new java.util.Vector(); for (int i = 0, c = buttonList.size(); i < c; i++) { FrameButton newB = (FrameButton) buttonList.elementAt(i); if (newB.getAlign() == align) { buttons.addElement(newB.createButton()); } } SkinWindowButton[] results = new SkinWindowButton[buttons.size()]; buttons.copyInto(results); return results; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return true; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { if (border != null) { c.setBorder(border); c.setOpaque(false); return true; } else { return false; } } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param isSelected Description of Parameter * @param title Description of Parameter * @return Description of the Returned Value */ public boolean paintTop(Graphics g, Component c, boolean isSelected, String title) { if (topSelected != null && topUnselected != null) { if (isSelected) { topSelected.paint(g, 0, 0, c); } else { topUnselected.paint(g, 0, 0, c); } } else { // fill a rectangle Color oldColor = g.getColor(); if (isSelected) { g.setColor(UIManager.getColor("InternalFrame.activeTitleBackground")); } else { g.setColor(UIManager.getColor("InternalFrame.inactiveTitleBackground")); } g.fillRect(0, 0, ((JComponent) c).getWidth(), ((JComponent) c).getHeight()); g.setColor(oldColor); } if (title != null) { FontMetrics fm = g.getFontMetrics(); int fmHeight = fm.getHeight() - fm.getLeading(); int baseline = (topHeight - fmHeight) / 2 + fm.getAscent() + fm.getLeading(); int width = fm.stringWidth(title); int x = 0; switch (textAlignment) { case LEFT: x = textShiftLeft; break; case MIDDLE: if (textAbsolutePosition) { x = (((JComponent)c).getWidth() - width) / 2; } else { x = (((JComponent) c).getWidth() - textShiftLeft - textShiftRight) / 2 + textShiftLeft - width / 2; } break; case RIGHT: x = ((JComponent) c).getWidth() - width - textShiftRight; break; } if (pixmapUnderTitle == false) { Color oldColor = g.getColor(); if (isSelected) { g.setColor(UIManager.getColor("InternalFrame.activeTitleBackground")); } else { g.setColor(UIManager.getColor("InternalFrame.inactiveTitleBackground")); } g.fillRect(x, 0, width, ((JComponent) c).getHeight()); g.setColor(oldColor); } if (isSelected && titleFrameShaded) { Color oldColor = g.getColor(); g.setColor(oldColor.darker().darker()); g.drawString(title, x + 1, baseline + 1); g.setColor(oldColor); } g.drawString(title, x, baseline); } return true; } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class FrameButton { ImageIcon selectedIcon; private ImageIcon rolloverIcon, downIcon, unselectedIcon; int align; int action = SkinTitlePane.NO_ACTION; boolean enabled = true; String command; String tooltip; /** * Constructor for the FrameButton object * * @param ini Description of Parameter * @param skinURL Description of Parameter * @param command Description of Parameter * @exception Exception Description of Exception */ FrameButton(IniFile ini, URL skinURL, String command) throws Exception { if ("Iconify".equals(command)) { command = "Minimize"; } String path = ini.getKeyValue("Window Titlebar", command + "Button"); if (path != null) { selectedIcon = new ImageIcon(SkinUtils.loadImage(new URL(skinURL, path))); unselectedIcon = selectedIcon; downIcon = selectedIcon; rolloverIcon = selectedIcon; } path = ini.getKeyValue("Window Titlebar", command + "DownButton"); if (path != null) { downIcon = new ImageIcon(SkinUtils.loadImage(new URL(skinURL, path))); } path = ini.getKeyValue("Window Titlebar", command + "InactiveButton"); if (path != null) { unselectedIcon = new ImageIcon(SkinUtils.loadImage(new URL(skinURL, path))); } path = ini.getKeyValue("Window Titlebar", command + "RolloverButton"); if (path != null) { rolloverIcon = new ImageIcon(SkinUtils.loadImage(new URL(skinURL, path))); } if ("Maximize".equalsIgnoreCase(command)) { action = SkinTitlePane.MAXIMIZE_ACTION; } else if ("Minimize".equalsIgnoreCase(command)) { action = SkinTitlePane.MINIMIZE_ACTION; } else if ("Close".equalsIgnoreCase(command)) { action = SkinTitlePane.CLOSE_ACTION; } this.command = command; } public void setEnabled(boolean b) { this.enabled = b; } public void setTooltip(String tooltip) { this.tooltip = tooltip; } /** * Sets the Align attribute of the FrameButton object * * @param align The new Align value */ public void setAlign(int align) { this.align = align; } /** * Gets the Align attribute of the FrameButton object * * @return The Align value */ public int getAlign() { return align; } /** * Description of the Method * * @return Description of the Returned Value */ public SkinWindowButton createButton() { SkinWindowButton button = new SkinWindowButton(-1, (topHeight - selectedIcon.getIconHeight()) / 2, align, action); if (selectedIcon != null) { button.setSize(selectedIcon.getIconWidth(), selectedIcon.getIconHeight()); button.setIcon(unselectedIcon); button.setRolloverIcon(rolloverIcon!=null?rolloverIcon:selectedIcon); button.setRolloverSelectedIcon(rolloverIcon!=null?rolloverIcon:selectedIcon); button.setPressedIcon(downIcon); button.setSelectedIcon(selectedIcon); button.setDisabledIcon(unselectedIcon); button.setDisabledSelectedIcon(unselectedIcon); button.setActionCommand(command); button.setEnabled(enabled); if (tooltip!=null) button.setToolTipText(tooltip); } return button; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/kde/KdeFrameBorder.java0000644000175000017500000001073210460410014025355 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.kde; import com.l2fprod.gui.plaf.skin.DefaultButton; import com.l2fprod.gui.plaf.skin.SkinUtils; import com.l2fprod.util.IniFile; import java.net.URL; /** * Created on 08/04/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:50:31 $ */ final class KdeFrameBorder extends DefaultButton { /** * Constructor for the KdeFrameBorder object * * @param ini Description of Parameter * @param skinURL Description of Parameter * @exception Exception Description of Exception */ public KdeFrameBorder(IniFile ini, URL skinURL) throws Exception { super(ini.isNullOrEmpty("Window Border", "shapePixmapTop") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapTop"))), ini.isNullOrEmpty("Window Border", "shapePixmapBottom") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapBottom"))), ini.isNullOrEmpty("Window Border", "shapePixmapLeft") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapLeft"))), ini.isNullOrEmpty("Window Border", "shapePixmapRight") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapRight"))), ini.isNullOrEmpty("Window Border", "shapePixmapTopLeft") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapTopLeft"))), ini.isNullOrEmpty("Window Border", "shapePixmapTopRight") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapTopRight"))), ini.isNullOrEmpty("Window Border", "shapePixmapBottomLeft") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapBottomLeft"))), ini.isNullOrEmpty("Window Border", "shapePixmapBottomRight") ? null : SkinUtils.loadImage(new URL(skinURL, ini.getKeyValue("Window Border", "shapePixmapBottomRight")))); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/kde/KdePersonality.java0000644000175000017500000001045610460410012025477 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.kde; import com.l2fprod.gui.plaf.skin.SkinUtils; import com.l2fprod.gui.plaf.skin.impl.AbstractSkinPersonality; import com.l2fprod.util.ImageUtils; import com.l2fprod.util.IniFile; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.net.URL; import javax.swing.JComponent; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:50:31 $ */ final class KdePersonality extends AbstractSkinPersonality { Image wallpaper; int wallpaperPaintMode; /** * Constructor for the KdePersonality object * * @param ini Description of Parameter * @param skinURL Description of Parameter * @exception Exception Description of Exception */ public KdePersonality(IniFile ini, URL skinURL) throws Exception { String path = ini.getKeyValue("Display", "Wallpaper0"); if (path != null) { try { wallpaper = SkinUtils.loadImage(new URL(skinURL, path)); wallpaperPaintMode = "Scaled".equalsIgnoreCase(ini.getKeyValue("Display", "WallpaperMode0")) ? ImageUtils.PAINT_STRETCH : ImageUtils.PAINT_TILE; } catch (Exception e) { // silently ignore the wallpaper loading error wallpaper = null; } } } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintBackground(Graphics g, Component c) { if (wallpaper != null) { ImageUtils.paint(c, g, wallpaper, wallpaperPaintMode); return true; } else { return false; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/kde/KdeSkin.java0000644000175000017500000001504510460410012024071 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl.kde; import java.io.File; import java.io.InputStream; import java.net.URL; import com.l2fprod.util.IniFile; import com.l2fprod.gui.plaf.skin.*; import com.l2fprod.gui.plaf.skin.impl.AbstractSkin; /** * KDE (The K Desktop Environment) Skin Support.
    * KdeSkin can be used in conjunction with a kde.themerc file.
    * You can find skins at: *
  • kde.themes.org
    *
    * Simply extract the skin file in a directory and use:
    *
    * * SkinLookAndFeel.setSkin(new KdeSkin("c:\downloads\myskin\kde\kde.themerc"));
    * UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); *

    *
    * to enable skins in your application !
    *
    *
    *
    * * * @author fred */ public final class KdeSkin extends AbstractSkin { private String[] colors; private final static Object[] swingToKde = { "desktop", new String[]{"desktop", "background"}, "activeCaption", new String[]{"activeBackground", "background"}, "activeCaptionText", new String[]{"activeForeground", "foreground"}, "activeCaptionBorder", new String[]{""}, "inactiveCaption", new String[]{"inactiveBackground", "background"}, "inactiveCaptionText", new String[]{"inactiveForeground", "foreground"}, "inactiveCaptionBorder", new String[]{""}, "window", new String[]{"windowBackground", "background"}, "windowBorder", new String[]{""}, "windowText", new String[]{"windowForeground", "foreground"}, "menu", new String[]{"background"}, "menuPressedItemB", new String[]{"selectBackground"}, "menuPressedItemF", new String[]{"selectForeground"}, "menuText", new String[]{"foreground"}, "text", new String[]{"background"}, "textText", new String[]{"foreground"}, "textHighlight", new String[]{"selectBackground"}, "textHighlightText", new String[]{"selectForeground"}, "textInactiveText", new String[]{""}, "control", new String[]{"background"}, "controlText", new String[]{"foreground"}, "controlHighlight", new String[]{""}, "controlLtHighlight", new String[]{""}, "controlShadow", new String[]{""}, "controlDkShadow", new String[]{""}, "scrollbar", new String[]{""}, "info", new String[]{""}, "infoText", new String[]{""}, }; /** * Construct a new KDE skin with the given filename * * @param filename path to a kde (themerc) skin file * @exception Exception Description of Exception */ public KdeSkin(String filename) throws Exception { this(SkinUtils.toURL(new File(filename))); } /** * Constructor for the KdeSkin object * * @param skinURL Description of Parameter * @exception Exception Description of Exception */ public KdeSkin(URL skinURL) throws Exception { this(skinURL, skinURL.openStream()); } /** * Constructor for the KdeSkin object * * @param skinURL Description of Parameter * @param input Description of Parameter * @exception Exception Description of Exception */ public KdeSkin(URL skinURL, InputStream input) throws Exception { IniFile ini = new IniFile(input); personality = new KdePersonality(ini, skinURL); frame = new KdeFrame(ini, skinURL); java.util.Vector colorList = new java.util.Vector(); for (int i = 0; i < swingToKde.length; i = i + 2) { // "swingcolor", { "c1", "c2" } String[] locals = (String[]) swingToKde[i + 1]; if (locals != null && locals.length > 0) { for (int j = 0, d = locals.length; j < d; j++) { if (ini.getKeyValue("Colors", locals[j]) != null) { colorList.addElement(swingToKde[i]); colorList.addElement(SkinUtils.decodeColor(ini.getKeyValue("Colors", locals[j]))); break; } } } } colors = new String[colorList.size()]; colorList.copyInto(colors); } /** * Gets the Colors attribute of the KdeSkin object * * @return The Colors value */ public String[] getColors() { return colors; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkin.java0000644000175000017500000001314410460410012024364 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import com.l2fprod.gui.plaf.skin.*; import javax.swing.UIDefaults; /** * Default Skin Support.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:29 $ */ public class AbstractSkin implements Skin { /** * Description of the Field */ protected SkinPersonality personality; /** * Description of the Field */ protected SkinButton button; /** * Description of the Field */ protected SkinFrame frame; /** * Description of the Field */ protected SkinTab tab; /** * Description of the Field */ protected SkinProgress progress; /** * Description of the Field */ protected SkinScrollbar scrollbar; /** * Description of the Field */ protected SkinSplitPane splitpane; /** * Description of the Field */ protected SkinSeparator separator; /** * Description of the Field */ protected SkinSlider slider; /** * Description of the Field */ protected java.util.Hashtable resources = new java.util.Hashtable(); /** * Gets the Personality attribute of the AbstractSkin object * * @return The Personality value */ public SkinPersonality getPersonality() { return personality; } /** * Gets the Button attribute of the AbstractSkin object * * @return The Button value */ public SkinButton getButton() { return button; } /** * Gets the Frame attribute of the AbstractSkin object * * @return The Frame value */ public SkinFrame getFrame() { return frame; } /** * Gets the Tab attribute of the AbstractSkin object * * @return The Tab value */ public SkinTab getTab() { return tab; } /** * Gets the Progress attribute of the AbstractSkin object * * @return The Progress value */ public SkinProgress getProgress() { return progress; } /** * Gets the Colors attribute of the AbstractSkin object * * @return The Colors value */ public String[] getColors() { return null; } /** * Gets the Scrollbar attribute of the AbstractSkin object * * @return The Scrollbar value */ public SkinScrollbar getScrollbar() { return scrollbar; } /** * Gets the Separator attribute of the AbstractSkin object * * @return The Separator value */ public SkinSeparator getSeparator() { return separator; } /** * Gets the SplitPane attribute of the AbstractSkin object * * @return The SplitPane value */ public SkinSplitPane getSplitPane() { return splitpane; } /** * Gets the Slider attribute of the AbstractSkin object * * @return The Slider value */ public SkinSlider getSlider() { return slider; } /** * Gets the Resource attribute of the AbstractSkin object * * @param key Description of Parameter * @return The Resource value */ public Object getResource(Object key) { return resources.get(key); } /** * Description of the Method */ public void unload() { } public void initComponentDefaults(UIDefaults table) { } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinButton.java0000644000175000017500000001332010460410014025556 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import java.awt.*; import javax.swing.*; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:29 $ */ public class AbstractSkinButton extends AbstractSkinComponent implements SkinButton { public AbstractSkinButton() { } public AbstractSkinButton(Skin p_ParentSkin) { super(p_ParentSkin); } /** * Gets the CheckBoxIconSize attribute of the AbstractSkinButton object * * @return The CheckBoxIconSize value */ public Dimension getCheckBoxIconSize() { return null; } /** * Gets the RadioButtonIconSize attribute of the AbstractSkinButton object * * @return The RadioButtonIconSize value */ public Dimension getRadioButtonIconSize() { return null; } /** * Gets the RadioIcon attribute of the AbstractSkinButton object * * @param b Description of Parameter * @return The RadioIcon value */ public Icon getRadioIcon(AbstractButton b) { return null; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return false; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @return Description of the Returned Value */ public final boolean paintButton(Graphics g, AbstractButton b) { ButtonModel model = b.getModel(); if (b.isEnabled() == false) { return paintDisabledButton(g, b); } else { //PENDING(fred): should handle disabledINButton, // when the toggle button is disabled but pressed (armed) if (b instanceof JToggleButton) { if ((model.isArmed() && model.isPressed()) || model.isSelected()) { return paintPressedToggle(g, b); } else if (model.isRollover()) { return paintRolloverToggle(g, b); } else { return paintToggle(g, b); } } else if (b instanceof JButton) { if (model.isPressed() && (b.isRolloverEnabled() == false || (b.isRolloverEnabled() && model.isRollover()))) { return paintPressedButton(g, b); } else if (model.isRollover()) { return paintRolloverButton(g, b); } else { return paintNormalButton(g, b); } } } return false; } protected boolean paintDisabledButton(Graphics g, AbstractButton b) { return false; } protected boolean paintPressedToggle(Graphics g, AbstractButton b) { return false; } protected boolean paintRolloverToggle(Graphics g, AbstractButton b) { return false; } protected boolean paintToggle(Graphics g, AbstractButton b) { return false; } protected boolean paintPressedButton(Graphics g, AbstractButton b) { return false; } protected boolean paintRolloverButton(Graphics g, AbstractButton b) { return false; } protected boolean paintNormalButton(Graphics g, AbstractButton b) { return false; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinComponent.java0000644000175000017500000000643710460410014026260 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import com.l2fprod.gui.plaf.skin.*; /** * Default Skin Support.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:29 $ */ public class AbstractSkinComponent implements SkinComponent { private Skin m_Skin; public AbstractSkinComponent() { } public AbstractSkinComponent(Skin p_ParentSkin) { m_Skin = p_ParentSkin; } public Skin getSkin() { return m_Skin; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return false; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(javax.swing.JComponent c) { return false; } public void uninstallSkin(javax.swing.JComponent c) { } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinFrame.java0000644000175000017500000000765610460410014025354 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import java.awt.*; import javax.swing.*; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2004/07/18 16:58:31 $ */ public class AbstractSkinFrame extends AbstractSkinComponent implements SkinFrame { /** * Gets the WindowButtons attribute of the AbstractSkinFrame object * * @param align Description of Parameter * @return The WindowButtons value */ public SkinWindowButton[] getWindowButtons(int align) { return new SkinWindowButton[0]; } /** * Gets the TopPreferredSize attribute of the AbstractSkinFrame object * * @return The TopPreferredSize value */ public Dimension getTopPreferredSize() { return null; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return false; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param isSelected Description of Parameter * @param title Description of Parameter * @return Description of the Returned Value */ public boolean paintTop(Graphics g, Component c, boolean isSelected, String title) { return false; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinPersonality.java0000644000175000017500000001373310460410014026624 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import java.awt.*; import javax.swing.*; import javax.swing.table.*; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:29 $ */ public class AbstractSkinPersonality extends AbstractSkinComponent implements SkinPersonality { /** * Gets the ComboBoxInsets attribute of the AbstractSkinPersonality object * * @return The ComboBoxInsets value */ public java.awt.Insets getComboBoxInsets() { return null; } /** * Gets the ComboBoxPreferredSize attribute of the AbstractSkinPersonality * object * * @param c Description of Parameter * @return The ComboBoxPreferredSize value */ public java.awt.Dimension getComboBoxPreferredSize(javax.swing.JComboBox c) { return null; } /** * Gets the TableHeaderRenderer attribute of the AbstractSkinPersonality * object * * @return The TableHeaderRenderer value */ public TableCellRenderer getTableHeaderRenderer() { return null; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return false; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return false; } public void uninstallSkin(JComponent c) { } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintDialog(Graphics g, Component c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintFocus(Graphics g, JComponent c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintMenu(Graphics g, JMenu c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintMenuItem(Graphics g, JMenuItem c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintBackground(Graphics g, Component c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param bounds Description of Parameter * @param hasFocus Description of Parameter * @return Description of the Returned Value */ public boolean paintComboBox(Graphics g, JComboBox c, Rectangle bounds, boolean hasFocus, boolean isRollover) { return false; } /** * Description of the Method * * @return Description of the Returned Value */ public TableCellRenderer createTableHeaderRenderer() { return getTableHeaderRenderer(); } /** * Description of the Method * * @return Description of the Returned Value */ public ListCellRenderer createListCellRenderer() { return null; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinProgress.java0000644000175000017500000001561310460410016026120 0ustar twernertwerner/* * ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. 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. * 3. The end-user documentation included with the redistribution, if any, * must include the following acknowlegement: "This product includes software * developed by L2FProd.com (http://www.L2FProd.com/)." Alternately, this * acknowlegement may appear in the software itself, if and wherever such * third-party acknowlegements normally appear. * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not be * used to endorse or promote products derived from this software without prior * written permission. For written permission, please contact info@L2FProd.com. * 5. Products derived from this software may not be called "SkinLF" nor may * "SkinLF" appear in their names without prior written permission of * L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 * L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import java.awt.*; import javax.swing.*; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ @created 27 avril 2002 * @version $Revision: 1.4 $, $Date: 2005/10/09 13:36:38 $ */ public abstract class AbstractSkinProgress extends AbstractSkinComponent implements SkinProgress { protected DefaultButton progressBarBackHorizontal; protected DefaultButton progressBarHorizontal; protected DefaultButton progressBarBackVertical; protected DefaultButton progressBarVertical; protected int orientation = JProgressBar.HORIZONTAL; protected final Dimension minimumSize = new Dimension(50, 17); /** * Set UIManager.put("ProgressBar.windowAnimation", Boolean.TRUE) to use the * window painting mode if the progress bar is inderterminate. */ protected boolean useWindow; public AbstractSkinProgress() { useWindow = Boolean.TRUE.equals(UIManager.get("ProgressBar.windowAnimation")); } /** * Gets the MinimumSize attribute of the AbstractSkinProgress object * * @param progress Description of Parameter * @return The MinimumSize value */ public final Dimension getMinimumSize(javax.swing.JProgressBar progress) { if (JProgressBar.VERTICAL == progress.getOrientation()) { return progressBarBackVertical.getMinimumSize(); } else { return progressBarBackHorizontal.getMinimumSize(); } } /** * Description of the Method * * @return Description of the Returned Value */ public final boolean status() { return progressBarHorizontal != null; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public final boolean installSkin(JComponent c) { return true; } protected final void paintBackBar(Graphics g, JProgressBar progress) { if (JProgressBar.VERTICAL == progress.getOrientation()) { if (progressBarBackVertical != null) { progressBarBackVertical.paint( g, 0, 0, progress.getWidth(), progress.getHeight(), progress); } } else { if (progressBarBackHorizontal != null) { progressBarBackHorizontal.paint( g, 0, 0, progress.getWidth(), progress.getHeight(), progress); } } } /** * Description of the Method * * @param g Description of Parameter * @param progress Description of Parameter * @return Description of the Returned Value */ public final boolean paintProgress( java.awt.Graphics g, javax.swing.JProgressBar progress) { int x, y, width, height; x = y = width = height = 0; paintBackBar(g, progress); if ((progress.getValue() > progress.getMinimum())) { if (JProgressBar.VERTICAL == progress.getOrientation()) { height = (int) ((double)progress.getValue() * progress.getHeight() / progress.getMaximum()); y = progress.getHeight() - height; width = progress.getWidth(); progressBarVertical.paint(g, x, y, width, height, progress); } else { y = 0; width = (int) ((double)progress.getValue() * progress.getWidth() / progress.getMaximum()); height = progress.getHeight(); progressBarHorizontal.paint(g, x, y, width, height, progress); } } return true; } public final boolean paintIndeterminateProgress( Graphics g, JProgressBar progress, Rectangle rec) { paintBackBar(g, progress); if (JProgressBar.VERTICAL == progress.getOrientation()) { if (useWindow) { progressBarVertical.paintWindow( g, progress.getWidth(), progress.getHeight(), rec.x, rec.y, rec.width, rec.height, progress); } else { progressBarVertical.paint( g, rec.x, rec.y, rec.width, rec.height, progress); } } else { if (useWindow) { progressBarHorizontal.paintWindow( g, progress.getWidth(), progress.getHeight(), rec.x, rec.y, rec.width, rec.height, progress); } else { progressBarHorizontal.paint( g, rec.x, rec.y, rec.width, rec.height, progress); } } return true; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinScrollbar.java0000644000175000017500000001211410460410014026226 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import java.awt.*; import javax.swing.*; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:29 $ */ public class AbstractSkinScrollbar extends AbstractSkinComponent implements SwingConstants, SkinScrollbar { public AbstractSkinScrollbar() { } public AbstractSkinScrollbar(Skin p_ParentSkin) { super(p_ParentSkin); } /** * Gets the PreferredSize attribute of the AbstractSkinScrollbar object * * @param scrollbar Description of Parameter * @return The PreferredSize value */ public java.awt.Dimension getPreferredSize(javax.swing.JScrollBar scrollbar) { return scrollbar.getPreferredSize(); } /** * Gets the MinimumThumbSize attribute of the AbstractSkinScrollbar object * * @return The MinimumThumbSize value */ public Dimension getMinimumThumbSize() { return null; } /** * Gets the ArrowPreferredSize attribute of the AbstractSkinScrollbar object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ public java.awt.Dimension getArrowPreferredSize(int direction) { return null; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return false; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ public boolean paintArrow(Graphics g, AbstractButton b, int direction) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintTrack(Graphics g, JScrollBar scrollbar, Rectangle trackBounds) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(Graphics g, JScrollBar scrollbar, Rectangle thumbBounds) { return false; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinSeparator.java0000644000175000017500000000610510460410012026244 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import com.l2fprod.gui.plaf.skin.SkinSeparator; /** * Skin Separator.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:29 $ */ public abstract class AbstractSkinSeparator extends AbstractSkinComponent implements SkinSeparator { public boolean paint(java.awt.Graphics g, javax.swing.JSeparator separator) { return false; } public java.awt.Dimension getPreferredSize(javax.swing.JSeparator separator, java.awt.Dimension uiPreferredSize) { return uiPreferredSize; } public boolean installSkin(javax.swing.JComponent component) { return true; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinSlider.java0000644000175000017500000001045510460410012025531 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import java.awt.*; import javax.swing.*; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:05:29 $ */ public class AbstractSkinSlider extends AbstractSkinComponent implements SkinSlider { /** * Gets the PreferredSize attribute of the AbstractSkinSlider object * * @param slider Description of Parameter * @return The PreferredSize value */ public java.awt.Dimension getPreferredSize(javax.swing.JSlider slider, java.awt.Dimension uiPreferredSize) { return uiPreferredSize; } public java.awt.Dimension getThumbSize(javax.swing.JSlider slider) { return new Dimension(10, 10); } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return false; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintTrack(java.awt.Graphics g, javax.swing.JSlider slider, java.awt.Rectangle trackBounds) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(java.awt.Graphics g, javax.swing.JSlider slider, java.awt.Rectangle thumbBounds) { return false; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinSplitPane.java0000644000175000017500000001047210460410014026207 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:54:39 $ */ public class AbstractSkinSplitPane extends AbstractSkinComponent implements SkinSplitPane { /** * Gets the PreferredSize attribute of the SkinSplitPane object * * @param splitpane Description of Parameter * @return The PreferredSize value */ public java.awt.Dimension getPreferredSize(javax.swing.JSplitPane splitpane) { return null; } /** * Gets the ArrowPreferredSize attribute of the SkinSplitPane object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ public java.awt.Dimension getArrowPreferredSize(int direction) { return null; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ public boolean paintArrow(java.awt.Graphics g, javax.swing.AbstractButton b, int direction) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param divider Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ public boolean paintGutter(java.awt.Graphics g, javax.swing.JSplitPane divider, java.awt.Dimension d) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param divider Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(java.awt.Graphics g, javax.swing.JSplitPane divider, java.awt.Dimension d) { return false; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/impl/AbstractSkinTab.java0000644000175000017500000001040410460410014025011 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin.impl; import java.awt.*; import javax.swing.*; import com.l2fprod.gui.plaf.skin.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2005/11/19 09:17:57 $ */ public class AbstractSkinTab extends AbstractSkinComponent implements SkinTab { /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { return false; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param isSelected Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ public boolean paintTab(Graphics g, int tabPlacement, boolean isSelected, int x, int y, int w, int h) { return false; } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param selectedIndex Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ public boolean paintContent(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { return false; } public boolean paintGap(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { return false; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/resources/0000755000175000017500000000000010460410034022203 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/skin/resources/skin.properties0000644000175000017500000000372310460407504025302 0ustar twernertwernerFileChooser.detailsViewButtonAccessibleName=Details FileChooser.detailsViewButtonToolTipText=Details FileChooser.fileAttrHeaderText=Attributes FileChooser.fileDateHeaderText=Modified FileChooser.fileNameHeaderText=Name FileChooser.fileNameLabelText=File Name\: FileChooser.fileNameLabelMnemonic=78 FileChooser.fileSizeHeaderText=Size FileChooser.fileTypeHeaderText=Type FileChooser.filesOfTypeLabelText=Files of Type\: FileChooser.filesOfTypeLabelMnemonic=84 FileChooser.homeFolderAccessibleName=Home FileChooser.homeFolderToolTipText=Home FileChooser.listViewButtonAccessibleName=List FileChooser.listViewButtonToolTipText=List FileChooser.lookInLabelText=Look In\: FileChooser.lookInLabelMnemonic=73 FileChooser.newFolderAccessibleName=New Folder FileChooser.newFolderToolTipText=Create New Folder FileChooser.saveInLabelText=Save In\: FileChooser.upFolderAccessibleName=Up FileChooser.upFolderToolTipText=Up One Level # Used for FilePane's popup menu FileChooser.viewMenuLabelText=View FileChooser.refreshActionLabelText=Refresh FileChooser.newFolderActionLabelText=New Folder FileChooser.listViewActionLabelText=List FileChooser.detailsViewActionLabelText=Details InternalFrameTitlePane.closeButtonAccessibleName=Close InternalFrameTitlePane.iconifyButtonAccessibleName=Iconify InternalFrameTitlePane.maximizeButtonAccessibleName=Maximize MetalTitlePane.closeMnemonic=67 MetalTitlePane.closeTitle=Close MetalTitlePane.iconifyMnemonic=69 MetalTitlePane.iconifyTitle=Minimize MetalTitlePane.maximizeMnemonic=88 MetalTitlePane.maximizeTitle=Maximize MetalTitlePane.restoreMnemonic=82 MetalTitlePane.restoreTitle=Restore SkinChooser.enableBackground = Enable Desktop Background SkinChooser.enableScrollBar = Enable XTra ScrollBars SkinChooser.getskins = Download Skins... SkinChooser.getskins.tip = Download Skins at http://www.javootoo.com SkinChooser.getskins.url = http://www.javootoo.com SkinChooser.install = Install New Skin... SkinChooser.preview = Preview SkinChooser.refresh = Refresh List skinlf-6.7/src/com/l2fprod/gui/plaf/skin/resources/skin_de.properties0000644000175000017500000000436110342044440025744 0ustar twernertwernerFileChooser.detailsViewButtonAccessibleName=Einzelheiten FileChooser.detailsViewButtonToolTipText=Einzelheiten FileChooser.fileAttrHeaderText=Attribut FileChooser.fileDateHeaderText=Ge\u00E4ndert FileChooser.fileNameHeaderText=Dateiname FileChooser.fileNameLabelText=Dateiname\: FileChooser.fileNameLabelMnemonic=110 FileChooser.fileSizeHeaderText=Gr\u00F6\u00DFe FileChooser.fileTypeHeaderText=Typ FileChooser.filesOfTypeLabelText=Dateityp\: FileChooser.filesOfTypeLabelMnemonic=116 FileChooser.homeFolderAccessibleName=Desktop FileChooser.homeFolderToolTipText=Desktop FileChooser.listViewButtonAccessibleName=Liste FileChooser.listViewButtonToolTipText=Liste FileChooser.lookInLabelText=Suche in\: FileChooser.lookInLabelMnemonic=105 FileChooser.newFolderAccessibleName=Neuer Ordner FileChooser.newFolderToolTipText=Neuen Ordner erstellen FileChooser.saveInLabelText=Speichere in\: FileChooser.upFolderAccessibleName=Nach oben FileChooser.upFolderToolTipText=Eine Ebene h\u00F6her # Used for FilePane's popup menu FileChooser.viewMenuLabelText=Ansicht FileChooser.refreshActionLabelText=Aktualisieren FileChooser.newFolderActionLabelText=Neuer Ordner FileChooser.listViewActionLabelText=Liste FileChooser.detailsViewActionLabelText=Einzelheiten InternalFrameTitlePane.closeButtonAccessibleName=Schlie\u00DFen InternalFrameTitlePane.iconifyButtonAccessibleName=Minimieren InternalFrameTitlePane.maximizeButtonAccessibleName=Maximieren MetalTitlePane.closeMnemonic=83 MetalTitlePane.closeTitle=Schlie\u00DFen MetalTitlePane.iconifyMnemonic=105 MetalTitlePane.iconifyTitle=Minimieren MetalTitlePane.maximizeMnemonic=97 MetalTitlePane.maximizeTitle=Maximieren MetalTitlePane.restoreMnemonic=114 MetalTitlePane.restoreTitle=Wiederherstellen SkinChooser.enableBackground = Arbeitsplatzhintergrund verwenden SkinChooser.enableScrollBar = Spezielle Rollbalken verwenden SkinChooser.getskins = Skins herunterladen... SkinChooser.getskins.tip = Skins von http\://www.javootoo.com herunterladen SkinChooser.getskins.url = http://www.javootoo.com SkinChooser.install = Neues Skin installieren... SkinChooser.preview = Vorschau SkinChooser.refresh = Liste aktualisieren FileChooser.openButtonText=\u00D6ffnen FileChooser.cancelButtonText=Abbruch FileChooser.openButtonToolTipText=\u00D6ffnen skinlf-6.7/src/com/l2fprod/gui/plaf/skin/resources/skin_fr.properties0000644000175000017500000000340707712544236026002 0ustar twernertwernerFileChooser.detailsViewButtonAccessibleName=Dtails FileChooser.detailsViewButtonToolTipText=Dtails FileChooser.fileAttrHeaderText=Attributs FileChooser.fileDateHeaderText=Modifi FileChooser.fileNameHeaderText=Nom FileChooser.fileNameLabelText=Nom de fichier \: FileChooser.fileSizeHeaderText=Taille FileChooser.fileTypeHeaderText=Type FileChooser.filesOfTypeLabelText=Fichiers du type \: FileChooser.homeFolderAccessibleName=Accueil FileChooser.homeFolderToolTipText=Rpertoire d'accueil FileChooser.listViewButtonAccessibleName=Liste FileChooser.listViewButtonToolTipText=Liste FileChooser.lookInLabelText=Rechercher dans \: FileChooser.newFolderAccessibleName=Nouveau dossier FileChooser.newFolderToolTipText=Cre un nouveau dossier. FileChooser.saveInLabelText=Enregistrer dans \: FileChooser.upFolderAccessibleName=Vers le haut FileChooser.upFolderToolTipText=Remonte d'un niveau. InternalFrameTitlePane.closeButtonAccessibleName=Fermer InternalFrameTitlePane.iconifyButtonAccessibleName=Rduire InternalFrameTitlePane.maximizeButtonAccessibleName=Agrandir MetalTitlePane.closeMnemonic=67 MetalTitlePane.closeTitle=Fermer MetalTitlePane.iconifyMnemonic=69 MetalTitlePane.iconifyTitle=Rduire MetalTitlePane.maximizeMnemonic=88 MetalTitlePane.maximizeTitle=Agrandir MetalTitlePane.restoreMnemonic=82 MetalTitlePane.restoreTitle=Restaurer SkinChooser.enableBackground = Activer Image de fond SkinChooser.enableScrollBar = Activer Barres de dfilement XTra SkinChooser.getskins = Tlcharger des thmes... SkinChooser.getskins.tip = Tlcharger des thmes depuis http://www.javootoo.com SkinChooser.getskins.url = http://www.javootoo.com SkinChooser.install = Installer Thme... SkinChooser.preview = Prvisualisation SkinChooser.refresh = Rafrachir skinlf-6.7/src/com/l2fprod/gui/plaf/skin/resources/skin_hu.properties0000644000175000017500000000357010265062356026003 0ustar twernertwernerFileChooser.detailsViewButtonAccessibleName=Rszletek FileChooser.detailsViewButtonToolTipText=Rszletek FileChooser.fileAttrHeaderText=Attributes FileChooser.fileDateHeaderText=Mdosult FileChooser.fileNameHeaderText=Nv FileChooser.fileNameLabelText=Fjl nv\: FileChooser.fileSizeHeaderText=Mret FileChooser.fileTypeHeaderText=Tipus FileChooser.filesOfTypeLabelText=Fjl tipus\: FileChooser.homeFolderAccessibleName=Otthon knyvtr FileChooser.homeFolderToolTipText=Otthon knyvtr FileChooser.listViewButtonAccessibleName=Lista FileChooser.listViewButtonToolTipText=Lista FileChooser.lookInLabelText=Aktulis knyvtr\: FileChooser.newFolderAccessibleName=j knyvtr FileChooser.newFolderToolTipText=j knyvtr ltrehozsa FileChooser.saveInLabelText=Elmenteni..\: FileChooser.upFolderAccessibleName=Fel FileChooser.upFolderToolTipText=Fel egy szinttel FileChooser.openButtonText=Megnyits FileChooser.openButtonToolTipText=A kivlasztott file megnyitsa FileChooser.cancelButtonText=Mgsem InternalFrameTitlePane.closeButtonAccessibleName=Bezrni InternalFrameTitlePane.iconifyButtonAccessibleName=Minimalizlni InternalFrameTitlePane.maximizeButtonAccessibleName=Maximalizlni MetalTitlePane.closeMnemonic=67 MetalTitlePane.closeTitle=Bezrni MetalTitlePane.iconifyMnemonic=69 MetalTitlePane.iconifyTitle=Minimalizlni MetalTitlePane.maximizeMnemonic=88 MetalTitlePane.maximizeTitle=Maximalizlni MetalTitlePane.restoreMnemonic=82 MetalTitlePane.restoreTitle=Visszallitani SkinChooser.enableBackground = Enable Desktop Background SkinChooser.enableScrollBar = Enable XTra ScrollBars SkinChooser.getskins = Download Skins... SkinChooser.getskins.tip = Download Skins at http://www.javootoo.com SkinChooser.getskins.url = http://www.javootoo.com SkinChooser.install = Install New Skin... SkinChooser.preview = Preview SkinChooser.refresh = Refresh List skinlf-6.7/src/com/l2fprod/gui/plaf/skin/CompoundSkin.java0000644000175000017500000011360510460410014023451 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.*; import java.util.Vector; import javax.swing.*; import javax.swing.table.*; import com.l2fprod.gui.plaf.skin.impl.AbstractSkin; /** * Assembles two skins to create a new one.
    * This can be used to combine features from two skins. * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.4 $, $Date: 2005/11/19 09:16:31 $ */ public final class CompoundSkin extends AbstractSkin { private Skin skina, skinb; /** * Construct a new Skin by merging two skins.
    * If a feature is missing in the first skin, the second skin is used. * * @param a Description of Parameter * @param b Description of Parameter */ public CompoundSkin(Skin a, Skin b) { skina = a; skinb = b; if ((a == null) || (b == null)) { throw new IllegalArgumentException("Skins must not be null!"); } button = new CompoundButton(); frame = new CompoundFrame(); personality = new CompoundPersonality(); progress = new CompoundProgress(); scrollbar = new CompoundScrollbar(); slider = new CompoundSlider(); tab = new CompoundTab(); splitpane = new CompoundSplitPane(); separator = new CompoundSeparator(); } /** * Gets the Colors attribute of the CompoundSkin object * * @return The Colors value */ public String[] getColors() { Vector v = new Vector(); String[] result = skina.getColors(); if (result != null) { addColors(result, v); } result = skinb.getColors(); if (result != null) { addColors(result, v); } result = new String[v.size()]; v.copyInto(result); return result; } /** * Gets the Resource attribute of the CompoundSkin object * * @param key Description of Parameter * @return The Resource value */ public Object getResource(Object key) { Object value = skina.getResource(key); return (value != null ? value : skinb.getResource(key)); } public void initComponentDefaults(UIDefaults table) { skina.initComponentDefaults(table); skinb.initComponentDefaults(table); } /** * Adds a feature to the Colors attribute of the CompoundSkin object * * @param colors The feature to be added to the Colors attribute * @param v The feature to be added to the Colors attribute */ protected void addColors(String[] colors, Vector v) { for (int i = 0, c = colors.length; i < c; i = i + 2) { if ("".equals(colors[i + 1])) { continue; } v.addElement(colors[i]); v.addElement(colors[i + 1]); } } private class CompoundComponent implements SkinComponent { public boolean status() { return true; } public boolean installSkin(javax.swing.JComponent c) { return false; } public void uninstallSkin(javax.swing.JComponent c) { } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundButton extends CompoundComponent implements SkinButton { /** * Gets the CheckBoxIconSize attribute of the CompoundButton object * * @return The CheckBoxIconSize value */ public Dimension getCheckBoxIconSize() { Dimension dimension = null; if (skina.getButton() != null) { dimension = skina.getButton().getCheckBoxIconSize(); } if ((dimension == null) && (skinb.getButton() != null)) { dimension = skinb.getButton().getCheckBoxIconSize(); } return dimension; } /** * Gets the RadioButtonIconSize attribute of the CompoundButton object * * @return The RadioButtonIconSize value */ public Dimension getRadioButtonIconSize() { Dimension dimension = null; if (skina.getButton() != null) { dimension = skina.getButton().getRadioButtonIconSize(); } if ((dimension == null) && (skinb.getButton() != null)) { dimension = skinb.getButton().getRadioButtonIconSize(); } return dimension; } /** * Gets the RadioIcon attribute of the CompoundButton object * * @param b Description of Parameter * @return The RadioIcon value */ public Icon getRadioIcon(AbstractButton b) { Icon icon = null; if (skina.getButton() != null) { icon = skina.getButton().getRadioIcon(b); } if ((icon == null) && (skinb.getButton() != null)) { icon = skinb.getButton().getRadioIcon(b); } return icon; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getButton() != null) { result = skina.getButton().status(); } if (!result && (skinb.getButton() != null)) { result = skinb.getButton().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getButton() != null) { result = skina.getButton().installSkin(c); } if (!result && (skinb.getButton() != null)) { result = skinb.getButton().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @return Description of the Returned Value */ public boolean paintButton(Graphics g, AbstractButton b) { boolean result = false; if (skina.getButton() != null) { result = skina.getButton().paintButton(g, b); } if (!result && (skinb.getButton() != null)) { result = skinb.getButton().paintButton(g, b); } return result; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundFrame extends CompoundComponent implements SkinFrame { /** * Gets the WindowButtons attribute of the CompoundFrame object * * @param align Description of Parameter * @return The WindowButtons value */ public SkinWindowButton[] getWindowButtons(int align) { SkinWindowButton[] buttons = null; if (skina.getFrame() != null) { buttons = skina.getFrame().getWindowButtons(align); } if ((buttons == null) && (skinb.getFrame() != null)) { buttons = skinb.getFrame().getWindowButtons(align); } return buttons; } /** * Gets the TopPreferredSize attribute of the CompoundFrame object * * @return The TopPreferredSize value */ public Dimension getTopPreferredSize() { Dimension dimension = null; if (skina.getFrame() != null) { dimension = skina.getFrame().getTopPreferredSize(); } if ((dimension == null) && (skinb.getFrame() != null)) { dimension = skinb.getFrame().getTopPreferredSize(); } return dimension; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getFrame() != null) { result = skina.getFrame().status(); } if (!result && (skinb.getFrame() != null)) { result = skinb.getFrame().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getFrame() != null) { result = skina.getFrame().installSkin(c); } if (!result && (skinb.getFrame() != null)) { result = skinb.getFrame().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param isSelected Description of Parameter * @param title Description of Parameter * @return Description of the Returned Value */ public boolean paintTop(Graphics g, Component c, boolean isSelected, String title) { boolean result = false; if (skina.getFrame() != null) { result = skina.getFrame().paintTop(g, c, isSelected, title); } if (!result && (skinb.getFrame() != null)) { result = skinb.getFrame().paintTop(g, c, isSelected, title); } return result; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundPersonality extends CompoundComponent implements SkinPersonality { /** * Gets the ComboBoxInsets attribute of the CompoundPersonality object * * @return The ComboBoxInsets value */ public java.awt.Insets getComboBoxInsets() { Insets insets = null; if (skina.getPersonality() != null) { insets = skina.getPersonality().getComboBoxInsets(); } if ((insets == null) && (skinb.getPersonality() != null)) { insets = skinb.getPersonality().getComboBoxInsets(); } return insets; } /** * Gets the ComboBoxPreferredSize attribute of the CompoundPersonality * object * * @param c Description of Parameter * @return The ComboBoxPreferredSize value */ public java.awt.Dimension getComboBoxPreferredSize(javax.swing.JComboBox c) { Dimension dimension = null; if (skina.getPersonality() != null) { dimension = skina.getPersonality().getComboBoxPreferredSize(c); } if ((dimension == null) && (skinb.getPersonality() != null)) { dimension = skinb.getPersonality().getComboBoxPreferredSize(c); } return dimension; } /** * Gets the TableHeaderRenderer attribute of the CompoundPersonality object * * @return The TableHeaderRenderer value */ public TableCellRenderer getTableHeaderRenderer() { TableCellRenderer renderer = null; if (skina.getPersonality() != null) { renderer = skina.getPersonality().getTableHeaderRenderer(); } if ((renderer == null) && (skinb.getPersonality() != null)) { renderer = skinb.getPersonality().getTableHeaderRenderer(); } return renderer; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().status(); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().installSkin(c); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintDialog(Graphics g, Component c) { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().paintDialog(g, c); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().paintDialog(g, c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintFocus(Graphics g, JComponent c) { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().paintFocus(g, c); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().paintFocus(g, c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintMenu(Graphics g, JMenu c) { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().paintMenu(g, c); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().paintMenu(g, c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintMenuItem(Graphics g, JMenuItem c) { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().paintMenuItem(g, c); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().paintMenuItem(g, c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param bounds Description of Parameter * @param hasFocus Description of Parameter * @return Description of the Returned Value */ public boolean paintComboBox(Graphics g, JComboBox c, Rectangle bounds, boolean hasFocus, boolean isRollover) { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().paintComboBox(g, c, bounds, hasFocus, isRollover); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().paintComboBox(g, c, bounds, hasFocus, isRollover); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public boolean paintBackground(Graphics g, Component c) { boolean result = false; if (skina.getPersonality() != null) { result = skina.getPersonality().paintBackground(g, c); } if (!result && (skinb.getPersonality() != null)) { result = skinb.getPersonality().paintBackground(g, c); } return result; } /** * Description of the Method * * @return Description of the Returned Value */ public TableCellRenderer createTableHeaderRenderer() { return getTableHeaderRenderer(); } /** * Description of the Method * * @return Description of the Returned Value */ public ListCellRenderer createListCellRenderer() { ListCellRenderer renderer = null; if (skina.getPersonality() != null) { renderer = skina.getPersonality().createListCellRenderer(); } if ((renderer == null) && (skinb.getPersonality() != null)) { renderer = skinb.getPersonality().createListCellRenderer(); } return renderer; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundProgress extends CompoundComponent implements SkinProgress { /** * Gets the MinimumSize attribute of the CompoundProgress object * * @param progress Description of Parameter * @return The MinimumSize value */ public Dimension getMinimumSize(javax.swing.JProgressBar progress) { Dimension dimension = null; if (skina.getProgress() != null) { dimension = skina.getProgress().getMinimumSize(progress); } if ((dimension == null) && (skinb.getProgress() != null)) { dimension = skinb.getProgress().getMinimumSize(progress); } return dimension; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getProgress() != null) { result = skina.getProgress().status(); } if (!result && (skinb.getProgress() != null)) { result = skinb.getProgress().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getProgress() != null) { result = skina.getProgress().installSkin(c); } if (!result && (skinb.getProgress() != null)) { result = skinb.getProgress().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param progress Description of Parameter * @return Description of the Returned Value */ public boolean paintProgress(Graphics g, JProgressBar progress) { boolean result = false; if (skina.getProgress() != null) { result = skina.getProgress().paintProgress(g, progress); } if (!result && (skinb.getProgress() != null)) { result = skinb.getProgress().paintProgress(g, progress); } return result; } /* (non-Javadoc) * @see com.l2fprod.gui.plaf.skin.SkinProgress#paintIndeterminateProgress(java.awt.Graphics, javax.swing.JProgressBar, java.awt.Rectangle) */ public boolean paintIndeterminateProgress(Graphics g, JProgressBar progress, Rectangle rec) { boolean result = false; if (skina.getProgress() != null) { result = skina.getProgress().paintIndeterminateProgress(g, progress,rec); } if (!result && (skinb.getProgress() != null)) { result = skinb.getProgress().paintIndeterminateProgress(g, progress,rec); } return result; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundScrollbar extends CompoundComponent implements SkinScrollbar { /** * Gets the PreferredSize attribute of the CompoundScrollbar object * * @param scrollbar Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JScrollBar scrollbar) { Dimension dimension = null; if (skina.getScrollbar() != null) { dimension = skina.getScrollbar().getPreferredSize(scrollbar); } if ((dimension == null) && (skinb.getScrollbar() != null)) { dimension = skinb.getScrollbar().getPreferredSize(scrollbar); } return dimension; } /** * Gets the MinimumThumbSize attribute of the CompoundScrollbar object * * @return The MinimumThumbSize value */ public Dimension getMinimumThumbSize() { Dimension dimension = null; if (skina.getScrollbar() != null) { dimension = skina.getScrollbar().getMinimumThumbSize(); } if ((dimension == null) && (skinb.getScrollbar() != null)) { dimension = skinb.getScrollbar().getMinimumThumbSize(); } return dimension; } /** * Gets the ArrowPreferredSize attribute of the CompoundScrollbar object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ public Dimension getArrowPreferredSize(int direction) { Dimension dimension = null; if (skina.getScrollbar() != null) { dimension = skina.getScrollbar().getArrowPreferredSize(direction); } if ((dimension == null) && (skinb.getScrollbar() != null)) { dimension = skinb.getScrollbar().getArrowPreferredSize(direction); } return dimension; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getScrollbar() != null) { result = skina.getScrollbar().status(); } if (!result && (skinb.getScrollbar() != null)) { result = skinb.getScrollbar().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getScrollbar() != null) { result = skina.getScrollbar().installSkin(c); } if (!result && (skinb.getScrollbar() != null)) { result = skinb.getScrollbar().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ public boolean paintArrow(Graphics g, AbstractButton b, int direction) { boolean result = false; if (skina.getScrollbar() != null) { result = skina.getScrollbar().paintArrow(g, b, direction); } if (!result && (skinb.getScrollbar() != null)) { result = skinb.getScrollbar().paintArrow(g, b, direction); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(Graphics g, JScrollBar scrollbar, Rectangle thumbBounds) { boolean result = false; if (skina.getScrollbar() != null) { result = skina.getScrollbar().paintThumb(g, scrollbar, thumbBounds); } if (!result && (skinb.getScrollbar() != null)) { result = skinb.getScrollbar().paintThumb(g, scrollbar, thumbBounds); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintTrack(Graphics g, JScrollBar scrollbar, Rectangle trackBounds) { boolean result = false; if (skina.getScrollbar() != null) { result = skina.getScrollbar().paintTrack(g, scrollbar, trackBounds); } if (!result && (skinb.getScrollbar() != null)) { result = skinb.getScrollbar().paintTrack(g, scrollbar, trackBounds); } return result; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundSlider extends CompoundComponent implements SkinSlider { /** * Gets the PreferredSize attribute of the CompoundSlider object * * @param slider Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JSlider slider, java.awt.Dimension uiPreferredSize) { Dimension dimension = null; if (skina.getSlider() != null) { dimension = skina.getSlider().getPreferredSize(slider, uiPreferredSize); } if ((dimension == null) && (skinb.getSlider() != null)) { dimension = skinb.getSlider().getPreferredSize(slider, uiPreferredSize); } return dimension; } /** * Gets the PreferredSize attribute of the CompoundSlider object * * @param slider Description of Parameter * @return The PreferredSize value */ public Dimension getThumbSize(JSlider slider) { Dimension dimension = null; if (skina.getSlider() != null) { dimension = skina.getSlider().getThumbSize(slider); } if ((dimension == null) && (skinb.getSlider() != null)) { dimension = skinb.getSlider().getThumbSize(slider); } return dimension; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getSlider() != null) { result = skina.getSlider().status(); } if (!result && (skinb.getSlider() != null)) { result = skinb.getSlider().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getSlider() != null) { result = skina.getSlider().installSkin(c); } if (!result && (skinb.getSlider() != null)) { result = skinb.getSlider().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintTrack(Graphics g, JSlider slider, Rectangle trackBounds) { boolean result = false; if (skina.getSlider() != null) { result = skina.getSlider().paintTrack(g, slider, trackBounds); } if (!result && (skinb.getSlider() != null)) { result = skinb.getSlider().paintTrack(g, slider, trackBounds); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(Graphics g, JSlider slider, Rectangle thumbBounds) { boolean result = false; if (skina.getSlider() != null) { result = skina.getSlider().paintThumb(g, slider, thumbBounds); } if (!result && (skinb.getSlider() != null)) { result = skinb.getSlider().paintThumb(g, slider, thumbBounds); } return result; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundSeparator extends CompoundComponent implements SkinSeparator { public boolean paint(java.awt.Graphics g, javax.swing.JSeparator separator) { boolean result = false; if (skina.getSeparator() != null) { result = skina.getSeparator().paint(g, separator); } if (!result && (skinb.getSeparator() != null)) { result = skinb.getSeparator().paint(g, separator); } return result; } public java.awt.Dimension getPreferredSize(javax.swing.JSeparator separator, java.awt.Dimension uiPreferredSize) { Dimension dimension = null; if (skina.getSeparator() != null) { dimension = skina.getSeparator().getPreferredSize(separator, uiPreferredSize); } if ((dimension == null) && (skinb.getSlider() != null)) { dimension = skinb.getSeparator().getPreferredSize(separator, uiPreferredSize); } return dimension; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getSeparator() != null) { result = skina.getSeparator().status(); } if (!result && (skinb.getSeparator() != null)) { result = skinb.getSeparator().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getSeparator() != null) { result = skina.getSeparator().installSkin(c); } if (!result && (skinb.getSeparator() != null)) { result = skinb.getSeparator().installSkin(c); } return result; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundSplitPane extends CompoundComponent implements SkinSplitPane { /** * Gets the ArrowPreferredSize attribute of the CompoundSplitPane object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ public Dimension getArrowPreferredSize(int direction) { Dimension dimension = null; if (skina.getSplitPane() != null) { dimension = skina.getSplitPane().getArrowPreferredSize(direction); } if ((dimension == null) && (skinb.getSplitPane() != null)) { dimension = skinb.getSplitPane().getArrowPreferredSize(direction); } return dimension; } /** * Gets the PreferredSize attribute of the CompoundSplitPane object * * @param splitpane Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JSplitPane splitpane) { Dimension dimension = null; if (skina.getSplitPane() != null) { dimension = skina.getSplitPane().getPreferredSize(splitpane); } if ((dimension == null) && (skinb.getSplitPane() != null)) { dimension = skinb.getSplitPane().getPreferredSize(splitpane); } return dimension; } /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getSplitPane() != null) { result = skina.getSplitPane().status(); } if (!result && (skinb.getSplitPane() != null)) { result = skinb.getSplitPane().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getSplitPane() != null) { result = skina.getSplitPane().installSkin(c); } if (!result && (skinb.getSplitPane() != null)) { result = skinb.getSplitPane().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ public boolean paintArrow(Graphics g, AbstractButton b, int direction) { boolean result = false; if (skina.getSplitPane() != null) { result = skina.getSplitPane().paintArrow(g, b, direction); } if (!result && (skinb.getSplitPane() != null)) { result = skinb.getSplitPane().paintArrow(g, b, direction); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param splitpane Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ public boolean paintGutter(Graphics g, JSplitPane splitpane, Dimension d) { boolean result = false; if (skina.getSplitPane() != null) { result = skina.getSplitPane().paintGutter(g, splitpane, d); } if (!result && (skinb.getSplitPane() != null)) { result = skinb.getSplitPane().paintGutter(g, splitpane, d); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param splitpane Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ public boolean paintThumb(Graphics g, JSplitPane splitpane, Dimension d) { boolean result = false; if (skina.getSplitPane() != null) { result = skina.getSplitPane().paintThumb(g, splitpane, d); } if (!result && (skinb.getSplitPane() != null)) { result = skinb.getSplitPane().paintThumb(g, splitpane, d); } return result; } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class CompoundTab extends CompoundComponent implements SkinTab { /** * Description of the Method * * @return Description of the Returned Value */ public boolean status() { boolean result = false; if (skina.getTab() != null) { result = skina.getTab().status(); } if (!result && (skinb.getTab() != null)) { result = skinb.getTab().status(); } return result; } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(JComponent c) { boolean result = false; if (skina.getTab() != null) { result = skina.getTab().installSkin(c); } if (!result && (skinb.getTab() != null)) { result = skinb.getTab().installSkin(c); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param isSelected Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ public boolean paintTab(Graphics g, int tabPlacement, boolean isSelected, int x, int y, int w, int h) { boolean result = false; if (skina.getTab() != null) { result = skina.getTab().paintTab(g, tabPlacement, isSelected, x, y, w, h); } if (!result && (skinb.getTab() != null)) { result = skinb.getTab().paintTab(g, tabPlacement, isSelected, x, y, w, h); } return result; } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param selectedIndex Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ public boolean paintContent(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { boolean result = false; if (skina.getTab() != null) { result = skina.getTab().paintContent(g, tabPlacement, selectedIndex, x, y, w, h); } if (!result && (skinb.getTab() != null)) { result = skinb.getTab().paintContent(g, tabPlacement, selectedIndex, x, y, w, h); } return result; } public boolean paintGap(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { boolean result = false; if (skina.getTab() != null) { result = skina.getTab().paintGap(g, tabPlacement, selectedIndex, x, y, w, h); } if (!result && (skinb.getTab() != null)) { result = skinb.getTab().paintGap(g, tabPlacement, selectedIndex, x, y, w, h); } return result; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/CustomImageObserver.java0000644000175000017500000000176310460410014024766 0ustar twernertwerner/* * Created on May 25, 2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package com.l2fprod.gui.plaf.skin; import java.awt.Image; import java.awt.image.ImageObserver; /** * @author sebastien * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ final class CustomImageObserver implements ImageObserver { /* (non-Javadoc) * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int) */ public boolean imageUpdate( Image img, int infoflags, int x, int y, int width, int height) { boolean toreturn = true; if (width > 0 && height > 0) toreturn = false; if (!toreturn) { synchronized (this) { this.notifyAll(); } } return toreturn; } public CustomImageObserver() { super(); } public Object getLock() { return this; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/DefaultButton.java0000644000175000017500000004443410460410014023623 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.plaf.*; import com.l2fprod.util.ImageUtils; /** * Stretch/Tile Button.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.4 $, $Date: 2005/11/19 09:16:31 $ */ public class DefaultButton implements Icon, Border, UIResource, java.io.Serializable { /** * Description of the Method * * @param g Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @param b Description of Parameter */ public void paint(Graphics g, int x, int y, int width, int height, Component b) { if (SkinUtils.DEBUG) { System.out.println("Painting (" + x + "," + y + "," + width + "x" + height + ") for " + b); } ImageUtils.paint(b, g, center, x + leftWidth, y + topHeight, width - leftWidth - rightWidth, height - topHeight - bottomHeight, false, center_fill); paintBorder(b, g, x, y, width, height); if (SkinUtils.DEBUG) { g.setColor(Color.black); g.drawRect(x + leftWidth, y + topHeight, width - leftWidth - rightWidth, height - topHeight - bottomHeight); g.drawLine(x + leftWidth, y, x + leftWidth, y + height); g.drawLine(x + width - rightWidth, y, x + width - rightWidth, y + height); g.drawLine(x, y + topHeight, x + width, y + topHeight); g.drawLine(x, y + height - bottomHeight, x + width, y + height - bottomHeight); } } /** * Description of the Field */ public transient Image topleft; /** * Description of the Field */ public transient Image topright; /** * Description of the Field */ public transient Image bottomleft; /** * Description of the Field */ public transient Image bottomright; /** * Description of the Field */ public transient Image top, right, bottom, left, center; public transient Image gap, gap_start, gap_end; protected int topHeight, bottomHeight, leftWidth, rightWidth; protected int imageWidth, imageHeight; protected int top_fill = ImageUtils.PAINT_STRETCH; protected int right_fill = ImageUtils.PAINT_STRETCH; protected int bottom_fill = ImageUtils.PAINT_STRETCH; protected int left_fill = ImageUtils.PAINT_STRETCH; protected int center_fill = ImageUtils.PAINT_STRETCH; protected boolean tile; protected Insets insets; /** * Constructor for the DefaultButton object */ public DefaultButton() { } /** * Constructor for the DefaultButton object * * @param bitmap Description of Parameter * @param imageWidth Description of Parameter * @param imageHeight Description of Parameter * @param topHeight Description of Parameter * @param rightWidth Description of Parameter * @param bottomHeight Description of Parameter * @param leftWidth Description of Parameter */ public DefaultButton(Image bitmap, int imageWidth, int imageHeight, int topHeight, int rightWidth, int bottomHeight, int leftWidth) { this(bitmap, imageWidth, imageHeight, topHeight, rightWidth, bottomHeight, leftWidth, false); } public DefaultButton(Image bitmap, Image gap, Image gap_start, Image gap_end, int imageWidth, int imageHeight, int topHeight, int rightWidth, int bottomHeight, int leftWidth) { this(bitmap, imageWidth, imageHeight, topHeight, rightWidth, bottomHeight, leftWidth, false); this.gap = gap; this.gap_start = gap_start; this.gap_end = gap_end; } /** * Constructor for the DefaultButton object * * @param top Description of Parameter * @param bottom Description of Parameter * @param left Description of Parameter * @param right Description of Parameter * @param topLeft Description of Parameter * @param topRight Description of Parameter * @param bottomLeft Description of Parameter * @param bottomRight Description of Parameter */ public DefaultButton(Image top, Image bottom, Image left, Image right, Image topLeft, Image topRight, Image bottomLeft, Image bottomRight) { this.top = top; this.bottom = bottom; this.left = left; this.right = right; this.topleft = topLeft; this.bottomleft = bottomLeft; this.topright = topRight; this.bottomright = bottomRight; this.topHeight = top != null ? top.getHeight(null) : (topleft != null ? topleft.getHeight(null) : 0); this.rightWidth = right != null ? right.getWidth(null) : 0; this.bottomHeight = bottom != null ? bottom.getHeight(null) : 0; this.leftWidth = left != null ? left.getWidth(null) : 0; insets = new Insets(top != null ? topHeight : 0, leftWidth, bottomHeight, rightWidth); } /** * Constructor for the DefaultButton object * * @param bitmap Description of Parameter * @param imageWidth Description of Parameter * @param imageHeight Description of Parameter * @param topHeight Description of Parameter * @param rightWidth Description of Parameter * @param bottomHeight Description of Parameter * @param leftWidth Description of Parameter * @param tile Description of Parameter */ public DefaultButton(Image bitmap, int imageWidth, int imageHeight, int topHeight, int rightWidth, int bottomHeight, int leftWidth, boolean tile) { this.topHeight = topHeight; this.rightWidth = rightWidth; this.bottomHeight = bottomHeight; this.leftWidth = leftWidth; this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.tile = tile; insets = new Insets(topHeight, leftWidth, bottomHeight, rightWidth); // corners topleft = ImageUtils.grab(bitmap, 0, 0, leftWidth, topHeight); topright = ImageUtils.grab(bitmap, imageWidth - rightWidth, 0, rightWidth, topHeight); bottomleft = ImageUtils.grab(bitmap, 0, imageHeight - bottomHeight, leftWidth, bottomHeight); bottomright = ImageUtils.grab(bitmap, imageWidth - rightWidth, imageHeight - bottomHeight, rightWidth, bottomHeight); // borders top = ImageUtils.grab(bitmap, leftWidth, 0, imageWidth - leftWidth - rightWidth, topHeight); if (rightWidth > 0) { right = ImageUtils.grab(bitmap, imageWidth - rightWidth, topHeight, rightWidth, imageHeight - topHeight - bottomHeight); } if (bottomHeight > 0) { bottom = ImageUtils.grab(bitmap, leftWidth, imageHeight - bottomHeight, imageWidth - leftWidth - rightWidth, bottomHeight); } if (leftWidth > 0) { left = ImageUtils.grab(bitmap, 0, topHeight, leftWidth, imageHeight - topHeight - bottomHeight); } // center center = ImageUtils.grab(bitmap, leftWidth, topHeight, imageWidth - leftWidth - rightWidth, imageHeight - topHeight - bottomHeight); } /** * Sets the CenterFill attribute of the DefaultButton object * * @param mode The new CenterFill value */ public void setCenterFill(int mode) { center_fill = mode; } /** * Gets the Disabled attribute of the DefaultButton object * * @return The Disabled value */ public DefaultButton getDisabled() { DefaultButton b = new DefaultButton(); b.topleft = ImageUtils.getDisabledImage(topleft); b.topright = ImageUtils.getDisabledImage(topright); b.bottomleft = ImageUtils.getDisabledImage(bottomleft); b.bottomright = ImageUtils.getDisabledImage(bottomright); b.top = ImageUtils.getDisabledImage(top); b.right = ImageUtils.getDisabledImage(right); b.bottom = ImageUtils.getDisabledImage(bottom); b.left = ImageUtils.getDisabledImage(left); b.center = ImageUtils.getDisabledImage(center); b.topHeight = topHeight; b.bottomHeight = bottomHeight; b.leftWidth = leftWidth; b.rightWidth = rightWidth; b.imageWidth = imageWidth; b.imageHeight = imageHeight; b.top_fill = top_fill; b.right_fill = right_fill; b.bottom_fill = bottom_fill; b.left_fill = left_fill; b.center_fill = center_fill; b.tile = tile; b.insets = insets; return b; } /** * Gets the TopToBottom attribute of the DefaultButton object * * @return The TopToBottom value */ public DefaultButton getTopToBottom() { DefaultButton b = new DefaultButton(); b.top = ImageUtils.flipHorizontally(bottom); b.topHeight = bottomHeight; b.top_fill = bottom_fill; b.topleft = ImageUtils.flipHorizontally(bottomleft); b.bottomleft = ImageUtils.flipHorizontally(topleft); b.topright = ImageUtils.flipHorizontally(bottomright); b.bottomright = ImageUtils.flipHorizontally(topright); b.bottom = ImageUtils.flipHorizontally(top); b.bottomHeight = topHeight; b.bottom_fill = top_fill; b.left = ImageUtils.flipHorizontally(left); b.leftWidth = leftWidth; b.left_fill = left_fill; b.right = ImageUtils.flipHorizontally(right); b.rightWidth = rightWidth; b.right_fill = right_fill; b.center = ImageUtils.flipHorizontally(center); b.center_fill = center_fill; b.imageWidth = imageWidth; b.imageHeight = imageHeight; b.tile = tile; b.insets = new Insets(insets.bottom, insets.left, insets.top, insets.right); return b; } /** * Description of the Method * * @return Description of the Returned Value */ public DefaultButton rotateCounterClockWise() { DefaultButton b = new DefaultButton(); b.top = ImageUtils.rotateLeft(right); b.topHeight = rightWidth; b.top_fill = right_fill; b.topleft = ImageUtils.rotateLeft(topright); b.bottomleft = ImageUtils.rotateLeft(topleft); b.topright = ImageUtils.rotateLeft(bottomright); b.bottomright = ImageUtils.rotateLeft(bottomleft); b.bottom = ImageUtils.rotateLeft(left); b.bottomHeight = leftWidth; b.bottom_fill = left_fill; b.left = ImageUtils.rotateLeft(top); b.leftWidth = topHeight; b.left_fill = top_fill; b.right = ImageUtils.rotateLeft(bottom); b.rightWidth = bottomHeight; b.right_fill = bottom_fill; b.center = ImageUtils.rotateLeft(center); b.center_fill = center_fill; b.imageWidth = imageHeight; b.imageHeight = imageWidth; b.tile = tile; b.insets = new Insets(insets.left, insets.top, insets.right, insets.bottom); return b; } public DefaultButton rotateClockWise() { DefaultButton b = new DefaultButton(); b.center = ImageUtils.rotateRight(center); b.center_fill = center_fill; b.top = ImageUtils.rotateRight(left); b.topHeight = leftWidth; b.top_fill = left_fill; b.right = ImageUtils.rotateRight(top); b.rightWidth = topHeight; b.right_fill = top_fill; b.bottom = ImageUtils.rotateRight(right); b.bottomHeight = rightWidth; b.bottom_fill = right_fill; b.left = ImageUtils.rotateRight(bottom); b.leftWidth = bottomHeight; b.left_fill = bottom_fill; b.topleft = ImageUtils.rotateRight(bottomleft); b.topright = ImageUtils.rotateRight(topleft); b.bottomleft = ImageUtils.rotateRight(bottomright); b.bottomright = ImageUtils.rotateRight(topright); b.imageWidth = imageHeight; b.imageHeight = imageWidth; b.tile = tile; b.insets = new Insets(leftWidth, bottomHeight, rightWidth, topHeight); return b; } /** * Gets the MinimumSize attribute of the DefaultButton object * * @return The MinimumSize value */ public Dimension getMinimumSize() { return new Dimension(imageWidth, imageHeight); } /** * Gets the PreferredSize attribute of the DefaultButton object * * @return The PreferredSize value */ public Dimension getPreferredSize() { return getMinimumSize(); } /** * Gets the Width attribute of the DefaultButton object * * @return The Width value */ public int getWidth() { return imageWidth; } /** * Gets the IconWidth attribute of the DefaultButton object * * @return The IconWidth value */ public int getIconWidth() { return getWidth(); } /** * Gets the Height attribute of the DefaultButton object * * @return The Height value */ public int getHeight() { return imageHeight; } /** * Gets the IconHeight attribute of the DefaultButton object * * @return The IconHeight value */ public int getIconHeight() { return getHeight(); } /** * Gets the Insets attribute of the DefaultButton object * * @return The Insets value */ public Insets getInsets() { return insets; } // Implements BORDER /** * Gets the BorderInsets attribute of the DefaultButton object * * @param c Description of Parameter * @return The BorderInsets value */ public Insets getBorderInsets(Component c) { return insets; } /** * Gets the BorderOpaque attribute of the DefaultButton object * * @return The BorderOpaque value */ public boolean isBorderOpaque() { return false; } /** * Description of the Method * * @return Description of the Returned Value */ public String toString() { return "DefaultButton(" + getWidth() + "x" + getHeight() + ",center_fill=" + center_fill + ")"; } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param x Description of Parameter * @param y Description of Parameter */ public void paintIcon(Component c, Graphics g, int x, int y) { if (center != null) { g.drawImage(center, x, y, c); } // paint(g, x, y, c); } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter */ public void paint(Graphics g, Component b) { paint(g, 0, 0, b); } /** * Description of the Method * * @param g Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param b Description of Parameter */ public void paint(Graphics g, int x, int y, Component b) { paint(g, x, y, ((JComponent)b).getWidth(), ((JComponent)b).getHeight(), b); } /** * Description of the Method * * @param b Description of Parameter * @param g Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter */ public void paintBorder(Component b, Graphics g, int x, int y, int width, int height) { // PENDING(fred): borders and center should be drawn as tiles!!! // borders // center if (top != null) { ImageUtils.paint(b, g, top, x + (topleft != null ? leftWidth : 0), y, width - (topleft != null ? leftWidth : 0) - (topright != null ? rightWidth : 0), topHeight, false, top_fill); } if (right != null) { ImageUtils.paint(b, g, right, x + width - rightWidth, y + topHeight, rightWidth, height - topHeight - bottomHeight, false, right_fill); } if (bottom != null) { ImageUtils.paint(b, g, bottom, x + (topleft != null ? leftWidth : 0), y + height - bottomHeight, width - (topleft != null ? leftWidth : 0) - (topright != null ? rightWidth : 0), bottomHeight, false, bottom_fill); } if (left != null) { ImageUtils.paint(b, g, left, x, y + topHeight, leftWidth, height - topHeight - bottomHeight, false, left_fill); } // finally, draw corners if (topleft != null) { ImageUtils.paint(b, g, topleft, x, y, 0, 0, false, ImageUtils.PAINT_NORMAL); } if (topright != null) { ImageUtils.paint(b, g, topright, x + width - topright.getWidth(null), y, 0, 0, false, ImageUtils.PAINT_NORMAL); } if (bottomleft != null) { ImageUtils.paint(b, g, bottomleft, x, y + height - bottomleft.getHeight(null), 0, 0, false, ImageUtils.PAINT_NORMAL); } if (bottomright != null) { ImageUtils.paint(b, g, bottomright, x + width - bottomright.getWidth(null), y + height - bottomright.getHeight(null), 0, 0, false, ImageUtils.PAINT_NORMAL); } } public void paintGap(Graphics g, int x, int y, int width, Component b) { //TODO: gap_border gap_start_border gap_end_border if(gap != null) { ImageUtils.paint(b, g, gap, x, y, width, 1); if(gap_start != null) { ImageUtils.paint(b, g, gap_start, x, y, 1, 1); } if(gap_end != null) { ImageUtils.paint(b, g, gap_end, x + width - 1, y, 1, 1); } } } public void paintWindow(Graphics g, int width, int height, int windowX, int windowY, int windowWidth, int windowHeight, Component b) { ImageUtils.paintWindow(b, g, center, leftWidth, topHeight, width - leftWidth - rightWidth, height - topHeight - bottomHeight ,windowX, windowY, windowWidth, windowHeight,false,center_fill); paintBorder(b, g,0,0, width, height); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/IncorrectVersionException.java0000644000175000017500000001062210460410016026212 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Thrown when a Theme Pack requires a SkinLF version greater than the current. *
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.4 $, $Date: 2005/11/19 09:25:05 $ */ public final class IncorrectVersionException extends Exception { /** * Constructor for the IncorrectVersionException object * * @param required Description of Parameter * @param current Description of Parameter */ public IncorrectVersionException(String required, String current) { super("Incorrect Skin Look And Feel version, " + "current version is " + current + ", required version is " + required); } /** * Check if the current version is bigger or equals to the required * version. If this is not the case an * IncorrectVersionException is thrown. * * @param current Description of Parameter * @param required Description of Parameter * @exception IncorrectVersionException if the current version does not fit */ public static void checkRequiredVersion(String current, String required) throws IncorrectVersionException { if ("6.7".equals(current)) { return; } java.util.StringTokenizer currentToken = new java.util.StringTokenizer(current, "."); java.util.StringTokenizer requiredToken = new java.util.StringTokenizer(required, "."); int currentCount = currentToken.countTokens(); int requiredCount = requiredToken.countTokens(); int min = Math.min(currentCount, requiredCount); for (int i = 0; i < min; i++) { String cTok = currentToken.nextToken(); String rTok = requiredToken.nextToken(); int cValue = Integer.parseInt(cTok); int rValue = Integer.parseInt(rTok); // the current version is bigger than the required if (cValue > rValue) { break; } if (cValue < rValue) { throw new IncorrectVersionException(required, current); } if ((i == min - 1) && (currentCount < requiredCount)) { throw new IncorrectVersionException(required, current); } } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/LafPluginSupport.java0000644000175000017500000000267410460410014024321 0ustar twernertwerner/** * Skin Look And Feel 6.7 License. * * Copyright 2000-2006 L2FProd.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.l2fprod.gui.plaf.skin; import javax.swing.UIDefaults; import org.jvnet.lafplugin.ComponentPluginManager; /** * Implements support for the laf-plugin project. * * @see Laf-Plugin */ public class LafPluginSupport { public static final String PLUGIN_XML = "META-INF/skinlf-plugin.xml"; private static ComponentPluginManager pluginManager = new ComponentPluginManager( PLUGIN_XML); /** * Called by {@link SkinLookAndFeel#initComponentDefaults(UIDefaults)} */ public static void initAllDefaultsEntries(UIDefaults table) { pluginManager.processAllDefaultsEntries(table, SkinLookAndFeel.getSkin()); } /** * Called by {@link SkinLookAndFeel#initialize()} */ public static void initialize() { pluginManager.initializeAll(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/LinuxLookAndFeel.java0000644000175000017500000000631110460410014024176 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.gui.plaf.skin.impl.gtk.GtkSkin; import com.l2fprod.gui.plaf.skin.impl.gtk.GtkSkinNotFoundException; /** * Linux Look And Feel.
    * Use this class to set the look and feel to the current user GTK theme.
    * This code was submitted by Nicholas Allen * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:09:07 $ */ public class LinuxLookAndFeel extends SkinLookAndFeel { /** * Constructor for the LinuxLookAndFeel object * * @exception GtkSkinNotFoundException Description of Exception * @exception Exception Description of Exception */ public LinuxLookAndFeel() throws GtkSkinNotFoundException, Exception { setSkin(new GtkSkin(GtkSkin.getDefaultSkinLocation())); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/Skin.java0000644000175000017500000001050210460410016021736 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.UIDefaults; /** * Skin Entry Class.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:09:07 $ */ public interface Skin { /** * Gets the Personality attribute of the Skin object * * @return The Personality value */ public SkinPersonality getPersonality(); /** * Gets the Button attribute of the Skin object * * @return The Button value */ public SkinButton getButton(); /** * Gets the Frame attribute of the Skin object * * @return The Frame value */ public SkinFrame getFrame(); /** * Gets the Tab attribute of the Skin object * * @return The Tab value */ public SkinTab getTab(); /** * Gets the Progress attribute of the Skin object * * @return The Progress value */ public SkinProgress getProgress(); /** * Gets the Colors attribute of the Skin object * * @return The Colors value */ public String[] getColors(); /** * Gets the Scrollbar attribute of the Skin object * * @return The Scrollbar value */ public SkinScrollbar getScrollbar(); /** * Gets the SplitPane attribute of the Skin object * * @return The SplitPane value */ public SkinSplitPane getSplitPane(); /** * Gets the Slider attribute of the Skin object * * @return The Slider value */ public SkinSlider getSlider(); /** * Gets the Separator attribute of the Skin object * * @return The Separator value */ public SkinSeparator getSeparator(); /** * Description of the Method */ public void unload(); /** * Gets the Resource attribute of the Skin object * * @param key Description of Parameter * @return The Resource value */ public Object getResource(Object key); public void initComponentDefaults(UIDefaults table); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinArrowButton.java0000644000175000017500000001106410460410014024147 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.UIManager; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ final class SkinArrowButton extends JButton implements SwingConstants { /** * Description of the Field */ private int direction; /** * Description of the Field */ private Skin skin = SkinLookAndFeel.getSkin(); /** * Constructor for the SkinArrowButton object * * @param direction Description of Parameter */ public SkinArrowButton(int direction) { super(); setRequestFocusEnabled(false); setDirection(direction); setBackground(UIManager.getColor("control")); } /** * Sets the Direction attribute of the SkinArrowButton object * * @param dir The new Direction value */ public void setDirection(int dir) { direction = dir; } /** * Gets the Direction attribute of the SkinArrowButton object * * @return The Direction value */ public int getDirection() { return direction; } /** * Gets the PreferredSize attribute of the SkinArrowButton object * * @return The PreferredSize value */ public Dimension getPreferredSize() { return skin.getScrollbar().getArrowPreferredSize(direction); } /** * Gets the MinimumSize attribute of the SkinArrowButton object * * @return The MinimumSize value */ public Dimension getMinimumSize() { return new Dimension(5, 5); } /** * Gets the MaximumSize attribute of the SkinArrowButton object * * @return The MaximumSize value */ public Dimension getMaximumSize() { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); } /** * Gets the FocusTraversable attribute of the SkinArrowButton object * * @return The FocusTraversable value */ public boolean isFocusTraversable() { return false; } /** * Description of the Method * * @param g Description of Parameter */ public void paint(Graphics g) { skin.getScrollbar().paintArrow(g, this, direction); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinButton.java0000644000175000017500000000672110460410014023140 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Button.
    * Include support for buttons, toggle buttons and radio. * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 19:47:23 $ */ public interface SkinButton extends SkinComponent { /** * Gets the CheckBoxIconSize attribute of the SkinButton object * * @return The CheckBoxIconSize value */ java.awt.Dimension getCheckBoxIconSize(); /** * Gets the RadioButtonIconSize attribute of the SkinButton object * * @return The RadioButtonIconSize value */ java.awt.Dimension getRadioButtonIconSize(); /** * Gets the RadioIcon attribute of the SkinButton object * * @param b Description of Parameter * @return The RadioIcon value */ javax.swing.Icon getRadioIcon(javax.swing.AbstractButton b); /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @return Description of the Returned Value */ boolean paintButton(java.awt.Graphics g, javax.swing.AbstractButton b); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinButtonUI.java0000644000175000017500000002027310460410016023376 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.plaf.basic.*; import javax.swing.plaf.*; import javax.swing.*; import javax.swing.text.View; import java.awt.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2006/07/22 09:52:08 $ */ public class SkinButtonUI extends BasicButtonUI { /** * Description of the Field */ protected int dashedRectGapX; /** * Description of the Field */ protected int dashedRectGapY; /** * Description of the Field */ protected int dashedRectGapWidth; /** * Description of the Field */ protected int dashedRectGapHeight; /** * Description of the Field */ protected Color focusColor; /** * Description of the Field */ protected Skin skin = SkinLookAndFeel.getSkin(); // ******************************** // Create PLAF // ******************************** /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinButtonUI(); } // ******************************** // Paint Methods // ******************************** /* * These rectangles/insets are allocated once for all * ButtonUI.paint() calls. Re-using rectangles rather than * allocating them in each paint call substantially reduced the time * it took paint to run. Obviously, this method can't be re-entered. */ private static Rectangle viewRect = new Rectangle(); private static Rectangle textRect = new Rectangle(); private static Rectangle iconRect = new Rectangle(); // ******************************** // Paint Methods // ******************************** /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); FontMetrics fm = g.getFontMetrics(); Insets i = c.getInsets(); viewRect.x = i.left; viewRect.y = i.top; viewRect.width = b.getWidth() - (i.right + viewRect.x); viewRect.height = b.getHeight() - (i.bottom + viewRect.y); textRect.x = textRect.y = textRect.width = textRect.height = 0; iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0; Font f = c.getFont(); g.setFont(f); // layout the text and icon String text = SwingUtilities.layoutCompoundLabel( c, fm, b.getText(), b.getIcon(), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, b.getText() == null ? 0 : defaultTextIconGap ); clearTextShiftOffset(); // perform UI specific press action, e.g. Windows L&F shifts text if (model.isArmed() && model.isPressed()) { paintButtonPressed(g, b); } skin.getButton().paintButton(g, b); // Paint the Icon if (b.getIcon() != null) { paintIcon(g, c, iconRect); } if (text != null && !text.equals("")) { //PENDING(fred): BasicHTML is not used because package private in JDK1.2 (not in 1.3) View v = (View) c.getClientProperty("html"); //BasicHTML.propertyKey if (v != null) { v.paint(g, textRect); } else { paintText(g, c, textRect, text); } } if (b.isFocusPainted() && b.hasFocus()) { // paint UI specific focus paintFocus(g, b, viewRect, textRect, iconRect); } } /** * Gets the FocusColor attribute of the SkinButtonUI object * * @return The FocusColor value */ protected Color getFocusColor() { return focusColor; } // ******************************** // Create Listeners // ******************************** // protected BasicButtonListener createButtonListener(AbstractButton b) { // return new SkinButtonListener(b); // } // ******************************** // Defaults // ******************************** /** * Description of the Method * * @param b Description of Parameter */ protected void installDefaults(final AbstractButton b) { super.installDefaults(b); String pp = getPropertyPrefix(); dashedRectGapX = UIManager.getInt(pp + "dashedRectGapX"); dashedRectGapY = UIManager.getInt(pp + "dashedRectGapY"); dashedRectGapWidth = UIManager.getInt(pp + "dashedRectGapWidth"); dashedRectGapHeight = UIManager.getInt(pp + "dashedRectGapHeight"); focusColor = UIManager.getColor(pp + "focus"); b.setBorderPainted(false); b.setFocusPainted(true); b.setOpaque(false); b.setRolloverEnabled(true); skin.getButton().installSkin(b); } /** * Description of the Method * * @param b Description of Parameter */ protected void uninstallDefaults(AbstractButton b) { super.uninstallDefaults(b); b.setBorderPainted(true); b.setFocusPainted(true); b.setOpaque(true); } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param viewRect Description of Parameter * @param textRect Description of Parameter * @param iconRect Description of Parameter */ protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { // focus painted same color as text on Basic?? int width = b.getWidth(); int height = b.getHeight(); g.setColor(getFocusColor()); BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX, dashedRectGapY, width - dashedRectGapWidth, height - dashedRectGapHeight); } /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter */ protected void paintButtonPressed(Graphics g, AbstractButton b) { setTextShiftOffset(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinCheckBoxIcon.java0000644000175000017500000000706210460410016024165 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Component; import java.awt.Graphics; import javax.swing.AbstractButton; import javax.swing.Icon; import javax.swing.plaf.UIResource; /** * Created on 05/04/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2006/07/22 09:52:08 $ */ final class SkinCheckBoxIcon implements Icon, java.io.Serializable, UIResource { /** * Gets the IconHeight attribute of the SkinCheckBoxIcon object * * @return The IconHeight value */ public int getIconHeight() { return SkinLookAndFeel.getSkin().getButton().getCheckBoxIconSize().height; } /** * Gets the IconWidth attribute of the SkinCheckBoxIcon object * * @return The IconWidth value */ public int getIconWidth() { return SkinLookAndFeel.getSkin().getButton().getCheckBoxIconSize().width; } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param x Description of Parameter * @param y Description of Parameter */ public void paintIcon(Component c, Graphics g, int x, int y) { SkinLookAndFeel.getSkin().getButton().getRadioIcon((AbstractButton) c).paintIcon(c, g, x, y); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinCheckBoxMenuItemUI.java0000644000175000017500000001064010460410014025250 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.plaf.*; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:46:29 $ */ public class SkinCheckBoxMenuItemUI extends SkinMenuItemUI { /** * Description of the Method * * @param item Description of Parameter * @param e Description of Parameter * @param path Description of Parameter * @param manager Description of Parameter */ public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) { Point p = e.getPoint(); if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) { if (e.getID() == MouseEvent.MOUSE_RELEASED) { manager.clearSelectedPath(); item.doClick(0); } else { manager.setSelectedPath(path); } } else if (item.getModel().isArmed()) { MenuElement newPath[] = new MenuElement[path.length - 1]; int i; int c; for (i = 0, c = path.length - 1; i < c; i++) { newPath[i] = path[i]; } manager.setSelectedPath(newPath); } } /** * Gets the PropertyPrefix attribute of the SkinCheckBoxMenuItemUI object * * @return The PropertyPrefix value */ protected String getPropertyPrefix() { return "CheckBoxMenuItem"; } /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); String prefix = getPropertyPrefix(); if (menuItem.getSelectedIcon() == null || menuItem.getSelectedIcon() instanceof UIResource) { menuItem.setSelectedIcon( UIManager.getIcon(prefix + ".checkIcon")); } } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinCheckBoxMenuItemUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinCheckBoxUI.java0000644000175000017500000000676410460410014023620 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.AbstractButton; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinCheckBoxUI extends SkinRadioButtonUI { private final static String propertyPrefix = "CheckBox" + "."; // ******************************** // Create PLAF // ******************************** /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinCheckBoxUI(); } /** * Gets the PropertyPrefix attribute of the SkinCheckBoxUI object * * @return The PropertyPrefix value */ public String getPropertyPrefix() { return propertyPrefix; } // ******************************** // Defaults // ******************************** /** * Description of the Method * * @param b Description of Parameter */ public void installDefaults(AbstractButton b) { super.installDefaults(b); icon = UIManager.getIcon(getPropertyPrefix() + "icon"); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinComboBoxUI.java0000644000175000017500000003321010460410016023626 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.gui.icon.ArrowIcon; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import java.awt.LayoutManager; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.CellRendererPane; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.KeyStroke; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicComboBoxUI; /** * @author $Author: l2fprod $ * @version $Revision: 1.5 $, $Date: 2005/12/04 15:34:37 $ */ public final class SkinComboBoxUI extends BasicComboBoxUI { private Skin skin = SkinLookAndFeel.getSkin(); private boolean rollover = false; private MouseListener rolloverListener; public SkinComboBoxUI() { // Install a new renderer for the selected value which will work with // both Java 1.4 and 1.5. currentValuePane = new CellRendererPane() { public void paintComponent( Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate) { JComponent jc = (JComponent) c; jc.setOpaque(false); super.paintComponent(g, c, p, x, y, w, h, shouldValidate); // This is a bit hacky, but restoring this property to it's previous // value does NOT work on J2SE 1.5.0_05 somehow. jc.setOpaque(true); } }; } /** * Gets the PreferredSize attribute of the SkinComboBoxUI object * * @param c Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JComponent c) { Dimension prefs = super.getMinimumSize(c); Dimension combo = skin.getPersonality().getComboBoxPreferredSize(comboBox); prefs.width = Math.max(prefs.width, combo.width); prefs.height = Math.max(prefs.height, combo.height); return prefs; } /** * Gets the MinimumSize attribute of the SkinComboBoxUI object * * @param c Description of Parameter * @return The MinimumSize value */ public Dimension getMinimumSize(JComponent c) { return getPreferredSize(c); } protected void installListeners() { super.installListeners(); rolloverListener = createRolloverListener(); comboBox.addMouseListener(rolloverListener); } protected void uninstallListeners() { super.uninstallListeners(); comboBox.removeMouseListener(rolloverListener); rolloverListener = null; } protected MouseListener createRolloverListener() { return new RolloverMouseListener(); } public class RolloverMouseListener extends MouseAdapter { public void mouseEntered(MouseEvent event) { rollover = true; comboBox.repaint(); } public void mouseExited(MouseEvent event) { rollover = false; comboBox.repaint(); } } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { hasFocus = comboBox.hasFocus(); Rectangle r = rectangleForCurrentValue(); skin.getPersonality().paintComboBox(g, comboBox, r, hasFocus, rollover); if (!comboBox.isEditable() || editor == null || !editor.isVisible()) { paintCurrentValue(g, r, false); } } /** * Gets the Insets attribute of the SkinComboBoxUI object * * @return The Insets value */ protected Insets getInsets() { return skin.getPersonality().getComboBoxInsets(); } /** * Description of the Method * * @return Description of the Returned Value */ protected JButton createArrowButton() { JButton button = new JButton(new ArrowIcon(ArrowIcon.SOUTH)); return button; } /** * Description of the Method */ protected void installComponents() { super.installComponents(); arrowButton.setVisible(false); } protected void configureEditor() { super.configureEditor(); editor.addMouseListener(rolloverListener); if (comboBox.getEditor() != null && comboBox.getEditor() instanceof UIResource && editor instanceof JComponent) { ((JComponent)editor).setOpaque(false); } } protected void unconfigureEditor() { super.unconfigureEditor(); editor.removeMouseListener(rolloverListener); } /** * Description of the Method * * @return Description of the Returned Value */ protected Rectangle rectangleForCurrentValue() { int width = comboBox.getWidth(); int height = comboBox.getHeight(); Insets insets = getInsets(); return new Rectangle(insets.left, insets.top, width - (insets.left + insets.right), height - (insets.top + insets.bottom)); } /** * Description of the Method * * @return Description of the Returned Value */ protected LayoutManager createLayoutManager() { return new SkinComboBoxLayoutManager(); } protected JComboBox comboBox() { return comboBox; } /** * Description of the Method */ protected void installKeyboardActions() { super.installKeyboardActions(); ActionListener downAction = new ActionListener() { public void actionPerformed(ActionEvent e) { if (comboBox().isEnabled()) { if (isPopupVisible()) { selectNextPossibleValue(); } else { setPopupVisible(comboBox(), true); } } } }; comboBox.registerKeyboardAction(downAction, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); comboBox.registerKeyboardAction(downAction, KeyStroke.getKeyStroke("KP_DOWN"), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ActionListener altAction = new ActionListener() { public void actionPerformed(ActionEvent e) { if (comboBox().isEnabled() && isPopupVisible()) { togglePopup(); } } }; comboBox.registerKeyboardAction(altAction, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.ALT_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); comboBox.registerKeyboardAction(altAction, KeyStroke.getKeyStroke("alt KP_DOWN"), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); comboBox.registerKeyboardAction(altAction, KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.ALT_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); comboBox.registerKeyboardAction(altAction, KeyStroke.getKeyStroke("alt KP_UP"), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ActionListener upAction = new ActionListener() { public void actionPerformed(ActionEvent e) { if (comboBox().isEnabled() && isPopupVisible()) { selectPreviousPossibleValue(); } } }; comboBox.registerKeyboardAction(upAction, KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); comboBox.registerKeyboardAction(upAction, KeyStroke.getKeyStroke("KP_UP"), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } /** * Description of the Method */ protected void uninstallKeyboardActions() { super.uninstallKeyboardActions(); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke("KP_DOWN")); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.ALT_MASK)); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke("alt KP_DOWN")); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0)); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke("KP_UP")); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.ALT_MASK)); comboBox.unregisterKeyboardAction(KeyStroke.getKeyStroke("alt KP_UP")); } /** * Description of the Method * * @return Description of the Returned Value */ protected Component editor() { return editor; } /** * Gets the PopupVisible attribute of the SkinComboBoxUI object * * @return The PopupVisible value */ boolean isPopupVisible() { return super.isPopupVisible(comboBox); } /** * Description of the Method */ void togglePopup() { toggleOpenClose(); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinComboBoxUI(); } public PropertyChangeListener createPropertyChangeListener() { return new SkinPropertyChangeListener(); } /** * This inner class is marked "public" due to a compiler bug. This * class should be treated as a "protected" inner class. Instantiate * it only within subclasses of . */ public class SkinPropertyChangeListener extends BasicComboBoxUI.PropertyChangeHandler { public void propertyChange(PropertyChangeEvent e) { super.propertyChange(e); String propertyName = e.getPropertyName(); if (propertyName.equals("background")) { Color color = (Color)e.getNewValue(); arrowButton.setBackground(color); listBox.setBackground(color); } else if (propertyName.equals("foreground")) { Color color = (Color)e.getNewValue(); arrowButton.setForeground(color); listBox.setForeground(color); } } } /** * Description of the Class * * @author fred */ public class SkinComboBoxLayoutManager implements LayoutManager { /** * Adds a feature to the LayoutComponent attribute of the * SkinComboBoxLayoutManager object * * @param name The feature to be added to the LayoutComponent attribute * @param comp The feature to be added to the LayoutComponent attribute */ public void addLayoutComponent(String name, Component comp) { } /** * Description of the Method * * @param comp Description of Parameter */ public void removeLayoutComponent(Component comp) { } /** * Description of the Method * * @param parent Description of Parameter * @return Description of the Returned Value */ public Dimension preferredLayoutSize(Container parent) { return parent.getPreferredSize(); } /** * Description of the Method * * @param parent Description of Parameter * @return Description of the Returned Value */ public Dimension minimumLayoutSize(Container parent) { return parent.getMinimumSize(); } /** * Description of the Method * * @param parent Description of Parameter */ public void layoutContainer(Container parent) { Rectangle cvb; if (SkinComboBoxUI.this.editor() != null) { cvb = rectangleForCurrentValue(); SkinComboBoxUI.this.editor().setBounds(cvb); } } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinComponent.java0000644000175000017500000000563510460410014023632 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Component.
    * * * @author $Author: l2fprod $ * @version $Revision: 1.1 $, $Date: 2003/08/01 19:47:23 $ */ public interface SkinComponent { /** * Description of the Method * * @return Description of the Returned Value */ boolean status(); /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public boolean installSkin(javax.swing.JComponent c); public void uninstallSkin(javax.swing.JComponent c); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinDesktopIconUI.java0000644000175000017500000001470610460410016024351 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.BorderLayout; import java.awt.Dimension; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.event.MouseInputListener; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicDesktopIconUI; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinDesktopIconUI extends BasicDesktopIconUI { /** * Description of the Field */ protected PropertyChangeListener propertyChangeListener; JLabel iconPane; MouseInputListener mouseInputListener; /** * Gets the MinimumSize attribute of the SkinDesktopIconUI object * * @param c Description of Parameter * @return The MinimumSize value */ public Dimension getMinimumSize(JComponent c) { return iconPane.getMinimumSize(); } /** * Gets the MaximumSize attribute of the SkinDesktopIconUI object * * @param c Description of Parameter * @return The MaximumSize value */ public Dimension getMaximumSize(JComponent c) { return iconPane.getMaximumSize(); } /** * Gets the PreferredSize attribute of the SkinDesktopIconUI object * * @param c Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JComponent c) { return iconPane.getPreferredSize(); } /** * Description of the Method */ protected void installComponents() { frame = desktopIcon.getInternalFrame(); desktopIcon.setBorder(null); iconPane = new JLabel(frame.getTitle(), frame.getFrameIcon(), JLabel.CENTER); iconPane.setHorizontalTextPosition(JLabel.CENTER); iconPane.setVerticalTextPosition(JLabel.BOTTOM); iconPane.setHorizontalAlignment(JLabel.CENTER); desktopIcon.setLayout(new BorderLayout()); desktopIcon.add(iconPane, BorderLayout.CENTER); desktopIcon.setOpaque(true); } /** * Description of the Method */ protected void installListeners() { mouseInputListener = createMouseInputListener(); iconPane.addMouseMotionListener(mouseInputListener); iconPane.addMouseListener(mouseInputListener); if (propertyChangeListener == null) { propertyChangeListener = createPropertyChangeListener(); } desktopIcon.getInternalFrame().addPropertyChangeListener(propertyChangeListener); } /** * Description of the Method */ protected void uninstallListeners() { super.uninstallListeners(); desktopIcon.getInternalFrame().removePropertyChangeListener(propertyChangeListener); } /** * Description of the Method * * @return Description of the Returned Value */ protected PropertyChangeListener createPropertyChangeListener() { return new PropertyChangeHandler(); } /** * Description of the Method */ protected void uninstallComponents() { desktopIcon.setLayout(null); desktopIcon.remove(iconPane); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinDesktopIconUI(); } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class PropertyChangeHandler implements PropertyChangeListener { /** * Description of the Method * * @param evt Description of Parameter */ public void propertyChange(PropertyChangeEvent evt) { String prop = evt.getPropertyName(); if (JInternalFrame.TITLE_PROPERTY.equals(prop)) { // PENDING(fred): we need to trim the title or define a maximum size // or display it on multiple lines ? iconPane.setText((String) evt.getNewValue()); } else if (JInternalFrame.FRAME_ICON_PROPERTY.equals(prop)) { iconPane.setIcon((Icon) evt.getNewValue()); } } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinDesktopPaneUI.java0000644000175000017500000000646710460410016024351 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicDesktopPaneUI; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:46:29 $ */ public final class SkinDesktopPaneUI extends BasicDesktopPaneUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { if (c.getClientProperty("JDesktop.backgroundEnabled") != null) { skin.getPersonality().paintBackground(g, c); } } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinDesktopPaneUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinFileChooserUI.java0000644000175000017500000000751710460410016024333 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.util.OS; import java.io.File; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFileChooser; import javax.swing.filechooser.FileView; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.metal.MetalFileChooserUI; /** * Created on 05/04/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2004/07/18 19:14:56 $ */ public final class SkinFileChooserUI extends MetalFileChooserUI { private BasicFileView fileView = new SystemFileView(); public static ComponentUI createUI(JComponent c) { return new SkinFileChooserUI((JFileChooser) c); } /** * Constructor for the SkinFileChooserUI object * * @param filechooser Description of Parameter */ public SkinFileChooserUI(JFileChooser filechooser) { super(filechooser); } public FileView getFileView(JFileChooser fc) { return fileView; } /** * return "native" icons for Files */ protected class SystemFileView extends BasicFileView { public Icon getIcon(File f) { Icon icon = getCachedIcon(f); if (icon != null) { return icon; } if (OS.isOneDotFourOrMore() && f != null) { icon = getFileChooser().getFileSystemView().getSystemIcon(f); } if (icon == null) { icon = super.getIcon(f); } cacheIcon(f, icon); return icon; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinFrame.java0000644000175000017500000000656510460410014022725 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Frame.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 19:47:23 $ */ public interface SkinFrame extends SkinComponent { /** * Gets the WindowButtons attribute of the SkinFrame object * * @param align Description of Parameter * @return The WindowButtons value */ SkinWindowButton[] getWindowButtons(int align); /** * Gets the TopPreferredSize attribute of the SkinFrame object * * @return The TopPreferredSize value */ java.awt.Dimension getTopPreferredSize(); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param isSelected Description of Parameter * @param title Description of Parameter * @return Description of the Returned Value */ boolean paintTop(java.awt.Graphics g, java.awt.Component c, boolean isSelected, String title); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinInternalFrameUI.java0000644000175000017500000001464410460410014024655 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager; import java.awt.event.MouseEvent; import javax.swing.JComponent; import javax.swing.JInternalFrame; import javax.swing.event.MouseInputAdapter; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicInternalFrameUI; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2003/12/06 21:46:29 $ */ public final class SkinInternalFrameUI extends BasicInternalFrameUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Constructor for the SkinInternalFrameUI object * * @param b Description of Parameter */ public SkinInternalFrameUI(JInternalFrame b) { super(b); } /** * Description of the Method * * @param c Description of Parameter */ public void installUI(JComponent c) { super.installUI(c); skin.getFrame().installSkin(c); } /** * Description of the Method * * @param w Description of Parameter * @return Description of the Returned Value */ protected JComponent createNorthPane(JInternalFrame w) { titlePane = new SkinTitlePane(w); return titlePane; } /** * Description of the Method * * @param w Description of Parameter * @return Description of the Returned Value */ protected MouseInputAdapter createBorderListener(JInternalFrame w) { return new MyBorderListener(); } /** * Description of the Method * * @param b Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent b) { return new SkinInternalFrameUI((JInternalFrame) b); } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ protected class MyBorderListener extends BorderListener { /** * Description of the Method * * @param e Description of Parameter */ public void mouseMoved(MouseEvent e) { JComponent pane = getNorthPane(); if (e.getSource()==frame && pane instanceof SkinTitlePane && ((SkinTitlePane) pane).getWindow().isShaded()) { return; } super.mouseMoved(e); } /** * Description of the Method * * @param e Description of Parameter */ public void mouseDragged(MouseEvent e) { try { // do not resize the frame if it is shaded JComponent pane = getNorthPane(); if (e.getSource()==frame && pane instanceof SkinTitlePane && ((SkinTitlePane) pane).getWindow().isShaded()) { return; } super.mouseDragged(e); } catch (NullPointerException ex) { // the nullpointerexception may be thrown by bug id 4383371 // if parentBounds is not set // sending the frame back and front should fix the problem as an Ancestor propertychangeevent // will be sent // this bug has been fixed in JDK1.3 // http://developer.java.sun.com/developer/bugParade/bugs/4383371.html ((JInternalFrame) e.getSource()).toBack(); ((JInternalFrame) e.getSource()).toFront(); } } } protected LayoutManager createLayoutManager(){ return new MyInternalFrameLayout(); } protected class MyInternalFrameLayout extends InternalFrameLayout { public Dimension minimumLayoutSize(Container c) { // The minimum size of the internal frame only takes into account the // title pane since you are allowed to resize the frames to the point // where just the title pane is visible. Dimension result = new Dimension(); if (getNorthPane() != null && getNorthPane() instanceof SkinTitlePane) { result = new Dimension(getNorthPane().getMinimumSize()); } Insets i = frame.getInsets(); result.width += i.left + i.right; result.height += i.top + i.bottom; return result; } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinListUI.java0000644000175000017500000000615510460410014023037 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicListUI; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:46:58 $ */ public final class SkinListUI extends BasicListUI { /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); list.setCellRenderer(SkinLookAndFeel.getSkin().getPersonality().createListCellRenderer()); } /** * Description of the Method * * @param list Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent list) { return new SkinListUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinLookAndFeel.java0000644000175000017500000012136310460410014024010 0ustar twernertwerner/* * ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: 1. * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. 2. 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. 3. The end-user documentation * included with the redistribution, if any, must include the following * acknowlegement: "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." Alternately, this acknowlegement may appear in * the software itself, if and wherever such third-party acknowlegements * normally appear. 4. The names "Skin Look And Feel", "SkinLF" and * "L2FProd.com" must not be used to endorse or promote products derived from * this software without prior written permission. For written permission, * please contact info@L2FProd.com. 5. Products derived from this software may * not be called "SkinLF" nor may "SkinLF" appear in their names without prior * written permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 * L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.contrib.nanoxml.XMLElement; import com.l2fprod.gui.plaf.skin.impl.gtk.GtkSkin; import com.l2fprod.gui.plaf.skin.impl.kde.KdeSkin; import com.l2fprod.util.OS; import com.l2fprod.util.StringUtils; import com.l2fprod.util.ZipResourceLoader; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Insets; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.InputStream; import java.net.URL; import java.util.Arrays; import java.util.Enumeration; import java.util.ResourceBundle; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; import javax.swing.plaf.BorderUIResource; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.DimensionUIResource; import javax.swing.plaf.FontUIResource; import javax.swing.plaf.IconUIResource; import javax.swing.plaf.InsetsUIResource; import javax.swing.plaf.basic.BasicLookAndFeel; import javax.swing.text.DefaultEditorKit; import javax.swing.text.JTextComponent; /** * Skin Look And Feel Main Class.
    Use this class to set the current skin * or to load skins.
    See L2FProd.com * website for the complete description of a theme pack. * * @author $Author: l2fprod $ * @version $Revision: 1.19 $, $Date: 2006/07/22 10:04:33 $ */ public class SkinLookAndFeel extends BasicLookAndFeel { /** * Description of the Field * * @deprecated Will be soon replaced by {@link #version()} */ public final static String VERSION = version(); /** * Returns the Skin Look And Feel version * * @return the Skin Look And Feel version */ public static String version() { return "6.7"; } public static String date() { return "07/22/2006 01:46 PM"; } private static Skin c_CurrentSkin; private static ZipResourceLoader c_ResourceLoader; /** * Constructs a new SkinLookAndFeel */ public SkinLookAndFeel() { UIManager.getLookAndFeelDefaults().put( "ClassLoader", getClass().getClassLoader()); } /** * Gets the Name attribute of the SkinLookAndFeel object * * @return The Name value */ public String getName() { return "SkinLF"; } /** * Gets the Description attribute of the SkinLookAndFeel object * * @return The Description value */ public String getDescription() { return "Skin Look and Feel"; } /** * Gets the ID attribute of the SkinLookAndFeel object * * @return The ID value */ public String getID() { return "SkinLF"; } /** * Gets the NativeLookAndFeel attribute of the SkinLookAndFeel object * * @return The NativeLookAndFeel value */ public boolean isNativeLookAndFeel() { return false; } public boolean getSupportsWindowDecorations() { return true; } /** * Gets the SupportedLookAndFeel attribute of the SkinLookAndFeel object * * @return The SupportedLookAndFeel value */ public boolean isSupportedLookAndFeel() { return true; } /** * Description of the Method * * @param table Description of Parameter */ protected void initClassDefaults(UIDefaults table) { super.initClassDefaults(table); java.util.Vector list = new java.util.Vector(); if (getSkin().getProgress() != null && getSkin().getProgress().status()) { list.addElement("ProgressBarUI"); list.addElement(SkinProgressBarUI.class.getName()); } if (getSkin().getTab() != null && getSkin().getTab().status()) { list.addElement("TabbedPaneUI"); list.addElement(SkinTabbedPaneUI.class.getName()); } if (getSkin().getFrame() != null && getSkin().getFrame().status()) { list.addElement("InternalFrameUI"); list.addElement(SkinInternalFrameUI.class.getName()); if (OS.isOneDotFourOrMore()) { // add support for decorated frames list.addElement("RootPaneUI"); list.addElement(SkinRootPaneUI.class.getName()); } list.addElement("WindowButtonUI"); list.addElement(SkinWindowButtonUI.class.getName()); } if (getSkin().getSlider() != null && getSkin().getSlider().status()) { list.addElement("SliderUI"); list.addElement(SkinSliderUI.class.getName()); } if (getSkin().getScrollbar() != null && getSkin().getScrollbar().status()) { list.addElement("ScrollBarUI"); list.addElement(SkinScrollBarUI.class.getName()); } if (getSkin().getButton() != null && getSkin().getButton().status()) { list.addElement("ButtonUI"); list.addElement(SkinButtonUI.class.getName()); list.addElement("ToggleButtonUI"); list.addElement(SkinToggleButtonUI.class.getName()); } if (getSkin().getSeparator() != null && getSkin().getSeparator().status()) { list.addElement("SeparatorUI"); list.addElement(SkinSeparatorUI.class.getName()); } Object[] uiDefaults = { "CheckBoxUI", SkinCheckBoxUI.class.getName(), "ComboBoxUI", SkinComboBoxUI.class.getName(), "CheckBoxMenuItemUI", SkinCheckBoxMenuItemUI.class.getName(), "MenuItemUI", SkinMenuItemUI.class.getName(), "MenuUI", SkinMenuUI.class.getName(), "MenuBarUI", SkinMenuBarUI.class.getName(), "ToolBarUI", SkinToolBarUI.class.getName(), // "ListUI", SkinListUI.class.getName(), "PopupMenuUI", SkinPopupMenuUI.class.getName(), "RadioButtonUI", SkinRadioButtonUI.class.getName(), "RadioButtonMenuItemUI", SkinRadioButtonMenuItemUI.class.getName(), "PanelUI", SkinPanelUI.class.getName(), "DesktopPaneUI", SkinDesktopPaneUI.class.getName(), "DesktopIconUI", SkinDesktopIconUI.class.getName(), "TableHeaderUI", SkinTableHeaderUI.class.getName(), // there is no basic filechooser ui! // so we use the filechooser from metal :( "FileChooserUI", SkinFileChooserUI.class.getName(), "TextFieldUI", "javax.swing.plaf.metal.MetalTextFieldUI", "SplitPaneUI", (Boolean.TRUE.equals(UIManager.get("JSplitPane.alternateUI")) ? (SkinSplitPaneUI.class.getName()) : "javax.swing.plaf.basic.BasicSplitPaneUI"), "TreeUI", SkinTreeUI.class.getName(), "OptionPaneUI", SkinOptionPaneUI.class.getName(), "ToolTipUI", SkinToolTipUI.class.getName(), }; for (int i = 0; i < uiDefaults.length; i++) { list.addElement(uiDefaults[i]); } Object[] results = new Object[list.size()]; list.copyInto(results); table.putDefaults(results); } /** * Description of the Method * * @param table Description of Parameter */ protected void initSystemColorDefaults(UIDefaults table) { super.initSystemColorDefaults(table); String[] skinColors = getSkin().getColors(); if (skinColors != null) { loadSystemColors(table, skinColors, isNativeLookAndFeel()); } else { loadSystemColors(table, new String[0], isNativeLookAndFeel()); } } /** * Description of the Method * * @param table Description of Parameter */ protected void initComponentDefaults(UIDefaults table) { super.initComponentDefaults(table); loadResourceBundle(table); // *** Tree Object treeExpandedIcon = SkinTreeUI.ExpandedIcon.createExpandedIcon(); Object treeCollapsedIcon = SkinTreeUI.CollapsedIcon.createCollapsedIcon(); Object checkIcon = new SkinCheckBoxIcon(); Object[] defaults = { // // Buttons "Button.dashedRectGapX", new Integer(5), "Button.dashedRectGapY", new Integer(4), "Button.dashedRectGapWidth", new Integer(10), "Button.dashedRectGapHeight", new Integer(8), "Button.textShiftOffset", new Integer(1), "Desktop.background", table.get("desktop"), "ToggleButton.textShiftOffset", new Integer(1), "CheckBoxMenuItem.checkIcon", checkIcon, "RadioButtonMenuItem.checkIcon", checkIcon, "SplitPane.dividerSize", new Integer(4), "SplitPane.background", table.get("control"), "ProgressBar.cellLength", new Integer(7), "ProgressBar.cellSpacing", new Integer(2), "Tree.expandedIcon", treeExpandedIcon, "Tree.collapsedIcon", treeCollapsedIcon, "Tree.line", Color.black, // horiz lines "Tree.hash", Color.black, // legs "Tree.rowHeight", new Integer(0), "Tree.textForeground", table.get("textText"), "Tree.textBackground", table.get("window"), "FileChooser.usesSingleFilePane", Boolean.TRUE, "FileChooser.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancelSelection", "F2", "editFileName", "F5", "refresh", "BACK_SPACE", "Go Up", "ENTER", "approveSelection" }), "InternalFrame.minimizeIconBackground", table.get("control"), "InternalFrame.resizeIconHighlight", table.get("controlHighlight"), "InternalFrame.resizeIconShadow", table.get("controlShadow"), "ToolTip.border", new BorderUIResource(new CompoundBorder(new LineBorder(Color.black), new EmptyBorder(0, 2, 0, 2))), }; table.putDefaults(defaults); // bug fixed by Christopher R. Staley [Chris.Staley@itpwebsolutions.com] // for JDK1.3 we use InputMap and for JDK1.1,1.2 we use KeyBindings try { Class.forName("javax.swing.InputMap"); Class uidefaults = Class.forName("javax.swing.UIDefaults"); Class[] innerClasses = uidefaults.getClasses(); java.lang.reflect.Constructor c = null; for (int i = 0; i < innerClasses.length; i++) { if (innerClasses[i].getName().endsWith("LazyInputMap")) { c = innerClasses[i].getConstructor(new Class[] { Object[].class }); break; } } Object[] fieldInputMap = new Object[] { "ctrl C", DefaultEditorKit.copyAction, "ctrl V", DefaultEditorKit.pasteAction, "ctrl X", DefaultEditorKit.cutAction, "COPY", DefaultEditorKit.copyAction, "PASTE", DefaultEditorKit.pasteAction, "CUT", DefaultEditorKit.cutAction, "shift LEFT", DefaultEditorKit.selectionBackwardAction, "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, "shift RIGHT", DefaultEditorKit.selectionForwardAction, "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, "ctrl LEFT", DefaultEditorKit.previousWordAction, "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, "ctrl RIGHT", DefaultEditorKit.nextWordAction, "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, "ctrl A", DefaultEditorKit.selectAllAction, "HOME", DefaultEditorKit.beginLineAction, "END", DefaultEditorKit.endLineAction, "shift HOME", DefaultEditorKit.selectionBeginLineAction, "shift END", DefaultEditorKit.selectionEndLineAction, "typed \010", DefaultEditorKit.deletePrevCharAction, "DELETE", DefaultEditorKit.deleteNextCharAction, "RIGHT", DefaultEditorKit.forwardAction, "LEFT", DefaultEditorKit.backwardAction, "KP_RIGHT", DefaultEditorKit.forwardAction, "KP_LEFT", DefaultEditorKit.backwardAction, "ENTER", JTextField.notifyAction, "ctrl BACK_SLASH", "unselect", "control shift O", "toggle-componentOrientation" }; Object[] multilineInputMap = new Object[] { "ctrl C", DefaultEditorKit.copyAction, "ctrl V", DefaultEditorKit.pasteAction, "ctrl X", DefaultEditorKit.cutAction, "COPY", DefaultEditorKit.copyAction, "PASTE", DefaultEditorKit.pasteAction, "CUT", DefaultEditorKit.cutAction, "shift LEFT", DefaultEditorKit.selectionBackwardAction, "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction, "shift RIGHT", DefaultEditorKit.selectionForwardAction, "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction, "ctrl LEFT", DefaultEditorKit.previousWordAction, "ctrl KP_LEFT", DefaultEditorKit.previousWordAction, "ctrl RIGHT", DefaultEditorKit.nextWordAction, "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction, "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction, "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction, "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction, "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction, "ctrl A", DefaultEditorKit.selectAllAction, "HOME", DefaultEditorKit.beginLineAction, "END", DefaultEditorKit.endLineAction, "shift HOME", DefaultEditorKit.selectionBeginLineAction, "shift END", DefaultEditorKit.selectionEndLineAction, "UP", DefaultEditorKit.upAction, "KP_UP", DefaultEditorKit.upAction, "DOWN", DefaultEditorKit.downAction, "KP_DOWN", DefaultEditorKit.downAction, "PAGE_UP", DefaultEditorKit.pageUpAction, "PAGE_DOWN", DefaultEditorKit.pageDownAction, "shift PAGE_UP", "selection-page-up", "shift PAGE_DOWN", "selection-page-down", "ctrl shift PAGE_UP", "selection-page-left", "ctrl shift PAGE_DOWN", "selection-page-right", "shift UP", DefaultEditorKit.selectionUpAction, "shift KP_UP", DefaultEditorKit.selectionUpAction, "shift DOWN", DefaultEditorKit.selectionDownAction, "shift KP_DOWN", DefaultEditorKit.selectionDownAction, "ENTER", DefaultEditorKit.insertBreakAction, "typed \010", DefaultEditorKit.deletePrevCharAction, "DELETE", DefaultEditorKit.deleteNextCharAction, "RIGHT", DefaultEditorKit.forwardAction, "LEFT", DefaultEditorKit.backwardAction, "KP_RIGHT", DefaultEditorKit.forwardAction, "KP_LEFT", DefaultEditorKit.backwardAction, "TAB", DefaultEditorKit.insertTabAction, "ctrl BACK_SLASH", "unselect", "ctrl HOME", DefaultEditorKit.beginAction, "ctrl END", DefaultEditorKit.endAction, "ctrl shift HOME", DefaultEditorKit.selectionBeginAction, "ctrl shift END", DefaultEditorKit.selectionEndAction, "ctrl T", "next-link-action", "ctrl shift T", "previous-link-action", "ctrl SPACE", "activate-link-action", "control shift O", "toggle-componentOrientation" }; table.put( "TextField.focusInputMap", c.newInstance(new Object[] { fieldInputMap })); table.put( "PasswordField.focusInputMap", c.newInstance(new Object[] { fieldInputMap })); table.put( "TextArea.focusInputMap", c.newInstance(new Object[] { multilineInputMap })); table.put( "TextPane.focusInputMap", c.newInstance(new Object[] { multilineInputMap })); table.put( "EditorPane.focusInputMap", c.newInstance(new Object[] { multilineInputMap })); } catch (Throwable e) { JTextComponent.KeyBinding[] fieldBindings = makeKeyBindings( new Object[] { "control C", DefaultEditorKit.copyAction, "control V", DefaultEditorKit.pasteAction, "control X", DefaultEditorKit.cutAction, "COPY", DefaultEditorKit.copyAction, "PASTE", DefaultEditorKit.pasteAction, "CUT", DefaultEditorKit.cutAction, "control INSERT", DefaultEditorKit.copyAction, "shift INSERT", DefaultEditorKit.pasteAction, "shift DELETE", DefaultEditorKit.cutAction, "control A", DefaultEditorKit.selectAllAction, "control BACK_SLASH", "unselect", "shift LEFT", DefaultEditorKit.selectionBackwardAction, "shift RIGHT", DefaultEditorKit.selectionForwardAction, "control LEFT", DefaultEditorKit.previousWordAction, "control RIGHT", DefaultEditorKit.nextWordAction, "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction, "control shift RIGHT", DefaultEditorKit.selectionNextWordAction, "HOME", DefaultEditorKit.beginLineAction, "END", DefaultEditorKit.endLineAction, "shift HOME", DefaultEditorKit.selectionBeginLineAction, "shift END", DefaultEditorKit.selectionEndLineAction, "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, "DELETE", DefaultEditorKit.deleteNextCharAction, "RIGHT", DefaultEditorKit.forwardAction, "LEFT", DefaultEditorKit.backwardAction, "KP_RIGHT", DefaultEditorKit.forwardAction, "KP_LEFT", DefaultEditorKit.backwardAction, "ENTER", JTextField.notifyAction, "control shift O", "toggle-componentOrientation" }); JTextComponent.KeyBinding[] multilineBindings = makeKeyBindings( new Object[] { "control C", DefaultEditorKit.copyAction, "control V", DefaultEditorKit.pasteAction, "control X", DefaultEditorKit.cutAction, "COPY", DefaultEditorKit.copyAction, "PASTE", DefaultEditorKit.pasteAction, "CUT", DefaultEditorKit.cutAction, "control INSERT", DefaultEditorKit.copyAction, "shift INSERT", DefaultEditorKit.pasteAction, "shift DELETE", DefaultEditorKit.cutAction, "shift LEFT", DefaultEditorKit.selectionBackwardAction, "shift RIGHT", DefaultEditorKit.selectionForwardAction, "control LEFT", DefaultEditorKit.previousWordAction, "control RIGHT", DefaultEditorKit.nextWordAction, "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction, "control shift RIGHT", DefaultEditorKit.selectionNextWordAction, "control A", DefaultEditorKit.selectAllAction, "control BACK_SLASH", "unselect", "HOME", DefaultEditorKit.beginLineAction, "END", DefaultEditorKit.endLineAction, "shift HOME", DefaultEditorKit.selectionBeginLineAction, "shift END", DefaultEditorKit.selectionEndLineAction, "control HOME", DefaultEditorKit.beginAction, "control END", DefaultEditorKit.endAction, "control shift HOME", DefaultEditorKit.selectionBeginAction, "control shift END", DefaultEditorKit.selectionEndAction, "UP", DefaultEditorKit.upAction, "DOWN", DefaultEditorKit.downAction, "BACK_SPACE", DefaultEditorKit.deletePrevCharAction, "DELETE", DefaultEditorKit.deleteNextCharAction, "RIGHT", DefaultEditorKit.forwardAction, "LEFT", DefaultEditorKit.backwardAction, "KP_RIGHT", DefaultEditorKit.forwardAction, "KP_LEFT", DefaultEditorKit.backwardAction, "PAGE_UP", DefaultEditorKit.pageUpAction, "PAGE_DOWN", DefaultEditorKit.pageDownAction, "shift PAGE_UP", "selection-page-up", "shift PAGE_DOWN", "selection-page-down", "control shift PAGE_UP", "selection-page-left", "control shift PAGE_DOWN", "selection-page-right", "shift UP", DefaultEditorKit.selectionUpAction, "shift DOWN", DefaultEditorKit.selectionDownAction, "ENTER", DefaultEditorKit.insertBreakAction, "TAB", DefaultEditorKit.insertTabAction, "control T", "next-link-action", "control shift T", "previous-link-action", "control SPACE", "activate-link-action", "control shift O", "toggle-componentOrientation" }); table.put("TextField.keyBindings", fieldBindings); table.put("PasswordField.keyBindings", fieldBindings); table.put("TextArea.keyBindings", multilineBindings); table.put("TextPane.keyBindings", multilineBindings); table.put("EditorPane.keyBindings", multilineBindings); } LafPluginSupport.initAllDefaultsEntries(table); } public void initialize() { super.initialize(); LafPluginSupport.initialize(); } /** * Description of the Method * * @param table Description of Parameter */ private void loadResourceBundle(UIDefaults table) { ResourceBundle bundle = ResourceBundle.getBundle("com.l2fprod.gui.plaf.skin.resources.skin"); Enumeration iter = bundle.getKeys(); while (iter.hasMoreElements()) { String key = (String)iter.nextElement(); table.put(key, fixMnemonic(key, bundle.getObject(key))); } } private Object fixMnemonic(String key, Object value) { if (key.endsWith("Mnemonic") && value instanceof String) { try { return Integer.decode((String) value); } catch (NumberFormatException ignored) {} } return value; } /** * Set the skin used by the Skin Look And Feel * * @param skin a skin */ public static void setSkin(Skin skin) { c_CurrentSkin = skin; } /** * Return the current skin.
    * * If the current skin has not yet been set, Skin Look And Feel will attempt * to load a themepack: *
      *
    • from the property skinlf.themepack (set on the command line using * -Dskinlf.themepack= * path-to-themepack or using System.getProperties().put("skinlf.themepack", path) *
    • *
    • from the user theme pack located in * <user.home>/.skinlf/themepack.zip.
    • *
    • from the user theme pack located in * <user.home>/.skinlf/themepack.zip
    • *
    • from the classloader used to load the SkinLookAndFeel class, looking for "/themepack.zip"
    • *
    * If after this lookup, no theme pack is found, an Error will be thrown. * * @return the current skin */ public static Skin getSkin() { Skin s = c_CurrentSkin; if (s == null) { try { // first the property String themepack = System.getProperty("skinlf.themepack"); if (themepack != null) { // a property exists, use it s = loadThemePack(themepack); } else { // then ~/.skinlf/themepack.zip File themepackFile = new File( System.getProperty("user.home") + File.separator + ".skinlf" + File.separator + "themepack.zip"); if (!themepackFile.isFile()) { // then ~/skinlf/themepack.zip themepackFile = new File( System.getProperty("user.home") + File.separator + "skinlf" + File.separator + "themepack.zip"); } if (themepackFile.isFile()) { s = loadThemePack(themepackFile.toURL()); } else { // finally in the classpath URL u = SkinLookAndFeel.class.getResource("/themepack.zip"); if (u != null) { s = loadThemePack(u); } else { throw new Error("themepack.zip not found in classpath"); } } } setSkin(s); } catch (Throwable th) { throw new Error( "Skin was null and an error occurs while trying to load the user theme pack. Source exception message is " + th.getMessage()); } } return s; } /** * @deprecated no longer needed */ public static void enable() throws javax.swing.UnsupportedLookAndFeelException { SkinLookAndFeel lnf = new SkinLookAndFeel(); UIManager.setLookAndFeel(lnf); UIManager.getLookAndFeelDefaults().put("ClassLoader", lnf.getClass().getClassLoader()); } /** * Load a skin from the given filename.
    SkinLF will use the filename to * guess which theme to instanciate * * @param filename the given filename * @return Description of the Returned Value * @exception Exception Description of Exception */ public static Skin loadSkin(String filename) throws Exception { return loadSkin(SkinUtils.toURL(new java.io.File(filename))); } /** * Load a skin from the given url.
    SkinLF will use the url filename to * guess which theme to instanciate * * @param url Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public static Skin loadSkin(java.net.URL url) throws Exception { String filename = url.getFile(); if (filename.endsWith("gtkrc")) { return new GtkSkin(url, getInputStream(url)); } else if (filename.endsWith(".themerc")) { return new KdeSkin(url, getInputStream(url)); } else { throw new Exception( "Unable to load this skin " + url + " (by using filename matching), " + " try an explicit constructor"); } } /** * Load the default theme pack.
    Skin Look And Feel will look for the * resource file named skinlf-themepack.xml in the user * classpath (using SkinLookAndFeel.class.getResource("/skinlf-themepack.xml")). * * @return Description of the Returned Value * @exception Exception Description of Exception */ public static Skin loadDefaultThemePack() throws Exception { return loadThemePackDefinition( SkinLookAndFeel.class.getResource("/skinlf-themepack.xml")); } /** * Load a Theme Pack from the given zip file.
    See * L2FProd.com website for the * complete description of a theme pack. * * @param filename the theme pack filename * @return Description of the Returned Value * @exception Exception Description of Exception */ public static Skin loadThemePack(String filename) throws Exception { if (filename.startsWith("http://") || filename.startsWith("https://") || filename.startsWith("ftp://") || filename.startsWith("file:/") || filename.startsWith("jar:/")) { return loadThemePack(new URL(filename)); } else { return loadThemePack(SkinUtils.toURL(new File(filename))); } } /** * Load a Theme Pack from the given zip url.
    See * L2FProd.com website for the * complete description of a theme pack. * * @param url the theme pack url * @return Description of the Returned Value * @exception Exception Description of Exception * @see com.l2fprod.util.ZipResourceLoader */ public static Skin loadThemePack(URL url) throws Exception { return loadThemePack(url.openStream()); } /** * Load a Theme Pack from the given stream pointing to a themepack.
    See * L2FProd.com website for the * complete description of a theme pack. * * @param streamToPack stream to the themepack * @see com.l2fprod.util.ZipResourceLoader */ public static Skin loadThemePack(InputStream streamToPack) throws Exception { ZipResourceLoader loader = new ZipResourceLoader(streamToPack); c_ResourceLoader = loader; Skin skin = loadThemePackDefinition( new URL("http://dummyhostforziploader/skinlf-themepack.xml")); c_ResourceLoader = null; return skin; } /** * Load a Theme Pack from the given theme pack definition.
    URLs in the * definition must be relative * * @param url the theme pack definition url * @return Description of the Returned Value * @exception Exception Description of Exception */ public static Skin loadThemePackDefinition(java.net.URL url) throws Exception { Skin skin = null; XMLElement element = new XMLElement(); element.parseFromReader(new java.io.InputStreamReader(getInputStream(url))); checkRequiredVersion(element.getProperty("REQUIRE")); // reset any custom properties that may be set in the skin UIManager.put("JDesktopPane.backgroundEnabled", Boolean.FALSE); UIManager.put("PopupMenu.animation", Boolean.FALSE); UIManager.put("ScrollBar.alternateLayout", Boolean.FALSE); UIManager.put("JSplitPane.alternateUI", Boolean.FALSE); Enumeration enumeration = element.enumerateChildren(); while (enumeration.hasMoreElements()) { element = (XMLElement)enumeration.nextElement(); String tagName = element.getTagName().toLowerCase(); if ("skin".equals(tagName)) { skin = buildSkin(url, element); } else if ("property".equals(tagName)) { String type = element.getProperty("TYPE"); // Take the boolean class if the typeclass is not specified for // backward compatibility. if (type == null || "".equals(type) || "boolean".equalsIgnoreCase(type) || "java.lang.Boolean".equalsIgnoreCase(type)) { UIManager.put( element.getProperty("NAME"), Boolean.valueOf(element.getProperty("VALUE"))); } else if ( "int".equalsIgnoreCase(type) || "java.lang.Integer".equalsIgnoreCase(type)) { UIManager.put( element.getProperty("NAME"), Integer.valueOf(element.getProperty("VALUE"))); } else if ( "String".equalsIgnoreCase(type) || "java.lang.String".equalsIgnoreCase(type)) { UIManager.put( element.getProperty("NAME"), element.getProperty("VALUE")); } else if ( "Color".equalsIgnoreCase(type) || "java.awt.Color".equalsIgnoreCase(type)) { Color color = Color.decode(element.getProperty("VALUE")); UIManager.put( element.getProperty("NAME"), new ColorUIResource(color)); } else if ( "Insets".equalsIgnoreCase(type) || "java.awt.Insets".equalsIgnoreCase(type)) { Insets insets = parseInsets(element.getProperty("VALUE")); UIManager.put( element.getProperty("NAME"), new InsetsUIResource( insets.top, insets.left, insets.bottom, insets.right)); } else if ( "Dimension".equalsIgnoreCase(type) || "java.awt.Dimension".equalsIgnoreCase(type)) { Dimension dim = parseDimension(element.getProperty("VALUE")); UIManager.put( element.getProperty("NAME"), new DimensionUIResource(dim.width, dim.height)); } else if ( "LineBorder".equalsIgnoreCase(type) || "javax.swing.border.LineBorder".equalsIgnoreCase(type)) { boolean rounded = false; Color color = Color.black; int thickness = 1; int padding = 0; String temp; temp = element.getProperty("ROUNDED"); if (temp != null) { rounded = (Boolean.getBoolean(temp)); } temp = element.getProperty("THICKNESS"); if (temp != null) { thickness = Integer.parseInt(temp); } temp = element.getProperty("PADDING"); if (temp != null) { padding = Integer.parseInt(temp); } temp = element.getProperty("COLOR"); if (temp != null) { color = Color.decode(temp); } Border border = new com.l2fprod.gui.border.LineBorder(color, thickness, rounded); if (padding > 0) { border = new CompoundBorder( border, BorderFactory.createEmptyBorder( padding, padding, padding, padding)); } UIManager.put( element.getProperty("NAME"), new BorderUIResource(border)); } else if ( "EmptyBorder".equalsIgnoreCase(type) || "javax.swing.border.EmptyBorder".equalsIgnoreCase(type)) { Insets insets = parseInsets(element.getProperty("VALUE")); Border border = new javax.swing.border.EmptyBorder(insets); UIManager.put( element.getProperty("NAME"), new BorderUIResource(border)); } } else if ("font".equalsIgnoreCase(tagName)) { String[] fontStyle = StringUtils.splitString(element.getProperty("VALUE"), ","); Font f = SkinUtils.getFont( fontStyle[0], Integer.parseInt(fontStyle[1]), Integer.parseInt(fontStyle[2])); if (f != null) { if ("Global".equalsIgnoreCase(element.getProperty("NAME"))) { SkinUtils.setFont(new FontUIResource(f)); } else { UIManager.put(element.getProperty("NAME"), new FontUIResource(f)); } } } else if ("icon".equalsIgnoreCase(tagName)) { final URL iconURL = new URL(url, element.getProperty("VALUE")); ImageIcon icon = new ImageIcon(SkinUtils.loadImage(iconURL)); UIManager.put(element.getProperty("NAME"), new IconUIResource(icon)); // put the default internal icon at work for JOptionPane too if ("InternalFrame.icon".equals(element.getProperty("NAME"))) { JOptionPane.getRootFrame().setIconImage(icon.getImage()); } } } return skin; } /** * Description of the Method * * @param required Description of Parameter * @exception IncorrectVersionException */ public static void checkRequiredVersion(String required) throws IncorrectVersionException { if ((required == null) || ("".equals(required))) { return; } IncorrectVersionException.checkRequiredVersion(version(), required); } /** * Gets the InputStream attribute of the SkinLookAndFeel class * * @param url Description of Parameter * @return The InputStream value * @exception Exception Description of Exception */ static InputStream getInputStream(URL url) throws Exception { if (c_ResourceLoader != null) { return c_ResourceLoader.getZipResource(url).getInputStream(); } else { return url.openStream(); } } /** * Gets the URLContent attribute of the SkinLookAndFeel class * * @param url Description of Parameter * @return The URLContent value * @exception Exception Description of Exception */ static byte[] getURLContent(URL url) throws Exception { if (c_ResourceLoader == null) { BufferedInputStream input = new BufferedInputStream(url.openStream()); ByteArrayOutputStream output = new ByteArrayOutputStream(); int read; while ((read = input.read()) != -1) { output.write(read); } return output.toByteArray(); } else { return c_ResourceLoader.getZipResource(url).getURLContent(); } } /** * Description of the Method * * @param str Description of Parameter * @return Description of the Returned Value */ private static Dimension parseDimension(String str) { int[] dim = new int[2]; Arrays.fill(dim, 0); String[] dimStrings = StringUtils.splitString(str, "{,}"); for (int i = 0; i < dim.length; i++) { dim[i] = Integer.parseInt(dimStrings[i]); } return new Dimension(dim[0], dim[1]); } /** * Description of the Method * * @param str Description of Parameter * @return Description of the Returned Value */ private static Insets parseInsets(String str) { int[] insets = new int[4]; Arrays.fill(insets, 0); String[] insetsString = StringUtils.splitString(str, "{,}"); for (int i = 0; i < insets.length; i++) { insets[i] = Integer.parseInt(insetsString[i]); } return new Insets(insets[0], insets[1], insets[2], insets[3]); } /** * Description of the Method * * @param context Description of Parameter * @param element Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ private static Skin buildSkin(URL context, XMLElement element) throws Exception { Skin result = null; if (element.countChildren() == 0) { result = loadSkin(new URL(context, element.getProperty("URL"))); } else if (element.countChildren() == 2) { // it's a compound skin result = new CompoundSkin( buildSkin(context, (XMLElement)element.getChildren().elementAt(0)), buildSkin(context, (XMLElement)element.getChildren().elementAt(1))); } return result; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinMenuBarUI.java0000644000175000017500000000652310460410012023452 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicMenuBarUI; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinMenuBarUI extends BasicMenuBarUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { skin.getPersonality().paintDialog(g, c); } /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); skin.getPersonality().installSkin(menuBar); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinMenuBarUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinMenuItemUI.java0000644000175000017500000000722110460410014023642 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.plaf.basic.*; import javax.swing.plaf.*; import javax.swing.*; import java.awt.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2005/11/19 09:22:37 $ */ public class SkinMenuItemUI extends BasicMenuItemUI { private Skin skin = SkinLookAndFeel.getSkin(); protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { Graphics2D g2d = (Graphics2D)g; AlphaComposite alpha = (AlphaComposite)((JComponent)menuItem.getParent()) .getClientProperty("alpha"); Composite oldComposite = g2d.getComposite(); if (alpha != null) { g2d.setComposite(alpha); } // end of if (alpha == null) skin.getPersonality().paintMenuItem(g, menuItem); if (alpha != null) { g2d.setComposite(oldComposite); } } /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); menuItem.setOpaque(false); } /** * Description of the Method */ protected void uninstallDefaults() { super.uninstallDefaults(); menuItem.setOpaque(true); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinMenuItemUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinMenuUI.java0000644000175000017500000000651610460410014023031 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Color; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicMenuUI; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinMenuUI extends BasicMenuUI { private Skin skin = SkinLookAndFeel.getSkin(); protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { skin.getPersonality().paintMenuItem(g, menuItem); } /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); menuItem.setOpaque(false); } /** * Description of the Method */ protected void uninstallDefaults() { super.uninstallDefaults(); menuItem.setOpaque(true); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinMenuUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinOptionPaneUI.java0000644000175000017500000001051310460410014024171 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.JRootPane; import javax.swing.RootPaneContainer; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicOptionPaneUI; /** * Description of the Class * * @author fred */ public final class SkinOptionPaneUI extends BasicOptionPaneUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinOptionPaneUI(); } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { // don't paint a root panel, a popup panel and glasspane if (c.getParent() instanceof JRootPane || c.getClass().getName().endsWith("JPanelPopup") || (c.getParent() instanceof RootPaneContainer && ((((RootPaneContainer)c.getParent()).getGlassPane() == c) || (((RootPaneContainer)c.getParent()).getLayeredPane() == c) ))) { return; } // always paint a ContentPane if (c.getParent() instanceof RootPaneContainer && (((RootPaneContainer)c.getParent()).getContentPane() == c)) { skin.getPersonality().paintDialog(g, c); return; } // finally paint a JComponent if it is opaque and if it has not changed // its background color if (c.isOpaque() && c.getBackground() instanceof ColorUIResource) { skin.getPersonality().paintDialog(g, c); } } protected void installDefaults() { super.installDefaults(); skin.getPersonality().installSkin(optionPane); } protected void uninstallDefaults() { super.uninstallDefaults(); skin.getPersonality().uninstallSkin(optionPane); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinPanelUI.java0000644000175000017500000001066010460410014023157 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JRootPane; import javax.swing.RootPaneContainer; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicPanelUI; /** * Description of the Class * * @author fred */ public final class SkinPanelUI extends BasicPanelUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { // don't paint a root panel, a popup panel and glasspane if (c.getParent() instanceof JRootPane || c.getClass().getName().endsWith("JPanelPopup") || (c.getParent() instanceof RootPaneContainer && ((((RootPaneContainer)c.getParent()).getGlassPane() == c) || (((RootPaneContainer)c.getParent()).getLayeredPane() == c) ))) { return; } // always paint a ContentPane if (c.getParent() instanceof RootPaneContainer && (((RootPaneContainer)c.getParent()).getContentPane() == c)) { skin.getPersonality().paintDialog(g, c); return; } // finally paint a JComponent if it is opaque and if it has not changed // its background color if (c.isOpaque() && c.getBackground() instanceof ColorUIResource) { skin.getPersonality().paintDialog(g, c); } } /** * Description of the Method * * @param p Description of Parameter */ protected void installDefaults(JPanel p) { super.installDefaults(p); skin.getPersonality().installSkin(p); } protected void uninstallDefaults(JPanel p) { super.uninstallDefaults(p); skin.getPersonality().uninstallSkin(p); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinPanelUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinPersonality.java0000644000175000017500000001244510460410014024176 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Personality.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 19:47:23 $ */ public interface SkinPersonality extends SkinComponent { /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ boolean paintDialog(java.awt.Graphics g, java.awt.Component c); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ boolean paintFocus(java.awt.Graphics g, javax.swing.JComponent c); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ boolean paintMenu(java.awt.Graphics g, javax.swing.JMenu c); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ boolean paintMenuItem(java.awt.Graphics g, javax.swing.JMenuItem c); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ boolean paintBackground(java.awt.Graphics g, java.awt.Component c); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param bounds Description of Parameter * @param hasFocus Description of Parameter * @return Description of the Returned Value */ boolean paintComboBox(java.awt.Graphics g, javax.swing.JComboBox c, java.awt.Rectangle bounds, boolean hasFocus, boolean isRollover); /** * Gets the ComboBoxInsets attribute of the SkinPersonality object * * @return The ComboBoxInsets value */ java.awt.Insets getComboBoxInsets(); /** * Gets the ComboBoxPreferredSize attribute of the SkinPersonality object * * @param c Description of Parameter * @return The ComboBoxPreferredSize value */ java.awt.Dimension getComboBoxPreferredSize(javax.swing.JComboBox c); /** * Description of the Method * * @return Description of the Returned Value */ javax.swing.ListCellRenderer createListCellRenderer(); /** * @return Description of the Returned Value * @deprecated replaced by getTableHeaderRenderer which returns a shared * instance */ javax.swing.table.TableCellRenderer createTableHeaderRenderer(); /** * Gets the TableHeaderRenderer attribute of the SkinPersonality object * * @return The TableHeaderRenderer value */ javax.swing.table.TableCellRenderer getTableHeaderRenderer(); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinPopupMenuUI.java0000644000175000017500000001676110460410012024056 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.AlphaComposite; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComponent; import javax.swing.JPopupMenu; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicPopupMenuUI; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinPopupMenuUI extends BasicPopupMenuUI { PopupMenuListener m_PopupListener; AncestorListener m_AncestorListener; private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method */ public void installDefaults() { super.installDefaults(); skin.getPersonality().installSkin(popupMenu); if (Boolean.TRUE.equals(UIManager.get("PopupMenu.animation"))) { popupMenu.setOpaque(false); } } /** * Description of the Method */ public void installListeners() { super.installListeners(); if (Boolean.TRUE.equals(UIManager.get("PopupMenu.animation"))) { popupMenu.addAncestorListener(m_AncestorListener = new SkinPopupAncestorListener()); popupMenu.addPopupMenuListener(m_PopupListener = new SkinPopupMenuListener()); } } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { Graphics2D g2d = (Graphics2D) g; AlphaComposite alpha = (AlphaComposite) c.getClientProperty("alpha"); if (alpha != null) { g2d.setComposite(alpha); } skin.getPersonality().paintDialog(g, c); super.paint(g, c); } /** * Description of the Method */ protected void uninstallDefaults() { super.uninstallDefaults(); popupMenu.setOpaque(true); } /** * Description of the Method */ protected void uninstallListeners() { super.uninstallListeners(); if (m_AncestorListener != null) { popupMenu.removeAncestorListener(m_AncestorListener); } if (m_PopupListener != null) { popupMenu.removePopupMenuListener(m_PopupListener); } popupMenu.putClientProperty("alpha", null); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinPopupMenuUI(); } public JPopupMenu popupMenu() { return popupMenu; } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ class SkinPopupAncestorListener implements AncestorListener { /** * Description of the Method * * @param event Description of Parameter */ public void ancestorAdded(AncestorEvent event) { Component parent = event.getComponent().getParent(); if (parent instanceof JComponent) { ((JComponent) parent).setDoubleBuffered(false); ((JComponent) parent).setOpaque(false); } // end of if (parent instanceof JComponent) } /** * Description of the Method * * @param event Description of Parameter */ public void ancestorMoved(AncestorEvent event) { } /** * Description of the Method * * @param event Description of Parameter */ public void ancestorRemoved(AncestorEvent event) { } } /** *

    Responsible for the fade-in effect of menus.

    *

    I re-wrote it using javax.swing.timer because the old version accessed * Swing components from outside of the event thread, which could * theoretically lead to data corruption. --William Tracy, 2/20/04

    * * @author fred * @created 27 avril 2002 * @author William Tracy */ class SkinPopupMenuListener implements PopupMenuListener { AlphaComposite current; Timer timer = new Timer(25, new ActionListener() { public void actionPerformed(ActionEvent e) { if (current == null || current.getAlpha() >= 0.75) { timer.stop(); } else { current = AlphaComposite.getInstance(current.getRule(), current.getAlpha() + 0.05f); popupMenu().putClientProperty("alpha", current); popupMenu().repaint(); } } }); /** * Called if menu is canceled. * * @param e Cancelling event */ public void popupMenuCanceled(PopupMenuEvent e) { timer.stop(); } /** * Called if menu will become invisible. * * @param e Event which causes menu to become invisible */ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { timer.stop(); } /** * Called if menu will become visible. Sets the starting fade-in color and * starts the fade timer. * * @param e Event which causes the menu to become visible */ public void popupMenuWillBecomeVisible(PopupMenuEvent e) { current = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.0f); timer.start(); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinPreviewWindow.java0000644000175000017500000002472610460410014024503 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.util.WindowUtils; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.BoundedRangeModel; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.DefaultBoundedRangeModel; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComboBox; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSlider; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JToggleButton; import javax.swing.JTree; import javax.swing.Timer; import javax.swing.UIManager; /** * SkinPreview Window.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2006/07/22 08:47:19 $ */ public class SkinPreviewWindow extends JFrame { /** * Constructor for the SkinPreviewWindow object */ public SkinPreviewWindow() { super(); JTabbedPane tabs = new JTabbedPane(); getContentPane().add("Center", tabs); tabs.addTab("Buttons", new ButtonTest()); tabs.addTab("CheckBox", new CheckBoxTest()); tabs.addTab("Radio", new RadioTest()); tabs.addTab("Progress", new ProgressTest()); tabs.addTab("Desktop", new InternalTest()); tabs.addTab("Scrollbars", new ScrollTest()); tabs.addTab("List", new ListTest()); tabs.addTab("Table", new TableTest()); JMenuBar menubar = new JMenuBar(); JMenu menu = new JMenu("File"); menu.add(new JCheckBoxMenuItem("Check Box ?")); JMenu submenu = new JMenu("Sub menu"); submenu.add(new JMenuItem("Hi!")); menu.add(submenu); menu.add(new JMenuItem("Exit")); menubar.add(menu); setJMenuBar(menubar); WindowUtils.sizeTo(this, 0.5d, 0.5d); WindowUtils.centerOnScreen(this); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent event) { SkinPreviewWindow.this.dispose(); } }); } /** * Runs the skin preview demo. * * @param args The command line arguments * @exception Exception Description of Exception */ public static void main(String[] args) throws Exception { Skin skin = null; if (args.length > 1) { skin = new CompoundSkin(SkinLookAndFeel.loadSkin(args[0]), SkinLookAndFeel.loadSkin(args[1])); } else { skin = SkinLookAndFeel.loadSkin(args[0]); } SkinLookAndFeel.setSkin(skin); UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); } /** * Demonstrates buttons. */ static class ButtonTest extends JPanel { /** * Constructor for the ButtonTest object */ ButtonTest() { setLayout(new BorderLayout()); add("North", new JButton("North")); add("East", new JButton("East")); add("South", new JButton("South")); add("West", new JButton("West")); JButton b = new JButton("Center"); b.setEnabled(false); add("Center", b); } } /** * Demonstrates check boxes. */ static class CheckBoxTest extends JPanel { /** * Constructor for the CheckBoxTest object */ CheckBoxTest() { setLayout(new BorderLayout()); Box p = new Box(BoxLayout.Y_AXIS); p.add(new JCheckBox("Hello ???")); p.add(Box.createVerticalStrut(3)); p.add(new JComboBox(new String[]{"1", "2", "4", "8"})); p.add(Box.createVerticalStrut(3)); JComboBox editable = new JComboBox(new String[]{"1", "2", "4", "8"}); editable.setEditable(true); p.add(editable); p.add(Box.createVerticalStrut(3)); JPanel toggles = new JPanel(); toggles.setLayout(new FlowLayout()); ButtonGroup group = new ButtonGroup(); JToggleButton button; button = new JToggleButton("Hello 1"); toggles.add(button); group.add(button); button = new JToggleButton("Hello 2"); toggles.add(button); group.add(button); button = new JToggleButton("Hello 3"); toggles.add(button); group.add(button); p.add(toggles); add("North", p); } } /** * Demonstrates radio buttons. */ static class RadioTest extends JPanel { /** * Constructor for the RadioTest object */ RadioTest() { ButtonGroup group = new ButtonGroup(); setLayout(new GridLayout(3, 1)); JRadioButton button; button = new JRadioButton("Hello 1"); add(button); group.add(button); button = new JRadioButton("Hello 2"); add(button); group.add(button); button = new JRadioButton("Hello 3"); add(button); group.add(button); } } /** * Demonstrates slider controlls and progress bars. */ static class ProgressTest extends JPanel { /** * Constructor for the ProgressTest object */ ProgressTest() { setLayout(new BorderLayout()); final BoundedRangeModel model = new DefaultBoundedRangeModel(0, 0, 0, 100); JProgressBar progress = new JProgressBar(model); add("South", progress); JSlider slider = new JSlider(model); add("North", slider); slider = new JSlider(JSlider.VERTICAL); slider.setModel(model); add("West", slider); progress = new JProgressBar(JProgressBar.VERTICAL); progress.setModel(model); add("East", progress); new Timer(50, new ActionListener() { int counter = 0; public void actionPerformed(ActionEvent e) { if (model.getValue() >= 100) { counter += 20; if (counter >= 500) model.setValue(0); } else { model.setValue(model.getValue() + 2); counter = 0; } } }).start(); } } /** * Tests internal frames. */ static class InternalTest extends JPanel { /** * Constructor for the InternalTest object */ InternalTest() { setLayout(new BorderLayout()); JDesktopPane desk = new JDesktopPane(); add("Center", new JScrollPane(desk)); desk.putClientProperty("JDesktopPane.backgroundEnabled", Boolean.TRUE); JInternalFrame frame = new JInternalFrame("A Frame", true, true, true, true); frame.getContentPane().add(new JButton("Ola")); frame.setVisible(true); frame.setSize(200, 100); desk.add(frame); frame = new JInternalFrame("An other Frame", true, true, true, true); frame.getContentPane().add(new JButton("Hello")); frame.setMaximizable(false); frame.setVisible(true); frame.setSize(200, 200); frame.setLocation(50, 50); desk.add(frame); } } /** * Tests scrollbars. */ static class ScrollTest extends JPanel { /** * Constructor for the ScrollTest object */ ScrollTest() { setLayout(new BorderLayout()); add("Center", new JScrollPane(new JTree())); } } /** * Tests lists. */ static class ListTest extends JPanel { /** * Constructor for the ListTest object */ ListTest() { setLayout(new BorderLayout()); String[] values = new String[50]; for (int i = 0, c = values.length; i < c; i++) { values[i] = "Item " + i; } add("Center", new JScrollPane(new JList(values))); } } /** * Tests tables. */ static class TableTest extends JPanel { /** * Constructor for the TableTest object */ TableTest() { setLayout(new BorderLayout()); String[] columns = new String[4]; String[][] rowData = new String[10][4]; for (int i = 0, c = rowData[0].length; i < c; i++) { columns[i] = "Column" + i; for (int j = 0, d = rowData.length; j < d; j++) { rowData[j][i] = "Cell(" + i + ", " + j + ")"; } } add("Center", new JScrollPane(new JTable(rowData, columns))); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinProgress.java0000644000175000017500000000636610460410014023476 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Rectangle; /** * Skin Progress.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/11/23 14:47:45 $ */ public interface SkinProgress extends SkinComponent { /** * Gets the MinimumSize attribute of the SkinProgress object * * @param progress Description of Parameter * @return The MinimumSize value */ java.awt.Dimension getMinimumSize(javax.swing.JProgressBar progress); /** * Description of the Method * * @param g Description of Parameter * @param progress Description of Parameter * @return Description of the Returned Value */ boolean paintProgress(java.awt.Graphics g, javax.swing.JProgressBar progress); boolean paintIndeterminateProgress(java.awt.Graphics g, javax.swing.JProgressBar progress, Rectangle rec); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinProgressBarUI.java0000644000175000017500000001404510460410014024352 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.util.OS; import java.awt.Graphics; import java.awt.Insets; import java.awt.Rectangle; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicProgressBarUI; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.5 $, $Date: 2004/07/18 19:12:56 $ */ public final class SkinProgressBarUI extends BasicProgressBarUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Used to hold the location and size of the bouncing box (returned * by getBox) to be painted. */ private Rectangle boxRect; /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { //if the progessBar is indererminate draw a window on the full //progressBar the size of the box to be shown. That box is determine //in the basicprogressbarui getBox() method if (OS.isOneDotFourOrMore() && progressBar.isIndeterminate()) { skin.getProgress(). paintIndeterminateProgress(g, progressBar, getBox(boxRect)); } else { skin.getProgress().paintProgress(g, progressBar); } int barRectX = 0; int barRectY = 0; int barRectWidth = progressBar.getWidth(); int barRectHeight = progressBar.getHeight(); Insets b = progressBar.getInsets(); // area for border barRectX += b.left; barRectY += b.top; barRectWidth -= (b.right + barRectX); barRectHeight -= (b.bottom + barRectY); int amountFull = getAmountFull(b, barRectWidth, barRectHeight); // Deal with possible text painting if (progressBar.isStringPainted()) { paintString(g, barRectX, barRectY, barRectWidth, barRectHeight, amountFull, b); } } /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); progressBar.setBorder(null); progressBar.setOpaque(true); progressBar.setBorderPainted(false); progressBar.setMinimumSize(skin.getProgress().getMinimumSize(progressBar)); } public void installUI(JComponent c) { super.installUI(c); if (OS.isOneDotFour()) { //JDK 1.4 has a bug where all the support for indeterminate is //not recreated when a look and feel is changed at runtime thus //resulting in nullpointerexception in updateSize(): //java.lang.NullPointerException // at javax.swing.plaf.basic.BasicProgressBarUI.updateSizes(BasicProgressBarUI.java:433) // at javax.swing.plaf.basic.BasicProgressBarUI.getBox(BasicProgressBarUI.java:375) // at com.l2fprod.gui.plaf.skin.SkinProgressBarUI.paint(SkinProgressBarUI.java:84) // //plus it does not re-enable the animation when the lnf has //changed. The following code fixes this. // //logged as http://developer.java.sun.com/developer/bugParade/bugs/4862295.html if (progressBar.isIndeterminate()) { progressBar.setIndeterminate(false); progressBar.setIndeterminate(true); } } } /** * Description of the Method */ protected void uninstallDefaults() { super.uninstallDefaults(); progressBar.setOpaque(true); progressBar.setBorderPainted(true); } /** * Description of the Method * * @param x Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent x) { return new SkinProgressBarUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinRadioButtonMenuItemUI.java0000644000175000017500000001122610460410014026015 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Point; import java.awt.event.MouseEvent; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.MenuElement; import javax.swing.MenuSelectionManager; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.UIResource; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:47:23 $ */ public final class SkinRadioButtonMenuItemUI extends SkinMenuItemUI { /** * Description of the Method * * @param item Description of Parameter * @param e Description of Parameter * @param path Description of Parameter * @param manager Description of Parameter */ public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) { Point p = e.getPoint(); if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) { if (e.getID() == MouseEvent.MOUSE_RELEASED) { manager.clearSelectedPath(); item.doClick(0); item.setArmed(false); } else { manager.setSelectedPath(path); } } else if (item.getModel().isArmed()) { MenuElement newPath[] = new MenuElement[path.length - 1]; int i; int c; for (i = 0, c = path.length - 1; i < c; i++) { newPath[i] = path[i]; } manager.setSelectedPath(newPath); } } /** * Gets the PropertyPrefix attribute of the SkinRadioButtonMenuItemUI object * * @return The PropertyPrefix value */ protected String getPropertyPrefix() { return "RadioButtonMenuItem"; } /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); String prefix = getPropertyPrefix(); if (menuItem.getSelectedIcon() == null || menuItem.getSelectedIcon() instanceof UIResource) { menuItem.setSelectedIcon( UIManager.getIcon(prefix + ".checkIcon")); } } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinRadioButtonMenuItemUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinRadioButtonUI.java0000644000175000017500000001731410460410014024355 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.plaf.basic.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.text.View; import java.awt.*; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class SkinRadioButtonUI extends BasicRadioButtonUI { /** * Description of the Field */ protected int dashedRectGapWidth; /** * Description of the Field */ protected int dashedRectGapHeight; /** * Description of the Field */ protected Color focusColor; /** * Description of the Field */ protected Skin skin = SkinLookAndFeel.getSkin(); // ******************************** // Paint Methods // ******************************** /* * These Dimensions/Rectangles are allocated once for all * RadioButtonUI.paint() calls. Re-using rectangles * rather than allocating them in each paint call substantially * reduced the time it took paint to run. Obviously, this * method can't be re-entered. */ private static Dimension size = new Dimension(); private static Rectangle viewRect = new Rectangle(); private static Rectangle iconRect = new Rectangle(); private static Rectangle textRect = new Rectangle(); // ******************************** // Create PLAF // ******************************** /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinRadioButtonUI(); } // ******************************** // Defaults // ******************************** /** * Description of the Method * * @param b Description of Parameter */ public void installDefaults(AbstractButton b) { super.installDefaults(b); // dashedRectGapX = ((Integer)UIManager.get("Button.dashedRectGapX")).intValue(); // dashedRectGapY = ((Integer)UIManager.get("Button.dashedRectGapY")).intValue(); // dashedRectGapWidth = ((Integer)UIManager.get("Button.dashedRectGapWidth")).intValue(); // dashedRectGapHeight = ((Integer)UIManager.get("Button.dashedRectGapHeight")).intValue(); focusColor = Color.black; //UIManager.getColor(getPropertyPrefix() + "focus"); b.setOpaque(false); } /** * paint the radio button * * @param g Description of Parameter * @param c Description of Parameter */ public synchronized void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); Font f = c.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(); size = b.getSize(size); viewRect.x = viewRect.y = 0; viewRect.width = size.width; viewRect.height = size.height; iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0; textRect.x = textRect.y = textRect.width = textRect.height = 0; Icon icon; if (b.isSelected()) { icon = b.getSelectedIcon(); } else { icon = b.getIcon(); } if (b.isRolloverEnabled() && model.isRollover()) { if (b.isSelected()) { icon = b.getRolloverSelectedIcon(); } else { icon = b.getRolloverIcon(); } } if (icon == null) { icon = skin.getButton().getRadioIcon(b); } String text = SwingUtilities.layoutCompoundLabel( c, fm, b.getText(), icon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, getDefaultTextIconGap(b)); // fill background if (c.isOpaque()) { g.setColor(b.getBackground()); g.fillRect(0, 0, size.width, size.height); } if (icon != null) { icon.paintIcon(c, g, iconRect.x, iconRect.y); } // Draw the Text if (text != null) { View v = (View) c.getClientProperty("html"); // BasicHTML.propertyKey if (v != null) { v.paint(g, textRect); } else { if (model.isEnabled()) { // *** paint the text normally g.setColor(b.getForeground()); BasicGraphicsUtils.drawString(g, text, model.getMnemonic(), textRect.x, textRect.y + fm.getAscent()); } else { // *** paint the text disabled g.setColor(b.getBackground().brighter()); BasicGraphicsUtils.drawString(g, text, model.getMnemonic(), textRect.x + 1, textRect.y + fm.getAscent() + 1); g.setColor(b.getBackground().darker()); BasicGraphicsUtils.drawString(g, text, model.getMnemonic(), textRect.x, textRect.y + fm.getAscent()); } } } if (b.hasFocus() && b.isFocusPainted() && textRect.width > 0 && textRect.height > 0) { paintFocus(g, textRect, size); } } /** * Gets the FocusColor attribute of the SkinRadioButtonUI object * * @return The FocusColor value */ protected Color getFocusColor() { return focusColor; } /** * Description of the Method * * @param g Description of Parameter * @param textRect Description of Parameter * @param d Description of Parameter */ protected void paintFocus(Graphics g, Rectangle textRect, Dimension d) { g.setColor(getFocusColor()); BasicGraphicsUtils.drawDashedRect(g, textRect.x, textRect.y, textRect.width, textRect.height); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinRootPaneUI.java0000644000175000017500000011130510460410014023645 0ustar twernertwerner/* * Adapted from MetalRootPaneUI comments below were copied from that class */ package com.l2fprod.gui.plaf.skin; import com.l2fprod.util.AccessUtils; import java.awt.*; import java.awt.event.ComponentEvent; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLayeredPane; import javax.swing.JMenu; import javax.swing.JRootPane; import javax.swing.LookAndFeel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.event.MouseInputListener; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicRootPaneUI; /** * * Provides the metal look and feel implementation of RootPaneUI. *

    * MetalRootPaneUI provides support for the windowDecorationStyle * property of JRootPane.MetalRootPaneUI does * this by way of installing a custom LayoutManager, a private * Component to render the appropriate widgets, and a private * Border. The LayoutManager is always * installed, regardless of the value of the windowDecorationStyle * property, but the Border and Component are * only installed/added if the windowDecorationStyle is other * than JRootPane.NONE. *

    * Warning: Serialized objects of this class will not be * compatible with future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running the * same version of Swing. As of 1.4, support for long term storage of all * JavaBeans TM has been added to the * java.beans package. Please see {@link java.beans.XMLEncoder}. * * @version 1.16 02/04/02 * @author Terry Kellerman * @since 1.4 */ public final class SkinRootPaneUI extends BasicRootPaneUI { // TO MAKE THE CODE COMPILE WITH JDK < 1.4 public final static int Frame_MAXIMIZED_BOTH = AccessUtils.getIntValue(JFrame.class, "MAXIMIZED_BOTH"); public final static int JRootPane_NONE = AccessUtils.getIntValue(JRootPane.class, "NONE"); public static int getExtendedState(Frame p_Frame) { return AccessUtils.getAsInt(p_Frame, "getExtendedState"); } public static void setExtendedState(Frame p_Frame, int p_Value) { AccessUtils.setAsInt(p_Frame, "setExtendedState", p_Value); } public static int getWindowDecorationStyle(JRootPane p_Pane) { return AccessUtils.getAsInt(p_Pane, "getWindowDecorationStyle"); } private Skin skin = SkinLookAndFeel.getSkin(); private Window.FrameWindow title = null; /** * The amount of space (in pixels) that the cursor is changed on. */ private static final int CORNER_DRAG_WIDTH = 16; /** * Region from edges that dragging is active from. */ private static final int BORDER_DRAG_THICKNESS = 5; /** * Window the JRootPane is in. */ private java.awt.Window window; /** * JComponent providing window decorations. This will be null * if not providing window decorations. */ private SkinTitlePane titlePane; /** * MouseInputListener that is added to the parent Window * the JRootPane is contained in. */ private MouseInputListener mouseInputListener; /** * The LayoutManager that is set on the JRootPane. */ private LayoutManager layoutManager; /** * LayoutManager of the JRootPane before we * replaced it. */ private LayoutManager savedOldLayout; /** * JRootPane providing the look and feel for. */ private JRootPane root; /** * Cursor used to track the cursor set by the user. This is * initially Cursor.DEFAULT_CURSOR. */ private Cursor lastCursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); /** * Creates a UI for a JRootPane. * * @param c the JRootPane the RootPaneUI will be created for * @return the RootPaneUI implementation for the passed in JRootPane */ public static ComponentUI createUI(JComponent c) { return new SkinRootPaneUI(); } private static java.awt.Window translateSource(MouseEvent ev) { Object source = ev.getSource(); java.awt.Window w; if (source.getClass() == SkinTitlePane.class) { SkinTitlePane titleSource = (SkinTitlePane)source; Window.FrameWindow win = (Window.FrameWindow)titleSource.getWindow(); w = win.getMainFrame(); } else w = (java.awt.Window)ev.getSource(); return w; } /** * Invokes supers implementation of installUI to install the * necessary state onto the passed in JRootPane to render the * metal look and feel implementation of RootPaneUI. If the * windowDecorationStyle property of the JRootPane * is other than JRootPane.NONE, this will add a custom * Component to render the widgets to JRootPane, * as well as installing a custom Border and LayoutManager * on the JRootPane. * * @param c the JRootPane to install state onto */ public void installUI(JComponent c) { super.installUI(c); root = (JRootPane)c; int style = getWindowDecorationStyle(root); if (style != JRootPane_NONE) { installClientDecorations(root); } //skin.getFrame().installSkin(c); } /** * Invokes supers implementation to uninstall any of its state. This will * also reset the LayoutManager of the JRootPane. * If a Component has been added to the JRootPane * to render the window decoration style, this method will remove it. * Similarly, this will revert the Border and LayoutManager of the JRootPane * to what it was before installUI was invoked. * * @param c the JRootPane to uninstall state from */ public void uninstallUI(JComponent c) { super.uninstallUI(c); uninstallClientDecorations(root); layoutManager = null; mouseInputListener = null; root = null; } /** * Installs the appropriate Border onto the JRootPane. */ void installBorder(JRootPane root) { int style = getWindowDecorationStyle(root); if (style == JRootPane_NONE) { LookAndFeel.uninstallBorder(root); } else { //LookAndFeel.installBorder(root, borderKeys[style]); skin.getFrame().installSkin(root); } } /** * Removes any border that may have been installed. */ private void uninstallBorder(JRootPane root) { LookAndFeel.uninstallBorder(root); } /** * Installs the necessary Listeners on the parent Window, if * there is one. *

    * This takes the parent so that cleanup can be done from removeNotify, * at which point the parent hasn't been reset yet. * * @param parent The parent of the JRootPane */ private void installWindowListeners(JRootPane root, Component parent) { if (parent instanceof java.awt.Window) { window = (java.awt.Window)parent; } else { window = SwingUtilities.getWindowAncestor(parent); } if (window != null) { if (mouseInputListener == null) { mouseInputListener = createWindowMouseInputListener(root); } window.addMouseListener(mouseInputListener); window.addMouseMotionListener(mouseInputListener); } } /** * Uninstalls the necessary Listeners on the Window the * Listeners were last installed on. */ private void uninstallWindowListeners(JRootPane root) { if (window != null) { window.removeMouseListener(mouseInputListener); window.removeMouseMotionListener(mouseInputListener); } } /** * Installs the appropriate LayoutManager on the JRootPane to * render the window decorations. */ private void installLayout(JRootPane root) { if (layoutManager == null) { layoutManager = createLayoutManager(); } savedOldLayout = root.getLayout(); root.setLayout(layoutManager); } /** * Uninstalls the previously installed LayoutManager. */ private void uninstallLayout(JRootPane root) { if (savedOldLayout != null) { root.setLayout(savedOldLayout); savedOldLayout = null; } } /** * Installs the necessary state onto the JRootPane to render client * decorations. This is ONLY invoked if the JRootPane has a * decoration style other than JRootPane.NONE. */ private void installClientDecorations(JRootPane root) { installBorder(root); JComponent titlePane = createTitlePane(root); setTitlePane(root, titlePane); installWindowListeners(root, root.getParent()); installLayout(root); adjustIconAndBackground(); if (window != null) { root.revalidate(); root.repaint(); } } private void adjustIconAndBackground() { if (window != null) { title.setFrame(window); // the titlePane may not have been updated yet as it was created with a // empty FrameWindow so update its actions. titlePane.enableActions(); // callback to notify the titlePane the FrameWindow was set titlePane.windowSet(); String[] colors = skin.getColors(); boolean cont = true; for (int i = 0; i < colors.length && cont; i++) { String string = colors[i]; if (string.equalsIgnoreCase("desktop")) { cont = false; try { Color background = new ColorUIResource(Color.decode(colors[i + 1])); window.setBackground(background); } catch (NumberFormatException e) { } } } java.awt.Window target = title.getMainFrame(); if (target instanceof JFrame) { JFrame current = (JFrame)target; Icon provided = titlePane.getWindow().getFrameIcon(); Icon general = UIManager.getIcon("InternalFrame.icon"); Icon toWork = provided; if (provided == null) toWork = general; if (toWork != null) { BufferedImage theIcon = new BufferedImage( toWork.getIconWidth(), toWork.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics graph = theIcon.getGraphics(); toWork.paintIcon(null, graph, 0, 0); current.setIconImage(theIcon); } } } } private void resetIconAndBackground() { if (window != null) { window.setBackground(null); title.setFrame(null); } } /** * Uninstalls any state that installClientDecorations has * installed. *

    * NOTE: This may be called if you haven't installed client decorations yet * (ie before installClientDecorations has been invoked). */ private void uninstallClientDecorations(JRootPane root) { uninstallBorder(root); uninstallWindowListeners(root); setTitlePane(root, null); uninstallLayout(root); resetIconAndBackground(); // We have to revalidate/repaint root if the style is JRootPane.NONE // only. When we needs to call revalidate/repaint with other styles // the installClientDecorations is always called after this method // imediatly and it will cause the revalidate/repaint at the proper // time. int style = getWindowDecorationStyle(root); if (style == JRootPane_NONE) { root.repaint(); root.revalidate(); } // Reset the cursor, as we may have changed it to a resize cursor if (window != null) { window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } window = null; } /** * Returns the JComponent to render the window decoration * style. */ private JComponent createTitlePane(JRootPane root) { JComponent titlePane = new SkinTitlePane(title = new Window.FrameWindow()) { // overriden to set the popup to not be lightweight. it // resulted in the popupmenu being hidden, not correctly // z-ordered. Using a JWindow does the trick protected JMenu createSystemMenu() { JMenu menu = new JMenu(" "); menu.getPopupMenu().setLightWeightPopupEnabled(false); return menu; } }; titlePane.setOpaque(false); return titlePane; } /** * Returns a MouseListener that will be added to the Window * containing the JRootPane. */ private MouseInputListener createWindowMouseInputListener(JRootPane root) { return new MouseInputHandler(); } /** * Returns a LayoutManager that will be set on the JRootPane. */ private LayoutManager createLayoutManager() { return new MetalRootLayout(); } /** * Sets the window title pane -- the JComponent used to provide a plaf a way * to override the native operating system's window title pane with one whose * look and feel are controlled by the plaf. The plaf creates and sets this * value; the default is null, implying a native operating system window * title pane. */ private void setTitlePane(JRootPane root, JComponent titlePane) { JLayeredPane layeredPane = root.getLayeredPane(); JComponent oldTitlePane = getTitlePane(); if (oldTitlePane != null) { oldTitlePane.setVisible(false); layeredPane.remove(oldTitlePane); } if (titlePane != null) { layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER); titlePane.setVisible(true); } this.titlePane = (SkinTitlePane)titlePane; } /** * Returns the JComponent rendering the title pane. If this * returns null, it implies there is no need to render window decorations. * * @return the current window title pane, or null * @see #setTitlePane */ private JComponent getTitlePane() { return titlePane; } private Window.FrameWindow getFrameWindow() { return title; } private java.awt.Window getMainWindow() { return window; } /** * Returns the JRootPane we're providing the look and feel * for. */ private JRootPane getRootPane() { return root; } /** * Invoked when a property changes. MetalRootPaneUI is * primarily interested in events originating from the JRootPane * it has been installed on identifying the property windowDecorationStyle. * If the windowDecorationStyle has changed to a value other * than JRootPane.NONE, this will add a Component * to the JRootPane to render the window decorations, as well * as installing a Border on the JRootPane. On * the other hand, if the windowDecorationStyle has changed to * JRootPane.NONE, this will remove the Component * that has been added to the JRootPane as well resetting the * Border to what it was before installUI was invoked. * * @param e A PropertyChangeEvent object describing the event source and the * property that has changed. */ public void propertyChange(PropertyChangeEvent e) { super.propertyChange(e); String propertyName = e.getPropertyName(); if (propertyName == null) { return; } if (propertyName.equals("windowDecorationStyle")) { JRootPane root = (JRootPane)e.getSource(); int style = getWindowDecorationStyle(root); // This is potentially more than needs to be done, // but it rarely happens and makes the install/uninstall process // simpler. MetalTitlePane also assumes it will be recreated if // the decoration style changes. uninstallClientDecorations(root); if (style != JRootPane_NONE) { installClientDecorations(root); } } else if (propertyName.equals("ancestor")) { uninstallWindowListeners(root); if (getWindowDecorationStyle((JRootPane)e.getSource()) != JRootPane_NONE) { installWindowListeners(root, root.getParent()); } } return; } public static void adjust( Rectangle bounds, Dimension min, int deltaX, int deltaY, int deltaWidth, int deltaHeight) { bounds.x += deltaX; bounds.y += deltaY; bounds.width += deltaWidth; bounds.height += deltaHeight; if (min != null) { if (bounds.width < min.width) { int correction = min.width - bounds.width; if (deltaX != 0) { bounds.x -= correction; } bounds.width = min.width; } if (bounds.height < min.height) { int correction = min.height - bounds.height; if (deltaY != 0) { bounds.y -= correction; } bounds.height = min.height; } } } /** * Returns the corner that contains the point x,y, * or -1 if the position doesn't match a corner. */ public static int calculateCorner(Component c, int x, int y) { int xPosition = calculatePosition(x, c.getWidth()); int yPosition = calculatePosition(y, c.getHeight()); if (xPosition == -1 || yPosition == -1) { return -1; } return yPosition * 5 + xPosition; } /** * Returns the Cursor to render for the specified corner. This returns 0 if * the corner doesn't map to a valid Cursor */ public static int getCursor(int corner) { if (corner == -1) { return 0; } return SkinRootPaneUI.cursorMapping[corner]; } /** * Returns an integer indicating the position of spot in * width. The return value will be: 0 if * < BORDER_DRAG_THICKNESS 1 if < CORNER_DRAG_WIDTH 2 if >= * CORNER_DRAG_WIDTH &&< width - BORDER_DRAG_THICKNESS 3 if >= width - * CORNER_DRAG_WIDTH 4 if >= width - BORDER_DRAG_THICKNESS 5 otherwise */ public static int calculatePosition(int spot, int width) { if (spot < SkinRootPaneUI.BORDER_DRAG_THICKNESS) { return 0; } if (spot < SkinRootPaneUI.CORNER_DRAG_WIDTH) { return 1; } if (spot >= (width - SkinRootPaneUI.BORDER_DRAG_THICKNESS)) { return 4; } if (spot >= (width - SkinRootPaneUI.CORNER_DRAG_WIDTH)) { return 3; } return 2; } /** * A custom layout manager that is responsible for the layout of layeredPane, * glassPane, menuBar and titlePane, if one has been installed. */ // NOTE: Ideally this would extends JRootPane.RootLayout, but that // would force this to be non-static. private static class MetalRootLayout implements LayoutManager2 { /** * Returns the amount of space the layout would like to have. * * @param parent the Container for which this layout manager is being used * @return a Dimension object containing the layout's preferred size */ public Dimension preferredLayoutSize(Container parent) { Dimension cpd, mbd, tpd; int cpWidth = 0; int cpHeight = 0; int mbWidth = 0; int mbHeight = 0; int tpWidth = 0; int tpHeight = 0; Insets i = parent.getInsets(); JRootPane root = (JRootPane)parent; if (root.getContentPane() != null) { cpd = root.getContentPane().getPreferredSize(); } else { cpd = root.getSize(); } if (cpd != null) { cpWidth = cpd.width; cpHeight = cpd.height; } if (root.getJMenuBar() != null) { mbd = root.getJMenuBar().getPreferredSize(); if (mbd != null) { mbWidth = mbd.width; mbHeight = mbd.height; } } if (getWindowDecorationStyle(root) != JRootPane_NONE && (root.getUI() instanceof SkinRootPaneUI)) { JComponent titlePane = ((SkinRootPaneUI)root.getUI()).getTitlePane(); if (titlePane != null) { tpd = titlePane.getPreferredSize(); if (tpd != null) { tpWidth = tpd.width; tpHeight = tpd.height; } } } return new Dimension( Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right, cpHeight + mbHeight + tpHeight + i.top + i.bottom); } /** * Returns the minimum amount of space the layout needs. * * @param parent the Container for which this layout manager is being used * @return a Dimension object containing the layout's minimum size */ public Dimension minimumLayoutSize(Container parent) { Dimension cpd, mbd, tpd; int cpWidth = 0; int cpHeight = 0; int mbWidth = 0; int mbHeight = 0; int tpWidth = 0; int tpHeight = 0; Insets i = parent.getInsets(); JRootPane root = (JRootPane)parent; // This code is enabled only if the parent is not a window with // look and feel decorations. Otherwise the look and feel honors // the minimum size and the window can not be resized to a small // size in the case where a component in the component hierarchy // returns a wrong/big minimum size. In such case, the minimum // size will be the one of the title pane. if (!(root.getParent() instanceof java.awt.Window && getWindowDecorationStyle(root) != JRootPane_NONE)) { if (root.getContentPane() != null) { cpd = root.getContentPane().getMinimumSize(); } else { cpd = root.getSize(); } if (cpd != null) { cpWidth = cpd.width; cpHeight = cpd.height; } } if (root.getJMenuBar() != null) { mbd = root.getJMenuBar().getMinimumSize(); if (mbd != null) { mbWidth = mbd.width; mbHeight = mbd.height; } } if (getWindowDecorationStyle(root) != JRootPane_NONE && (root.getUI() instanceof SkinRootPaneUI)) { JComponent titlePane = ((SkinRootPaneUI)root.getUI()).getTitlePane(); if (titlePane != null) { tpd = titlePane.getMinimumSize(); if (tpd != null) { tpWidth = tpd.width; tpHeight = tpd.height; } } } // FYI, MetalRootLayout has a bug in the dimension as it uses // tpWidth in the height calculation // Now logged as // http://developer.java.sun.com/developer/bugParade/bugs/4916923.html return new Dimension( Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right, cpHeight + mbHeight + tpHeight + i.top + i.bottom); } /** * Returns the maximum amount of space the layout can use. * * @param target the Container for which this layout manager is being used * @return a Dimension object containing the layout's maximum size */ public Dimension maximumLayoutSize(Container target) { Dimension cpd, mbd, tpd; int cpWidth = Integer.MAX_VALUE; int cpHeight = Integer.MAX_VALUE; int mbWidth = Integer.MAX_VALUE; int mbHeight = Integer.MAX_VALUE; int tpWidth = Integer.MAX_VALUE; int tpHeight = Integer.MAX_VALUE; Insets i = target.getInsets(); JRootPane root = (JRootPane)target; if (root.getContentPane() != null) { cpd = root.getContentPane().getMaximumSize(); if (cpd != null) { cpWidth = cpd.width; cpHeight = cpd.height; } } if (root.getJMenuBar() != null) { mbd = root.getJMenuBar().getMaximumSize(); if (mbd != null) { mbWidth = mbd.width; mbHeight = mbd.height; } } if (getWindowDecorationStyle(root) != JRootPane_NONE && (root.getUI() instanceof SkinRootPaneUI)) { JComponent titlePane = ((SkinRootPaneUI)root.getUI()).getTitlePane(); if (titlePane != null) { tpd = titlePane.getMaximumSize(); if (tpd != null) { tpWidth = tpd.width; tpHeight = tpd.height; } } } int maxHeight = Math.max(Math.max(cpHeight, mbHeight), tpHeight); // Only overflows if 3 real non-MAX_VALUE heights, sum to > MAX_VALUE // Only will happen if sums to more than 2 billion units. Not likely. if (maxHeight != Integer.MAX_VALUE) { maxHeight = cpHeight + mbHeight + tpHeight + i.top + i.bottom; } int maxWidth = Math.max(Math.max(cpWidth, mbWidth), tpWidth); // Similar overflow comment as above if (maxWidth != Integer.MAX_VALUE) { maxWidth += i.left + i.right; } return new Dimension(maxWidth, maxHeight); } /** * Instructs the layout manager to perform the layout for the specified * container. * * @param parent the Container for which this layout manager is being used */ public void layoutContainer(Container parent) { JRootPane root = (JRootPane)parent; Rectangle b = root.getBounds(); Insets i = root.getInsets(); int nextY = 0; int w = b.width - i.right - i.left; int h = b.height - i.top - i.bottom; if (root.getLayeredPane() != null) { root.getLayeredPane().setBounds(i.left, i.top, w, h); } if (root.getGlassPane() != null) { root.getGlassPane().setBounds(i.left, i.top, w, h); } // Note: This is laying out the children in the layeredPane, // technically, these are not our children. if (getWindowDecorationStyle(root) != JRootPane_NONE && (root.getUI() instanceof SkinRootPaneUI)) { JComponent titlePane = ((SkinRootPaneUI)root.getUI()).getTitlePane(); if (titlePane != null) { Dimension tpd = titlePane.getPreferredSize(); if (tpd != null) { int tpHeight = tpd.height; titlePane.setBounds(0, 0, w, tpHeight); nextY += tpHeight; } } } if (root.getJMenuBar() != null) { Dimension mbd = root.getJMenuBar().getPreferredSize(); root.getJMenuBar().setBounds(0, nextY, w, mbd.height); nextY += mbd.height; } if (root.getContentPane() != null) { root.getContentPane().setBounds(0, nextY, w, h < nextY ? 0 : h - nextY); } } public void addLayoutComponent(String name, Component comp) { } public void removeLayoutComponent(Component comp) { } public void addLayoutComponent(Component comp, Object constraints) { } public float getLayoutAlignmentX(Container target) { return 0.0f; } public float getLayoutAlignmentY(Container target) { return 0.0f; } public void invalidateLayout(Container target) { } } /** * Maps from positions to cursor type. Refer to calculateCorner and * calculatePosition for details of this. */ private static final int[] cursorMapping = new int[] { Cursor.NW_RESIZE_CURSOR, Cursor.NW_RESIZE_CURSOR, Cursor.N_RESIZE_CURSOR, Cursor.NE_RESIZE_CURSOR, Cursor.NE_RESIZE_CURSOR, Cursor.NW_RESIZE_CURSOR, 0, 0, 0, Cursor.NE_RESIZE_CURSOR, Cursor.W_RESIZE_CURSOR, 0, 0, 0, Cursor.E_RESIZE_CURSOR, Cursor.SW_RESIZE_CURSOR, 0, 0, 0, Cursor.SE_RESIZE_CURSOR, Cursor.SW_RESIZE_CURSOR, Cursor.SW_RESIZE_CURSOR, Cursor.S_RESIZE_CURSOR, Cursor.SE_RESIZE_CURSOR, Cursor.SE_RESIZE_CURSOR }; /** * MouseInputHandler is responsible for handling resize/moving of the Window. * It sets the cursor directly on the Window when then mouse moves over a hot * spot. */ private class MouseInputHandler implements MouseInputListener { /** * Set to true if the drag operation is moving the window. */ private boolean isMovingWindow; /** * Used to determine the corner the resize is occuring from. */ private int dragCursor; /** * X location the mouse went down on for a drag operation. */ private int dragOffsetX; /** * Y location the mouse went down on for a drag operation. */ private int dragOffsetY; /** * Width of the window when the drag started. */ private int dragWidth; /** * Height of the window when the drag started. */ private int dragHeight; /** * Sometimes mouse entered events generated twice, without proper mouse exit event. If we dont check for this * possibility, this will cause strange mouse icons. For example the resize cursor appears in the whole window. */ private boolean mouseAlreadyEntered = false; public void mousePressed(MouseEvent ev) { if (root==null || getWindowDecorationStyle(root) == JRootPane_NONE) { return; } Point dragWindowOffset = ev.getPoint(); java.awt.Window w = translateSource(ev); if (w != null) { w.toFront(); } Point convertedDragWindowOffset = SwingUtilities.convertPoint(w, dragWindowOffset, getTitlePane()); if (getTitlePane() != null && getTitlePane().contains(convertedDragWindowOffset)) { if (!getFrameWindow().isMaximum() && dragWindowOffset.y >= BORDER_DRAG_THICKNESS && dragWindowOffset.x >= BORDER_DRAG_THICKNESS && dragWindowOffset.x < w.getWidth() - BORDER_DRAG_THICKNESS) { isMovingWindow = true; dragOffsetX = dragWindowOffset.x; dragOffsetY = dragWindowOffset.y; } } //this was an else if before but the title panel would not //cause a resize if (getFrameWindow().isResizable() && !getFrameWindow().isShaded() && !getFrameWindow().isMaximum()) { //&& ((frameState & Frame_MAXIMIZED_BOTH) == 0) //|| (d != null && d.isResizable())) { dragOffsetX = dragWindowOffset.x; dragOffsetY = dragWindowOffset.y; dragWidth = w.getWidth(); dragHeight = w.getHeight(); //System.out.println("Calulation cursor"); dragCursor = SkinRootPaneUI.getCursor( SkinRootPaneUI.calculateCorner( w, dragWindowOffset.x, dragWindowOffset.y)); } } public void mouseReleased(MouseEvent ev) { if (dragCursor != 0 && window != null && !window.isValid()) { // Some Window systems validate as you resize, others won't, // thus the check for validity before repainting. window.validate(); getRootPane().repaint(); } isMovingWindow = false; dragCursor = 0; } public void mouseMoved(MouseEvent ev) { JRootPane root = getRootPane(); if (root!=null && getWindowDecorationStyle(root) == JRootPane_NONE) { return; } java.awt.Window w = translateSource(ev); // Update the cursor int cursor = SkinRootPaneUI.getCursor( SkinRootPaneUI.calculateCorner(w, ev.getX(), ev.getY())); if (cursor != 0 && getFrameWindow().isResizable() && !getFrameWindow().isShaded() && !getFrameWindow().isMaximum()) { w.setCursor(Cursor.getPredefinedCursor(cursor)); } else { w.setCursor(lastCursor); } } public void mouseDragged(MouseEvent ev) { java.awt.Window w = translateSource(ev); Point pt = ev.getPoint(); // System.out.println("MovingWindow:"+isMovingWindow+" // dragcursor:"+dragCursor); if (isMovingWindow) { Point windowPt = w.getLocationOnScreen(); windowPt.x += pt.x - dragOffsetX; windowPt.y += pt.y - dragOffsetY; w.setLocation(windowPt); } else if (dragCursor != 0) { Rectangle r = w.getBounds(); Rectangle startBounds = new Rectangle(r); Dimension min = w.getMinimumSize(); switch (dragCursor) { case Cursor.E_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, 0, 0, pt.x + (dragWidth - dragOffsetX) - r.width, 0); break; case Cursor.S_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, 0, 0, 0, pt.y + (dragHeight - dragOffsetY) - r.height); break; case Cursor.N_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, 0, pt.y - dragOffsetY, 0, - (pt.y - dragOffsetY)); break; case Cursor.W_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, pt.x - dragOffsetX, 0, - (pt.x - dragOffsetX), 0); break; case Cursor.NE_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, 0, pt.y - dragOffsetY, pt.x + (dragWidth - dragOffsetX) - r.width, - (pt.y - dragOffsetY)); break; case Cursor.SE_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, 0, 0, pt.x + (dragWidth - dragOffsetX) - r.width, pt.y + (dragHeight - dragOffsetY) - r.height); break; case Cursor.NW_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, pt.x - dragOffsetX, pt.y - dragOffsetY, - (pt.x - dragOffsetX), - (pt.y - dragOffsetY)); break; case Cursor.SW_RESIZE_CURSOR : SkinRootPaneUI.adjust( r, min, pt.x - dragOffsetX, 0, - (pt.x - dragOffsetX), pt.y + (dragHeight - dragOffsetY) - r.height); break; default : break; } if (!r.equals(startBounds)) { if (getFrameWindow().isResizable()) { w.setBounds(r); // Defer repaint/validate on mouseReleased unless dynamic // layout is active. if (Boolean .TRUE .equals( AccessUtils.invoke( Toolkit.getDefaultToolkit(), "isDynamicLayoutActive", null, null))) { w.validate(); getRootPane().repaint(); } getFrameWindow().dispatchEvent( new ComponentEvent( getMainWindow(), ComponentEvent.COMPONENT_RESIZED)); } } } } public void mouseEntered(MouseEvent ev) { java.awt.Window w = translateSource(ev); if (!mouseAlreadyEntered) { lastCursor = w.getCursor(); } mouseAlreadyEntered = true; mouseMoved(ev); } public void mouseExited(MouseEvent ev) { java.awt.Window w = translateSource(ev); mouseAlreadyEntered = false; w.setCursor(lastCursor); } public void mouseClicked(MouseEvent ev) { java.awt.Window w = translateSource(ev); Frame f; if (w instanceof Frame) { f = (Frame)w; } else { return; } Point convertedPoint = SwingUtilities.convertPoint(w, ev.getPoint(), getTitlePane()); int state = getExtendedState(f); if (getTitlePane() != null && getTitlePane().contains(convertedPoint)) { if ((ev.getClickCount() % 2) == 0 && ((ev.getModifiers() & InputEvent.BUTTON1_MASK) != 0)) { if (f.isResizable()) { if ((state & Frame_MAXIMIZED_BOTH) != 0) { setExtendedState(f, state & ~Frame_MAXIMIZED_BOTH); } else { setExtendedState(f, state | Frame_MAXIMIZED_BOTH); } return; } } } } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinScrollBarUI.java0000644000175000017500000001273010460410014024003 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.gui.plaf.xtra.XTraScrollBarUI; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JScrollBar; import javax.swing.plaf.ComponentUI; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:53:26 $ */ public final class SkinScrollBarUI extends XTraScrollBarUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Gets the PreferredSize attribute of the SkinScrollBarUI object * * @param c Description of Parameter * @return The PreferredSize value */ public Dimension getPreferredSize(JComponent c) { return skin.getScrollbar().getPreferredSize((JScrollBar) c); } /** * Gets the MinimumThumbSize attribute of the SkinScrollBarUI object * * @return The MinimumThumbSize value */ protected Dimension getMinimumThumbSize() { return skin.getScrollbar().getMinimumThumbSize(); } /** * Description of the Method * * @param orientation Description of Parameter * @return Description of the Returned Value */ protected JButton createDecreaseButton(int orientation) { return new SkinArrowButton(orientation); } /** * Description of the Method * * @param orientation Description of Parameter * @return Description of the Returned Value */ protected JButton createIncreaseButton(int orientation) { return new SkinArrowButton(orientation); } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param trackBounds Description of Parameter */ protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { // g.setColor(trackColor); // g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height); g.translate(trackBounds.x, trackBounds.y); skin.getScrollbar().paintTrack(g, scrollbar, trackBounds); g.translate(-trackBounds.x, -trackBounds.y); if (trackHighlight == DECREASE_HIGHLIGHT) { paintDecreaseHighlight(g); } else if (trackHighlight == INCREASE_HIGHLIGHT) { paintIncreaseHighlight(g); } } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param thumbBounds Description of Parameter */ protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { if (thumbBounds.isEmpty() || !scrollbar.isEnabled()) { return; } g.translate(thumbBounds.x, thumbBounds.y); skin.getScrollbar().paintThumb(g, scrollbar, thumbBounds); g.translate(-thumbBounds.x, -thumbBounds.y); } /** * Description of the Method * * @param x Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent x) { return new SkinScrollBarUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinScrollbar.java0000644000175000017500000001052710460410014023607 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Scrollbar.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 19:47:23 $ */ public interface SkinScrollbar extends SkinComponent { /** * Gets the PreferredSize attribute of the SkinScrollbar object * * @param scrollbar Description of Parameter * @return The PreferredSize value */ java.awt.Dimension getPreferredSize(javax.swing.JScrollBar scrollbar); /** * Gets the MinimumThumbSize attribute of the SkinScrollbar object * * @return The MinimumThumbSize value */ java.awt.Dimension getMinimumThumbSize(); /** * Gets the ArrowPreferredSize attribute of the SkinScrollbar object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ java.awt.Dimension getArrowPreferredSize(int direction); /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ boolean paintArrow(java.awt.Graphics g, javax.swing.AbstractButton b, int direction); /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ boolean paintThumb(java.awt.Graphics g, javax.swing.JScrollBar scrollbar, java.awt.Rectangle thumbBounds); /** * Description of the Method * * @param g Description of Parameter * @param scrollbar Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ boolean paintTrack(java.awt.Graphics g, javax.swing.JScrollBar scrollbar, java.awt.Rectangle trackBounds); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSeparator.java0000644000175000017500000000541410460410014023623 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Separator.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:04:39 $ */ public interface SkinSeparator extends SkinComponent { boolean paint(java.awt.Graphics g, javax.swing.JSeparator separator); java.awt.Dimension getPreferredSize(javax.swing.JSeparator separator, java.awt.Dimension uiPreferredSize); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSeparatorUI.java0000644000175000017500000000712210460410014024057 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.JSeparator; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicSeparatorUI; /** * Skin SeparatorUI.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:47:23 $ */ public final class SkinSeparatorUI extends BasicSeparatorUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { skin.getSeparator().paint(g, (JSeparator)c); } /** * Description of the Method * * @param c Description of Parameter */ public java.awt.Dimension getPreferredSize( JComponent c ) { return skin.getSeparator().getPreferredSize((JSeparator)c, super.getPreferredSize(c)); } /** * Description of the Method * * @param x Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent x) { return new SkinSeparatorUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSlider.java0000644000175000017500000000726310460410012023107 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Slider.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:04:39 $ */ public interface SkinSlider extends SkinComponent { /** * Gets the PreferredSize attribute of the SkinSlider object * * @param slider Description of Parameter * @return The PreferredSize value */ java.awt.Dimension getPreferredSize(javax.swing.JSlider slider, java.awt.Dimension uiPreferredSize); java.awt.Dimension getThumbSize(javax.swing.JSlider slider); /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param trackBounds Description of Parameter * @return Description of the Returned Value */ boolean paintTrack(java.awt.Graphics g, javax.swing.JSlider slider, java.awt.Rectangle trackBounds); /** * Description of the Method * * @param g Description of Parameter * @param slider Description of Parameter * @param thumbBounds Description of Parameter * @return Description of the Returned Value */ boolean paintThumb(java.awt.Graphics g, javax.swing.JSlider slider, java.awt.Rectangle thumbBounds); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSliderUI.java0000644000175000017500000001212510460410012023336 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.plaf.basic.*; import javax.swing.plaf.*; import javax.swing.*; import java.awt.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:47:23 $ */ public final class SkinSliderUI extends BasicSliderUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Constructor for the SkinSliderUI object * * @param b Description of Parameter */ public SkinSliderUI(JSlider b) { super(b); } public Dimension getPreferredHorizontalSize() { return skin.getSlider().getPreferredSize(slider, super.getPreferredHorizontalSize()); } public Dimension getPreferredVerticalSize() { return skin.getSlider().getPreferredSize(slider, super.getPreferredVerticalSize()); } public Dimension getMinimumHorizontalSize() { return skin.getSlider().getPreferredSize(slider, super.getMinimumHorizontalSize()); } public Dimension getMinimumVerticalSize() { return skin.getSlider().getPreferredSize(slider, super.getMinimumVerticalSize()); } /** * Description of the Method * * @param g Description of Parameter */ public void paintTrack(Graphics g) { Rectangle trackBounds = trackRect; int cx; int cy; if (slider.getOrientation() == SwingConstants.HORIZONTAL) { cy = (trackBounds.height / 2) - 2; g.translate(trackBounds.x, trackBounds.y + cy); skin.getSlider().paintTrack(g, slider, trackBounds); g.translate(-trackBounds.x, -(trackBounds.y + cy)); } else { cx = (trackBounds.width / 2) - 2; g.translate(trackBounds.x + cx, trackBounds.y); skin.getSlider().paintTrack(g, slider, trackBounds); g.translate(-(trackBounds.x + cx), -trackBounds.y); } } /** * Description of the Method * * @param g Description of Parameter */ public void paintThumb(Graphics g) { Rectangle knobBounds = thumbRect; g.translate(knobBounds.x, knobBounds.y); skin.getSlider().paintThumb(g, slider, knobBounds); g.translate(-knobBounds.x, -knobBounds.y); } /** * Description of the Method * * @param b Description of Parameter */ protected void installDefaults(JSlider b) { super.installDefaults(b); skin.getSlider().installSkin(b); } protected Dimension getThumbSize() { Dimension dim = skin.getSlider().getThumbSize(slider); return dim==null?super.getThumbSize():dim; } /** * Description of the Method * * @param x Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent x) { return new SkinSliderUI((JSlider) x); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSplitArrowButton.java0000644000175000017500000001214310460410014025162 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.border.Border; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinSplitArrowButton extends JButton implements SwingConstants { /** * Description of the Field */ protected int direction; /** * Description of the Field */ protected Skin skin = SkinLookAndFeel.getSkin(); /** * Constructor for the SkinSplitArrowButton object * * @param direction Description of Parameter */ public SkinSplitArrowButton(int direction) { super(); setRequestFocusEnabled(false); setDirection(direction); setBackground(UIManager.getColor("control")); Dimension size = getPreferredSize(); setSize(size.width, size.height); } /** * Sets the Direction attribute of the SkinSplitArrowButton object * * @param dir The new Direction value */ public void setDirection(int dir) { direction = dir; } /** * Sets the Border attribute of the SkinSplitArrowButton object * * @param b The new Border value */ public void setBorder(Border b) { } /** * Gets the Direction attribute of the SkinSplitArrowButton object * * @return The Direction value */ public int getDirection() { return direction; } /** * Gets the PreferredSize attribute of the SkinSplitArrowButton object * * @return The PreferredSize value */ public Dimension getPreferredSize() { return skin.getSplitPane().getArrowPreferredSize(direction); } /** * Gets the MinimumSize attribute of the SkinSplitArrowButton object * * @return The MinimumSize value */ public Dimension getMinimumSize() { return new Dimension(5, 5); } /** * Gets the MaximumSize attribute of the SkinSplitArrowButton object * * @return The MaximumSize value */ public Dimension getMaximumSize() { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); } /** * Gets the Insets attribute of the SkinSplitArrowButton object * * @return The Insets value */ public Insets getInsets() { return new Insets(0, 0, 0, 0); } /** * Gets the FocusTraversable attribute of the SkinSplitArrowButton object * * @return The FocusTraversable value */ public boolean isFocusTraversable() { return false; } /** * Description of the Method * * @param g Description of Parameter */ public void paint(Graphics g) { skin.getSplitPane().paintArrow(g, this, direction); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSplitPane.java0000644000175000017500000001015410460410014023557 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin SplitPane.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2003/08/01 20:04:39 $ */ public interface SkinSplitPane extends SkinComponent { /** * Gets the PreferredSize attribute of the SkinSplitPane object * * @param splitpane Description of Parameter * @return The PreferredSize value */ java.awt.Dimension getPreferredSize(javax.swing.JSplitPane splitpane); /** * Gets the ArrowPreferredSize attribute of the SkinSplitPane object * * @param direction Description of Parameter * @return The ArrowPreferredSize value */ java.awt.Dimension getArrowPreferredSize(int direction); /** * Description of the Method * * @param g Description of Parameter * @param b Description of Parameter * @param direction Description of Parameter * @return Description of the Returned Value */ boolean paintArrow(java.awt.Graphics g, javax.swing.AbstractButton b, int direction); /** * Description of the Method * * @param g Description of Parameter * @param divider Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ boolean paintGutter(java.awt.Graphics g, javax.swing.JSplitPane divider, java.awt.Dimension d); /** * Description of the Method * * @param g Description of Parameter * @param divider Description of Parameter * @param d Description of Parameter * @return Description of the Returned Value */ boolean paintThumb(java.awt.Graphics g, javax.swing.JSplitPane divider, java.awt.Dimension d); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSplitPaneDivider.java0000644000175000017500000002041210460410014025064 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Component; import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import java.awt.LayoutManager; import java.awt.Rectangle; import javax.swing.JButton; import javax.swing.JSplitPane; import javax.swing.plaf.basic.BasicSplitPaneDivider; import javax.swing.plaf.basic.BasicSplitPaneUI; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinSplitPaneDivider extends BasicSplitPaneDivider implements javax.swing.SwingConstants { /** * Description of the Field */ protected Skin skin = SkinLookAndFeel.getSkin(); final static Cursor defaultCursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); final static Insets NO_INSETS = new Insets(0, 0, 0, 0); /** * Constructor for the SkinSplitPaneDivider object * * @param ui Description of Parameter */ public SkinSplitPaneDivider(BasicSplitPaneUI ui) { super(ui); setLayout(new DividerLayout()); } /** * Sets the size of the divider to newSize. That is the * width if the splitpane is HORIZONTAL_SPLIT, or the * height of VERTICAL_SPLIT . * * @param newSize The new DividerSize value */ public void setDividerSize(int newSize) { dividerSize = newSize; splitPane.setDividerSize(newSize); } /** * Paints the divider. * * @param g Description of Parameter */ public void paint(Graphics g) { //Paint the border. //Border border = getBorder(); //if (border != null) { Dimension size = getSize(); //border.paintBorder(this, g, 0, 0, size.width, size.height); skin.getSplitPane().paintGutter(g, splitPane, size); if (leftButton != null) { Rectangle bounds = leftButton.getBounds(); Graphics glb = g.create(bounds.x, bounds.y, bounds.width, bounds.height); leftButton.paint(glb); } if (rightButton != null) { Rectangle bounds = rightButton.getBounds(); Graphics grb = g.create(bounds.x, bounds.y, bounds.width, bounds.height); rightButton.paint(grb); } skin.getSplitPane().paintThumb(g, splitPane, size); } /** * Creates and return an instance of JButton that can be used to collapse the * left component in the split pane. * * @return Description of the Returned Value */ protected JButton createLeftOneTouchButton() { int button_direction = SOUTH; if (orientation == JSplitPane.HORIZONTAL_SPLIT) { button_direction = WEST; } JButton b = new SkinSplitArrowButton(button_direction); b.setCursor(defaultCursor); b.setFocusPainted(false); b.setBorderPainted(false); updateDividerSize(b.getPreferredSize()); return b; } /** * Creates and return an instance of JButton that can be used to collapse the * right component in the split pane. * * @return Description of the Returned Value */ protected JButton createRightOneTouchButton() { int button_direction = NORTH; if (orientation == JSplitPane.HORIZONTAL_SPLIT) { button_direction = EAST; } JButton b = new SkinSplitArrowButton(button_direction); b.setCursor(defaultCursor); b.setFocusPainted(false); b.setBorderPainted(false); updateDividerSize(b.getPreferredSize()); return b; } /** * Update the divider size to contain the appropriate dimension. * * @param d Description of Parameter */ protected void updateDividerSize(Dimension d) { int buttonSize; if (orientation == JSplitPane.HORIZONTAL_SPLIT) { buttonSize = d.width; } else { buttonSize = d.height; } int sbSize = splitPane.getDividerSize(); if (sbSize < buttonSize) { splitPane.setDividerSize(buttonSize); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ protected class DividerLayout implements LayoutManager { /** * Description of the Method * * @param c Description of Parameter */ public void layoutContainer(Container c) { if (leftButton != null && rightButton != null && c == SkinSplitPaneDivider.this) { Dimension leftSize = leftButton.getPreferredSize(); Dimension rightSize = rightButton.getPreferredSize(); if (splitPane.isOneTouchExpandable()) { Insets insets = getInsets(); if (insets == null) { insets = NO_INSETS; } if (orientation == JSplitPane.VERTICAL_SPLIT) { int blockSize = getDividerSize() - (insets.left + insets.right); int y = (c.getSize().height - blockSize) / 2; leftButton.setBounds(insets.left + leftSize.width, y, leftSize.width, leftSize.height); rightButton.setBounds((insets.left * 2) + leftSize.width + rightSize.width, y, rightSize.width, rightSize.height); } else { int blockSize = getDividerSize() - (insets.top + insets.bottom); int x = (c.getSize().width - blockSize) / 2; leftButton.setBounds(x, insets.top + leftSize.height, leftSize.width, leftSize.height); rightButton.setBounds(x, (insets.top * 2) + leftSize.height + rightSize.height, rightSize.width, rightSize.height); } } else { leftButton.setBounds(-5, -5, 1, 1); rightButton.setBounds(-5, -5, 1, 1); } } } public Dimension minimumLayoutSize(Container c) { return new Dimension(0,0); } public Dimension preferredLayoutSize(Container c) { return new Dimension(0, 0); } public void removeLayoutComponent(Component c) {} public void addLayoutComponent(String string, Component c) {} } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinSplitPaneUI.java0000644000175000017500000000617310460410014024023 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicSplitPaneDivider; import javax.swing.plaf.basic.BasicSplitPaneUI; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version */ public final class SkinSplitPaneUI extends BasicSplitPaneUI { /** * Creates the default divider. * * @return Description of the Returned Value */ public BasicSplitPaneDivider createDefaultDivider() { return new SkinSplitPaneDivider(this); } /** * Description of the Method * * @param x Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent x) { return new SkinSplitPaneUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinTab.java0000644000175000017500000000740610460410014022374 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; /** * Skin Tab.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2005/11/19 09:17:26 $ */ public interface SkinTab extends SkinComponent { /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param isSelected Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ boolean paintTab(java.awt.Graphics g, int tabPlacement, boolean isSelected, int x, int y, int w, int h); /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param selectedIndex Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ boolean paintContent(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h); boolean paintGap(java.awt.Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h); } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinTabbedPaneUI.java0000644000175000017500000001333110460410014024103 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.*; import javax.swing.plaf.basic.*; import javax.swing.plaf.*; import javax.swing.*; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinTabbedPaneUI extends BasicTabbedPaneUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param tabIndex Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @param isSelected Description of Parameter */ protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { skin.getTab().paintTab(g, tabPlacement, isSelected, x, y, w, h); } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param selectedIndex Description of Parameter */ protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) { int width = tabPane.getWidth(); int height = tabPane.getHeight(); Insets insets = tabPane.getInsets(); int x = insets.left; int y = insets.top; int w = width - insets.right - insets.left; int h = height - insets.top - insets.bottom; switch (tabPlacement) { case LEFT: x += calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); w -= (x - insets.left); break; case RIGHT: w -= calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); break; case BOTTOM: h -= calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); break; case TOP: default: y += calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); h -= (y - insets.top); } if (skin.getTab().paintContent(g, tabPlacement, selectedIndex, x, y, w, h) == false) { paintContentBorderTopEdge(g, tabPlacement, selectedIndex, x, y, w, h); paintContentBorderLeftEdge(g, tabPlacement, selectedIndex, x, y, w, h); paintContentBorderBottomEdge(g, tabPlacement, selectedIndex, x, y, w, h); paintContentBorderRightEdge(g, tabPlacement, selectedIndex, x, y, w, h); } else { Rectangle rect = getTabBounds(selectedIndex, calcRect); skin.getTab().paintGap(g, tabPlacement, selectedIndex, rect.x, y, rect.width, h); } } /** * Description of the Method * * @param g Description of Parameter * @param tabPlacement Description of Parameter * @param tabIndex Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @param isSelected Description of Parameter */ protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinTabbedPaneUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinTableHeaderUI.java0000644000175000017500000000770410460410014024265 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.util.Enumeration; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicTableHeaderUI; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:47:37 $ */ public final class SkinTableHeaderUI extends BasicTableHeaderUI { TableCellRenderer renderer; Skin skin = SkinLookAndFeel.getSkin(); /** * Constructor for the SkinTableHeaderUI object */ public SkinTableHeaderUI() { super(); renderer = skin.getPersonality().getTableHeaderRenderer(); } /** * Description of the Method * * @param c Description of Parameter */ public void installUI(JComponent c) { super.installUI(c); try { // if JDK1.3 or later header.getClass().getMethod("setDefaultRenderer", new Class[]{TableCellRenderer.class}).invoke(header, new Object[]{renderer}); } catch (Exception e) { // else do it the old way Enumeration enumeration = header.getColumnModel().getColumns(); while (enumeration.hasMoreElements()) { TableColumn aColumn = (TableColumn) enumeration.nextElement(); aColumn.setHeaderRenderer(renderer); } } // end of else } /** * Description of the Method * * @param h Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent h) { return new SkinTableHeaderUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinTitlePane.java0000644000175000017500000005760610460410014023562 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.util.OS; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyVetoException; import javax.swing.AbstractAction; import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JSeparator; import javax.swing.UIManager; import javax.swing.plaf.basic.BasicInternalFrameTitlePane; /** * Description of the Class * * @author fred */ public class SkinTitlePane extends BasicInternalFrameTitlePane { /** * Description of the Field */ protected Window m_Window; private SkinWindowButton[] m_WindowButtons; /** * Description of the Field */ private Action shadeAction; private Skin skin; private WindowListener m_WindowListener; public final static int ICON_OFFSET = 16; /** * Align button relative to top left of window */ public final static int ALIGN_TOP_LEFT = 0; /** * Align button relative to the top right of window */ public final static int ALIGN_TOP_RIGHT = 1; /** * Description of the Field */ public final static int CLOSE_ACTION = 0; /** * Description of the Field */ public final static int MAXIMIZE_ACTION = 22; /** * Description of the Field */ public final static int MINIMIZE_ACTION = 23; /** * Description of the Field */ public final static int NO_ACTION = -1; /** * Constructor for the SkinTitlePane object * * @param f Description of Parameter */ public SkinTitlePane(JInternalFrame f) { this(new Window.InternalFrameWindow(f)); } /** * Constructor for the SkinTitlePane object * * @param f Description of Parameter */ public SkinTitlePane(Window f) { super(null); m_Window = f; // in JDK1.4 Sun changed the way listener is added remove before // it was in add/remove notify now add is made in installDefaults // and remove by BasicInternalFrameUI if (OS.isOneDotFourOrMore()) { installListeners(); } } /** * Gets the Window attribute of the SkinTitlePane object * * @return The Window value */ public Window getWindow() { return m_Window; } /** * Gets the PreferredSize attribute of the SkinTitlePane object * * @return The PreferredSize value */ public Dimension getPreferredSize() { return skin.getFrame().getTopPreferredSize(); } /** * Gets the MinimumSize attribute of the SkinTitlePane object * * @return The MinimumSize value */ public Dimension getMinimumSize() { return skin.getFrame().getTopPreferredSize(); } /** * Description of the Method * * @param g Description of Parameter */ public void paintComponent(Graphics g) { boolean isSelected = m_Window.isSelected(); Font f = g.getFont(); if (m_Window.getTitle() != null) { if (isSelected) { g.setColor(selectedTextColor); } else { g.setColor(notSelectedTextColor); } g.setFont(UIManager.getFont("InternalFrame.titleFont")); } skin.getFrame().paintTop(g, this, isSelected, m_Window.getTitle()); g.setFont(f); } /** * Sets the ButtonIcons attribute of the SkinTitlePane object */ protected void setButtonIcons() { } /** * Description of the Method */ protected void installTitlePane() { installDefaults(); createActions(); enableActions(); assembleSystemMenu(); setLayout(createLayout()); add(menuBar); setOpaque(true); skin = SkinLookAndFeel.getSkin(); createButtons(); } /** * Description of the Method */ protected void createActions() { maximizeAction = new MaximizeAction(); maximizeAction.setEnabled(true); iconifyAction = new IconifyAction(); iconifyAction.setEnabled(true); closeAction = new CloseAction(); closeAction.setEnabled(true); restoreAction = new RestoreAction(); restoreAction.setEnabled(true); shadeAction = new ShadeAction(); shadeAction.setEnabled(true); } /** * Overriden to register on the window */ protected void installListeners() { // the window container may be null when the titlePane is used by // a JFrame/JDialog if (m_Window == null || m_Window.getContainer() == null) { return; } if (propertyChangeListener == null) { propertyChangeListener = createPropertyChangeListener(); } m_Window.addPropertyChangeListener(propertyChangeListener); if (m_Window instanceof Window.FrameWindow) { if (m_WindowListener == null) { m_WindowListener = createWindowListener(); } ((Window.FrameWindow)m_Window).getMainFrame().addWindowListener( m_WindowListener); } } /** * called by the SkinRootPaneUI when the window container has been * set */ void windowSet() { installListeners(); } /** * Tracks window activation events to update the buttons and the * titlebar */ private WindowListener createWindowListener() { return new WindowAdapter() { public void windowActivated(WindowEvent e) { try { m_Window.setSelected(true); updateButtons(); } catch (PropertyVetoException ex) {} } public void windowDeactivated(WindowEvent e) { try { m_Window.setSelected(false); updateButtons(); } catch (PropertyVetoException ex) {} } }; } /** * Overriden to unregister on the window */ protected void uninstallListeners() { m_Window.removePropertyChangeListener(propertyChangeListener); if (m_Window instanceof Window.FrameWindow && m_WindowListener != null) { ((Window.FrameWindow)m_Window).getMainFrame().removeWindowListener( m_WindowListener); } } /** * Same as parent class except it does not initialize the icons */ protected void installDefaults() { selectedTitleColor = UIManager.getColor("InternalFrame.activeTitleBackground"); selectedTextColor = UIManager.getColor("InternalFrame.activeTitleForeground"); notSelectedTitleColor = UIManager.getColor("InternalFrame.inactiveTitleBackground"); notSelectedTextColor = UIManager.getColor("InternalFrame.inactiveTitleForeground"); } /** * Description of the Method */ protected void createButtons() { SkinWindowButton[] buttonsLeft = skin.getFrame().getWindowButtons(ALIGN_TOP_LEFT); if (buttonsLeft != null) { for (int i = 0, c = buttonsLeft.length; i < c; i++) { addButton(buttonsLeft[i]); } } SkinWindowButton[] buttonsRight = skin.getFrame().getWindowButtons(ALIGN_TOP_RIGHT); if (buttonsRight != null) { for (int i = 0, c = buttonsRight.length; i < c; i++) { addButton(buttonsRight[i]); } } m_WindowButtons = new SkinWindowButton[buttonsLeft.length + buttonsRight.length]; System.arraycopy(buttonsLeft, 0, m_WindowButtons, 0, buttonsLeft.length); System.arraycopy(buttonsRight, 0, m_WindowButtons, buttonsLeft.length, buttonsRight.length); } private void updateButtons() { for (int i = 0; i < m_WindowButtons.length; i++) { m_WindowButtons[i].setSelected(m_Window.isSelected()); } repaint(); } /** * Adds a feature to the Button attribute of the SkinTitlePane object * * @param button The feature to be added to the Button attribute */ protected void addButton(SkinWindowButton button) { switch (button.getWindowAction()) { case CLOSE_ACTION: button.addActionListener(closeAction); registerButtonForAction(button, closeAction); break; case MAXIMIZE_ACTION: button.addActionListener(maximizeAction); registerButtonForAction(button, maximizeAction); break; case MINIMIZE_ACTION: button.addActionListener(iconifyAction); registerButtonForAction(button, iconifyAction); break; } add(button); } /** * Adds a feature to the SystemMenuItems attribute of the SkinTitlePane object * * @param systemMenu The feature to be added to the SystemMenuItems attribute */ protected void addSystemMenuItems(JMenu systemMenu) { JMenuItem mi = systemMenu.add(restoreAction); mi.setMnemonic('R'); mi = systemMenu.add(iconifyAction); mi.setMnemonic('n'); mi = systemMenu.add(maximizeAction); mi.setMnemonic('x'); if (!Boolean.TRUE.equals(UIManager.get("TitlePane.disableShade"))) { systemMenu.add(shadeAction); } systemMenu.add(new JSeparator()); mi = systemMenu.add(closeAction); mi.setMnemonic('C'); } protected JMenuBar createSystemMenuBar() { menuBar = new SystemMenuBar(); menuBar.setBorderPainted(false); return menuBar; } /** * Description of the Method */ protected void enableActions() { if (m_Window == null) { return; } restoreAction.setEnabled(m_Window.isMaximum() || m_Window.isIcon()); maximizeAction.setEnabled(m_Window.isMaximizable()); iconifyAction.setEnabled(m_Window.isIconifiable() && !m_Window.isIcon()); closeAction.setEnabled(m_Window.isClosable()); shadeAction.setEnabled(!m_Window.isMaximum() && !m_Window.isIcon()); doLayout(); } /** * Description of the Method * * @return Description of the Returned Value */ protected PropertyChangeListener createPropertyChangeListener() { return new PropertyChangeHandler(); } /** * Description of the Method * * @return Description of the Returned Value */ protected LayoutManager createLayout() { return new TitlePaneLayout(); } /** * Description of the Method * * @param b Description of Parameter * @return Description of the Returned Value */ protected PropertyChangeListener createActionChangeListener(AbstractButton b) { return new ActionChangedListener(b); } // end TitlePaneLayout /** * Description of the Method * * @param b Description of Parameter * @param a Description of Parameter */ private void registerButtonForAction(AbstractButton b, Action a) { PropertyChangeListener actionPropertyChangeListener = createActionChangeListener(b); a.addPropertyChangeListener(actionPropertyChangeListener); b.setEnabled(a.isEnabled()); } /** * Description of the Class * * @author fred */ public class PropertyChangeHandler implements PropertyChangeListener { /** * Description of the Method * * @param evt Description of Parameter */ public void propertyChange(PropertyChangeEvent evt) { String prop = evt.getPropertyName(); if (JInternalFrame.IS_SELECTED_PROPERTY.equals(prop)) { updateButtons(); repaint(); return; } enableActions(); revalidate(); repaint(); } } /** * Description of the Class * * @author fred */ public class TitlePaneLayout implements LayoutManager { /** * Adds a feature to the LayoutComponent attribute of the TitlePaneLayout * object * * @param name The feature to be added to the LayoutComponent attribute * @param c The feature to be added to the LayoutComponent attribute */ public void addLayoutComponent(String name, Component c) { } /** * Description of the Method * * @param c Description of Parameter */ public void removeLayoutComponent(Component c) { } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public Dimension preferredLayoutSize(Container c) { return new Dimension(100, 18); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public Dimension minimumLayoutSize(Container c) { return preferredLayoutSize(c); } /** * Description of the Method * * @param c Description of Parameter */ public void layoutContainer(Container c) { int w = getWidth(); int nmembers = c.getComponentCount(); int atlX = 2; int atrX = 0; menuBar.setBounds(atlX, (getHeight() - 16) / 2, 16, 16); atlX += 18; for (int i = 1 /* * skip menubar */ ; i < nmembers; i++) { SkinWindowButton m = (SkinWindowButton) c.getComponent(i); m.setSelected(m_Window.isSelected()); // only adjust the system buttons. boolean userDefinedAction =(m.getWindowAction()==SkinTitlePane.NO_ACTION); if (!userDefinedAction) m.setVisible(m.isEnabled()); if (m.isEnabled() || userDefinedAction) { if (m.getAlign() == ALIGN_TOP_LEFT) { if (m.getXCoord() == -1) { m.setLocation(atlX, Math.max(m.getYCoord(), 1)); atlX += m.getWidth(); } else { m.setLocation(m.getXCoord(), m.getYCoord()); } } else if (m.getAlign() == ALIGN_TOP_RIGHT) { if (m.getXCoord() == -1) { m.setLocation(w - atrX - m.getWidth(), Math.max(m.getYCoord(), 1)); atrX += m.getWidth(); } else { m.setLocation(w - m.getXCoord(), m.getYCoord()); } } } } } } /** * This inner class is marked "public" due to a compiler bug. This * class should be treated as a "protected" inner class. Instantiate * it only within subclasses of . * * @author fred */ public class CloseAction extends AbstractAction { /** * Constructor for the CloseAction object */ public CloseAction() { super("Close"); } /** * Description of the Method * * @param e Description of Parameter */ public void actionPerformed(ActionEvent e) { if (m_Window.isClosable()) { try { m_Window.setClosed(true); } catch (PropertyVetoException e0) { } } } } // end CloseAction /** * This inner class is marked "public" due to a compiler bug. This * class should be treated as a "protected" inner class. Instantiate * it only within subclasses of . * * @author fred */ public class MaximizeAction extends AbstractAction { /** * Constructor for the MaximizeAction object */ public MaximizeAction() { super("Maximize"); } /** * Description of the Method * * @param e Description of Parameter */ public void actionPerformed(ActionEvent e) { if (m_Window.isMaximizable()) { if (!m_Window.isMaximum()) { try { m_Window.setMaximum(true); } catch (PropertyVetoException e5) { } } else { try { m_Window.setMaximum(false); if (m_Window.isIconifiable() && m_Window.isIcon()) { m_Window.setIcon(false); } } catch (PropertyVetoException e6) { } } } } } // MaximizeAction /** * This inner class is marked "public" due to a compiler bug. This * class should be treated as a "protected" inner class. Instantiate * it only within subclasses of . * * @author fred * @created 27 avril 2002 */ public class IconifyAction extends AbstractAction { /** * Constructor for the IconifyAction object */ public IconifyAction() { super("Minimize"); } /** * Description of the Method * * @param e Description of Parameter */ public void actionPerformed(ActionEvent e) { if (m_Window.isIconifiable()) { if (!m_Window.isIcon()) { try { m_Window.setIcon(true); } catch (PropertyVetoException e1) { } } else { try { m_Window.setIcon(false); if (m_Window.isMaximizable() && m_Window.isMaximum()) { m_Window.setMaximum(false); } } catch (PropertyVetoException e1) { } } } } } // end IconifyAction /** * This inner class is marked "public" due to a compiler bug. This * class should be treated as a "protected" inner class. Instantiate * it only within subclasses of . * * @author fred * @created 27 avril 2002 */ public class RestoreAction extends AbstractAction { /** * Constructor for the RestoreAction object */ public RestoreAction() { super("Restore"); } /** * Description of the Method * * @param e Description of Parameter */ public void actionPerformed(ActionEvent e) { if (m_Window.isMaximizable() && m_Window.isMaximum()) { try { m_Window.setMaximum(false); } catch (PropertyVetoException e4) { } } else if (m_Window.isIconifiable() && m_Window.isIcon()) { try { m_Window.setIcon(false); } catch (PropertyVetoException e4) { } } } } // end RestoreAction /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class ShadeAction extends AbstractAction { /** * Constructor for the ShadeAction object */ public ShadeAction() { super("Shade"); } /** * Description of the Method * * @param event Description of Parameter */ public void actionPerformed(ActionEvent event) { m_Window.setShaded(!m_Window.isShaded()); } } /** * This inner class is marked "public" due to a compiler bug. This * class should be treated as a "protected" inner class. Instantiate * it only within subclasses of . * * @author fred * @created 27 avril 2002 */ public class SystemMenuBar extends JMenuBar { /** * Gets the FocusTraversable attribute of the SystemMenuBar object * * @return The FocusTraversable value */ public boolean isFocusTraversable() { return false; } /** * Gets the Opaque attribute of the SystemMenuBar object * * @return The Opaque value */ public boolean isOpaque() { return true; } /** * Description of the Method */ public void requestFocus() { } /** * Description of the Method * * @param g Description of Parameter */ public void paint(Graphics g) { Icon icon = m_Window.getFrameIcon(); if (icon == null) { icon = UIManager.getIcon("InternalFrame.icon"); } if (icon != null) { // Resize to 16x16 if necessary. if (icon instanceof ImageIcon && (icon.getIconWidth() > 16 || icon.getIconHeight() > 16)) { Image img = ((ImageIcon) icon).getImage(); ((ImageIcon) icon).setImage(img.getScaledInstance(16, 16, Image.SCALE_SMOOTH)); } icon.paintIcon(this, g, 0, 0); } } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class ActionChangedListener implements PropertyChangeListener { AbstractButton button; /** * Constructor for the ActionChangedListener object * * @param b Description of Parameter */ ActionChangedListener(AbstractButton b) { super(); setTarget(b); } /** * Sets the Target attribute of the ActionChangedListener object * * @param b The new Target value */ public void setTarget(AbstractButton b) { this.button = b; } /** * Description of the Method * * @param e Description of Parameter */ public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); if (e.getPropertyName().equals(Action.NAME)) { String text = (String) e.getNewValue(); button.setText(text); button.repaint(); } else if (propertyName.equals("enabled")) { Boolean enabledState = (Boolean) e.getNewValue(); button.setEnabled(enabledState.booleanValue()); button.repaint(); } else if (e.getPropertyName().equals(Action.SMALL_ICON)) { Icon icon = (Icon) e.getNewValue(); button.setIcon(icon); button.invalidate(); button.repaint(); } } } } // End Title Pane Class skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinToggleButtonUI.java0000644000175000017500000001147110460410014024536 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.text.View; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public final class SkinToggleButtonUI extends SkinButtonUI { // ******************************** // Paint Methods // ******************************** /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); Dimension size = b.getSize(); FontMetrics fm = g.getFontMetrics(); Insets i = c.getInsets(); Rectangle viewRect = new Rectangle(size); viewRect.x += i.left; viewRect.y += i.top; viewRect.width -= (i.right + viewRect.x); viewRect.height -= (i.bottom + viewRect.y); Rectangle iconRect = new Rectangle(); Rectangle textRect = new Rectangle(); Font f = c.getFont(); g.setFont(f); // layout the text and icon String text = SwingUtilities.layoutCompoundLabel( c, fm, b.getText(), b.getIcon(), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, b.getText() == null ? 0 : getDefaultTextIconGap(b) ); g.setColor(b.getBackground()); clearTextShiftOffset(); if (model.isArmed() && model.isPressed() || model.isSelected()) { paintButtonPressed(g, b); } skin.getButton().paintButton(g, b); // Paint the Icon if (b.getIcon() != null) { paintIcon(g, b, iconRect); } // Draw the Text if (text != null && !text.equals("")) { View v = (View) c.getClientProperty("html"); //BasicHTML.propertyKey); if (v != null) { v.paint(g, textRect); } else { paintText(g, (JComponent)b, textRect, text); } } if (b.isFocusPainted() && b.hasFocus()) { // paint UI specific focus paintFocus(g, b, viewRect, textRect, iconRect); } } /** * Description of the Method * * @param b Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent b) { return new SkinToggleButtonUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinToolBarUI.java0000644000175000017500000000670410460410014023466 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Graphics; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicToolBarUI; /** * Created on 03/02/2001 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2003/12/06 21:47:37 $ */ public final class SkinToolBarUI extends BasicToolBarUI { private Skin skin = SkinLookAndFeel.getSkin(); /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { skin.getPersonality().paintDialog(g, c); } /** * Description of the Method */ protected void installDefaults() { super.installDefaults(); skin.getPersonality().installSkin(toolBar); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinToolBarUI(); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinToolTipUI.java0000644000175000017500000001371610460410014023517 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Toolkit; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.JToolTip; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicToolTipUI; /** * @author $Author: l2fprod $ * @version $Revision: 1.4 $, $Date: 2005/10/09 13:30:55 $ */ public final class SkinToolTipUI extends BasicToolTipUI { static SkinToolTipUI sharedInstance = new SkinToolTipUI(); private Font smallFont; private JToolTip tip; public static final int padSpaceBetweenStrings = 12; private String acceleratorDelimiter; public SkinToolTipUI() { super(); } public static ComponentUI createUI(JComponent c) { return sharedInstance; } public void installUI(JComponent c) { super.installUI(c); tip = (JToolTip)c; Font f = c.getFont(); smallFont = new Font( f.getName(), f.getStyle(), f.getSize() - 2 ); acceleratorDelimiter = UIManager.getString( "MenuItem.acceleratorDelimiter" ); if ( acceleratorDelimiter == null ) { acceleratorDelimiter = "-"; } } public void paint(Graphics g, JComponent c) { super.paint(g, c); Font font = c.getFont(); FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font); String keyText = getAcceleratorString(); String tipText = ((JToolTip)c).getTipText(); if (tipText == null) { tipText = ""; } if (! (keyText.equals(""))) { // only draw control key if there is one g.setFont(smallFont); g.setColor( c.getForeground() ); // from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4449310 metrics = c.getFontMetrics(smallFont); g.drawString(keyText, c.getWidth() - 2 - metrics.stringWidth(keyText), c.getHeight() - 2 - metrics.getDescent()); } } public Dimension getPreferredSize(JComponent c) { Dimension d = super.getPreferredSize(c); String key = getAcceleratorString(); if (! (key.equals(""))) { FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(smallFont); d.width += fm.stringWidth(key) + padSpaceBetweenStrings; } return d; } public String getAcceleratorString() { JComponent comp = tip.getComponent(); if (comp == null) { return ""; } KeyStroke[] keys = comp.getRegisteredKeyStrokes(); String controlKeyStr = ""; for (int i = 0; i < keys.length; i++) { int mod = keys[i].getModifiers(); int condition = comp.getConditionForKeyStroke(keys[i]); if ( condition == JComponent.WHEN_IN_FOCUSED_WINDOW && ( (mod & InputEvent.ALT_MASK) != 0 || (mod & InputEvent.CTRL_MASK) != 0 || (mod & InputEvent.SHIFT_MASK) != 0 || (mod & InputEvent.META_MASK) != 0 ) ) { controlKeyStr = KeyEvent.getKeyModifiersText(mod) + acceleratorDelimiter + (char)keys[i].getKeyCode(); break; } } /* Special case for menu item since they do not register a keyboard action for their mnemonics and they always use Alt */ if ( controlKeyStr.equals("") && comp instanceof JMenuItem ) { int mnemonic = ((JMenuItem) comp).getMnemonic(); if ( mnemonic != 0 ) { controlKeyStr = "Alt" + acceleratorDelimiter + (char) mnemonic; } } return controlKeyStr; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinTreeUI.java0000644000175000017500000001433710460410014023024 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.io.Serializable; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicTreeUI; /** * A placeholder for default Tree icons. * * @author fred * @created 27 avril 2002 */ public final class SkinTreeUI extends BasicTreeUI { /** * Description of the Field */ protected final static int HALF_SIZE = 4; /** * Description of the Field */ protected final static int SIZE = 9; /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param x Description of Parameter * @param top Description of Parameter * @param bottom Description of Parameter */ protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom) { drawDashedVerticalLine(g, x, top, bottom); } /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter * @param y Description of Parameter * @param left Description of Parameter * @param right Description of Parameter */ protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right) { drawDashedHorizontalLine(g, y, left, right); } /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinTreeUI(); } /** * The minus sign button icon * * @author fred * @created 27 avril 2002 */ static class ExpandedIcon implements Icon, Serializable { /** * Gets the IconWidth attribute of the ExpandedIcon object * * @return The IconWidth value */ public int getIconWidth() { return SIZE; } /** * Gets the IconHeight attribute of the ExpandedIcon object * * @return The IconHeight value */ public int getIconHeight() { return SIZE; } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param x Description of Parameter * @param y Description of Parameter */ public void paintIcon(Component c, Graphics g, int x, int y) { Color backgroundColor = c.getBackground(); if (backgroundColor != null) { g.setColor(backgroundColor); } else { g.setColor(Color.white); } g.fillRect(x, y, SIZE - 1, SIZE - 1); g.setColor(Color.gray); g.drawRect(x, y, SIZE - 1, SIZE - 1); g.setColor(Color.black); g.drawLine(x + 2, y + HALF_SIZE, x + (SIZE - 3), y + HALF_SIZE); } /** * Description of the Method * * @return Description of the Returned Value */ public static Icon createExpandedIcon() { return new ExpandedIcon(); } } /** * The plus sign button icon * * @author fred * @created 27 avril 2002 */ static class CollapsedIcon extends ExpandedIcon { /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param x Description of Parameter * @param y Description of Parameter */ public void paintIcon(Component c, Graphics g, int x, int y) { super.paintIcon(c, g, x, y); g.drawLine(x + HALF_SIZE, y + 2, x + HALF_SIZE, y + (SIZE - 3)); } /** * Description of the Method * * @return Description of the Returned Value */ public static Icon createCollapsedIcon() { return new CollapsedIcon(); } } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinUtils.java0000644000175000017500000002070210460410014022760 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.util.ImageUtils; import java.awt.Font; import java.awt.Image; import java.awt.Insets; import java.awt.Toolkit; import java.io.File; import java.net.URL; import java.util.Enumeration; import java.util.StringTokenizer; import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.6 $, $Date: 2004/05/22 15:12:33 $ */ public final class SkinUtils { /** * Description of the Field */ public final static boolean DEBUG = "true".equals(com.l2fprod.util.AccessUtils.getProperty("debug.skinlf")); /* * Font f = null; * Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); * for (int i = 0, c = fonts.length; i < c; i++) { * if (fonts[i].getFontName().equals(name)) { * f = fonts[i].deriveFont(type, size); * break; * } * } * return f; * } */ /** * Sets the Font attribute of the SkinUtils class * * @param f The new Font value */ public static void setFont(Font f) { UIDefaults defs = UIManager.getDefaults(); for (Enumeration keys = defs.keys(); keys.hasMoreElements();) { Object o = keys.nextElement(); if (o instanceof String) { String aKey = (String) o; if (aKey.endsWith(".font") || aKey.endsWith(".titleFont") || aKey.endsWith(".acceleratorFont")) { if (defs.get(aKey) instanceof FontUIResource) { UIManager.put(aKey, f); } } } } } /** * Gets the Font attribute of the SkinUtils class * * @param name Description of Parameter * @param type Description of Parameter * @param size Description of Parameter * @return The Font value */ public static Font getFont(String name, int type, int size) { return new Font(name, type, size); } /** * Description of the Method * * @param filename Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public static Image loadImage(String filename) throws Exception { return loadImage(toURL(new File(filename))); } /** * Description of the Method * * @param url Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public static Image loadImage(URL url) throws Exception { Image img = null; byte[] imageByte = SkinLookAndFeel.getURLContent(url); img = Toolkit.getDefaultToolkit(). createImage(imageByte, 0, imageByte.length); CustomImageObserver custom = new CustomImageObserver(); Object lock = custom.getLock(); synchronized (lock) { int width = img.getWidth(custom); int height = img.getHeight(custom); if (height < 1 && width < 1) lock.wait(); } return ImageUtils.transparent(img); } /** * Description of the Method * * @param f Description of Parameter * @return Description of the Returned * Value * @exception java.net.MalformedURLException Description of Exception */ public static URL toURL(File f) throws java.net.MalformedURLException { String path = f.getAbsolutePath(); if (File.separatorChar != '/') { path = path.replace(File.separatorChar, '/'); } if (!path.startsWith("/")) { path = "/" + path; } if (!path.endsWith("/") && f.isDirectory()) { path = path + "/"; } return new URL("file", "", path); } // color is R,G,B // supported format of the string are // { r, g, b } // r g b // r,g,b // r.r, g.g, b.b /** * Description of the Method * * @param color Description of Parameter * @return Description of the Returned Value */ public static String decodeColor(String color) { if (color.startsWith("#")) { return color; } java.util.StringTokenizer token = new java.util.StringTokenizer(color, ", {}"); String result = "#"; String r = token.nextToken(); String g = token.nextToken(); String b = token.nextToken(); if (is0to1color(r) && is0to1color(g) && is0to1color(b)) { r = (int) (Float.parseFloat(r) * 255) + ""; g = (int) (Float.parseFloat(g) * 255) + ""; b = (int) (Float.parseFloat(b) * 255) + ""; } else { r = (int) Float.parseFloat(r) + ""; g = (int) Float.parseFloat(g) + ""; b = (int) Float.parseFloat(b) + ""; } result += toHexString(Integer.parseInt(r)); result += toHexString(Integer.parseInt(g)); result += toHexString(Integer.parseInt(b)); return result; } /** * Description of the Method * * @param composite Description of Parameter * @return Description of the Returned Value */ static boolean is0to1color(String composite) { int index = composite.indexOf("."); if (index != -1 && composite.substring(0, index).length() <= 1) { return true; } else { return false; } } /** * Description of the Method * * @param i Description of Parameter * @return Description of the Returned Value */ static String toHexString(int i) { if (i == 0) { return "00"; } else { return Integer.toHexString(i).toUpperCase(); } } /** * Convert strings like 12, 12, 54, 45 to an insets * where values are LEFT, RIGHT, TOP, BOTTOM */ public static Insets stringToInsets(String border) { StringTokenizer token = new StringTokenizer(border, ","); int left = Integer.parseInt(token.nextToken().trim()); int right = Integer.parseInt(token.nextToken().trim()); int top = Integer.parseInt(token.nextToken().trim()); int bottom = Integer.parseInt(token.nextToken().trim()); return new Insets(top, left, bottom, right); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinWindowButton.java0000644000175000017500000001067510460410012024331 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.JButton; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.4 $, $Date: 2004/07/18 19:20:16 $ */ public final class SkinWindowButton extends JButton { private int align, action; private int xcoord, ycoord; /** * Constructor for the SkinWindowButton object * * @param align Description of Parameter * @param action Description of Parameter */ public SkinWindowButton(int align, int action) { this(-1, -1, align, action); } /** * Constructor for the SkinWindowButton object * * @param xcoord Description of Parameter * @param ycoord Description of Parameter * @param align Description of Parameter * @param action Description of Parameter */ public SkinWindowButton(int xcoord, int ycoord, int align, int action) { this.xcoord = xcoord; this.ycoord = ycoord; this.align = align; this.action = action; setBorderPainted(false); setFocusPainted(false); setOpaque(false); setIcon(getIcon()); setRolloverIcon(getRolloverIcon()); } public boolean isFocusTraversable() { return false; } public void requestFocus() {}; /** * Gets the UIClassID attribute of the SkinWindowButton object * * @return The UIClassID value */ public String getUIClassID() { return "WindowButtonUI"; } /** * Gets the XCoord attribute of the SkinWindowButton object * * @return The XCoord value */ public int getXCoord() { return xcoord; } /** * Gets the YCoord attribute of the SkinWindowButton object * * @return The YCoord value */ public int getYCoord() { return ycoord; } /** * Gets the Align attribute of the SkinWindowButton object * * @return The Align value */ public int getAlign() { return align; } /** * Gets the WindowAction attribute of the SkinWindowButton object * * @return The WindowAction value */ public int getWindowAction() { return action; } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/SkinWindowButtonUI.java0000644000175000017500000001073710460410014024570 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import javax.swing.plaf.basic.*; import javax.swing.plaf.*; import javax.swing.*; import java.awt.*; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.5 $, $Date: 2006/07/22 09:52:07 $ */ public final class SkinWindowButtonUI extends BasicButtonUI { private static Rectangle iconRect = new Rectangle(); // ******************************** // Create PLAF // ******************************** /** * Description of the Method * * @param c Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent c) { return new SkinWindowButtonUI(); } // ******************************** // Paint Methods // ******************************** /** * Description of the Method * * @param g Description of Parameter * @param c Description of Parameter */ public void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; iconRect.x = iconRect.y = 0; iconRect.width = b.getWidth(); iconRect.height = b.getHeight(); // Paint the Icon if (b.getIcon() != null) { paintIcon(g, c, iconRect); } } // ******************************** // Create Listeners // ******************************** /** * Description of the Method * * @param b Description of Parameter * @return Description of the Returned Value */ protected BasicButtonListener createButtonListener(AbstractButton b) { return new BasicButtonListener(b); } // ******************************** // Defaults // ******************************** /** * Description of the Method * * @param b Description of Parameter */ protected void installDefaults(final AbstractButton b) { super.installDefaults(b); b.setBorderPainted(false); b.setFocusPainted(false); b.setOpaque(false); } /** * Description of the Method * * @param b Description of Parameter */ protected void uninstallDefaults(AbstractButton b) { super.uninstallDefaults(b); b.setOpaque(true); b.setBorderPainted(true); b.setFocusPainted(true); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/Skinit.java0000644000175000017500000002121610460410012022273 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import java.io.File; import java.lang.reflect.Method; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import javax.swing.UIManager; import javax.swing.LookAndFeel; import javax.swing.plaf.metal.*; import com.l2fprod.gui.plaf.skin.SkinLookAndFeel; import com.l2fprod.gui.plaf.skin.Skin; import com.l2fprod.gui.plaf.skin.SkinUtils; import com.l2fprod.gui.plaf.skin.CompoundSkin; /** * Skinit.
    * Skinit is Skin Look And Feel wrapper. It allows you to start any application * with SkinLF. Skinit will prevent the application to set its own Look And * Feel. Once Skin Look And Feel is set, it can't be removed.
    * * @author $Author: l2fprod $ * @version $Revision: 1.4 $, $Date: 2004/07/09 16:11:30 $ */ public class Skinit { /** * The main program for the Skinit class * * @param args The command line arguments * @exception Exception Description of Exception */ public static void main(String[] args) throws Exception { if (args.length == 0) { printUsage(); } int mainClassNameIndex = -1; String gtktheme = null; String kdetheme = null; String packtheme = null; String lnfclassname = null; String metaltheme = null; for (int i = 0, c = args.length; i < c; i++) { if (args[i].equals("-gtk")) { gtktheme = args[++i]; } else if (args[i].equals("-kde")) { kdetheme = args[++i]; } else if (args[i].equals("-pack")) { packtheme = args[++i]; } else if (args[i].equals("-lnf")) { lnfclassname = args[++i]; } else if (args[i].equals("-metaltheme")) { metaltheme = args[++i]; } else { mainClassNameIndex = i; break; } } String[] realArgs = new String[args.length - mainClassNameIndex - 1]; for (int i = 0, c = realArgs.length; i < c; i++) { realArgs[i] = args[mainClassNameIndex + i + 1]; } // First try to find the class Class clazz = null; try { clazz = Class.forName(args[mainClassNameIndex]); } catch (ClassNotFoundException e) { System.err.println("The class " + args[mainClassNameIndex] + " was not found in the classpath."); System.exit(1); } catch (Throwable e) { e.printStackTrace(); System.exit(1); } // if the class exists, get the main method Method mainMethod = null; try { mainMethod = clazz.getMethod("main", new Class[]{String[].class}); } catch (NoSuchMethodException e) { System.err.println("No method public static void main(String[] args) in " + clazz.getName()); System.exit(1); } catch (Throwable e) { e.printStackTrace(); System.exit(1); } // try to make sure the main method is accessible try { mainMethod.setAccessible(true); } catch (Throwable e) { } // main class and main method found, time to load the skin if (lnfclassname != null) { LookAndFeel lnf = (LookAndFeel)Class.forName(lnfclassname).newInstance(); UIManager.setLookAndFeel(lnf); } else if (metaltheme != null) { MetalTheme theme = (MetalTheme)Class.forName(metaltheme).newInstance(); MetalLookAndFeel metal = new MetalLookAndFeel(); MetalLookAndFeel.setCurrentTheme(theme); UIManager.setLookAndFeel(metal); } else { Skin skin = null; if (packtheme != null) { if (SkinUtils.DEBUG) { System.out.println("Loading themepack " + packtheme); } if (packtheme.toLowerCase().endsWith(".xml")) { skin = SkinLookAndFeel.loadThemePackDefinition(new File(packtheme) .toURL()); } else { skin = SkinLookAndFeel.loadThemePack(packtheme); } } else if (gtktheme != null) { if (kdetheme != null) { skin = new CompoundSkin(SkinLookAndFeel.loadSkin(gtktheme), SkinLookAndFeel.loadSkin(kdetheme)); } else { skin = SkinLookAndFeel.loadSkin(gtktheme); } } /* * try to use the user default skin */ if (skin == null) { if (SkinUtils.DEBUG) { System.out.println("Trying user skin"); } skin = SkinLookAndFeel.getSkin(); } if (skin != null) { SkinLookAndFeel.setSkin(skin); SkinLookAndFeel lnf = new SkinLookAndFeel(); UIManager.setLookAndFeel(lnf); UIManager. addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { Object newLF = event.getNewValue(); if ((newLF instanceof SkinLookAndFeel) == false) { try { UIManager.setLookAndFeel(new SkinLookAndFeel()); } catch (Exception e) { e.printStackTrace(); } } } }); } else { System.out.println("No GTK theme provided, defaulting to application Look And Feel"); } } try { mainMethod.invoke(null, new Object[]{realArgs}); } catch (IllegalAccessException e) { System.err.println("Please make sure the class " + clazz.getName() + " and the method main(String[] args) are public."); System.exit(1); } catch (Throwable e) { e.printStackTrace(); System.exit(1); } } /** * Description of the Method */ static void printUsage() { String usage = "Skinit - Skin Look And Feel " + SkinLookAndFeel.version() + " wrapper\n" + "Usage: skinit [options] class [args...]\n" + "\n" + "where options include:\n" + "\t-gtk GTK Theme Filename\n" + "\t-kde KDE Theme Filename\n" + "\t-pack Theme Pack Filename\n" + "\t-lnf Look and feel class name\n" + "\t-metaltheme Metal Theme to use\n"; System.out.println(usage); System.exit(1); } } skinlf-6.7/src/com/l2fprod/gui/plaf/skin/Window.java0000644000175000017500000005364410460410014022315 0ustar twernertwerner/* * ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. 2. 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. 3. The end-user documentation included with * the redistribution, if any, must include the following * acknowlegement: "This product includes software developed by * L2FProd.com (http://www.L2FProd.com/)." Alternately, this * acknowlegement may appear in the software itself, if and wherever * such third-party acknowlegements normally appear. 4. The names * "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not be used * to endorse or promote products derived from this software without * prior written permission. For written permission, please contact * info@L2FProd.com. 5. Products derived from this software may not be * called "SkinLF" nor may "SkinLF" appear in their names without * prior written permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.skin; import com.l2fprod.util.OS; import java.awt.AWTEvent; import java.awt.Container; import java.awt.Frame; import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ComponentEvent; import java.awt.event.WindowEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyVetoException; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; /** * Created on 27/05/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ @created 27 avril 2002 * @version $Revision: 1.11 $, $Date: 2005/11/19 09:25:28 $ */ public interface Window { /** * Description of the Field */ public final static String IS_SHADED_PROPERTY = "shaded"; public final static String SHADE_BOUNDS_PROPERTY = "windowshadeBounds"; /** * Gets the Container attribute of the Window object * * @return The Container value */ Container getContainer(); /** * Adds a feature to the PropertyChangeListener attribute of the * Window object * * @param listener The feature to be added to the * PropertyChangeListener attribute */ void addPropertyChangeListener(PropertyChangeListener listener); /** * Remove a feature to the PropertyChangeListener attribute of the * Window object * * @param listener The feature to be remove from the * PropertyChangeListener attribute */ void removePropertyChangeListener(PropertyChangeListener listener); /** * Gets the Selected attribute of the Window object * * @return The Selected value */ boolean isSelected(); /** * Sets the Selected attribute of the Window object * * @param b The new Selected value * @exception PropertyVetoException Description of Exception */ void setSelected(boolean b) throws PropertyVetoException; /** * Gets the Icon attribute of the Window object * * @return The Icon value */ boolean isIcon(); /** * Sets the Icon attribute of the Window object * * @param b The new Icon value * @exception PropertyVetoException Description of Exception */ void setIcon(boolean b) throws PropertyVetoException; /** * Gets the Maximum attribute of the Window object * * @return The Maximum value */ boolean isMaximum(); /** * Sets the Maximum attribute of the Window object * * @param b The new Maximum value * @exception PropertyVetoException Description of Exception */ void setMaximum(boolean b) throws PropertyVetoException; /** * Gets the Shaded attribute of the Window object * * @return The Shaded value */ boolean isShaded(); /** * Sets the Shaded attribute of the Window object * * @param b The new Shaded value */ void setShaded(boolean b); /** * Gets the Maximizable attribute of the Window object * * @return The Maximizable value */ boolean isMaximizable(); /** * Gets the Iconifiable attribute of the Window object * * @return The Iconifiable value */ boolean isIconifiable(); /** * Gets the Closable attribute of the Window object * * @return The Closable value */ boolean isClosable(); /** * Sets the Closed attribute of the Window object * * @param b The new Closed value * @exception PropertyVetoException Description of Exception */ void setClosed(boolean b) throws PropertyVetoException; /** * Gets the Resizable attribute of the Window object * * @return The Resizable value */ boolean isResizable(); /** * Gets the Title attribute of the Window object * * @return The Title value */ String getTitle(); /** * Gets the FrameIcon attribute of the Window object * * @return The FrameIcon value */ Icon getFrameIcon(); /** * Description of the Method * * @param event Description of Parameter */ void dispatchEvent(AWTEvent event); /** * Description of the Class * * @author fred @created 27 avril 2002 */ public static class InternalFrameWindow implements Window { JInternalFrame frame; boolean shaded = false; /** * Constructor for the InternalFrameWindow object * * @param frame Description of Parameter */ public InternalFrameWindow(JInternalFrame frame) { this.frame = frame; } /** * Sets the Selected attribute of the InternalFrameWindow object * * @param b The new Selected value * @exception PropertyVetoException Description of Exception */ public void setSelected(boolean b) throws PropertyVetoException { frame.setSelected(b); } /** * Sets the Icon attribute of the InternalFrameWindow object * * @param b The new Icon value * @exception PropertyVetoException Description of Exception */ public void setIcon(boolean b) throws PropertyVetoException { frame.setIcon(b); } /** * Sets the Maximum attribute of the InternalFrameWindow object * * @param b The new Maximum value * @exception PropertyVetoException Description of Exception */ public void setMaximum(boolean b) throws PropertyVetoException { frame.setMaximum(b); } /** * Sets the Shaded attribute of the InternalFrameWindow object * * @param b The new Shaded value */ public void setShaded(boolean b) { if (b == shaded) { return; } if (b == true) { Rectangle bounds = frame.getBounds(); Rectangle p = new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); frame.putClientProperty(SHADE_BOUNDS_PROPERTY, p); frame.setBounds(p.x, p.y, p.width, frame.getMinimumSize().height - 2); } else { Point location = frame.getLocation(); Rectangle p = (Rectangle)frame.getClientProperty(SHADE_BOUNDS_PROPERTY); frame.getDesktopPane().getDesktopManager().setBoundsForFrame(frame, location.x, location.y, p.width, p.height); frame.putClientProperty(SHADE_BOUNDS_PROPERTY, null); } shaded = b; } /** * Sets the Closed attribute of the InternalFrameWindow object * * @param b The new Closed value * @exception PropertyVetoException Description of Exception */ public void setClosed(boolean b) throws PropertyVetoException { if (OS.isOneDotThreeOrMore()) { try { Class.forName("javax.swing.JInternalFrame").getMethod( "doDefaultCloseAction", new Class[0]).invoke(frame, null); } catch (Exception e) { e.printStackTrace(); } } else { if (b == false) { frame.setClosed(b); return; } doDefaultCloseAction(); } } /** * Gets the Container attribute of the InternalFrameWindow object * * @return The Container value */ public Container getContainer() { return frame; } /** * Gets the Selected attribute of the InternalFrameWindow object * * @return The Selected value */ public boolean isSelected() { return frame.isSelected(); } /** * Gets the Icon attribute of the InternalFrameWindow object * * @return The Icon value */ public boolean isIcon() { return frame.isIcon(); } /** * Gets the Maximum attribute of the InternalFrameWindow object * * @return The Maximum value */ public boolean isMaximum() { return frame.isMaximum(); } /** * Gets the Shaded attribute of the InternalFrameWindow object * * @return The Shaded value */ public boolean isShaded() { return shaded; } /** * Gets the Maximizable attribute of the InternalFrameWindow * object * * @return The Maximizable value */ public boolean isMaximizable() { return frame.isMaximizable(); } /** * Gets the Iconifiable attribute of the InternalFrameWindow * object * * @return The Iconifiable value */ public boolean isIconifiable() { return frame.isIconifiable(); } /** * Gets the Closable attribute of the InternalFrameWindow object * * @return The Closable value */ public boolean isClosable() { return frame.isClosable(); } /** * Gets the Resizable attribute of the InternalFrameWindow object * * @return The Resizable value */ public boolean isResizable() { return isShaded() == false && frame.isResizable(); } /** * Gets the Title attribute of the InternalFrameWindow object * * @return The Title value */ public String getTitle() { return frame.getTitle(); } /** * Gets the FrameIcon attribute of the InternalFrameWindow object * * @return The FrameIcon value */ public Icon getFrameIcon() { return frame.getFrameIcon(); } /** * Adds a feature to the PropertyChangeListener attribute of the * InternalFrameWindow object * * @param listener The feature to be added to the * PropertyChangeListener attribute */ public void addPropertyChangeListener(PropertyChangeListener listener) { frame.addPropertyChangeListener(listener); } /** * Adds a feature to the PropertyChangeListener attribute of the * InternalFrameWindow object * * @param listener The feature to be added to the * PropertyChangeListener attribute */ public void removePropertyChangeListener(PropertyChangeListener listener) { frame.removePropertyChangeListener(listener); } /** * Description of the Method * * @param event Description of Parameter */ public void dispatchEvent(AWTEvent event) { frame.dispatchEvent(event); } // workaround for JDK1.2 // seems to work as expected in most case /** * Description of the Method */ private void doDefaultCloseAction() { int defaultCloseOperation = frame.getDefaultCloseOperation(); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); switch (defaultCloseOperation) { case WindowConstants.HIDE_ON_CLOSE: try { frame.setClosed(true); frame.setVisible(false); if (frame.isSelected()) { frame.setSelected(false); } } catch (PropertyVetoException pve) {} break; case WindowConstants.DISPOSE_ON_CLOSE: try { frame.setClosed(true); frame.dispose(); // only executes if close wasn't vetoed. } catch (PropertyVetoException pve) {} break; case 3: // EXIT_ON_CLOSE: System.exit(0); break; case WindowConstants.DO_NOTHING_ON_CLOSE: try { frame.setClosed(true); } catch (PropertyVetoException pve) {} default: break; } frame.setDefaultCloseOperation(defaultCloseOperation); } public String toString() { return super.toString() + "[title=" + getTitle() + "]"; } } static class FrameWindow implements Window { private JFrame frame = null; private JDialog dialog = null; private Rectangle oldBounds = null; private boolean shaded = false; private boolean selected = true; private Image cachedFrameImage = null; private Icon cachedFrameIcon = null; /** * Constructor for the SkinWindowWindow object */ public FrameWindow() { frame = null; } public void setFrame(java.awt.Window argWin) { if (argWin instanceof JDialog) { dialog = (JDialog)argWin; } else if (argWin instanceof JFrame) { frame = (JFrame)argWin; } else { frame = null; dialog = null; } oldBounds = null; shaded = false; } /** * Sets the Selected attribute of the SkinWindowWindow object * * @param b The new Selected value */ public void setSelected(boolean b) { if (b) { if (frame != null) { frame.repaint(); } else if (dialog != null) { dialog.repaint(); } } this.selected = b; } public java.awt.Window getMainFrame() { java.awt.Window toreturn = null; if (frame != null) toreturn = frame; else if (dialog != null) toreturn = dialog; return toreturn; } /** * Sets the Icon attribute of the SkinWindowWindow object * * @param b The new Icon value */ public void setIcon(boolean b) { if (frame != null) { frame.setState(Frame.ICONIFIED); //frame.show(); } else if (dialog != null) { // not support by dialog } } /** * Sets the Maximum attribute of the SkinWindowWindow object * * @param b The new Maximum value */ public void setMaximum(boolean b) { if (frame != null) { if (b && SkinRootPaneUI.getExtendedState(frame) != SkinRootPaneUI.Frame_MAXIMIZED_BOTH) { SkinRootPaneUI.setExtendedState(frame, SkinRootPaneUI.Frame_MAXIMIZED_BOTH); } else if (!b) { SkinRootPaneUI.setExtendedState(frame, Frame.NORMAL); } dispatchEvent(new ComponentEvent(frame, ComponentEvent.COMPONENT_RESIZED)); } else if (dialog != null) { // not available for JDialog } } /** * Sets the Shaded attribute of the SkinWindowWindow object * * @param b The new Shaded value */ public void setShaded(boolean b) { java.awt.Window window = (frame == null)?(java.awt.Window)dialog :(java.awt.Window)frame; if (window == null || b == shaded) { return; } if (b == true) { Rectangle bounds = window.getBounds(); oldBounds = new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); window.setBounds(oldBounds.x, oldBounds.y, oldBounds.width, window .getMinimumSize().height - 2); } else { Point location = window.getLocation(); window.setBounds(location.x, location.y, oldBounds.width, oldBounds.height); oldBounds = null; } shaded = b; } /** * Sets the Closed attribute of the SkinWindowWindow object * * @param b The new Closed value */ public void setClosed(boolean b) { if (frame != null) frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING)); else if (dialog != null) dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING)); } /** * Gets the Container attribute of the SkinWindowWindow object * * @return The Container value */ public Container getContainer() { if (frame != null) return frame.getContentPane(); else if (dialog != null) return dialog.getContentPane(); return null; } /** * Gets the Selected attribute of the SkinWindowWindow object * * @return The Selected value */ public boolean isSelected() { return selected; /** With JDK1.4 use: boolean toreturn = true; if (frame != null) toreturn = frame.isActive(); else if (dialog != null) toreturn = dialog.isActive(); return toreturn; **/ } /** * Gets the Icon attribute of the SkinWindowWindow object * * @return The Icon value */ public boolean isIcon() { boolean toreturn = false; if (frame != null) toreturn = frame.getState() == Frame.ICONIFIED; return toreturn; } /** * Gets the Maximum attribute of the SkinWindowWindow object * * @return The Maximum value */ public boolean isMaximum() { boolean toreturn = false; if (frame != null) toreturn = SkinRootPaneUI.getExtendedState(frame) == SkinRootPaneUI.Frame_MAXIMIZED_BOTH; return toreturn; } /** * Gets the Maximizable attribute of the SkinWindowWindow object * * @return The Maximizable value */ public boolean isMaximizable() { boolean toreturn = false; if (frame != null) toreturn = frame.isResizable() && !isShaded(); return toreturn; } /** * Gets the Shaded attribute of the SkinWindowWindow object * * @return The Shaded value */ public boolean isShaded() { return shaded; } /** * Gets the Iconifiable attribute of the SkinWindowWindow object * * @return The Iconifiable value */ public boolean isIconifiable() { boolean toreturn = false; if (frame != null) toreturn = frame.isResizable(); return toreturn; } /** * Gets the Closable attribute of the SkinWindowWindow object * * @return The Closable value */ public boolean isClosable() { return true; } /** * Gets the Resizable attribute of the SkinWindowWindow object * * @return The Resizable value */ public boolean isResizable() { boolean toreturn = false; if (frame != null) { toreturn = frame.isResizable(); } else if (dialog != null) { return dialog.isResizable() && !isShaded(); } return toreturn; } /** * Gets the Title attribute of the SkinWindowWindow object * * @return The Title value */ public String getTitle() { String title = ""; if (frame != null) title = frame.getTitle(); else if (dialog != null) title = dialog.getTitle(); return title; } /** * Gets the FrameIcon attribute of the SkinWindowWindow object * * @return The FrameIcon value */ public Icon getFrameIcon() { Icon toreturn = null; Image frameImage = null; if (frame != null) { frameImage = frame.getIconImage(); } else if (dialog != null) { // JDialog takes it from the parent frame Frame parent = (Frame)SwingUtilities.getAncestorOfClass(Frame.class, dialog); if (parent != null) { frameImage = parent.getIconImage(); } } if (frameImage != null) { if (frameImage==cachedFrameImage) { return cachedFrameIcon; } toreturn = new ImageIcon(frameImage); cachedFrameImage = frameImage; cachedFrameIcon = toreturn; } return toreturn; } /** * Adds a feature to the PropertyChangeListener attribute of the * SkinWindowWindow object * * @param listener The feature to be added to the * PropertyChangeListener attribute */ public void addPropertyChangeListener(PropertyChangeListener listener) { if (frame != null) frame.addPropertyChangeListener(listener); else if (dialog != null) dialog.addPropertyChangeListener(listener); } /** * Removes a feature to the PropertyChangeListener attribute of * the SkinWindowWindow object * * @param listener The feature to be added to the * PropertyChangeListener attribute */ public void removePropertyChangeListener(PropertyChangeListener listener) { if (frame != null) frame.removePropertyChangeListener(listener); else if (dialog != null) dialog.removePropertyChangeListener(listener); } /** * Description of the Method * * @param event Description of Parameter */ public void dispatchEvent(AWTEvent event) { if (frame != null) { frame.dispatchEvent(event); } else if (dialog != null) { dialog.dispatchEvent(event); } } public String toString() { return super.toString() + "[title=" + getTitle() + "]"; } } }skinlf-6.7/src/com/l2fprod/gui/plaf/xtra/0000755000175000017500000000000010460410034020203 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/plaf/xtra/XTraScrollBarUI.java0000644000175000017500000003476310460410012023777 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.plaf.xtra; import javax.swing.plaf.basic.*; import javax.swing.plaf.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; /** * XTra Scrollbar.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2004/07/29 19:09:27 $ */ public class XTraScrollBarUI extends BasicScrollBarUI { /** * Description of the Field */ protected boolean useAlternateLayout = Boolean.TRUE.equals(UIManager.get("ScrollBar.alternateLayout")); /** * Sets the ThumbBounds attribute of the XTraScrollBarUI object * * @param x The new ThumbBounds value * @param y The new ThumbBounds value * @param w The new ThumbBounds value * @param h The new ThumbBounds value */ public void setThumbBounds(int x, int y, int w, int h) { super.setThumbBounds(x, y, w, h); } /** * Gets the Dragging attribute of the XTraScrollBarUI object * * @return The Dragging value */ public boolean isDragging() { return isDragging; } /** * Gets the ThumbBounds attribute of the XTraScrollBarUI object * * @return The ThumbBounds value */ public Rectangle getThumbBounds() { return super.getThumbBounds(); } /** * Gets the TrackBounds attribute of the XTraScrollBarUI object * * @return The TrackBounds value */ public Rectangle getTrackBounds() { return super.getTrackBounds(); } /** * Description of the Method * * @return Description of the Returned Value */ public JButton decrButton() { return decrButton; } /** * Description of the Method * * @return Description of the Returned Value */ public JButton incrButton() { return incrButton; } /** * Description of the Method * * @return Description of the Returned Value */ public JScrollBar scrollbar() { return scrollbar; } /** * Description of the Method * * @param sb Description of Parameter */ protected void layoutVScrollbar(JScrollBar sb) { if (useAlternateLayout) { alternateLayoutVScrollbar(sb); } else { super.layoutVScrollbar(sb); } } /** * Description of the Method * * @param sb Description of Parameter */ protected void alternateLayoutVScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); /* * Width and left edge of the buttons and thumb. */ int itemW = sbSize.width - (sbInsets.left + sbInsets.right); int itemX = sbInsets.left; /* * Nominal locations of the buttons, assuming their preferred * size will fit. */ int incrButtonH = incrButton.getPreferredSize().height; int incrButtonY = sbSize.height - (sbInsets.bottom + incrButtonH); int decrButtonH = decrButton.getPreferredSize().height; int decrButtonY = incrButtonY - decrButtonH; /* * The thumb must fit within the height left over after we * subtract the preferredSize of the buttons and the insets. */ int sbInsetsH = sbInsets.top + sbInsets.bottom; int sbButtonsH = decrButtonH + incrButtonH; float trackH = sbSize.height - (sbInsetsH + sbButtonsH); /* * Compute the height and origin of the thumb. The case * where the thumb is at the bottom edge is handled specially * to avoid numerical problems in computing thumbY. Enforce * the thumbs min/max dimensions. If the thumb doesn't * fit in the track (trackH) we'll hide it later. */ float min = sb.getMinimum(); float extent = sb.getVisibleAmount(); float range = sb.getMaximum() - min; float value = sb.getValue(); int thumbH = (range <= 0) ? getMaximumThumbSize().height : (int) (trackH * (extent / range)); thumbH = Math.max(thumbH, getMinimumThumbSize().height); thumbH = Math.min(thumbH, getMaximumThumbSize().height); int thumbY = decrButtonY - thumbH; //incrButtonY - thumbH; if (sb.getValue() < (sb.getMaximum() - sb.getVisibleAmount())) { float thumbRange = trackH - thumbH; thumbY = (int) (0.5f + (thumbRange * ((value - min) / (range - extent)))); //thumbY += decrButtonY + decrButtonH; } /* * If the buttons don't fit, allocate half of the available * space to each and move the lower one (incrButton) down. */ int sbAvailButtonH = (sbSize.height - sbInsetsH); if (sbAvailButtonH < sbButtonsH) { incrButtonH = decrButtonH = sbAvailButtonH / 2; incrButtonY = sbSize.height - (sbInsets.bottom + incrButtonH); } decrButton.setBounds(itemX, decrButtonY, itemW, decrButtonH); incrButton.setBounds(itemX, incrButtonY, itemW, incrButtonH); /* * Update the trackRect field. */ int itrackY = sbInsets.top; int itrackH = decrButtonY - itrackY; trackRect.setBounds(itemX, itrackY, itemW, itrackH); /* * If the thumb isn't going to fit, zero it's bounds. Otherwise * make sure it fits between the buttons. Note that setting the * thumbs bounds will cause a repaint. */ if (thumbH >= (int) trackH) { setThumbBounds(0, 0, 0, 0); } else { if ((thumbY + thumbH) > decrButtonY) { thumbY = decrButtonY - thumbH; } /* * if (thumbY < (decrButtonY + decrButtonH)) { * thumbY = decrButtonY + decrButtonH + 1; * } */ setThumbBounds(itemX, thumbY, itemW, thumbH); } } /** * Description of the Method * * @param sb Description of Parameter */ protected void layoutHScrollbar(JScrollBar sb) { if (useAlternateLayout) { alternateLayoutHScrollbar(sb); } else { super.layoutHScrollbar(sb); } } /** * Description of the Method * * @param sb Description of Parameter */ protected void alternateLayoutHScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); /* * Height and top edge of the buttons and thumb. */ int itemH = sbSize.height - (sbInsets.top + sbInsets.bottom); int itemY = sbInsets.top; /* * Nominal locations of the buttons, assuming their preferred * size will fit. */ int incrButtonW = incrButton.getPreferredSize().width; int incrButtonX = sbSize.width - (sbInsets.right + incrButtonW); int decrButtonW = decrButton.getPreferredSize().width; int decrButtonX = incrButtonX - decrButtonW; /* * The thumb must fit within the width left over after we * subtract the preferredSize of the buttons and the insets. */ int sbInsetsW = sbInsets.left + sbInsets.right; int sbButtonsW = decrButtonW + incrButtonW; float trackW = sbSize.width - (sbInsetsW + sbButtonsW); /* * Compute the width and origin of the thumb. Enforce * the thumbs min/max dimensions. The case where the thumb * is at the right edge is handled specially to avoid numerical * problems in computing thumbX. If the thumb doesn't * fit in the track (trackH) we'll hide it later. */ float min = sb.getMinimum(); float extent = sb.getVisibleAmount(); float range = sb.getMaximum() - min; float value = sb.getValue(); int thumbW = (range <= 0) ? getMaximumThumbSize().width : (int) (trackW * (extent / range)); thumbW = Math.max(thumbW, getMinimumThumbSize().width); thumbW = Math.min(thumbW, getMaximumThumbSize().width); int thumbX = decrButtonX - thumbW; if (sb.getValue() < (sb.getMaximum() - sb.getVisibleAmount())) { float thumbRange = trackW - thumbW; thumbX = (int) (0.5f + (thumbRange * ((value - min) / (range - extent)))); //thumbX += decrButtonX + decrButtonW; } /* * If the buttons don't fit, allocate half of the available * space to each and move the right one (incrButton) over. */ int sbAvailButtonW = (sbSize.width - sbInsetsW); if (sbAvailButtonW < sbButtonsW) { incrButtonW = decrButtonW = sbAvailButtonW / 2; incrButtonX = sbSize.width - (sbInsets.right + incrButtonW); } decrButton.setBounds(decrButtonX, itemY, decrButtonW, itemH); incrButton.setBounds(incrButtonX, itemY, incrButtonW, itemH); /* * Update the trackRect field. */ int itrackX = sbInsets.left; //decrButtonX + decrButtonW; int itrackW = decrButtonX - itrackX; trackRect.setBounds(itrackX, itemY, itrackW, itemH); /* * Make sure the thumb fits between the buttons. Note * that setting the thumbs bounds causes a repaint. */ if (thumbW >= (int) trackW) { setThumbBounds(0, 0, 0, 0); } else { if (thumbX + thumbW > incrButtonX) { thumbX = incrButtonX - thumbW; } /* * if (thumbX < decrButtonX + decrButtonW) { * thumbX = decrButtonX + decrButtonW + 1; * } */ setThumbBounds(thumbX, itemY, thumbW, itemH); } } /** * Description of the Method * * @return Description of the Returned Value */ protected TrackListener createTrackListener() { if (useAlternateLayout) { return new MyTrackListener(); } else { return super.createTrackListener(); } } /** * Description of the Method * * @param x Description of Parameter * @return Description of the Returned Value */ public static ComponentUI createUI(JComponent x) { return new XTraScrollBarUI(); } /** * Track mouse drags. * * @author fred * @created 27 avril 2002 */ public class MyTrackListener extends TrackListener { /** * Set the models value to the position of the top/left of the thumb * relative to the origin of the track. * * @param e Description of Parameter */ public void mouseDragged(MouseEvent e) { if (!XTraScrollBarUI.this.scrollbar().isEnabled() || !XTraScrollBarUI.this.isDragging()) { return; } Insets sbInsets = XTraScrollBarUI.this.scrollbar().getInsets(); BoundedRangeModel model = XTraScrollBarUI.this.scrollbar().getModel(); Rectangle thumbR = XTraScrollBarUI.this.getThumbBounds(); int thumbMin; int thumbMax; int thumbPos; if (XTraScrollBarUI.this.scrollbar().getOrientation() == JScrollBar.VERTICAL) { thumbMin = sbInsets.top; //decrButton.getY() + decrButton.getHeight(); thumbMax = XTraScrollBarUI.this.decrButton().getY() /* * incrButton.getY() */ - XTraScrollBarUI.this.getThumbBounds().height; thumbPos = Math.min(thumbMax, Math.max(thumbMin, (e.getY() - offset))); XTraScrollBarUI.this.setThumbBounds(thumbR.x, thumbPos, thumbR.width, thumbR.height); } else { thumbMin = sbInsets.left; //decrButton.getX() + decrButton.getWidth(); thumbMax = XTraScrollBarUI.this.decrButton().getX() /* * incrButton.getX() */ - XTraScrollBarUI.this.getThumbBounds().width; thumbPos = Math.min(thumbMax, Math.max(thumbMin, (e.getX() - offset))); XTraScrollBarUI.this.setThumbBounds(thumbPos, thumbR.y, thumbR.width, thumbR.height); } /* * Set the scrollbars value. If the thumb has reached the end of * the scrollbar, then just set the value to its maximum. Otherwise * compute the value as accurately as possible. */ if (thumbPos == thumbMax) { XTraScrollBarUI.this.scrollbar().setValue(model.getMaximum() - model.getExtent()); } else { float valueMax = model.getMaximum() - model.getExtent(); float valueRange = valueMax - model.getMinimum(); float thumbValue = thumbPos - thumbMin; float thumbRange = thumbMax - thumbMin; int value = (int) (0.5 + ((thumbValue / thumbRange) * valueRange)); XTraScrollBarUI.this.scrollbar().setValue(value + model.getMinimum()); } } } } skinlf-6.7/src/com/l2fprod/gui/region/0000755000175000017500000000000010460410034017566 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/gui/region/ImageRegion.java0000644000175000017500000000727710460410012022630 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.region; import java.awt.Image; /** * Created on 21/12/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:51:20 $ */ public final class ImageRegion extends Region { Image img; int width; int height; /** * Constructor for the ImageRegion object * * @param img Description of Parameter */ public ImageRegion(Image img) { this(img, img.getWidth(null), img.getHeight(null)); } /** * Constructor for the ImageRegion object * * @param img Description of Parameter * @param width Description of Parameter * @param height Description of Parameter */ public ImageRegion(Image img, int width, int height) { this.img = img; this.width = width; this.height = height; } /** * Gets the Image attribute of the ImageRegion object * * @return The Image value */ public Image getImage() { return img; } /** * Gets the Width attribute of the ImageRegion object * * @return The Width value */ public int getWidth() { return width; } /** * Gets the Height attribute of the ImageRegion object * * @return The Height value */ public int getHeight() { return height; } } skinlf-6.7/src/com/l2fprod/gui/region/Region.java0000644000175000017500000000514510460410014021657 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.region; /** * SkinRegion.
    * Created on 29/11/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:51:20 $ */ public class Region { } skinlf-6.7/src/com/l2fprod/gui/region/RegionBuilder.java0000644000175000017500000001525510460410014023171 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui.region; import java.awt.Window; import java.awt.Image; import com.l2fprod.gui.nativeskin.NativeSkin; /** * SkinRegion.
    * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:51:20 $ */ public final class RegionBuilder implements com.l2fprod.gui.nativeskin.NativeConstants { static RegionBuilder theInstance = new RegionBuilder(); public RegionBuilder getInstance() { return theInstance; } public static boolean isSupported() { return NativeSkin.isSupported(); } /** * Sets the WindowRegion attribute of the RegionBuilder object * * @param window The new WindowRegion value * @param region The new WindowRegion value * @param redraw The new WindowRegion value */ public void setWindowRegion(Window window, Region region, boolean redraw) { NativeSkin.getInstance().setWindowRegion(window, region, redraw); } /** * Sets the Region for the graphical object identified by the given native handle. * This method may be used with environment such as Eclipse/SWT where it is easy * to get the native handle of any "Shell" object. * * @param handle an int value * @param region a Region value * @param redraw a boolean value */ public void setWindowRegion(int handle, Region region, boolean redraw) { NativeSkin.getInstance().setWindowRegion(handle, region, redraw); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ public Region createEllipticRegion(int x1, int y1, int x2, int y2) { return NativeSkin.getInstance().createEllipticRegion(x1, y1, x2, y2); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @return Description of the Returned Value */ public Region createRectangleRegion(int x1, int y1, int x2, int y2) { return NativeSkin.getInstance().createRectangleRegion(x1, y1, x2, y2); } /** * Description of the Method * * @param x1 Description of Parameter * @param y1 Description of Parameter * @param x2 Description of Parameter * @param y2 Description of Parameter * @param x3 Description of Parameter * @param y3 Description of Parameter * @return Description of the Returned Value */ public Region createRoundRectangleRegion(int x1, int y1, int x2, int y2, int x3, int y3) { return NativeSkin.getInstance().createRoundRectangleRegion(x1, y1, x2, y2, x3, y3); } /** * Description of the Method * * @param xpoints Description of Parameter * @param ypoints Description of Parameter * @param fillMode Description of Parameter * @return Description of the Returned Value */ public Region createPolygonRegion(int[] xpoints, int[] ypoints, int fillMode) { return NativeSkin.getInstance().createPolygonRegion(xpoints, ypoints, fillMode); } /** * Description of the Method * * @param region1 Description of Parameter * @param region2 Description of Parameter * @param combineMode Description of Parameter * @return Description of the Returned Value */ public Region combineRegions(Region region1, Region region2, int combineMode) { return NativeSkin.getInstance().combineRegions(region1, region2, combineMode); } /** * Description of the Method * * @param image Description of Parameter * @return Description of the Returned Value */ public Region createRegion(Image image) { return NativeSkin.getInstance().createRegion(image); } /** * Description of the Method * * @param image Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @return Description of the Returned Value */ public Region createRegion(Image image, int width, int height) { return NativeSkin.getInstance().createRegion(image, width, height); } } skinlf-6.7/src/com/l2fprod/gui/SkinApplet.java0000644000175000017500000001021610460410014021216 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui; import com.l2fprod.gui.plaf.skin.SkinLookAndFeel; import com.l2fprod.gui.plaf.skin.Skin; import java.net.URL; import javax.swing.*; /** * SkinApplet.
    * Base class for applet that want to use the Skin Look And Feel. * * @author Frederic Lavigne * @created 27 avril 2002 */ public class SkinApplet extends JApplet { /** * Description of the Field */ public static String THEMEPACK_TAG = "themepack"; /** * Init the SkinLookAndFeel by using the applet parameter "themepack" * (THEMEPACK_TAG). if the parameter is not set, the themepack "themepack.zip" * is loaded. * * @exception Exception if an error occurs while loading the themepack */ public void initSkin() throws Exception { initSkin(THEMEPACK_TAG); } /** * Init the SkinLookAndFeel by using the applet parameter themepackTagName. if * the parameter is not set, the themepack "/themepack.zip" is loaded. * * @param themepackTagName Description of Parameter * @exception Exception if an error occurs while loading the themepack */ public void initSkin(String themepackTagName) throws Exception { String themepack = getParameter(themepackTagName); URL themepackURL; // if no themepack has been provided in the applet tag // use the default themepack provided in the jar of the applet if (themepack == null) { themepackURL = SkinApplet.class.getResource("/themepack.zip"); } else { // a themepack has been provided, relative to the codebase themepackURL = new URL(getCodeBase(), themepack); } Skin skin = SkinLookAndFeel.loadThemePack(themepackURL); SkinLookAndFeel.setSkin(skin); UIManager.setLookAndFeel(new SkinLookAndFeel()); } } skinlf-6.7/src/com/l2fprod/gui/SkinChooser.java0000644000175000017500000002561710460410014021406 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui; import com.l2fprod.gui.plaf.skin.CompoundSkin; import com.l2fprod.gui.plaf.skin.Skin; import com.l2fprod.gui.plaf.skin.SkinLookAndFeel; import com.l2fprod.gui.plaf.skin.SkinPreviewWindow; import com.l2fprod.util.OS; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.io.File; import java.io.IOException; import java.util.ResourceBundle; import java.util.Vector; import javax.swing.*; /** * Skin Chooser.
    * * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2004/07/18 16:54:48 $ */ public class SkinChooser extends JPanel { private JList skinList; private String[] directories; private JCheckBox backgroundCheckBox, scrollBarCheckBox; private ResourceBundle bundle; private boolean themePackMode = false; final static String REFRESH_CMD = "refresh"; final static String PREVIEW_CMD = "preview"; final static String GETSKINS_CMD = "getskins"; /** * Construct a new SkinChooser pane. */ public SkinChooser() { loadResourceBundle(); setLayout(new BorderLayout(3, 3)); JPanel listPane = new JPanel(new BorderLayout(3, 3)); JPanel buttonPane = new JPanel(new GridLayout(1, 3, 3, 3)); JButton button = new JButton(bundle.getString("SkinChooser.getskins")); buttonPane.add(button); button.addActionListener(new GetSkinsAction()); button.setToolTipText(bundle.getString("SkinChooser.getskins.tip")); button = new JButton(bundle.getString("SkinChooser.preview")); buttonPane.add(button); button.addActionListener(new PreviewAction()); button = new JButton(bundle.getString("SkinChooser.refresh")); buttonPane.add(button); button.addActionListener(new RefreshAction()); listPane.add("Center", new JScrollPane(skinList = new JList())); listPane.add("South", buttonPane); add("Center", listPane); Box optionPane = Box.createVerticalBox(); optionPane.add(backgroundCheckBox = new JCheckBox(bundle.getString("SkinChooser.enableBackground"))); optionPane.add(scrollBarCheckBox = new JCheckBox(bundle.getString("SkinChooser.enableScrollBar"))); add("East", optionPane); } /** * Set search paths * * @param directories search paths */ public void setSkinLocations(String[] directories) { this.directories = directories; Vector skins = new Vector(); for (int i = 0, c = directories.length; i < c; i++) { buildSkinList(skins, new File(directories[i])); } skinList.setListData(skins); } /** * Set theme pack mode to true if you want to select a theme pack from the * chooser. * * @param b the new value */ public void setThemePackMode(boolean b) { themePackMode = b; } /** * @return search paths */ public String[] getSkinLocations() { return directories; } /** * @return true if the chooser shows only theme packs */ public boolean getThemePackMode() { return themePackMode; } /** * @return the currently selected skins */ public String[] getSelectedSkins() { return (String[]) skinList.getSelectedValues(); } /** * Refresh the skin list. * * @see #setSkinLocations */ public void refreshList() { if ((directories != null) && (directories.length > 0)) { setSkinLocations(directories); } } /** * Apply current selection.
    * The method sets the current skin (SkinLookAndFeel.setSkin) then calls * UIManager.setLookAndFeel. * * @exception Exception Description of Exception */ public void apply() throws Exception { Object[] values = skinList.getSelectedValues(); if ((values == null) || (themePackMode && values.length != 1) || (!themePackMode && values.length != 2)) { return; } UIManager.put("JDesktopPane.backgroundEnabled", backgroundCheckBox.isSelected() ? Boolean.TRUE : null); UIManager.put("ScrollBar.alternateLayout", scrollBarCheckBox.isSelected() ? Boolean.TRUE : null); Skin skin = null; if (themePackMode) { skin = SkinLookAndFeel.loadThemePack((String) values[0]); } else { skin = new CompoundSkin(SkinLookAndFeel.loadSkin((String) values[0]), SkinLookAndFeel.loadSkin((String) values[1])); } SkinLookAndFeel.setSkin(skin); UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); } /** * Recursively traverse directory and add skin files to v * .
    * Skin files are added if accept(skinFile) returns true * * @param v vector to store skin list * @param directory the directory to list for skin files */ protected void buildSkinList(Vector v, File directory) { if (!directory.isDirectory() || !directory.exists()) { return; } String[] files = directory.list(); File f; for (int i = 0, c = files.length; i < c; i++) { f = new File(directory, files[i]); if (f.isDirectory()) { buildSkinList(v, f); } else if (accept(f)) { try { v.addElement(f.getCanonicalPath()); } catch (IOException e) { } } } } /** * Check if a given file is a skin file.
    * Subclasses can override this method to provide better handling of skin * files.
    * The default implementation checks if the file ends with gtkrc or themerc. * * @param f the file to check * @return true if the file is a valid skin file */ protected boolean accept(File f) { return (f.isDirectory() == false && ((themePackMode && f.getName().endsWith(".zip")) || (f.getName().endsWith("gtkrc") || f.getName().endsWith("themerc")))); } /** * Description of the Method */ protected void showPreviewWindow() { Skin oldSkin = SkinLookAndFeel.getSkin(); LookAndFeel oldLAF = UIManager.getLookAndFeel(); try { Object[] values = skinList.getSelectedValues(); if ((values == null) || (values.length != 2)) { return; } Skin skin = new CompoundSkin(SkinLookAndFeel.loadSkin((String) values[0]), SkinLookAndFeel.loadSkin((String) values[1])); SkinLookAndFeel.setSkin(skin); UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); Window window = new SkinPreviewWindow(); window.setVisible(true); } catch (Exception e) { e.printStackTrace(); } finally { SkinLookAndFeel.setSkin(oldSkin); try { UIManager.setLookAndFeel(oldLAF); } catch (UnsupportedLookAndFeelException e) { } } } /** * Description of the Method */ private void loadResourceBundle() { bundle = ResourceBundle.getBundle("com.l2fprod.gui.plaf.skin.resources.skin"); } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class RefreshAction extends AbstractAction { /** * Constructor for the RefreshAction object */ public RefreshAction() { super(REFRESH_CMD); } /** * Description of the Method * * @param event Description of Parameter */ public void actionPerformed(ActionEvent event) { refreshList(); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class GetSkinsAction extends AbstractAction { /** * Constructor for the GetSkinsAction object */ public GetSkinsAction() { super(GETSKINS_CMD); } /** * Description of the Method * * @param event Description of Parameter */ public void actionPerformed(ActionEvent event) { try { OS.openDocument(bundle.getString("SkinChooser.getskins.url")); } catch (Exception e) { e.printStackTrace(); } } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private class PreviewAction extends AbstractAction { /** * Constructor for the PreviewAction object */ public PreviewAction() { super(PREVIEW_CMD); } /** * Description of the Method * * @param event Description of Parameter */ public void actionPerformed(ActionEvent event) { showPreviewWindow(); } } } skinlf-6.7/src/com/l2fprod/gui/WindowSnapping.java0000644000175000017500000001773710460410014022132 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.gui; import java.awt.Window; import java.awt.Rectangle; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.util.Vector; import javax.swing.SwingConstants; /** * WindowSnapping.
    * Created on 15/06/2000 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/12/06 21:45:05 $ */ public class WindowSnapping { static SnapListener sharedSnap = new SnapListener(); /** * Description of the Method * * @param snap Description of Parameter * @param position Description of Parameter */ public static void snap(Window snap, int position) { // snap to active window sharedSnap.snaps.addElement(new Snap(snap, position)); } /** * Description of the Method * * @param snap Description of Parameter * @param position Description of Parameter * @param target Description of Parameter */ public static void snap(Window snap, int position, Window target) { // snap to target SnapListener l = new SnapListener(); l.snaps.addElement(new Snap(snap, position)); target.addWindowListener(l); } /** * Description of the Method * * @param target Description of Parameter */ public static void registerSnapping(Window target) { if (target != null) { target.addWindowListener(sharedSnap); } } /** * Description of the Method * * @param target Description of Parameter */ public static void unregisterSnapping(Window target) { if (target != null) { target.removeWindowListener(sharedSnap); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private static class SnapListener extends WindowAdapter implements ComponentListener { Vector snaps = new Vector(); Window lastActivate = null; boolean ignoreEvents = false; /** * Description of the Method * * @param e Description of Parameter */ public void windowActivated(WindowEvent e) { if (ignoreEvents) { // ok the next event will be processed ignoreEvents = false; return; } if (lastActivate != null) { lastActivate.removeComponentListener(this); } attachSnapTo(e.getWindow()); lastActivate = e.getWindow(); lastActivate.addComponentListener(this); } /** * Description of the Method * * @param e Description of Parameter */ public void componentHidden(ComponentEvent e) { } /** * Description of the Method * * @param e Description of Parameter */ public void componentMoved(ComponentEvent e) { attachSnapTo(lastActivate); } /** * Description of the Method * * @param e Description of Parameter */ public void componentShown(ComponentEvent e) { } /** * Description of the Method * * @param e Description of Parameter */ public void componentResized(ComponentEvent e) { } /** * Description of the Method * * @param target Description of Parameter */ public void attachSnapTo(Window target) { synchronized (snaps) { // notify the listener that it should not handle the next windowActivateEvent ignoreEvents = true; for (int i = 0, c = snaps.size(); i < c; i++) { ((Snap) snaps.elementAt(i)).attachTo(target); } // restore focus to target target.requestFocus(); target.toFront(); } } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ private static class Snap { Window snap; int position; /** * Constructor for the Snap object * * @param snap Description of Parameter * @param position Description of Parameter */ public Snap(Window snap, int position) { this.snap = snap; this.position = position; } /** * Description of the Method * * @param target Description of Parameter */ public void attachTo(Window target) { // i'm a snap window, i should follow my target Rectangle targetBounds = target.getBounds(); int x; int y; switch (position) { default: case SwingConstants.NORTH_WEST: // top left corner x = targetBounds.x; y = targetBounds.y - snap.getSize().height; break; case SwingConstants.NORTH_EAST: // top right corner x = targetBounds.x + targetBounds.width - snap.getSize().width; y = targetBounds.y - snap.getSize().height; break; case SwingConstants.SOUTH_WEST: // bottom left corner x = targetBounds.x; y = targetBounds.y + targetBounds.height; break; case SwingConstants.SOUTH_EAST: x = targetBounds.x + targetBounds.width - snap.getSize().width; y = targetBounds.y + targetBounds.height; break; case SwingConstants.WEST: x = targetBounds.x - snap.getSize().width; y = targetBounds.y; break; case SwingConstants.EAST: x = targetBounds.x + targetBounds.width; y = targetBounds.y; break; } snap.setLocation(x, y); // snap.toFront(); } } } skinlf-6.7/src/com/l2fprod/tools/0000755000175000017500000000000010460410034016657 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/tools/msstyles/0000755000175000017500000000000010460410034020542 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/tools/msstyles/MsStylesToSkinLF.java0000644000175000017500000002077210460410016024552 0ustar twernertwernerpackage com.l2fprod.tools.msstyles; import com.l2fprod.tools.ThemeConverter; import com.l2fprod.tools.ImageUtils; import java.awt.Image; import java.io.File; import java.io.FileInputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.xpath.XPathAPI; import org.w3c.dom.Document; import org.w3c.dom.Element; public class MsStylesToSkinLF extends ThemeConverter { private Document msstyle; private String msstyleDirectory; private String msstyleFile; private Element lastElement; public MsStylesToSkinLF() { super("MS{", "}"); } public void setMsStyleDirectory(String directory) { msstyleDirectory = directory; } public String getMsStyleDirectory() { return msstyleDirectory; } public void setMsStyleXML(String file) throws Exception { msstyleFile = file; // load the xml DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); msstyle = builder.parse(new FileInputStream(file)); } public void process() throws Exception { super.process(); System.out.println("Fixing Window borders"); postProcessWindowDecorations(); } /** * Locate the element. if xpath is absolute, update the lastElement * property else find a node relative to lastElement but do not * update it. * * @param xpath a String value * @return an Element value * @exception Exception if an error occurs */ private Element locateElement(String xpath) throws Exception { if (xpath.startsWith("//")) { lastElement = (Element)XPathAPI.selectSingleNode(msstyle.getDocumentElement(), xpath); return lastElement; } else { return (Element)XPathAPI.selectSingleNode(lastElement, xpath); } } private String getPropertyValue(Element part, String property) throws Exception { Element element = (Element)XPathAPI. selectSingleNode(part, "Property[@Name='" + property + "']"); if (element == null) { return null; } else { return element.getAttribute("Value"); } } protected String handleProperty(String path) throws Exception { Element element = locateElement(path); return element.getAttribute("Value"); } protected String handleImage(String path, int index, int count, String outputname) throws Exception { Element element = locateElement(path); if (element == null) { throw new Exception("Node " + path + " not found"); } // how are the chunk organized? vertical or horizontal boolean vertical = true; String imageFile = null; if ("Property".equalsIgnoreCase(element.getTagName())) { imageFile = element.getAttribute("Value"); } else if ("Part".equalsIgnoreCase(element.getTagName()) || "Class".equalsIgnoreCase(element.getTagName())) { // may happen if image is available is several DPI imageFile = getPropertyValue(element, "ImageFile1"); if (imageFile == null) { imageFile = getPropertyValue(element, "ImageFile"); } String layout = getPropertyValue(element, "ImageLayout"); if (layout == null) { layout = getPropertyValue(element, "Imagelayout"); } vertical = "vertical".equalsIgnoreCase(layout); String countProperty = getPropertyValue(element, "ImageCount"); if (countProperty != null) { count = Integer.parseInt(countProperty); } } if (imageFile == null || "".equals(imageFile)) { throw new Exception("No value found for " + path + " (" + imageFile + ")"); } // System.out.println("element name = " + element.getTagName()); // System.out.println("imageFile = " + imageFile); File file = new File(getMsStyleDirectory(), imageFile); // if the .BMP is not found, try the .png if (file.exists() == false && imageFile.toLowerCase().endsWith(".bmp")) { imageFile = imageFile.substring(0, imageFile.length() - 4) + ".png"; file = new File(getMsStyleDirectory(), imageFile); if (!file.exists()) { imageFile = imageFile.substring(0, imageFile.length() - 4) + ".gif"; } } ImageUtils.createPicture(getMsStyleDirectory() + File.separator + imageFile, index, count, new File(getCurrentOutputDirectory(), outputname).getAbsolutePath(), vertical); return outputname; } private void postProcessWindowDecorations() throws Exception { // get the top selected and move the left and right top corners as // single images, then remove the borders from the selected and // unselected. Image top = ImageUtils.loadPng(new File(getSkinDirectory(), "kde/titlebar_selected.png").getAbsolutePath()); Image topUnselected = ImageUtils.loadPng(new File(getSkinDirectory(), "kde/titlebar_unselected.png").getAbsolutePath()); Image left = ImageUtils.loadPng(new File(getSkinDirectory(), "kde/window_left.png").getAbsolutePath()); Image right = ImageUtils.loadPng(new File(getSkinDirectory(), "kde/window_right.png").getAbsolutePath()); Image topleft = ImageUtils.grab(top, 0, 0, left.getWidth(null), top.getHeight(null)); ImageUtils.savePng(topleft, new File(getSkinDirectory(), "kde/window_topleft.png").getAbsolutePath()); Image topright = ImageUtils.grab(top, top.getWidth(null) - right.getWidth(null), 0, right.getWidth(null), top.getHeight(null)); ImageUtils.savePng(topright, new File(getSkinDirectory(), "kde/window_topright.png").getAbsolutePath()); // rewrite the top selected top = ImageUtils.grab(top, left.getWidth(null), 0, top.getWidth(null) - left.getWidth(null) - right.getWidth(null), top.getHeight(null)); ImageUtils.savePng(top, new File(getSkinDirectory(), "kde/titlebar_selected.png").getAbsolutePath()); // and unselected topUnselected = ImageUtils.grab(topUnselected, left.getWidth(null), 0, top.getWidth(null) - left.getWidth(null) - right.getWidth(null), top.getHeight(null)); ImageUtils.savePng(topUnselected, new File(getSkinDirectory(), "kde/titlebar_unselected.png").getAbsolutePath()); // same process with the bottom image Image bottom = ImageUtils.loadPng(new File(getSkinDirectory(), "kde/window_bottom.png").getAbsolutePath()); Image bottomLeft = ImageUtils.grab(bottom, 0, 0, left.getWidth(null), bottom.getHeight(null)); ImageUtils.savePng(bottomLeft, new File(getSkinDirectory(), "kde/window_bottomleft.png").getAbsolutePath()); Image bottomRight = ImageUtils.grab(bottom, bottom.getWidth(null) - right.getWidth(null), 0, right.getWidth(null), bottom.getHeight(null)); ImageUtils.savePng(bottomRight, new File(getSkinDirectory(), "kde/window_bottomright.png").getAbsolutePath()); // rewrite the bottom // rewrite the top selected bottom = ImageUtils.grab(bottom, left.getWidth(null), 0, bottom.getWidth(null) - left.getWidth(null) - right.getWidth(null), bottom.getHeight(null)); ImageUtils.savePng(bottom, new File(getSkinDirectory(), "kde/window_bottom.png").getAbsolutePath()); } protected String paramString() { return super.paramString() + ",msstyleDirectory=" + msstyleDirectory + ",msstyleFile=" + msstyleFile; } public static void main(String[] args) throws Exception { if (args.length != 3) { System.err.println("usage: msstylestoskinlf "); System.exit(1); } String msstyleDir = args[0]; String msstyles = args[1]; String out = args[2]; File outDir = new File(out); outDir.mkdirs(); MsStylesToSkinLF converter = new MsStylesToSkinLF(); converter.setMsStyleDirectory(msstyleDir); converter.setMsStyleXML(msstyles); converter.setSkinDirectory(outDir); System.out.println(converter.toString()); converter.process(); // awt thread may prevent to exit System.exit(0); } } skinlf-6.7/src/com/l2fprod/tools/ImageUtils.java0000644000175000017500000000511610460410012021564 0ustar twernertwernerpackage com.l2fprod.tools; import java.awt.*; import java.awt.image.*; import java.io.File; import javax.swing.ImageIcon; import com.ibm.imageconversion.*; import com.sun.jimi.core.*; public class ImageUtils { public static Component bitmapCreator = new javax.swing.JLabel(); static BMPDecoder decoder = new BMPDecoder(); static BMPEncoder encoder = new BMPEncoder(); public static Image loadPng(String pathToImage) throws Exception { ImageIcon icon = new ImageIcon(new File(pathToImage).toURL()); return icon.getImage(); } public static void savePng(Image image, String pathToImage) throws Exception { Jimi.putImage(image, pathToImage); } public static void createPicture(String pathToImage, int index, int maxParts, String filename, boolean horizontal) { try { System.out.println("working with " + pathToImage); Image image = null; if (pathToImage.toLowerCase().endsWith(".png") || pathToImage.toLowerCase().endsWith(".gif")) { image = loadPng(pathToImage); } else if (pathToImage.toLowerCase().endsWith(".bmp")) { decoder.setInputFilename(pathToImage); decoder.triggerAction(); image = decoder.getResult(); } else { throw new Error("do not know how to load " + pathToImage); } // if only one image, dump it as it if (index == 0 && maxParts == 1) { Jimi.putImage(image, filename); } else { if (horizontal) { int partHeight = image.getHeight(bitmapCreator) / maxParts; image = grab(image, 0, partHeight*index, image.getWidth(bitmapCreator), partHeight); } else { int partWidth = image.getWidth(bitmapCreator) / maxParts; image = grab(image, partWidth * index, 0, partWidth, image.getHeight(bitmapCreator)); } Jimi.putImage(image, filename); } } catch (Exception e) { System.out.println("error while working with " + pathToImage); e.printStackTrace(); } } public static Image grab(Image image, int x, int y, int width, int height) { if (width * height < 0) return null; int[] pixels = new int[width * height]; PixelGrabber grabber = new PixelGrabber(image, x, y, width, height, pixels, 0, width); try { grabber.grabPixels(); } catch (Exception e) { e.printStackTrace(); } return bitmapCreator.createImage(new MemoryImageSource(width, height, pixels, 0, width)); } } skinlf-6.7/src/com/l2fprod/tools/ThemeConverter.java0000644000175000017500000001047610460410014022462 0ustar twernertwernerpackage com.l2fprod.tools; import java.io.LineNumberReader; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public abstract class ThemeConverter { private final String prefix; private final String suffix; private File skinDirectory; private File currentOutputDir; protected ThemeConverter(String prefix, String suffix) { this.prefix = prefix; this.suffix = suffix; } public void setSkinDirectory(File directory) { skinDirectory = directory; } protected File getSkinDirectory() { return skinDirectory; } public void setCurrentOutputDirectory(File directory) { currentOutputDir = directory; } public File getCurrentOutputDirectory() { return currentOutputDir; } public void process() throws Exception { // process the gtk template System.out.println("Processing GTK template"); File gtkFolder = new File(skinDirectory, "gtk"); gtkFolder.mkdirs(); setCurrentOutputDirectory(gtkFolder); processTemplate(getClass().getResourceAsStream("gtkrc.template"), new FileOutputStream(new File(gtkFolder, "gtkrc"))); // process the kde template System.out.println("Processing KDE template"); File kdeFolder = new File(skinDirectory, "kde"); kdeFolder.mkdirs(); setCurrentOutputDirectory(kdeFolder); processTemplate(getClass().getResourceAsStream("kde.template"), new FileOutputStream(new File(kdeFolder, "kde.themerc"))); } protected void processTemplate(InputStream template, OutputStream output) throws Exception { PrintWriter out = new PrintWriter(output); LineNumberReader reader = new LineNumberReader(new InputStreamReader(template)); try { String read; while ((read = reader.readLine()) != null) { out.println(parseLine(read)); } } catch (Exception e) { System.err.println("Error at line:" + reader.getLineNumber()); e.printStackTrace(); } finally { out.flush(); } } protected String parseLine(String line) throws Exception { int index = line.indexOf(prefix); if (index == -1) return line; else { int endIndex = line.indexOf(suffix, index + prefix.length()); if (endIndex == -1) throw new Exception("Tag not closed"); String tag = line.substring(index + prefix.length(), endIndex); return line.substring(0, index) + parseTag(tag) + parseLine(line.substring(endIndex + 1)); } } protected String parseTag(String tag) throws Exception { // handle Image:pathtoimagefile#index,count|filenametocreate.png|trueorfalse if (tag.startsWith("Image:")) { StringTokenizer token = new StringTokenizer(tag, ":#,|"); // skip image token.nextToken(); // path String path = token.hasMoreTokens()?token.nextToken():null; // index int index = token.hasMoreTokens()?Integer.parseInt(token.nextToken()):-1; // count int count = token.hasMoreTokens()?Integer.parseInt(token.nextToken()):-1; // filenametocreate String output = token.hasMoreTokens()?token.nextToken():null; // we have all parameters return handleImage(path, index, count, output); } else if (tag.startsWith("Property:")) { StringTokenizer token = new StringTokenizer(tag, ":"); // skip prop token.nextToken(); // value String prop = token.hasMoreTokens()?token.nextToken():null; return handleProperty(prop); } else { System.err.println("Found unknown tag: " + tag); return tag; } } protected abstract String handleImage(String path, int index, int count, String outputname) throws Exception; protected abstract String handleProperty(String path) throws Exception; public String toString() { return getClass().getName() + "[" + paramString() + "]"; } protected String paramString() { return "prefix=" + prefix + ",suffix=" + suffix + ",skinDirectory=" + skinDirectory; } } skinlf-6.7/src/com/l2fprod/util/0000755000175000017500000000000010460410034016474 5ustar twernertwernerskinlf-6.7/src/com/l2fprod/util/AccessUtils.java0000644000175000017500000001103510460410014021557 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; /** * Created on 11/04/2001 by Frederic Lavigne, fred@L2FProd.com * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2003/08/25 20:00:47 $ */ public class AccessUtils { /** * Gets the Property attribute of the AccessUtils class * * @param name Description of Parameter * @return The Property value */ public static String getProperty(String name) { return getProperty(name, null); } /** * Gets the Property attribute of the AccessUtils class * * @param name Description of Parameter * @param defaultValue Description of Parameter * @return The Property value */ public static String getProperty(String name, String defaultValue) { String result = null; try { result = System.getProperty(name); } catch (Throwable th) { } if (result == null) { result = defaultValue; } return result; } public static int getIntValue(Class p_Class, String p_Field) { try { return p_Class.getField(p_Field).getInt(null); } catch (Throwable throwable) { throw new Error(throwable.getMessage()); } } public static int getIntValue(Object p_Object, String p_Field) { try { return p_Object.getClass().getField(p_Field).getInt(p_Object); } catch (Throwable throwable) { throw new Error(throwable.getMessage()); } } public static Object invoke(Object p_Object, String p_Method, Class[] p_ParameterClasses, Object[] p_Parameters) { try { return p_Object.getClass().getMethod(p_Method, p_ParameterClasses).invoke(p_Object, p_Parameters); } catch (Throwable throwable) { throwable.printStackTrace(); throw new Error(throwable.getMessage()); } } public static int getAsInt(Object p_Object, String p_Method) { return ((Integer)invoke(p_Object, p_Method, null, null)).intValue(); } public static void setAsInt(Object p_Object, String p_Method, int p_Int) { invoke(p_Object, p_Method, new Class[]{int.class}, new Object[]{new Integer(p_Int)}); } } skinlf-6.7/src/com/l2fprod/util/ColorFillFilter.java0000644000175000017500000001265310460410014022377 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; import java.awt.Color; import java.awt.image.BufferedImage; import java.awt.image.RGBImageFilter; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.1 $, $Date: 2004/07/18 11:19:44 $ */ public class ColorFillFilter extends RGBImageFilter { /** * Description of the Field */ public int m_Red, m_Green, m_Blue; /** * Constructor for the ColorFillFilter object * * @param r Description of Parameter * @param g Description of Parameter * @param b Description of Parameter */ public ColorFillFilter(int r, int g, int b) { setColor(r, g, b); canFilterIndexColorModel = true; } /** * Constructor for the ColorFillFilter object * * @param color Description of Parameter */ public ColorFillFilter(Color color) { this(100 * color.getRed() / 255, 100 * color.getGreen() / 255, 100 * color.getBlue() / 255); } /** * Constructor for the ColorFillFilter object */ public ColorFillFilter() { this(100, 100, 100); } /** * Sets the Color attribute of the ColorFillFilter object * * @param r The new Color value * @param g The new Color value * @param b The new Color value */ public void setColor(int r, int g, int b) { m_Red = r; m_Green = g; m_Blue = b; if (false && m_Red == 100 && m_Green == 100 && m_Blue == 100) { m_Red = 90; m_Green = 90; m_Blue = 90; } } /** * Sets the Red attribute of the ColorFillFilter object * * @param r The new Red value */ public void setRed(int r) { m_Red = r; } /** * Sets the Green attribute of the ColorFillFilter object * * @param g The new Green value */ public void setGreen(int g) { m_Green = g; } /** * Sets the Blue attribute of the ColorFillFilter object * * @param b The new Blue value */ public void setBlue(int b) { m_Blue = b; } /** * Description of the Method * * @param x Description of Parameter * @param y Description of Parameter * @param rgb Description of Parameter * @return Description of the Returned Value */ public int filterRGB(int x, int y, int rgb) { if (rgb == 0 || rgb == ImageUtils.TRANSPARENT_PIXEL) { return rgb; } int r = ((rgb & 0x00ff0000) >> 16) * m_Red / 100; if (r < 0) { r = 0; } if (r > 255) { r = 255; } int g = ((rgb & 0x0000ff00) >> 8) * m_Green / 100; if (g < 0) { g = 0; } if (g > 255) { g = 255; } int b = ((rgb & 0x000000ff)) * m_Blue / 100; if (b < 0) { b = 0; } if (b > 255) { b = 255; } return 0xff000000 | (r << 16) | (g << 8) | (b << 0); } public void filter(BufferedImage src, BufferedImage dest) { for (int x = 0, c = src.getWidth(); x < c; x++) { for (int y = 0, d = src.getHeight(); y < d; y++) { dest.setRGB(x, y, filterRGB(x, y, src.getRGB(x, y))); } } } } skinlf-6.7/src/com/l2fprod/util/ImageUtils.java0000644000175000017500000005257610460410014021417 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; import com.l2fprod.contrib.freehep.PanelArtistUtilities; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; import java.awt.image.FilteredImageSource; import java.awt.image.MemoryImageSource; import java.awt.image.PixelGrabber; import java.awt.image.RGBImageFilter; import java.awt.image.WritableRaster; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.plaf.ColorUIResource; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.8 $, $Date: 2006/07/22 09:52:13 $ */ public final class ImageUtils implements SwingConstants { /** * Description of the Field */ public final static Component producer = new java.awt.Component() { }; /** * Description of the Field */ public final static int PAINT_NORMAL = 0; /** * Description of the Field */ public final static int PAINT_STRETCH = 1; /** * Description of the Field */ public final static int PAINT_TILE = 2; /** * Description of the Field */ public final static int PAINT_CENTERED = 3; /** * Description of the Field */ public final static int PAINT_NONE = 5; /** * Description of the Field */ public final static int TRANSPARENT_RED = 255; /** * Description of the Field */ public final static int TRANSPARENT_GREEN = 0; /** * Description of the Field */ public final static int TRANSPARENT_BLUE = 255; /** * Description of the Field */ public final static int TRANSPARENT_TO_REMOVE = new Color(255, 0, 255).getRGB(); /** * Description of the Field */ public final static int TRANSPARENT_PIXEL = new Color(255, 0, 0, 0).getRGB(); /** * Gets the DisabledIcon attribute of the ImageUtils class * * @param anIcon Description of Parameter * @return The DisabledIcon value */ public static ImageIcon getDisabledIcon(ImageIcon anIcon) { return getDisabledIcon(anIcon.getImage()); } /** * Gets the DisabledIcon attribute of the ImageUtils class * * @param anImage Description of Parameter * @return The DisabledIcon value */ public static ImageIcon getDisabledIcon(Image anImage) { return new WeakImageIcon(getDisabledImage(anImage)); } /** * Gets the DisabledImage attribute of the ImageUtils class * * @param anImage Description of Parameter * @return The DisabledImage value */ public static Image getDisabledImage(Image anImage) { if (anImage == null) { return null; } else { return filterImage(new javax.swing.GrayFilter(true, 75), anImage); } } /** * Description of the Method * * @param filter Description of Parameter * @param image Description of Parameter * @return Description of the Returned Value */ public static Image filterImage(RGBImageFilter filter, Image image) { return producer.createImage(new FilteredImageSource(image.getSource(), filter)); } /** * Description of the Method * * @param anImage Description of Parameter * @return Description of the Returned Value */ public static Image rotateImage(Image anImage) { int w = anImage.getWidth(null); int h = anImage.getHeight(null); int[] pixels = new int[w * h]; PixelGrabber pixel = new PixelGrabber(anImage, 0, 0, w, h, pixels, 0, w); try { pixel.grabPixels(); } catch (Exception e) { // e.printStackTrace(); } int[] rot = new int[h * w]; int pos = 0; for (int i = w; i > 0; i--) { for (int j = 0; j < h; j++) { rot[pos] = pixels[i + (w * j) - 1]; pos++; } } return convertBytesToImage(producer, rot, h, w); } /** * Description of the Method * * @param anImage Description of Parameter * @param angle Description of Parameter * @return Description of the Returned Value */ public static Image rotateImage(Image anImage, double angle) { int width = anImage.getWidth(null); int height = anImage.getHeight(null); int[] pixels = new int[width * height]; PixelGrabber pixel = new PixelGrabber(anImage, 0, 0, width, height, pixels, 0, width); try { pixel.grabPixels(); } catch (Exception e) { // e.printStackTrace(); } int[] pixels2 = new int[width * height]; int i = 0; double radians = -angle / (180 / Math.PI); double cos = Math.cos(radians); double sin = Math.sin(radians); int centerX = width >> 1; int centerY = height >> 1; for (int oldY = -centerY; oldY < centerY; oldY++) { for (int oldX = -centerX; oldX < centerX; oldX++) { int newX = centerX + (int) ((oldX * cos) - (oldY * sin)); int newY = centerY + (int) ((oldX * sin) + (oldY * cos)); if (newX > 0 && newX < width && newY > 0 && newY < height) { pixels2[i++] = pixels[(width * newY) + newX]; } else { pixels2[i++] = pixels[0]; } } } return producer.createImage(new MemoryImageSource(width, height, pixels2, 0, width)); } /** * Description of the Method * * @param c Description of Parameter * @param pixels Description of Parameter * @param w Description of Parameter * @param h Description of Parameter * @return Description of the Returned Value */ public static Image convertBytesToImage(Component c, int[] pixels, int w, int h) { return c.createImage(new MemoryImageSource(w, h, pixels, 0, w)); } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param image Description of Parameter */ public static void paint(Component c, Graphics g, Image image) { paint(c, g, image, true); } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param paintType Description of Parameter */ public static void paint(Component c, Graphics g, Image image, int paintType) { paint(c, g, image, true, paintType); } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param alignWithParent Description of Parameter */ public static void paint(Component c, Graphics g, Image image, boolean alignWithParent) { paint(c, g, image, alignWithParent, PAINT_STRETCH); } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param alignWithParent Description of Parameter * @param paintType Description of Parameter */ public static void paint(Component c, Graphics g, Image image, boolean alignWithParent, int paintType) { paint(c, g, image, 0, 0, ((JComponent)c).getWidth(), ((JComponent)c).getHeight(), alignWithParent, paintType); } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter */ public static void paint(Component c, Graphics g, Image image, int x, int y, int width, int height) { paint(c, g, image, x, y, width, height, true, PAINT_STRETCH); } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @param paintType Description of Parameter */ public static void paint(Component c, Graphics g, Image image, int x, int y, int width, int height, int paintType) { paint(c, g, image, x, y, width, height, true, paintType); } /** * Description of the Method * * @param c Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @param alignWithParent Description of Parameter * @param paintType Description of Parameter */ public static void paint(Component c, Graphics g, Image image, int x, int y, int width, int height, boolean alignWithParent, int paintType) { if (image == null) { return; } Color color = c.getBackground(); if (color != null && !(color instanceof ColorUIResource)) { ColorFillFilter filter = new ColorFillFilter(color); BufferedImage buffered = toBufferedImage(image); BufferedImage filtered = new BufferedImage(buffered.getWidth(), buffered.getHeight(), BufferedImage.TYPE_INT_ARGB); filter.filter(buffered, filtered); image = filtered; } switch (paintType) { case PAINT_NORMAL : g.drawImage(image, x, y, c); break; case PAINT_STRETCH : g.drawImage(image, x, y, width, height, c); break; case PAINT_TILE : paintTile(c, g, image, x, y, width, height, alignWithParent); break; case PAINT_CENTERED : g.drawImage(image, (width - image.getWidth(c)) / 2, (height - image.getHeight(c)) / 2, c); break; case PAINT_NONE : break; } } /* * The idea is to paint an image to a buffer of the full size of width/height and * setting everything else but the window to transparent */ public static void paintWindow(Component c, Graphics g, Image image, int x, int y, int width, int height, int windowX, int windowY, int windowWidth, int windowsHeight, boolean alignWithParent, int paintType) { width += x; height += y; BufferedImage windowed = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graph = windowed.createGraphics(); graph.setClip(0, 0, width, height); switch (paintType) { case PAINT_NORMAL : graph.drawImage(image, x, y, c); break; case PAINT_STRETCH : graph.drawImage(image, x, y, width, height, c); break; case PAINT_TILE : paintTile(c, graph, image, x, y, width, height, alignWithParent); break; case PAINT_CENTERED : graph.drawImage(image, (width - image.getWidth(c)) / 2, (height - image.getHeight(c)) / 2, c); break; case PAINT_NONE : break; } WritableRaster raster = windowed.getAlphaRaster(); //do the left part of the window for (int i = 0; i < windowX; i++) { for (int j = 0; j < height; j++) { raster.setSample(i, j, 0, 0); } } //do the right part of the window for (int i = windowX + windowWidth; i < width; i++) { for (int j = 0; j < height; j++) { raster.setSample(i, j, 0, 0); } } int windowXEnd = windowX + windowWidth; //do the bottom part of the window for (int i = windowX; i < windowXEnd; i++) { for (int j = windowY + windowsHeight; j < height; j++) { raster.setSample(i, j, 0, 0); } } //do the top part of the window for (int i = windowX; i < windowXEnd; i++) { for (int j = 0; j < windowY; j++) { raster.setSample(i, j, 0, 0); } } g.drawImage(windowed, 0, 0, width, height, c); } /** * Description of the Method * * @param component Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter */ public static void paintTile(Component component, Graphics g, Image image, int x, int y, int width, int height) { paintTile(component, g, image, x, y, width, height, true); } /** * Description of the Method * * @param image Description of Parameter * @return Description of the Returned Value */ public static Image transparent(Image image) { return toBufferedImage(image); } /** * Description of the Method * * @param image Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @return Description of the Returned Value */ public static Image grab(Image image, int x, int y, int width, int height) { if (width * height <= 0) { return null; } if (image instanceof BufferedImage) { return ((BufferedImage)image).getSubimage(x, y, width, height); } int[] pixels = new int[width * height]; PixelGrabber grabber = new PixelGrabber(image, x, y, width, height, pixels, 0, width); try { grabber.grabPixels(); } catch (Exception e) { e.printStackTrace(); } int pixel, red, green, blue; for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { pixel = pixels[j * width + i]; red = (pixel >> 16) & 0xff; green = (pixel >> 8) & 0xff; blue = (pixel) & 0xff; if ((red == TRANSPARENT_RED) && (green == TRANSPARENT_GREEN) && (blue == TRANSPARENT_BLUE)) { pixels[j * width + i] = TRANSPARENT_PIXEL; } } } Image newImage = producer.createImage(new MemoryImageSource(width, height, pixels, 0, width)); return toBufferedImage(newImage); } /** * Description of the Method * * @param image Description of Parameter * @param factor Description of Parameter * @return Description of the Returned Value */ public static Image buildTile(Image image, int factor) { int width = image.getWidth(producer); int height = image.getHeight(producer); int[] pixels = new int[width * height]; PixelGrabber grabber = new PixelGrabber(image, 0, 0, width, height, pixels, 0, width); try { grabber.grabPixels(); } catch (Exception e) { e.printStackTrace(); } // do an horizontal tiling int[] zoomed = new int[pixels.length * factor]; for (int i = 0; i < height; i++) { for (int j = 0; j < factor; j++) { System.arraycopy(pixels, width * i, zoomed, (width * factor * i) + width * j, width); } } pixels = zoomed; // do a vertical duplication int[] zoomed2 = new int[pixels.length * factor]; for (int i = 0; i < factor; i++) { System.arraycopy(pixels, 0, zoomed2, i * pixels.length, pixels.length); } return producer.createImage(new MemoryImageSource(width * factor, height * factor, zoomed2, 0, width * factor)); } /** * Description of the Method * * @param image Description of Parameter * @return Description of the Returned Value */ public static BufferedImage toBufferedImage(Image image) { if (image == null) { return null; } if (image instanceof BufferedImage) { return (BufferedImage)image; } // This code ensures that all the pixels in // the image are loaded. image = new ImageIcon(image).getImage(); // Create the buffered image. BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); // Copy image to buffered image. Graphics2D g = bufferedImage.createGraphics(); // paint the image. g.drawImage(image, 0, 0, null); g.dispose(); // Get the DataBuffer from your bufferedImage like DataBuffer db = bufferedImage.getRaster().getDataBuffer(); // then you can just iterate through and convert your chosencolor to a transparent color for (int i = 0, c = db.getSize(); i < c; i++) { if (db.getElem(i) == TRANSPARENT_TO_REMOVE) { // set to transparent db.setElem(i, TRANSPARENT_PIXEL); } } return bufferedImage; } /** * Description of the Method * * @param image Description of Parameter * @return Description of the Returned Value */ public static Image flipHorizontally(Image image) { if (image == null) { return null; } AffineTransform transform = PanelArtistUtilities.getYFlipTransform(image.getHeight(producer)); AffineTransformOp operation = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); return operation.filter((BufferedImage)image, null); } /** * Description of the Method * * @param anImage Description of Parameter * @return Description of the Returned Value */ public static Image rotateLeft(Image anImage) { if (anImage == null) { return null; } AffineTransform transform = PanelArtistUtilities.getCCWRotateTransform(anImage.getWidth(producer), anImage.getHeight(producer)); AffineTransformOp operation = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); return transparent(operation.filter((BufferedImage)anImage, null)); } public static Image rotateRight(Image anImage) { if (anImage == null) { return null; } AffineTransform transform = PanelArtistUtilities.getCWRotateTransform(anImage.getWidth(producer), anImage.getHeight(producer)); AffineTransformOp operation = new AffineTransformOp(transform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); return transparent(operation.filter((BufferedImage)anImage, null)); } /** * Description of the Method * * @param component Description of Parameter * @param g Description of Parameter * @param image Description of Parameter * @param x Description of Parameter * @param y Description of Parameter * @param width Description of Parameter * @param height Description of Parameter * @param alignWithParent Description of Parameter */ private static void paintTile(Component component, Graphics g, Image image, int x, int y, int width, int height, boolean alignWithParent) { if (image == null) { return; } final int dx = image.getWidth(null); final int dy = image.getHeight(null); // skip a 0 size image if (dx <= 0 || dy <= 0) { return; } //work out the offset from (0,0) in the root frame. int xoff = 0; int yoff = 0; Shape oldClip = g.getClip(); if (oldClip.contains(x, y, width, height) || (width <= 0 || height <= 0)) { g.setClip(x, y, width, height); } else if (oldClip.intersects(x, y, width, height)) { Rectangle currentRect = oldClip.getBounds(); g.setClip(SwingUtilities.computeIntersection(x, y, width, height, (Rectangle)currentRect.clone())); } if (alignWithParent) { Component parent = component.getParent(); xoff = component.getLocation().x; yoff = component.getLocation().y; while (parent != null && (parent instanceof javax.swing.JInternalFrame == false)) { //don't want the screen coords of the topmost container... if (parent.getParent() != null) { xoff += parent.getLocation().x; yoff += parent.getLocation().y; } parent = parent.getParent(); } x -= (xoff % dx); y -= (yoff % dy); } int maxX = x + width + dx; int maxY = y + height + dy; for (; x <= maxX; x += dx) { for (int j = y; j <= maxY; j += dy) { g.drawImage(image, x, j, component); } } g.setClip(oldClip); } } skinlf-6.7/src/com/l2fprod/util/IniFile.java0000644000175000017500000002521210460410014020656 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; import java.io.*; import java.util.*; import java.net.URL; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.5 $, $Date: 2005/11/19 09:26:22 $ */ public class IniFile { Hashtable sections; /** * Constructor for the IniFile object */ public IniFile() { sections = new Hashtable(); } /** * Constructor for the IniFile object * * @param filename Description of Parameter * @exception FileNotFoundException Description of Exception */ public IniFile(String filename) throws FileNotFoundException { this(); load(filename); } /** * Constructor for the IniFile object * * @param url Description of Parameter * @exception IOException Description of Exception */ public IniFile(URL url) throws IOException { this(); load(url.openStream()); } /** * Constructor for the IniFile object * * @param input Description of Parameter */ public IniFile(InputStream input) { this(); load(input); } /** * Sets the KeyValue attribute of the IniFile object * * @param section The new KeyValue value * @param key The new KeyValue value * @param value The new KeyValue value */ public void setKeyValue(String section, String key, String value) { try { getSection(section).put(key.toLowerCase(), value); } catch (NullPointerException e) { e.printStackTrace(); } } /** * Gets the Sections attribute of the IniFile object * * @return The Sections value */ public Hashtable getSections() { return sections; } /** * Gets the Section attribute of the IniFile object * * @param section Description of Parameter * @return The Section value */ public Hashtable getSection(String section) { return (Hashtable) (sections.get(section.toLowerCase())); } /** * Gets the NullOrEmpty attribute of the IniFile object * * @param section Description of Parameter * @param key Description of Parameter * @return The NullOrEmpty value */ public boolean isNullOrEmpty(String section, String key) { String value = getKeyValue(section, key); return (value == null || value.length() == 0); } /** * Gets the KeyValue attribute of the IniFile object * * @param section Description of Parameter * @param key Description of Parameter * @return The KeyValue value */ public String getKeyValue(String section, String key) { try { return (String) getSection(section).get(key.toLowerCase()); } catch (NullPointerException e) { return null; } } /** * Gets the KeyIntValue attribute of the IniFile object * * @param section Description of Parameter * @param key Description of Parameter * @return The KeyIntValue value */ public int getKeyIntValue(String section, String key) { return getKeyIntValue(section, key, 0); } /** * Gets the KeyIntValue attribute of the IniFile object * * @param section Description of Parameter * @param key Description of Parameter * @param defaultValue Description of Parameter * @return The KeyIntValue value */ public int getKeyIntValue(String section, String key, int defaultValue) { String value = getKeyValue(section, key.toLowerCase()); if (value == null) { return defaultValue; } else { try { return Integer.parseInt(value); } catch (NumberFormatException e) { return 0; } } } /** * return true if the value of the key is yes/true, false if no/false, defaultValue in all other cases. * @param section * @param key * @param defaultValue */ public boolean getKeyBooleanValue(String section, String key, boolean defaultValue) { String value = getKeyValue(section, key.toLowerCase()); if (value == null) { return defaultValue; } if ("yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value)) return true; if ("no".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) return false; return defaultValue; } /** * Gets the KeysAndValues attribute of the IniFile object * * @param aSection Description of Parameter * @return The KeysAndValues value */ public String[][] getKeysAndValues(String aSection) { Hashtable section = getSection(aSection); if (section == null) { return null; } String[][] results = new String[section.size()][2]; int i = 0; for (Enumeration f = section.keys(), g = section.elements(); f.hasMoreElements(); i++) { results[i][0] = (String) f.nextElement(); results[i][1] = (String) g.nextElement(); } return results; } public String getSectionWhere(String[][] query) { String result = null; for (Enumeration e = getSections().keys(); e.hasMoreElements(); ) { String current = (String)e.nextElement(); boolean match = true; for (int i = 0, c = query.length; i < c; i++) { if (getKeyValue(current, query[i][0]) == null || getKeyValue(current, query[i][0]).equals(query[i][1]) == false) { match = false; break; } } if (match) { result = current; break; } } return result; } /** * Description of the Method * * @param filename Description of Parameter * @exception FileNotFoundException Description of Exception */ public void load(String filename) throws FileNotFoundException { load(new FileInputStream(filename)); } /** * Description of the Method * * @param filename Description of Parameter * @exception IOException Description of Exception */ public void save(String filename) throws IOException { save(new FileOutputStream(filename)); } /** * Description of the Method * * @param in Description of Parameter */ public void load(InputStream in) { try { BufferedReader input = new BufferedReader(new InputStreamReader(in)); String read; Hashtable section = null; String section_name; while ((read = input.readLine()) != null) { if (read.startsWith(";") || read.startsWith("#")) { continue; } else if (read.startsWith("[")) { // new section section_name = read.substring(1, read.indexOf("]")).toLowerCase(); section = (Hashtable) sections.get(section_name); if (section == null) { section = new Hashtable(); sections.put(section_name, section); } } else if (read.indexOf("=") != -1 && section != null) { // new key String key = read.substring(0, read.indexOf("=")).trim().toLowerCase(); String value = read.substring(read.indexOf("=") + 1).trim(); section.put(key, value); } } } catch (Exception e) { e.printStackTrace(); } } /** * Description of the Method * * @param out Description of Parameter */ public void save(OutputStream out) { try { PrintWriter output = new PrintWriter(out); String section; for (Enumeration e = sections.keys(); e.hasMoreElements(); ) { section = (String) e.nextElement(); output.println("[" + section + "]"); for (Enumeration f = getSection(section).keys(), g = getSection(section).elements(); f.hasMoreElements(); ) { output.println(f.nextElement() + "=" + g.nextElement()); } } output.flush(); output.close(); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } /** * Adds a feature to the Section attribute of the IniFile object * * @param section The feature to be added to the Section attribute */ public void addSection(String section) { sections.put(section.toLowerCase(), new Hashtable()); } /** * Description of the Method * * @param section Description of Parameter */ public void removeSection(String section) { } /** * Simple test function * * @param args The command line arguments * @exception Exception Description of Exception */ public static void main(String[] args) throws Exception { (new IniFile()).load(new FileInputStream(args[0])); } } skinlf-6.7/src/com/l2fprod/util/LazyTable.java0000644000175000017500000001227610460410014021234 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; import java.util.Hashtable; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class LazyTable extends Hashtable { private final static Object PENDING = new String("Pending"); /** * Description of the Method * * @param key Description of Parameter * @return Description of the Returned Value */ public Object get(Object key) { /* * Quickly handle the common case, without grabbing * a lock. */ Object value = super.get(key); if ((value != PENDING) && !(value instanceof ActiveValue) && !(value instanceof LazyValue)) { return value; } /* * If the LazyValue for key is being constructed by another * thread then wait and then return the new value, otherwise drop * the lock and construct the ActiveValue or the LazyValue. * We use the special value PENDING to mark LazyValues that * are being constructed. */ synchronized (this) { value = super.get(key); if (value == PENDING) { do { try { this.wait(); } catch (InterruptedException e) { } value = super.get(key); } while (value == PENDING); return value; } else if (value instanceof LazyValue) { super.put(key, PENDING); } else if (!(value instanceof ActiveValue)) { return value; } } /* * At this point we know that the value of key was * a LazyValue or an ActiveValue. */ if (value instanceof LazyValue) { try { /* * If an exception is thrown we'll just put the LazyValue * back in the table. */ value = ((LazyValue) value).createValue(this); } finally { synchronized (this) { if (value == null) { super.remove(key); } else { super.put(key, value); } this.notify(); } } } else { value = ((ActiveValue) value).createValue(this); } return value; } /** * Description of the Interface * * @author fred * @created 27 avril 2002 */ public interface LazyValue { /** * Description of the Method * * @param table Description of Parameter * @return Description of the Returned Value */ Object createValue(LazyTable table); } /** * Description of the Interface * * @author fred * @created 27 avril 2002 */ public interface ActiveValue { /** * Description of the Method * * @param table Description of Parameter * @return Description of the Returned Value */ Object createValue(LazyTable table); } } skinlf-6.7/src/com/l2fprod/util/OS.java0000644000175000017500000001745710460410016017676 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; /** * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.3 $, $Date: 2004/07/18 19:13:11 $ */ public final class OS { /** * Description of the Field */ public final static int JDK1_1 = 11; /** * Description of the Field */ public final static int JDK1_2 = 12; /** * Description of the Field */ public final static int JDK1_3 = 13; /** * Description of the Field */ public final static int JDK1_4 = 14; private static boolean isWindows95; private static boolean isWindowsNT; private static boolean isWindows2000; private static boolean isMacintosh; private static boolean isSolaris; private static boolean isLinux; private static boolean isCaseSensitive; private static int jdkVersion = JDK1_1; /** * Constructor for the OS object */ private OS() { } /** * Gets the Windows attribute of the OS class * * @return The Windows value */ public static boolean isWindows() { return isWindows95() || isWindowsNT() || isWindows2000(); } /** * Gets the Windows95 attribute of the OS class * * @return The Windows95 value */ public static boolean isWindows95() { return isWindows95; } /** * Gets the WindowsNT attribute of the OS class * * @return The WindowsNT value */ public static boolean isWindowsNT() { return isWindowsNT; } /** * Gets the Windows2000 attribute of the OS class * * @return The Windows2000 value */ public static boolean isWindows2000() { return isWindows2000; } /** * Gets the Macintosh attribute of the OS class * * @return The Macintosh value */ public static boolean isMacintosh() { return isMacintosh; } /** * Gets the Solaris attribute of the OS class * * @return The Solaris value */ public static boolean isSolaris() { return isSolaris; } /** * Gets the Linux attribute of the OS class * * @return The Linux value */ public static boolean isLinux() { return isLinux; } /** * Gets the Unix attribute of the OS class * * @return The Unix value */ public static boolean isUnix() { return isSolaris() || isLinux(); } /** * Gets the CaseSensitive attribute of the OS class * * @return The CaseSensitive value */ public static boolean isCaseSensitive() { return isCaseSensitive; } /** * Gets the JDKVersion attribute of the OS class * * @return The JDKVersion value */ public static int getJDKVersion() { return jdkVersion; } /** * Gets the OneDotOne attribute of the OS class * * @return The OneDotOne value */ public static boolean isOneDotOne() { return jdkVersion == JDK1_1; } /** * Gets the OneDotTwo attribute of the OS class * * @return The OneDotTwo value */ public static boolean isOneDotTwo() { return jdkVersion == JDK1_2; } /** * Gets the OneDotThree attribute of the OS class * * @return The OneDotThree value */ public static boolean isOneDotThree() { return jdkVersion == JDK1_3; } /** * Gets the OneDotFour attribute of the OS class * * @return The OneDotFour value */ public static boolean isOneDotFour() { return jdkVersion == JDK1_4; } public static boolean isOneDotFourOrMore() { return jdkVersion >= JDK1_4; } /** * Gets the OneDotThreeOrMore attribute of the OS class * * @return The OneDotThreeOrMore value */ public static boolean isOneDotThreeOrMore() { return jdkVersion >= JDK1_3; } /** * Description of the Method * * @param path Description of Parameter * @exception Exception Description of Exception */ public static void openDocument(String path) throws Exception { if (isWindows2000()) { Runtime.getRuntime().exec(new String[]{"cmd /c start", path}); } else if (isWindows()) { Runtime.getRuntime().exec(new String[]{"start", path}); } else { System.err.println("OS.openDocument() not supported on this platform (" + System.getProperty("os.name")); } } static { String s = System.getProperty("os.name").toLowerCase(); String version = System.getProperty("os.version").toLowerCase(); if ("windows nt".equals(s) && "5.0".equals(version)) { isWindows2000 = true; } else if (s.equals("windows nt")) { isWindowsNT = true; } else if (s.startsWith("windows")) { // win95 or win98 isWindows95 = true; } else if (s.equals("macintosh") || s.equals("macos") || s.equals("mac os") || s.equals("mac os x")) { isMacintosh = true; } else if (s.equals("sunos") || s.equals("solaris")) { isSolaris = true; isCaseSensitive = true; } else if (s.equals("linux")) { isLinux = true; isCaseSensitive = true; } } // JDK version static { try { Class.forName("java.lang.ref.WeakReference"); jdkVersion = JDK1_2; } catch (Exception e) { } try { Class.forName("javax.swing.UIDefaults$LazyInputMap"); jdkVersion = JDK1_3; } catch (Exception e) { } try { Class.forName("java.lang.CharSequence"); jdkVersion = JDK1_4; } catch (Exception e) { } } } skinlf-6.7/src/com/l2fprod/util/StringUtils.java0000644000175000017500000000772110460410014021633 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; import java.util.StringTokenizer; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class StringUtils { /** * Description of the Method * * @param txt Description of Parameter * @param from Description of Parameter * @param to Description of Parameter * @return Description of the Returned Value */ public static String replace(String txt, String from, String to) { int index = txt.indexOf(from); if (index != -1) { txt = txt.substring(0, index) + to + replace(txt.substring(index + from.length()), from, to); } return txt; } /** * Description of the Method * * @param s Description of Parameter * @param delim Description of Parameter * @return Description of the Returned Value */ public static String[] splitString(String s, String delim) { StringTokenizer token = new StringTokenizer(s, delim); String[] split = new String[token.countTokens()]; int i = 0; while (token.hasMoreTokens()) { split[i] = token.nextToken(); i++; } return split; } /** * Description of the Method * * @param s Description of Parameter * @param length Description of Parameter * @param c Description of Parameter * @return Description of the Returned Value */ public static String format(String s, int length, char c) { int len = s.length(); if (len >= length) { return s; } while (len < length) { s += c; len++; } return s; } } skinlf-6.7/src/com/l2fprod/util/WeakImageIcon.java0000644000175000017500000000223610460410014022003 0ustar twernertwerner/** * Skin Look And Feel 6.7 License. * * Copyright 2000-2006 L2FProd.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.l2fprod.util; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.image.ImageObserver; import javax.swing.ImageIcon; class WeakImageIcon extends ImageIcon { public WeakImageIcon(Image image) { super(image); } public synchronized void paintIcon(Component c, Graphics g, int x, int y) { ImageObserver observer = getImageObserver(); if (observer == null) { g.drawImage(getImage(), x, y, null); } else { g.drawImage(getImage(), x, y, null); } } } skinlf-6.7/src/com/l2fprod/util/WindowUtils.java0000644000175000017500000001121410460410014021624 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 com.l2fprod.util; import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLayeredPane; import javax.swing.JRootPane; import com.l2fprod.gui.plaf.skin.SkinTitlePane; import com.l2fprod.gui.plaf.skin.SkinWindowButton; /** * @author $Author: zombi $ * @created 27 avril 2002 * @version $Revision: 1.2 $, $Date: 2005/07/02 21:47:29 $ */ public class WindowUtils { /** * Description of the Method * * @param w Description of Parameter */ public static void centerOnScreen(Window w) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = w.getSize(); w.setLocation((screenSize.width - size.width) / 2, (screenSize.height - size.height) / 2); } /** * Description of the Method * * @param w Description of Parameter * @param x Description of Parameter * @param y Description of Parameter */ public static void sizeTo(Window w, double x, double y) { Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); w.setSize((int) (size.width * x), (int) (size.height * y)); } public static JButton getWindowButton(JFrame window, String name) { return getWindowButton(window.getRootPane(), name); } public static JButton getWindowButton(JDialog window, String name) { return getWindowButton(window.getRootPane(), name); } public static JButton getWindowButton(JRootPane rootPane, String name) { JLayeredPane jlp = rootPane.getLayeredPane(); for (int i=0;i * It takes the path to an image as first argument. * Based on JDK 1.2.2 Clock2 demo. * * @author fred */ public class Clock extends Component implements Runnable { Image backgroundImage; Thread timer; // The thread that displays clock int lastxs, lastys, lastxm, lastym, lastxh, lastyh; // Dimensions used to draw hands Date currentDate; // Used to get date to display Color handColor; // Color of main hands and dial Color numberColor; // Color of second hand and numbers public Clock(Image back) throws Exception { backgroundImage = back; lastxs = lastys = lastxm = lastym = lastxh = lastyh = 0; currentDate = new Date(); handColor = Color.blue; numberColor = Color.darkGray; setSize(backgroundImage.getWidth(this), backgroundImage.getHeight(this)); } // Paint is the main part of the program public void paint(Graphics g) { // draw the background g.drawImage(backgroundImage, 0, 0, this); int width = getWidth(); int height = getHeight(); int xh, yh, xm, ym, xs, ys, s = 0, m = 10, h = 10, xcenter, ycenter; currentDate = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("s",Locale.getDefault()); try { s = Integer.parseInt(formatter.format(currentDate)); } catch (NumberFormatException n) { s = 0; } formatter.applyPattern("m"); try { m = Integer.parseInt(formatter.format(currentDate)); } catch (NumberFormatException n) { m = 10; } formatter.applyPattern("h"); try { h = Integer.parseInt(formatter.format(currentDate)); } catch (NumberFormatException n) { h = 10; } formatter.applyPattern("EEE MMM dd HH:mm:ss yyyy"); xcenter = width / 2; ycenter = height / 2; // a= s* pi/2 - pi/2 (to switch 0,0 from 3:00 to 12:00) // x = r(cos a) + xcenter, y = r(sin a) + ycenter xs = (int)(Math.cos(s * 3.14f/30 - 3.14f/2) * 45 + xcenter); ys = (int)(Math.sin(s * 3.14f/30 - 3.14f/2) * 45 + ycenter); xm = (int)(Math.cos(m * 3.14f/30 - 3.14f/2) * 40 + xcenter); ym = (int)(Math.sin(m * 3.14f/30 - 3.14f/2) * 40 + ycenter); xh = (int)(Math.cos((h*30 + m/2) * 3.14f/180 - 3.14f/2) * 30 + xcenter); yh = (int)(Math.sin((h*30 + m/2) * 3.14f/180 - 3.14f/2) * 30 + ycenter); // Erase if necessary, and redraw g.setColor(getBackground()); if (xs != lastxs || ys != lastys) { g.drawLine(xcenter, ycenter, lastxs, lastys); } if (xm != lastxm || ym != lastym) { g.drawLine(xcenter, ycenter-1, lastxm, lastym); g.drawLine(xcenter-1, ycenter, lastxm, lastym); } if (xh != lastxh || yh != lastyh) { g.drawLine(xcenter, ycenter-1, lastxh, lastyh); g.drawLine(xcenter-1, ycenter, lastxh, lastyh); } g.setColor(handColor); g.drawLine(xcenter, ycenter, xs, ys); g.drawLine(xcenter, ycenter-1, xm, ym); g.drawLine(xcenter-1, ycenter, xm, ym); g.drawLine(xcenter, ycenter-1, xh, yh); g.drawLine(xcenter-1, ycenter, xh, yh); lastxs=xs; lastys=ys; lastxm=xm; lastym=ym; lastxh=xh; lastyh=yh; currentDate=null; } public void start() { timer = new Thread(this); timer.start(); } public void stop() { timer = null; } public void run() { Thread me = Thread.currentThread(); while (timer == me) { try { Thread.sleep(500); } catch (InterruptedException e) { } repaint(); } } public void update(Graphics g) { paint(g); } public static void main(String[] args) throws Exception { // Create a window which will hold our clock final Window window = new Window(new Frame()) { public void setVisible(boolean b) { System.out.println(b); super.setVisible(b); } public void pack() { } }; window.setLayout(new BorderLayout()); // Load the clock image Image back; if (args[0].startsWith("http://")) { back = Toolkit.getDefaultToolkit().getImage(new URL(args[0])); } else { back = Toolkit.getDefaultToolkit().getImage(args[0]); } try { MediaTracker tracker = new MediaTracker(window); tracker.addImage(back, 0); tracker.waitForAll(); } catch (InterruptedException e) { } // Create a new clock final Clock clock = new Clock(back); // start animate the ticks clock.start(); // put the clock in the window and resize window.add("Center", clock); window.setSize(clock.getSize()); // create an ImageRegion from the background image // so we can use a rounded clock ImageRegion region = new ImageRegion(back); NativeSkin.getInstance().setWindowRegion(window, region, true); // A clock should always be on top of other windows NativeSkin.getInstance().setAlwaysOnTop(window, true); // but transparent so you can see through NativeSkin.getInstance().setWindowTransparency(window, 127); // Add a PopupMenu to switch transparency and quit the clock final PopupMenu popup = new PopupMenu(); for (int i = 0; i < 100; i = i + 10) { final int t = i; MenuItem item = new MenuItem(i + "%"); popup.add(item); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { int transparency = (int)(255 * ((double)(100 - t) / (double)100)); NativeSkin.getInstance().setWindowTransparency(window, transparency); NativeSkin.getInstance().setAlwaysOnTop(window, true); } }; item.addActionListener(listener); } popup.addSeparator(); popup.add(new MenuItem("Exit")). addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); clock.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent event) { if (event.isPopupTrigger()) { popup.show(clock, event.getX(), event.getY()); } } }); clock.add(popup); // Add a listener to move the window around WindowMover mover = new WindowMover(window); clock.addMouseListener(mover); clock.addMouseMotionListener(mover); // finally show the clock. window.show(); } static class WindowMover extends MouseAdapter implements MouseMotionListener { int clickX, clickY; Window window; public WindowMover(Window w) { window = w; } public void mousePressed(MouseEvent event) { clickX = event.getX(); clickY = event.getY(); } public void mouseDragged(MouseEvent event) { int dX = event.getX() - clickX; int dY = event.getY() - clickY; window.setLocation(window.getX() + dX, window.getY() + dY); } public void mouseMoved(MouseEvent event) { } } } skinlf-6.7/src/examples/NativeSplashScreen.java0000644000175000017500000001350710460410014021617 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 examples; import javax.swing.*; import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import com.l2fprod.gui.region.*; import com.l2fprod.gui.nativeskin.*; /** * NativeSplashScreen. * A SkinRegion demo */ public class NativeSplashScreen extends Window implements KeyListener, MouseListener, ActionListener { public NativeSplashScreen(Frame parent, ImageIcon icon, int timeout) { super(parent); setLayout(new BorderLayout()); JLayeredPane layer = new JLayeredPane(); JLabel picture = new JLabel(icon); layer.add(picture, JLayeredPane.DEFAULT_LAYER); layer.setPreferredSize(picture.getPreferredSize()); picture.setSize(picture.getPreferredSize()); add("Center", layer); // only use the region if it is supported by the platform if (NativeSkin.isSupported()) { // get the Region builder final NativeSkin builder = NativeSkin.getInstance(); // create a region object from the icon image Region region = builder.createRegion(icon.getImage()); // set the Region to the window builder.setWindowRegion(this, region, true); builder.setAlwaysOnTop(this, true); final JSlider slider = new JSlider(10, 255); layer.add(slider, JLayeredPane.PALETTE_LAYER); slider.setMajorTickSpacing(20); slider.setSnapToTicks(true); slider.setBounds(327, 147, 150, 20); slider.setOpaque(false); slider.setDoubleBuffered(false); builder.setWindowTransparency(NativeSplashScreen.this, slider.getValue()); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { builder.setWindowTransparency(NativeSplashScreen.this, slider.getValue()); } }); } else { System.err.println("NativeSkin not supported on this platform"); } pack(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((screen.width - getWidth())/2, (screen.height - getHeight())/2); // Listen for key strokes addKeyListener(this); // Listen for mouse events from here and parent addMouseListener(this); if (parent != null) { parent.addMouseListener(this); } // Timeout after a while Timer timer = new Timer(0, this); timer.setRepeats(false); timer.setInitialDelay(timeout); timer.start(); } public synchronized void block() { while(isVisible()) { try { wait(5); } catch (Exception e) { } } } public void setVisible(boolean b) { if (!b) { NativeSkin.getInstance().setWindowTransparency(this, 255); } super.setVisible(b); } // Dismiss the window on a key press public void keyTyped(KeyEvent event) {} public void keyReleased(KeyEvent event) {} public void keyPressed(KeyEvent event) { setVisible(false); dispose(); } // Dismiss the window on a mouse click public void mousePressed(MouseEvent event) {} public void mouseReleased(MouseEvent event) {} public void mouseEntered(MouseEvent event) {} public void mouseExited(MouseEvent event) {} public void mouseClicked(MouseEvent event) { setVisible(false); dispose(); } // Dismiss the window on a timeout public void actionPerformed(ActionEvent event) { setVisible(false); dispose(); } } skinlf-6.7/src/examples/SimpleApplet.java0000644000175000017500000000657610460410012020463 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 examples; import com.l2fprod.gui.SkinApplet; import java.awt.BorderLayout; import javax.swing.*; /** * SimpleApplet.
    * An applet showing how to set the Skin Look And Feel using a themepack * provided as an applet parameter or using the themepack bundled in the applet * jar file. * * @author fred * @created 27 avril 2002 */ public class SimpleApplet extends SkinApplet { /** * Constructor for the SimpleApplet object */ public SimpleApplet() { } /** * The init() method is called by the Applet container (appletviewer,java * plugin,...). In this method, we will set up the look and feel and tries to * load a theme pack */ public void init() { try { initSkin(THEMEPACK_TAG); createUI(); } catch (Exception e) { e.printStackTrace(); } } /** * Description of the Method */ public void createUI() { getContentPane().setLayout(new BorderLayout(3, 3)); getContentPane().add("Center", new JButton("Congratulations !")); } } skinlf-6.7/src/examples/VerticalLayout.java0000644000175000017500000001165310460410014021025 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 examples; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager; /** * Description of the Class * * @author fred * @created 27 avril 2002 */ public class VerticalLayout implements LayoutManager { int gap = 0; /** * Constructor for the VerticalLayout object */ public VerticalLayout() { } /** * Constructor for the VerticalLayout object * * @param gap Description of Parameter */ public VerticalLayout(int gap) { this.gap = gap; } /** * Adds a feature to the LayoutComponent attribute of the VerticalLayout * object * * @param name The feature to be added to the LayoutComponent attribute * @param c The feature to be added to the LayoutComponent attribute */ public void addLayoutComponent(String name, Component c) { } /** * Description of the Method * * @param parent Description of Parameter */ public void layoutContainer(Container parent) { Insets insets = parent.getInsets(); Dimension size = parent.getSize(); int width = size.width - insets.left - insets.right; int height = insets.top; for (int i = 0, c = parent.getComponentCount(); i < c; i++) { Component m = parent.getComponent(i); if (m.isVisible()) { m.setBounds(insets.left, height, width, m.getPreferredSize().height); height += m.getSize().height + gap; } } } /** * Description of the Method * * @param parent Description of Parameter * @return Description of the Returned Value */ public Dimension minimumLayoutSize(Container parent) { return preferredLayoutSize(parent); } /** * Description of the Method * * @param parent Description of Parameter * @return Description of the Returned Value */ public Dimension preferredLayoutSize(Container parent) { Insets insets = parent.getInsets(); Dimension pref = new Dimension(0, 0); for (int i = 0, c = parent.getComponentCount(); i < c; i++) { Component m = parent.getComponent(i); if (m.isVisible()) { pref.height += parent.getComponent(i).getPreferredSize().height + gap; pref.width = Math.max(pref.width, parent.getComponent(i).getPreferredSize().width); } } pref.height += insets.top + insets.bottom; return pref; } /** * Description of the Method * * @param c Description of Parameter */ public void removeLayoutComponent(Component c) { } } skinlf-6.7/src/examples/alwaysontop.java0000644000175000017500000000613710460410012020435 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 examples; import java.awt.*; import java.awt.event.*; import com.l2fprod.gui.nativeskin.NativeSkin; /** * Always On top demo.
    * * @author fred * @created 27 avril 2002 */ public class alwaysontop { public static void main(String[] args) { final Frame frame = new Frame("Always On Top test"); frame.setLayout(new BorderLayout()); final Checkbox check = new Checkbox("Check to make this window always on top"); check.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { NativeSkin.getInstance().setAlwaysOnTop(frame, check.getState()); } }); frame.add("Center", check); frame.pack(); frame.setLocation(100, 100); frame.show(); } } skinlf-6.7/src/examples/demo.java0000644000175000017500000001354710460410014017006 0ustar twernertwerner/* * ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: 1. * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. 2. 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. 3. The end-user documentation * included with the redistribution, if any, must include the following * acknowlegement: "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." Alternately, this acknowlegement may appear in * the software itself, if and wherever such third-party acknowlegements * normally appear. 4. The names "Skin Look And Feel", "SkinLF" and * "L2FProd.com" must not be used to endorse or promote products derived from * this software without prior written permission. For written permission, * please contact info@L2FProd.com. 5. Products derived from this software may * not be called "SkinLF" nor may "SkinLF" appear in their names without prior * written permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 * L2FPROD.COM OR ITS 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 examples; import com.l2fprod.gui.plaf.skin.Skin; import com.l2fprod.gui.plaf.skin.SkinLookAndFeel; import com.l2fprod.util.OS; import com.l2fprod.util.WindowUtils; import java.awt.BorderLayout; import java.awt.Image; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import javax.swing.ImageIcon; import javax.swing.JApplet; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.MetalTheme; /** * Skin Look And Feel Demo.
    Provides information on how to use Skin Look * And Feel * * @author fred @created 27 avril 2002 */ public class demo extends JApplet { /** * Constructor for the demo object */ public demo() { } /** * Description of the Method * * @param themes Description of Parameter */ public void createUI(String[] themes) { getContentPane().setLayout(new BorderLayout(3, 3)); getContentPane().add("Center", new demoPanel(themes)); } /** * main method. * * @param args the list of theme packs available for this demo * @exception Exception Description of Exception */ public static void main(String[] args) throws Exception { if (args.length > 0) { String themepack = args[0]; if (themepack.endsWith(".xml")) { SkinLookAndFeel.setSkin( SkinLookAndFeel.loadThemePackDefinition(new File(args[0]).toURL())); UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); } else if (themepack.startsWith("class:")) { String classname = themepack.substring("class:".length()); SkinLookAndFeel.setSkin((Skin)Class.forName(classname).newInstance()); UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); } else if (themepack.startsWith("theme:")) { String classname = themepack.substring("theme:".length()); MetalTheme theme = (MetalTheme)Class.forName(classname).newInstance(); MetalLookAndFeel metal = new MetalLookAndFeel(); MetalLookAndFeel.setCurrentTheme(theme); UIManager.setLookAndFeel(metal); } else { SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(args[0])); UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel"); } } demo d = new demo(); d.createUI(args); // if we are running with JDK1.4 decorates the frames and dialogs if (OS.isOneDotFourOrMore()) { java.lang.reflect.Method method = JFrame.class.getMethod( "setDefaultLookAndFeelDecorated", new Class[] { boolean.class }); method.invoke(null, new Object[] { Boolean.TRUE }); method = JDialog.class.getMethod( "setDefaultLookAndFeelDecorated", new Class[] { boolean.class }); method.invoke(null, new Object[] { Boolean.TRUE }); } Image frameIcon = new ImageIcon(demo.class.getResource("windowicon.gif")).getImage(); // so option pane as same icon as us JOptionPane.getRootFrame().setIconImage(frameIcon); JFrame f = new JFrame("Skin Look And Feel " + SkinLookAndFeel.version()); f.setIconImage(frameIcon); f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add("Center", d); f.pack(); WindowUtils.centerOnScreen(f); f.setVisible(true); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { System.exit(0); } }); } } skinlf-6.7/src/examples/demoPanel.java0000644000175000017500000006546310460410014017772 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 examples; import com.l2fprod.gui.plaf.skin.SkinLookAndFeel; import com.l2fprod.util.AccessUtils; import com.l2fprod.util.OS; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyVetoException; import java.beans.VetoableChangeListener; import java.util.Enumeration; import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; /** * Simple Test Panel for a Look And Feel * * @author $Author: l2fprod $ * @created 27 avril 2002 * @version $Revision: 1.12 $, $Date: 2006/07/22 11:41:19 $ */ public class demoPanel extends JPanel { demoWelcome m_Welcome; /** * Constructor for the demoPanel object * * @param themes Description of Parameter */ public demoPanel(String[] themes) { setLayout(new BorderLayout(3, 3)); // Create the menu bar JMenuBar menubar = new JMenuBar(); JMenu menu = new JMenu("File"); menu.setMnemonic('f'); menu.add(new JMenuItem("Save")); menu.add( new AbstractAction("Open") { public void actionPerformed(ActionEvent event) { try { // are we running in JavaWebStart? Class serviceClass = Class.forName("javax.jnlp.ServiceManager"); Object fileOpenService = serviceClass. getMethod("lookup", new Class[]{String.class}). invoke(null, new Object[]{"javax.jnlp.FileOpenService"}); fileOpenService.getClass(). getMethod("openFileDialog", new Class[]{String.class, String[].class}). invoke(fileOpenService, new Object[]{null, null}); } catch (Exception e) { System.err.println("Error trying JavaWebStart, will default to JFileChooser:" + e.getMessage()); JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); if (JFileChooser.APPROVE_OPTION==chooser.showDialog(demoPanel.this, "Ok")) { JOptionPane.showMessageDialog(demoPanel.this, "You selected " + chooser.getSelectedFile()); } else { JOptionPane.showMessageDialog(demoPanel.this, "You pressed Cancel"); } } } }); menu.addSeparator(); JMenuItem item = new JMenuItem("Exit"); item.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { exit(); } }); menu.add(item); menubar.add(menu); menu = new JMenu("Edit"); menu.setMnemonic('e'); menu.add(new JCheckBoxMenuItem("CheckBoxMenu Item (selected)", true)); menu.add(new JCheckBoxMenuItem("CheckBoxMenu Item (unselected)")); menu.addSeparator(); menu.add(new JCheckBoxMenuItem("CheckBoxMenu Item (disabled/selected)", true)).setEnabled(false); menu.add(new JCheckBoxMenuItem("CheckBoxMenu Item (disabled/unselected)")).setEnabled(false); menu.addSeparator(); menu.add(new JRadioButtonMenuItem("RadioButtonMenu Item (selected)", true)); menu.add(new JRadioButtonMenuItem("RadioButtonMenu Item (unselected)")); menu.addSeparator(); menu.add(new JRadioButtonMenuItem("RadioButtonMenu Item (disabled/selected)", true)).setEnabled(false); menu.add(new JRadioButtonMenuItem("RadioButtonMenu Item (disabled/unselected)")).setEnabled(false); menubar.add(menu); add("North", menubar); JPanel buttonPane = new JPanel(new VerticalLayout(3)); JButton button = new JButton("Rollover"); ButtonModel model = new DefaultButtonModel() { public boolean isSelected() { return true; } public boolean isRollover() { return true; } }; button.setModel(model); buttonPane.add(button); buttonPane.add(button = new JButton("Normal")); button.setBackground(Color.green); button = new JButton("Pressed"); button.setForeground(Color.red); model = new DefaultButtonModel() { public boolean isPressed() { return true; } public boolean isArmed() { return true; } public boolean isSelected() { return true; } }; button.setModel(model); buttonPane.add(button); button = new JButton("Disabled"); button.setEnabled(false); buttonPane.add(button); buttonPane.add(new JButton("With HTML")); JPanel common = new JPanel(new GridLayout(5, 2)); JCheckBox check = new JCheckBox("Check", true); common.add(check); JRadioButton select = new JRadioButton("Select", true); common.add(select); check = new JCheckBox("Check box
    with
    multiple lines", false); check.setBackground(Color.red); common.add(check); select = new JRadioButton("Select", false); common.add(select); check = new JCheckBox("Check", true); check.setEnabled(false); common.add(check); select = new JRadioButton("Select", true); select.setEnabled(false); common.add(select); check = new JCheckBox("Check", false); check.setEnabled(false); common.add(check); select = new JRadioButton("Select", false); select.setEnabled(false); common.add(select); ButtonGroup toggleGroup = new ButtonGroup(); JToggleButton toggle = new JToggleButton("Standard Toggle", true); common.add(toggle); toggleGroup.add(toggle); toggle = new JToggleButton("WithHTML"); common.add(toggle); toggleGroup.add(toggle); JPanel grid = new JPanel(new GridLayout(OS.isOneDotFour()?3:2, 1)); // add the progress bar with indeterminate state if JDK1.4 if (OS.isOneDotFour()) { JProgressBar indeterminate = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100); AccessUtils.invoke(indeterminate, "setIndeterminate", new Class[]{boolean.class}, new Object[]{Boolean.TRUE}); grid.add(indeterminate); } JProgressBar progress = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100); progress.setValue(75); progress.setPreferredSize(new Dimension(10, 25)); JSlider slider = new JSlider(progress.getModel()); slider.setPaintTicks(true); grid.add(progress); grid.add(slider); JPanel mainPane = new BasePanel(new BorderLayout(3, 3)); mainPane.add("North", new MemoryPanel()); mainPane.add("Center", common); mainPane.add("South", grid); mainPane.add("East", buttonPane); mainPane.setBorder(new EmptyBorder(10, 10, 10, 10)); final JTabbedPane tabs = new JTabbedPane(); tabs.addTab("SkinLF", m_Welcome = new demoWelcome(themes)); tabs.addTab("Common", mainPane); tabs.addTab("Unselected", new BasePanel(new JScrollPane(new JTree()))); tabs.addTab("Disabled", new JPanel()); tabs.addTab("InternalFrame", new InternalTest()); tabs.addTab("TextComponent", new TextTest()); tabs.addTab("Combo and List", new ComboList()); tabs.addTab("Table", new TablePanel()); tabs.addTab("List", new ListPanel()); tabs.addTab("Split", new SplitTest()); tabs.addTab("Chooser", new ChooserPanel()); tabs.setEnabledAt(3, false); JMenu tabPlacement = new JMenu("Tab Placement"); tabPlacement.setMnemonic('t'); tabPlacement.add( new AbstractAction("TOP") { public void actionPerformed(ActionEvent event) { tabs.setTabPlacement(JTabbedPane.TOP); } }); tabPlacement.add( new AbstractAction("BOTTOM") { public void actionPerformed(ActionEvent event) { tabs.setTabPlacement(JTabbedPane.BOTTOM); } }); tabPlacement.add( new AbstractAction("LEFT") { public void actionPerformed(ActionEvent event) { tabs.setTabPlacement(JTabbedPane.LEFT); } }); tabPlacement.add( new AbstractAction("RIGHT") { public void actionPerformed(ActionEvent event) { tabs.setTabPlacement(JTabbedPane.RIGHT); } }); menubar.add(tabPlacement); add("Center", tabs); JScrollBar hsb = new JScrollBar(JScrollBar.HORIZONTAL, 50, 20, 0, 100); add("South", hsb); JScrollBar vsb = new JScrollBar(JScrollBar.VERTICAL, 50, 20, 0, 100); add("East", vsb); JProgressBar vprogress = new JProgressBar(JProgressBar.VERTICAL, 0, 100); vprogress.setModel(progress.getModel()); vprogress.setPreferredSize(new Dimension(25, 10)); add("West", vprogress); menu = new JMenu("Help"); menu.setMnemonic('h'); menu.setToolTipText("Show the help!"); menu.add( new AbstractAction("About " + SkinLookAndFeel.version()) { public void actionPerformed(ActionEvent event) { JOptionPane.showMessageDialog(demoPanel.this, "SkinLookAndFeel " + SkinLookAndFeel.version() + " build " + SkinLookAndFeel.date() + "\n" + "(c) 2000-2006 L2FProd.com"); } }); menubar.add(menu); } /** * Description of the Method */ void exit() { System.exit(0); } final static Border EMPTY_BORDER = new EmptyBorder(4,4,4,4); static class BasePanel extends JPanel { public BasePanel() { super(); setBorder(EMPTY_BORDER); } public BasePanel(LayoutManager p_Layout) { super(p_Layout); setBorder(EMPTY_BORDER); } public BasePanel(Component c) { this(new BorderLayout()); add("Center", c); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ static class MemoryPanel extends JPanel { /** * Constructor for the MemoryPanel object */ MemoryPanel() { setLayout(new FlowLayout(FlowLayout.LEFT)); JButton b = new JButton("gc()"); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { Runtime.getRuntime().gc(); } }); add(b); final JLabel memory; add(memory = new JLabel(" ")); Timer t = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent event) { memory.setText(" Free: " + Runtime.getRuntime().freeMemory() + " Total: " + Runtime.getRuntime().totalMemory()); } }); t.setRepeats(true); t.start(); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ static class SplitTest extends BasePanel { /** * Constructor for the SplitTest object */ SplitTest() { setLayout(new BorderLayout()); JButton button; final JSplitPane innerSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(new JTree()), button = new JButton("Split!")); final JSplitPane split1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(new JTree()), innerSplit); add("Center", split1); innerSplit.setBorder(null); split1.setBorder(null); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { innerSplit.setOneTouchExpandable(!innerSplit.isOneTouchExpandable()); split1.setOneTouchExpandable(!split1.isOneTouchExpandable()); } }); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ static class InternalTest extends BasePanel { /** * Constructor for the InternalTest object */ InternalTest() { setLayout(new BorderLayout()); JDesktopPane desk = new JDesktopPane(); add("Center", new JScrollPane(desk)); desk.putClientProperty("JDesktopPane.backgroundEnabled", Boolean.TRUE); desk.putClientProperty("JDesktopPane.dragMode", "faster"); JInternalFrame frame = new JInternalFrame("A Frame (DO_NOTHING_ON_CLOSE)", true, true, true, true); frame.getContentPane().add(new JScrollPane(new JTree())); frame.setVisible(true); frame.setSize(200, 100); frame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); frame.addVetoableChangeListener( new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException { if (event.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY) && Boolean.TRUE.equals(event.getNewValue())) { JOptionPane.showMessageDialog((JInternalFrame) event.getSource(), "You can veto Frame Closing here!"); throw new PropertyVetoException("don't close!", event); } // end of if (event.getPropertyName().equals() } }); desk.add(frame); // // this frame has a workaround for a bug in Swing where setIconifiable does not fire any event // until JDK1.4 // final JInternalFrame frame2 = new JInternalFrame("An other Frame", true, true, true, true) { public void setIconifiable(boolean b) { if (OS.isOneDotFour()) { super.setIconifiable(b); } else { Boolean oldValue = isIconifiable() ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; super.setIconifiable(b); this.firePropertyChange("iconable", oldValue, newValue); } } }; frame2.getContentPane().setLayout(new GridLayout(3, 1)); JButton button = new JButton("Toggle closable"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { frame2.setClosable(!frame2.isClosable()); } }); frame2.getContentPane().add(button); button = new JButton("Toggle iconifiable"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { frame2.setIconifiable(!frame2.isIconifiable()); } }); frame2.getContentPane().add(button); frame2.setMaximizable(false); frame2.setVisible(true); frame2.setSize(200, 200); frame2.setLocation(50, 50); desk.add(frame2); JInternalFrame frame3 = new JInternalFrame("Not iconifiable", true, true, true, false); frame3.setIconifiable(false); frame3.setSize(200, 200); frame3.setLocation(75, 75); frame3.setVisible(true); desk.add(frame3); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ static class TextTest extends BasePanel { /** * Constructor for the TextTest object */ TextTest() { setLayout(new VerticalLayout()); add(new JLabel("This is a testbed for the key bindinds")); add(new JLabel("JTextField:")); add(new JTextField("please try the key bindings")); add(new JLabel("JPasswordField:")); add(new JPasswordField()); JScrollPane scroll; add(new JLabel("JTextArea:")); add(scroll = new JScrollPane(new JTextArea("please try the key bindings\nthis is skin look and feel", 4, 50))); scroll.setPreferredSize(new Dimension(100, 60)); add(new JLabel("JTextPane:")); add(scroll = new JScrollPane(new JTextPane())); scroll.setPreferredSize(new Dimension(100, 60)); add(new JLabel("JEditorPane:")); add(scroll = new JScrollPane(new JEditorPane())); scroll.setPreferredSize(new Dimension(100, 60)); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ static class TablePanel extends BasePanel { /** * Constructor for the TablePanel object */ TablePanel() { setLayout(new BorderLayout()); JTable table = new JTable( new AbstractTableModel() { public int getRowCount() { return 50000; } public int getColumnCount() { return 5; } public Object getValueAt(int row, int column) { if (column == 1) { return new Integer((int)(((double)100 * row) / getRowCount())); } else { return new Integer(row * column); } } }); add("Center", new JScrollPane(table)); table.getColumnModel().getColumn(1).setCellRenderer(new JProgressBarCellRenderer()); // here is an example of overriding the default table cellrenderer to provide a custom one while reusing // while reusing the skin tablecellrenderer final Icon arrowIcon = new Icon() { public int getIconWidth() { return 10; } public int getIconHeight() { return 10; } public void paintIcon(Component c, Graphics g, int x, int y) { Color oldColor = g.getColor(); g.setColor(Color.black); g.drawRect(x, y, 10, 10); g.setColor(oldColor); } }; TableCellRenderer headerRenderer = new TableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { DefaultTableCellRenderer c = (DefaultTableCellRenderer) SkinLookAndFeel.getSkin().getPersonality().createTableHeaderRenderer(); c.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (column == 0) { c.setForeground(Color.red); c.setIcon(arrowIcon); } else { c.setIcon(null); } return c; } }; Enumeration enumeration = table.getColumnModel().getColumns(); while (enumeration.hasMoreElements()) { TableColumn aColumn = (TableColumn) enumeration.nextElement(); aColumn.setHeaderRenderer(headerRenderer); } table.getTableHeader().setReorderingAllowed(false); } } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ static class ComboList extends BasePanel { /** * Constructor for the ComboList object */ ComboList() { setLayout(new VerticalLayout()); add(new JLabel("Normal ComboBox:")); add(new JComboBox(new String[]{"1", "2", "4", "8"})); JComboBox disabled = new JComboBox(new String[]{"1", "2", "4", "8"}); disabled.setEnabled(false); add(new JLabel("Disabled ComboBox")); add(disabled); add(new JLabel("Editable ComboBox")); final JComboBox editable = new JComboBox(new String[]{"1", "2", "4", "8"}); // editable.setEditable(true); add(editable); JButton b = new JButton("Toggle Editable"); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { editable.setEditable(!editable.isEditable()); } }); add(b); class FontCellRenderer extends DefaultListCellRenderer { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String fontName = ((Font)value).getFontName(); return super.getListCellRendererComponent(list, fontName, index, isSelected, cellHasFocus); } }; JComboBox fonts = new JComboBox(GraphicsEnvironment.getLocalGraphicsEnvironment(). getAllFonts()); FontCellRenderer render = new FontCellRenderer(); fonts.setOpaque(false); fonts.setRenderer(render); add(fonts); // JDK1.4 only try { add((JComponent) Class.forName("javax.swing.JSpinner").newInstance()); } catch (Exception e) { } } } static class ListPanel extends BasePanel { ListPanel() { setLayout(new BorderLayout()); ListModel model = new AbstractListModel() { public Object getElementAt(int index) { return new Integer((int)(((double)100 * index) / getSize())); } public int getSize() { return 10; } }; JList list = new JList(model); list.setCellRenderer(new ListComponentRenderer()); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setFixedCellWidth(272); list.setFixedCellHeight(21); JScrollPane listScrollPane = new JScrollPane(list); add("Center", listScrollPane); } } static class ListComponentRenderer extends BasePanel implements ListCellRenderer { JProgressBar progBar; public ListComponentRenderer() { // Configure this setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(2, 2, 2, 2))); setOpaque(true); // Configure progBar progBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100); progBar.setBorder(BorderFactory.createRaisedBevelBorder()); progBar.setPreferredSize(new Dimension(100, 15)); progBar.setMinimumSize(new Dimension(100, 15)); progBar.setMaximumSize(new Dimension(100, 15)); progBar.setValue(0); add(new JLabel("Fixed Size Label")); add(progBar); } /** * Comply with ListCellRenderer Interface * @param list the JList doing the renderering * @param value object being rendered * @param index cell index * @param isSelected is selected * @param cellHasFocus cell has focus? * @return Component to render */ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { progBar.setValue(((Integer)value).intValue()); setBackground(isSelected ? Color.red : Color.white); setForeground(isSelected ? Color.white : Color.black); return this; } } static class JProgressBarCellRenderer extends JProgressBar implements TableCellRenderer { public JProgressBarCellRenderer() { super(); Dimension progressSize = new Dimension(50, 8); setMaximumSize(progressSize); setPreferredSize(progressSize); setMinimumSize(progressSize); } public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { setBackground(list.getBackground()); handleValue(value); return this; } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { setBackground(tree.getBackground()); handleValue(value); return this; } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { setBackground(table.getBackground()); handleValue(value); return this; } /** * Called by getListCellRendererComponent, getTreeCellRendererComponent, getTableCellRendererComponent to render the value. * The default implementation checks the type of value and sets the model or the value correctly. * * @param value an Object value */ protected void handleValue(Object value) { if (value instanceof BoundedRangeModel) { setModel((BoundedRangeModel)value); } else { setValue(((Integer)value).intValue()); } } } static class ChooserPanel extends BasePanel { public ChooserPanel() { setLayout(new GridLayout(3, 1)); JButton button = new JButton("Pick a Color"); add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JColorChooser.showDialog(null, "Pick a Color", null); } }); } } } skinlf-6.7/src/examples/demoWelcome.java0000644000175000017500000002105210460410014020310 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 examples; import java.io.File; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import com.l2fprod.gui.plaf.skin.*; /** * demoWelcome.
    * Shows the Welcome screen and the combobox to select a skin. * * @author fred * @created 27 avril 2002 */ public class demoWelcome extends JPanel { JComboBox m_Themes; /** * Constructor for the demoWelcome object * * @param themes Description of Parameter */ public demoWelcome(String[] themes) { setBorder(new EmptyBorder(10, 10, 10, 10)); setLayout(new BorderLayout(10, 10)); JLabel label = new JLabel(new ImageIcon(demoWelcome.class.getResource("skinlfdemo.gif"))); label.setOpaque(true); label.setBackground(Color.black); label.setBorder(new LineBorder(Color.black)); add("West", label); JPanel right = new JPanel(new BorderLayout(3, 3)); add("Center", right); JPanel toolbar = new JPanel(new FlowLayout()); JButton hello = new JButton("Hello"); hello.setToolTipText("Hello!
    Bonjour !
    Ciao !"); hello.setMnemonic('i'); toolbar.add(hello); toolbar.add(new JSeparator(JSeparator.VERTICAL)); toolbar.add(new JButton("World!")); add("North", toolbar); JPanel p = new JPanel(); p.setLayout(new VerticalLayout(3)); JTextArea area = new JTextArea(); area.setWrapStyleWord(true); area.setLineWrap(true); area.setBorder(null); area.setEditable(false); area.setOpaque(false); area.setText("Welcome to Skin Look And Feel " + SkinLookAndFeel.version() + "\n" + "Use the combobox above to test the various themepacks available.\n"); area.setBackground(getBackground()); p.add(area); p.add(new JSeparator()); p.add(new JLabel("Available Themepacks:")); p.add(m_Themes = new JComboBox(themes)); m_Themes.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { setTheme((String) m_Themes.getSelectedItem()); } }); // setTheme(themes[0]); right.add("North", p); right.add("East", new JSeparator(JSeparator.VERTICAL)); // right.add("Center", new VuMeter(15)); } /** * Sets the Theme attribute of the demoWelcome object * * @param selectedItem The new Theme value */ void setTheme(String selectedItem) { try { if (selectedItem.endsWith(".xml")) { SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePackDefinition(SkinUtils.toURL(new File(selectedItem)))); } else { SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(selectedItem)); } UIManager.setLookAndFeel(new SkinLookAndFeel()); Component c = SwingUtilities.getAncestorOfClass(java.awt.Window.class, this); if (c == null) { c = SwingUtilities.getAncestorOfClass(demo.class, this); } if (c != null) { SwingUtilities.updateComponentTreeUI(c); } } catch (Exception e) { e.printStackTrace(); } // end of try-catch } /** * Description of the Class * * @author fred * @created 27 avril 2002 */ static class VuMeter extends JPanel { double[] bars; int[] barDirections; // CellRendererPane cellRenderer = new CellRendererPane(); /** * Constructor for the VuMeter object * * @param barCount Description of Parameter */ public VuMeter(int barCount) { setPreferredSize(new Dimension(100, 100)); setOpaque(true); setBackground(Color.white); setDoubleBuffered(false); bars = new double[barCount]; barDirections = new int[barCount]; Arrays.fill(barDirections, 1); Thread runner = new Thread() { public void run() { while (true) { try { if (VuMeter.this.isVisible()) { VuMeter.this.repaint(); } Thread.sleep(500); } catch (Exception e) { } } } }; runner.start(); runner.setPriority(Thread.MIN_PRIORITY); // add(cellRenderer); } /** * Description of the Method * * @param g Description of Parameter */ protected void paintComponent(Graphics g) { g.setColor(getParent().getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); int w = getWidth() / bars.length; int barHeight; for (int i = 0, c = bars.length; i < c; i++) { double speed = Math.random() * 0.3; bars[i] += (speed * barDirections[i]); if (bars[i] >= 1) { bars[i] = 1; barDirections[i] = -1; } else if (bars[i] <= 0) { bars[i] = 0; barDirections[i] = 1; } barHeight = (int) (getHeight() * bars[i]); paintBar(g, new Rectangle(i * w, getHeight() - barHeight, w - 2, barHeight), new Rectangle(i * w, 0, w - 2, getHeight()), bars[i], barDirections[i]); } } /** * Description of the Method * * @param g Description of Parameter * @param barRect Description of Parameter * @param fullRect Description of Parameter * @param barValue Description of Parameter * @param barDirection Description of Parameter */ protected void paintBar(Graphics g, Rectangle barRect, Rectangle fullRect, double barValue, int barDirection) { //renderer.setValue((int)(barValue * 100)); //cellRenderer.paintComponent(g, renderer, this, fullRect.x, fullRect.y, fullRect.width, fullRect.height); g.setColor(getParent().getBackground().brighter()); g.fillRect(fullRect.x, fullRect.y, fullRect.width, fullRect.height); g.setColor(getParent().getBackground().darker()); g.drawRect(fullRect.x, fullRect.y, fullRect.width, fullRect.height); g.fillRect(barRect.x, barRect.y, barRect.width, barRect.height); } // JProgressBar renderer = new JProgressBar(JProgressBar.VERTICAL); } } skinlf-6.7/src/examples/nativesplash.java0000644000175000017500000000542010460410014020552 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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 examples; import java.awt.*; import javax.swing.*; /** * Skin Region Demo. */ public class nativesplash { public static void main(String[] args) { NativeSplashScreen splash = new NativeSplashScreen(new Frame(), new ImageIcon(nativesplash.class.getResource("skinregiondemo.gif")), 25000); splash.show(); splash.block(); System.exit(0); } } skinlf-6.7/src/Skinit.java0000644000175000017500000000566510460410014015507 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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. * ==================================================================== */ /** * Skinit.
    Skinit is Skin Look And Feel wrapper. It allows you to * start any application with SkinLF. Skinit will prevent the * application to set its own Look And Feel. Once Skin Look And Feel * is set, it can't be removed.
    * * @author fred */ public class Skinit extends com.l2fprod.gui.plaf.skin.Skinit { /** * The main program for the Skinit class * * @param args The command line arguments * @throws Exception Description of Exception */ public static void main(String[] args) throws Exception { com.l2fprod.gui.plaf.skin.Skinit.main(args); } } skinlf-6.7/AUTHORS0000644000175000017500000000013407760155410013665 0ustar twernertwernerproject lead: Frederic Lavigne contributors: Sebastien Martel skinlf-6.7/CHANGES0000644000175000017500000003112310460410034013575 0ustar twernertwernerHistory of Changes What's new in version 6.7 - 22 July 2006 * Updated to LafPlugin 0.2 * Applied patch for threading issue in popupmenu animation * Attempt to reduce memory leak (https://skinlf.dev.java.net/issues/show_bug.cgi?id=7) What's new in version 6.2 - 11 February 2006 * Fix for editable JComboBox * German resource file * Minor fix in NativeSkin, window was 1pixel wider. * Dropped JDK1.3 support in NativeSkin * Better JFileChooser implementation for JDK 1.4 and 1.5 What's new in version 1.2.12 - 9 October 2005 * Fixed an issue with the list renderer used by a ComboBox, background and foreground were not used, renderer was not replaced when switching skins or lookandfeels What's new in version 1.2.11 - 20 February 2005 * Caching of the JFrame iconImage when frame is decorated * Added extra border to ToolTips using HTML * With two overlapping window it is possible to use 100%CPU, and effectively kill the application What's new in version 1.2.10 - 13 August 2004 * Native Skin was broken with JDK 1.3.1 What's new in version 1.2.9 - 29 July 2004 * Potential for lockup when accessing skinlf due to synchronization issue * When using window decoration, the window title bar was not painted differently for inactive windows. The window buttons (close, minimize, maximize) were not using the "disabled" icon of kde themes * in the demo, a call to System.getProperties().put was leading to a SecurityException * If a color was set as the background of a component, it will be used to paint the component. Meaning you can finally change the background of buttons * New property to disable the "Shade" action menu. Use UIManager.put("TitlePane.disableShade", Boolean.TRUE) before applying SkinLF to remove the menu item * Now use native icons for JFileChooser (JDK 1.4 and later) What's new in version 1.2.8 - 7 May 2004 * Removed SkinWindow, JDK1.4 provides better alternative * SkinLookAndFeel.getSkin() looks for the default themepack using "skinlf.themepack" property or ~/.skinlf/themepack.zip or ~/skinlf/themepack.zip or themepack.zip in the classpath. * Deprecated SkinLookAndFeel.enable() * JDialog was not resizable * JDialog window buttons were not correctly updated * JDialog window icon was not using its parent frame icon * JProgressBar has some painting glitches when current value was the minimum value What's new in version 1.2.7 - 23 November 2003 * Added support for indeterminate mode of progress bar in JDK1.4 * Fixed loading of themepacks through HTTPS What's new in version 1.2.6 - 16 November 2003 * Alluminium Alloy Toxic themepack * One more resizing issue with JDK1.4 was left in the code * Dropped JDK1.2 support, SkinLF 1.2.5 is the last version supporting JDK1.2 * Fixed one memory leak when switching skins at runtime (was visible on the demo) * Shaded frame was resizable via the border corners * Decorated frame was not supporting the "shading" feature * With JDK1.4, the InternalFrame buttons were visible even if they are was disabled, a not closable frame had the close button for example What's new in version 1.2.5 - 4 October 2003 * Fix resizing issue with JDK1.4 window decoration * Fix window popup menu with JDK1.4 window decoration is used. Popup was going behind * Updated the demo to allow File open dialogs to be visible in JavaWebStart What's new in version 1.2.4 - 24 August 2003 * Cell shaded themepack * Support for TextComponent, List and Table borders * Added Accelerator in tooltip text * Painting in JOptionPane not proper Fixes bug 600054. * separator image very large in macostheme Fixes bug 599547. * Frame buttons focusable Fixes bug 599365. * Solved : JComboBox arrow problem Fixes bug 544782. * Editable JComboBox has wrong picture Fixes bug 577433. * JSlider causes NullPointerException Fixes bug 602515. * Support for JDK1.4 Window Decoration (old SkinWindow) What's new in version 1.2.3 - 29 July 2002 * NullPointerException after CTRL+SPACE Fixes bug 585981. * NativeSkin does not load for NT4.0 Fixes bug 575196. * opaque JPanel Fixes bug 567924. What's new in version 1.2.2 - 12 June 2002 * JLayeredPane opacity bug Fixes bug 557004. * Shading of InternalFrame in JDK1.4 was resizing the window to 0 pixel in height. * JTable serialization was failing due to GtkPersonality not being serializable. The header renderer is now in its own class, same for GtkListCellRenderer. DefaultButton images have been made transient too Fixes bug 560277. * NativeSkin replaces SkinRegion, no only limited to irregular windows (library name changed too) * Ability to set windows to be always on top (Win32) * Transparency for windows (Win32) What's new in version 1.2.1 - 9 May 2002 * Button rendering sometimes incoherent Fixes bug 511901. * A skinned JToggleButton problem... Fixes bug 511415. * JCheckBox and html Fixes bug 502869. * Buttons with focus don't look different Fixes bug 480094. * Different control for ToolBar/MenuBar Fixes bug 541118. * Problem with Jimi Fixes bug 545514. * Header Renderer Fixes bug 541112. * Scroll Bar handles missing. Fixes bug 541084. * JMenu Background problems Fixes bug 523899. * painting issues when jprogress bar was used as a renderer in table/list * support for SplitPane divider * applied JRefactory on all the code * finally support for JSeparators is there * enhanced themepack properties with integers, strings, borders * SkinRegion now supports JRE1.4 Fixes bug 518030. What's new in version 1.2 - 17 March 2002 * themepacks are now loaded using a ZipResourceLoader. This will help developers load themepacks in applet or javawebstart applications * removed dependency on Jimi package. Now only Gif, JPeg and Png are supported. * alpha transparency for menus What's new in version 1.2beta - 15 November 2001 * fixed table header rendering in JDK1.3 * bottom tabs are calculated by flipping top tabs * improved fix for frame defaultCloseAction Fixes bug 463704. What's new in version 1.2alpha - 22 October 2001 * major memory enhancements by using BufferedImage * fixed color handling for color definition like { 0.4, 0.5, 0.6 } * added space to left of jcombobox * the fix for JTextComponent key bindings was not working properly due to a typo in a classname loaded by Class.forName: Class.forName("javax.swing.UIDefaults.LazyInputMap") should be written as Class.forName("javax.swing.UIDefaults$LazyInputMap"). * JMenu is now painted as a JMenuItem when selected Fixes bug 426708. * DO_NOTHING_ON_CLOSE was not correctly handled due to a bug in JDK1.2. A workaround has been included for JDK1.2/JDK1.3 in skin/Window.java Fixes bug 463704. * If an InternalFrame action is not enabled, it will not be visible in the title bar Fixes bug 470059. What's new in version 1.1 - 14 August 2001 * better support for KDE frameborder, internal frame icons and button layout * in this release, there is no more support for JDK1.1 * gray filter applied to checkboxes and options if disable icons not provided * ability to specify a font in a theme pack * clip was not set in ImageUtils.paintTile resulting in painting glitches DefaultButton was aligning images with parent What's new in version 1.0.1 - 19 June 2001 * re-enable painting of background. This shortcuts the setOpaque() method of a panel. if a user want to paint the background of its panel (with a picture or a plain color) he can override the paintComponent method and do the painting in this method. What's new in version 1.0 - 11 June 2001 * version update, following the unreleased 0.3.2 What's new in version 0.3.2 - 9 June 2001 * ClassCastException in SkinInternalPaneUI (this solves problems with netbeans 3.2) * Update to Nanoxml 1.6.7 * System.getProperty() must not be used (except for non-secure properties) if we want SkinLF to work in applet Fixes bug 415108. What's new in version 0.3.1 - 19 March 2001 * not editable is not handled by BasicLaF, SkinLF uses TextFieldUI from MetalLaF Fixes bug 405017. * handled tab placement (TOP, LEFT, RIGHT, BOTTOM), the theme must provide at least the TOP select/unselected tab images * menu background was not correctly painted. Now all bitmaps use the gtk STRETCH = true or false if available with default to false Fixes bug 233407. * added getComboBoxInsets() in SkinPersonality, but aqua theme pack left border is 12, should be 4 or 5. Fixes bug 404971. * the LinuxLookAndFeel loads the default gtk theme Thanks to Nicholas Allen. * Slider's track and thumb were off from each other Thanks to Ngoc Pham. Fixes bug 133503. * the button focus was not correctly painted. The "focus" section in gtkrc is now used if available Fixes bug 133409. * ImageUtils may lead to an infinite loop in some race conditions What's new in version 0.3.1beta - 9 February 2001 * gtkparser: a class may have several styles (see scrollbars: scrollbar and arrows) gtk: fix color handling * added theme pack support in SkinChooser * JPassword and JTextArea navigation failed if application look and feel was not initially set to SkinLF Thanks to Christopher R. Staley. * remove WindowsLookAndFeel related icons in SkinLookAndFeel * added classes precaching in SkinLookAndFeel. Fixes bug 125360. * new documentation (tutorials are included) * SkinRegion implementation for X11 including Solaris and Linux. Region created from Image Transparency Thanks to Herve Lemaitre. * fix border repaint bug in JInternalFrame (SwingSet runs better now) prevent a shaded JInternalFrame from being resized What's new in version 0.3.1alpha - 1 December 2000 * here it is: Irregular Windows for the Java Platform ! What's new in version 0.3 - 25 November 2000 * introduced Skin Look And Feel Theme Packs GTK and KDE in one zip file customized icons for trees, filechoosers, internalframes, dialogs default whistler theme bundled with SkinLF * TabbedPane border * added WindowSnapping (see examples/snap.java) * easily skin any application with Skinit (see Tutorial 2 at www.L2FProd.com) * SkinButtonUI, setRolloverEnabled(true) was missing * added SkinLookAndFeel.loadSkin(URL url) * added preview to SkinChooser * updated the scrollbar support (rollover on arrows and handle) * reduced package size again * removed KDE sound support => see README.SOUND * created a lightweight version with only GIF and JPG support (no Jimi) What's new in version 0.2.3a - 17 June 2000 * Fix bug in KdeSkin.setSoundEnabled What's new in version 0.2.3 - 13 June 2000 * Sound support preview (from KDE themes) for Window Events => see README.SOUND for more information * SkinWindowEvent to handle shade/unshade, maximize/unmaximize on SkinWindow What's new in version 0.2.3RC2 - 7 June 2000 * JDK1.1 support (and about time too!) * added ScrollBar.alternateLayout property to enable grouping of scrollbar buttons: UIManager.put("ScrollBar.alternateLayout", Boolean.TRUE); com.l2fprod.gui.plaf.xtra.XTraScrollBarUI can be used without SkinLF * improved SkinWindow moving and resizing by using a ghostWindow * added Shade/Unshade feature to SkinWindow/JInternalFrame * reduced package size by removing Jimi encoders and using -O flag and some unused images in bundled themes * better color handling from gtk and kde themes * JSlider support (still buggy) * created SkinChooser to easily add support for SkinLF in your app What's new in version 0.2.3RC1 - 29 May 2000 * changes in TableHeaderUI => custom column header renderers were overriden by SkinLF, now SkinLF only installs its renderer in installUI * added JDesktopPane.backgroundEnabled client property to JDesktopPane to enable the desktop background (supported by KDE skins) * improved SkinWindow (move and resize), SkinWindow is now usable * added WindowList and WindowManager * added examples (applets, skinwindow, demo) What's new in version 0.2.2a - 13 May 2000 * JDK1.3 support What's new in version 0.2.2 - 12 May 2000 * allowed loading of Skins from java.net.URL instead of java.io.File => SkinLF can now be used in an applet * begin merge with xWindow (com.l2fprod.gui.SkinWindow) * bug fixes * moved gtk and kde packages to com.l2fprod.gui.plaf.skin.impl What's new in version 0.2.1 - 9 April 2000 * added missing tokens in GtkParser * fixed scrollbar preferred size * added window border support to KDE theme * improved color support * added getDefaultSkinLocation() to GTK What's new in version 0.2 - 19 March 2000 * gtk and kde theme support is new * new components added * removed uis (windowBlinds) skin support due to copyright statements What's new in version 0.1 - 3 March 2000 * everything is new !skinlf-6.7/INSTALL0000644000175000017500000000150407741615646013663 0ustar twernertwernerRequirements ------------ In order to use SkinLF, you will need: JRE1.3 or later SkinLF has been tested with: JDK1.3 (Windows,Solaris,Linux) and JDK 1.4 (Windows) Installation ------------ To run applications and use SkinLF, you will need to update your environment settings: Add /path-where-skinlf-is-installed/lib/skinlf.jar to your CLASSPATH variable. To compile, you will only need to update your CLASSPATH variable. If you want to use SkinRegion to create irregular windows (available only on Microsoft Windows): Add /path-where-skinlf-is-installed/lib/skinregion.jar to your CLASSPATH variable. And /path-where-skinlf-is-installed/lib to your PATH SkinRegion uses a Dynamic Linked Library (skinregion.dll). Examples -------- examples are provided in the "examples" directory. skinlf-6.7/LICENSE0000644000175000017500000000451307720225724013631 0ustar twernertwerner/* ==================================================================== * * Skin Look And Feel 6.7 License. * * Copyright (c) 2000-2006 L2FProd.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by L2FProd.com * (http://www.L2FProd.com/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not * be used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact info@L2FProd.com. * * 5. Products derived from this software may not be called "SkinLF" * nor may "SkinLF" appear in their names without prior written * permission of L2FProd.com. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 L2FPROD.COM OR ITS 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. * ==================================================================== */ skinlf-6.7/LICENSE_nanoxml0000644000175000017500000000215107712540314015355 0ustar twernertwernerThis is the license for nanoXML, used by Skin Look And Feel for Theme Pack definitions nanoXML is available at http://nanoXML.sourceforge.net $Id: LICENSE_nanoxml,v 1.2 2003/08/01 19:34:35 l2fprod Exp $ Copyright (C) 2000 Marc De Scheemaecker, All Rights Reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. skinlf-6.7/README0000644000175000017500000000072207722165734013510 0ustar twernertwernerGeneral Information ------------------- This is SkinLF (Skin Look And Feel) version 6.7. SkinLF allows Java developers to write skinnable applications using the Swing toolkit. SkinLF currently supports skin files created for GTK and KDE. Only image themes are supported (engine image). The official web site is: http://www.L2FProd.com/ The developer zone is: http://dev.L2FProd.com/ Installation ------------ See the file 'INSTALL' skinlf-6.7/THANKS0000644000175000017500000000275610460407504013537 0ustar twernertwernerThanks to: Charly, he finds out a missing feature for JTextComponents (incomplete keybindings). He also provides great feedback thanks to SkinLF integration in its opensource project. Romain Guy, he persuades me to support JDK1.1 (this was not so easy: replace all occurences of java.util.List by java.util.Vector and cast java.awt.Component to javax.swing.JComponent to get support for getX,getY,getWidth,getHeight methods :p) Yiannis Paschalidis for the fix he sends: "Anyhow, after messing around with it for a while, I noticed a problem with the skinning of nested JPanels - the background bitmap didn't tile correctly as each panel starts tiling from 0,0 in the bitmap. Here's the fixed code for com.l2fprod.util.ImageUtils: [...]" Joseph Shelby for the code snippet he sends: "but here's a "SkinFactory" that will load up the user's current GTK skin [...]" Herve Lemaitre for providing the SkinRegion X11 Implementation. He also adds the creation of region from an image. Kevin L Wilson for submitting the SplitPane divider code and several bug fixes. All the people asking for irregular window support Sebastien Martel, he submitted the support for JDK1.4 frame/dialog decoration. I was going to "kill" SkinLF, he saved it :) Francis Perreault for submitting fixes. Christian Schlichtherle for providing JFileChooser patches for JDK1.5 compatibility and german resources Michael Brackx for providing a fix for the NativeSkin. and many others submitting screenshots, suggestions, bug fixes...