001package polaris.sdk.ui.controls; 002import polaris.sdk.ui.*; 003/** A single tinted glass surface. Press animates the surface and content together. */ 004public class Button extends Widget { 005 protected boolean primary; 006 public Button(){this("Button");}public Button(String text){super(text);focusable=true;} 007 public Button primary(boolean value){primary=value;return this;} 008 protected float selectedAmount(){return 0;} 009 @Override protected boolean pressTransform(){return true;} 010 @Override protected void paint(Painter p){stateSurface(p,selectedAmount(),primary?1:0);float fs=theme().fontSize;int weight=500;p.textWeight(text,ax+(w-p.textWidth(text,fs,weight))/2,ay+(h-fs)/2,fs,ink(),weight);} 011}