swing - Java-LAF: How to create Decoration using Synth-XML? -


i'm trying create custom look-and-feel using synth-framework.

i used tutorial ( look-and-feel tutorial oracle/sun ) experiment,and managed skin buttons, panels etc.

the problem have is,that want decorate window/jframe.

i read things , tried out metallookandfeel , code,that works:

    try{         uimanager.setlookandfeel(new metallookandfeel());     }catch(unsupportedlookandfeelexception e){      }     javax.swing.jframe.setdefaultlookandfeeldecorated(true);     new sfframe().setvisible(true); 

now try use own laf:

<?xml version="1.0" encoding="utf-8"?> <synth>         <!-- style regions use -->     <style id="backingstyle">         <opaque value="true"/>         <font name="dialog" size="14"/>         <state>             <color value="#04688d" type="background"/>             <color value="#ffffff" type="foreground"/>          </state>         <defaultsproperty key="synthetica.window.decoration" type="boolean" value="true"/>     </style>     <bind style="backingstyle" type="region" key=".*"/>     <style id="button">         <!-- shift text 1 pixel when pressed -->         <property key="button.textshiftoffset" type="integer" value="1"/>         <!-- set size of buttons -->         <insets top="4" left="4" bottom="4" right="4"/>         <state>             <imagepainter method="buttonbackground" path="/synth/images/button.png" sourceinsets="4 4 4 4"/>             <font name="dialog" size="16"/>             <color type="text_foreground" value="#ffffff"/>         </state>                       <state value="pressed">              <imagepainter method="buttonbackground" path="/synth/images/button_pressed.png" sourceinsets="4 4 4 4"/>         </state>                     <state value="mouse_over">                 <imagepainter method="buttonbackground" path="/synth/images/button_over.png" sourceinsets="4 4 4 4"/>         </state>     </style>     <bind style="button" type="region" key="button"/> </synth> 

the code use load laf looks this:

    synthlookandfeel laf = new synthlookandfeel();     try{         inputstream in = sfframe.class.getresourceasstream("/synth/synth.xml");         laf.load(in, sfframe.class);         uimanager.setlookandfeel(laf);     }catch(parseexception | unsupportedlookandfeelexception e){         e.printstacktrace();     }     javax.swing.jframe.setdefaultlookandfeeldecorated(true);     new sfframe().setvisible(true); 

the buttons , panels skinned, of course, window/jframe doesn't.

i can't find source on how skin/decorate window/jframe synth-xml. can me there?

  • afaik isn't possible decorating jframe/jdialog/jwindow own l&f

  • jframe/jdialog/jwindow based on peers came native os, default has same decorations type color, font, font size rest of windows invoked native os

  • afaik substance can that, have @ code source, ref. post (-:forked new owner:-)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -