本文整理匯總了Java中javax.swing.JButton.setIconTextGap方法的典型用法代碼示例。如果您正苦於以下問題:Java JButton.setIconTextGap方法的具體用法?Java JButton.setIconTextGap怎麽用?Java JButton.setIconTextGap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setIconTextGap方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupButton
import javax.swing.JButton; //導入方法依賴的package包/類
private void setupButton(JButton button)
{
applyFlatterLaF(button);
button.setBorderPainted(false);
button.setIconTextGap(10);
button.addActionListener(this);
}
示例2: ColorValueCellEditor
import javax.swing.JButton; //導入方法依賴的package包/類
public ColorValueCellEditor(final ParameterTypeColor type) {
this.type = type;
button = new JButton("Choose Color...");
button.setToolTipText(type.getDescription());
button.setIconTextGap(6);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Color newColor = JColorChooser.showDialog(RapidMinerGUI.getMainFrame(), "Choose Color for " + type.getKey(),
((ColorIcon) button.getIcon()).getColor());
if (newColor != null) {
setEditorColor(newColor);
}
fireEditingStopped();
}
});
}
示例3: createButtons
import javax.swing.JButton; //導入方法依賴的package包/類
protected List<JButton> createButtons()
{
List<JButton> buttons = new ArrayList<JButton>();
for( TLEAction action : actions )
{
JButton button = new JHoverButton(action);
button.setBorderPainted(false);
button.setIconTextGap(5);
buttons.add(button);
}
return buttons;
}
示例4: setup
import javax.swing.JButton; //導入方法依賴的package包/類
@Override
public void setup(Set<String> grantedPrivileges, String name)
{
getButtonActions(actions);
listFilled = false;
model = new GenericListModel<NameValue>();
list = new JList<>(model);
list.addMouseListener(new ListDoubleClickListener(list, editAction));
list.addMouseListener(new ListPopupListener(list, actions));
list.addListSelectionListener(new ListSelectionListener()
{
@Override
public void valueChanged(ListSelectionEvent e)
{
updateButtons();
}
});
JScrollPane scroll = new JScrollPane(list);
JLabel heading = new JLabel(name);
heading.setHorizontalAlignment(SwingConstants.CENTER);
heading.setHorizontalTextPosition(SwingConstants.CENTER);
JButton refreshButton = new JTextlessButton(refreshAction);
refreshButton.setBorderPainted(false);
refreshButton.setIconTextGap(0);
refreshButton.setBorder(null);
JComponent buttonsComp = createButtonsPanel();
final int width1 = refreshButton.getPreferredSize().width;
final int height1 = refreshButton.getPreferredSize().height;
final int height2 = buttonsComp.getPreferredSize().height;
final int[] rows = {5, height1, 5, TableLayout.FILL, 5, height2,};
final int[] cols = {width1, TableLayout.FILL, width1, 5};
everything = new JPanel(new TableLayout(rows, cols, 0, 0));
everything.add(heading, new Rectangle(1, 1, 1, 1));
everything.add(refreshButton, new Rectangle(2, 1, 1, 1));
everything.add(scroll, new Rectangle(0, 3, 3, 1));
everything.add(buttonsComp, new Rectangle(0, 5, 3, 1));
updateButtons();
}