我正在尝试使用synth外观和感觉xml来设置JToggleButton的背景图像,这似乎有效,但按钮中的文本没有显示。有什么东西我不见了吗?这是代码:
laf.xml:
<style id="dayBtnStyle">
<insets top="4" left="18" right="18" bottom="3"/>
<state>
<font name="HelveticaNeue" size="40"/>
<color value="#586A7B" type="TEXT_FOREGROUND"/>
<imagePainter path="images/keyDay-Off.png"
sourceInsets="10 10 10 10"/>
</state>
<state value="SELECTED">
<font name="HelveticaNeue" size="40"/>
<color value="WHITE" type="TEXT_FOREGROUND"/>
<imagePainter method="buttonBackground" path="images/keyDay-On.png"
sourceInsets="10 10 10 10"/>
</state>
</style>
<bind style="dayBtnStyle" type="name" key="dayBtn"/>
test.java:
JToggleButton b = new JToggleButton ("test");
b.setName("dayBtn");