2
這是我的代碼來設置按鈕圖標底部的標籤。如何將AbstractButton的標籤放在圖標的底部?
m_button.setIcon(large);
m_button.setLabel(m_button.getName());
m_button.setVerticalTextPosition(m_button.BOTTOM);
m_button.setMargin(BUTTON_INSETS);
m_button.setSize(BUTTON_SIZE);
m_button.setSize(20, 20);
但結果是下面的結果。
作爲第二圖像。標籤正好位於Icon的底部。 – Sajeev
也許這有助於http://stackoverflow.com/questions/354866/swing-jbutton-icon-above-text它使用SwingConstants.BOTTOM並且還建立了水平位置。 – RubioRic
而'setLabel'已棄用,請嘗試'setText'。 – Berger