本文整理匯總了Java中javax.swing.plaf.ButtonUI類的典型用法代碼示例。如果您正苦於以下問題:Java ButtonUI類的具體用法?Java ButtonUI怎麽用?Java ButtonUI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ButtonUI類屬於javax.swing.plaf包,在下文中一共展示了ButtonUI類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSynthContext
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
private static SynthContext getSynthContext () {
try {
JButton dummyButton = getDummyButton();
ButtonUI bui = dummyButton.getUI();
if (bui instanceof SynthUI) {
return ((SynthUI) bui).getContext(dummyButton);
} else {
throw new IllegalStateException ("I don't have a SynthButtonUI to play with"); //NOI18N
}
} catch (Exception e) {
functioning = Boolean.FALSE;
if (log) {
e.printStackTrace();
}
return null;
}
}
示例2: getAccessor
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
private static WindowsMenuItemUIAccessor getAccessor(
JMenuItem menuItem) {
WindowsMenuItemUIAccessor rv = null;
ButtonUI uiObject = (menuItem != null) ? menuItem.getUI()
: null;
if (uiObject instanceof WindowsMenuItemUI) {
rv = ((WindowsMenuItemUI) uiObject).accessor;
} else if (uiObject instanceof WindowsMenuUI) {
rv = ((WindowsMenuUI) uiObject).accessor;
} else if (uiObject instanceof WindowsCheckBoxMenuItemUI) {
rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor;
} else if (uiObject instanceof WindowsRadioButtonMenuItemUI) {
rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor;
}
return rv;
}
示例3: actionPerformed
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
public void actionPerformed(ActionEvent e) {
AbstractButton button = (AbstractButton)e.getSource();
ButtonUI ui = button.getUI();
if(ui instanceof FilledButtonUI) {
FilledButtonUI fui = (FilledButtonUI)ui;
List<PaintUIEffect> effects = fui.getEffects(button);
boolean hasZoom = false;
for(int a = 0; a<effects.size(); a++) {
PaintUIEffect effect = effects.get(a);
if(effect instanceof ZoomIconPaintUIEffect && effect.getComponent()==button)
hasZoom = true;
}
if(!hasZoom)
effects.add(new ZoomIconPaintUIEffect(button));
}
}
示例4: mouseExited
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
/** Kill the effects if the user moused over the component
* really quickly.
*/
@Override
public void mouseExited(MouseEvent e) {
AbstractButton button = (AbstractButton)e.getSource();
ButtonUI ui = button.getUI();
if(ui instanceof FilledButtonUI) {
FilledButtonUI fui = (FilledButtonUI)ui;
List<PaintUIEffect> list = fui.getEffects(button);
int ctr = 0;
while(ctr<list.size()) {
PaintUIEffect effect = list.get(ctr);
if(effect instanceof ShimmerPaintUIEffect &&
effect.getProgress()<.2f &&
effect.getComponent()==button) {
list.remove(ctr);
} else {
ctr++;
}
}
}
}
示例5: setTextIcon
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
/**
* Sets given icon to display between checkbox icon and text.
*
* @return true in case of success and false otherwise
*/
public boolean setTextIcon(@NotNull Icon icon) {
if (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
return false;
}
ButtonUI ui = getUI();
if (ui instanceof BasicRadioButtonUI) {
Icon defaultIcon = ((BasicRadioButtonUI) ui).getDefaultIcon();
if (defaultIcon != null) {
MergedIcon mergedIcon = new MergedIcon(defaultIcon, 10, icon);
setIcon(mergedIcon);
return true;
}
}
return false;
}
示例6: configure
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
public void configure(AbstractButton button, AbstractCommand command, CommandFaceDescriptor faceDescriptor)
{
Assert.notNull(button, "The button to configure cannot be null.");
Assert.notNull(faceDescriptor, "The command face descriptor cannot be null.");
if (StringUtils.hasText(faceDescriptor.getDescription()))
button.setText(faceDescriptor.getDescription());
else
button.setText(faceDescriptor.getText());
button.setToolTipText(faceDescriptor.getCaption());
if (faceDescriptor.getLargeIcon() != null)
faceDescriptor.configureIconInfo(button, true);
else
faceDescriptor.configureIcon(button);
try
{
button.setUI((ButtonUI) Class.forName((String) UIManager.get("LinkButtonUI")).newInstance());
}
catch (Exception e)
{
}
}
示例7: addTab
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
@Nonnull
@RequiredDispatchThread
public TabInfo addTab(@Nonnull String tabName, @Nonnull JComponent component, @Nullable JComponent preferredFocusableComponent) {
StaticAnchoredButton button = new StaticAnchoredButton(tabName, ToolWindowAnchor.LEFT);
button.addItemListener(myItemListener);
button.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
button.setBackground(new Color(247, 243, 239));
button.setUI((ButtonUI)DesktopStripeButtonUI.createUI(button));
myTabPanel.add(button);
TabInfo tabInfo = new TabInfo(button, component, preferredFocusableComponent);
button.putClientProperty(TabInfo.class, tabInfo);
myButtonGroup.add(button);
myContentPanel.add(component, tabName);
if(myButtonGroup.getSelection() == null) {
tabInfo.select();
}
return tabInfo;
}
示例8: updateUI
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
@Override
public void updateUI () {
SlidingTabDisplayerButtonUI ui = null;
try {
ui = (SlidingTabDisplayerButtonUI) UIManager.getUI(this);
setUI (ui);
return;
} catch (Error e) {
System.err.println ("Error getting sliding button UI: " + e.getMessage());
} catch (Exception ex) {
System.err.println ("Exception getting button UI: " + ex.getMessage());
}
setUI ((ButtonUI) SlidingTabDisplayerButtonUI.createUI(this));
}
示例9: getUI
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
/**
* Maps {@code AbstractButton.getUI()} through queue
*/
public ButtonUI getUI() {
return (runMapping(new MapAction<ButtonUI>("getUI") {
@Override
public ButtonUI map() {
return ((AbstractButton) getSource()).getUI();
}
}));
}
示例10: setUI
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
/**
* Maps {@code AbstractButton.setUI(ButtonUI)} through queue
*/
public void setUI(final ButtonUI buttonUI) {
runMapping(new MapVoidAction("setUI") {
@Override
public void map() {
((AbstractButton) getSource()).setUI(buttonUI);
}
});
}
示例11: addTab
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
void addTab(JOutlookBar tabs, String title) {
JPanel panel = new JPanel();
panel.setLayout(new PercentLayout(PercentLayout.VERTICAL, 0));
panel.setOpaque(false);
String[] buttons = new String[] {"Inbox", "icons/outlook-inbox.gif",
"Outbox", "icons/outlook-outbox.gif", "Drafts", "icons/outlook-inbox.gif",
"Templates", "icons/outlook-inbox.gif", "Deleted Items",
"icons/outlook-trash.gif",};
for (int i = 0, c = buttons.length; i < c; i += 2) {
JButton button = new JButton(buttons[i]);
try {
button.setUI((ButtonUI)Class.forName(
(String)UIManager.get("OutlookButtonUI")).newInstance());
} catch (Exception e) {
e.printStackTrace();
}
button.setIcon(new ImageIcon(OutlookBarMain.class
.getResource(buttons[i + 1])));
panel.add(button);
}
JScrollPane scroll = tabs.makeScrollPane(panel);
tabs.addTab("", scroll);
// this to test the UI gets notified of changes
int index = tabs.indexOfComponent(scroll);
tabs.setTitleAt(index, title);
tabs.setToolTipTextAt(index, title + " Tooltip");
}
示例12: XPDirectoryControls
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
public XPDirectoryControls(LocationPaneUI paneUI) {
super(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0; c.gridy = 0;
c.weightx = 0; c.weighty = 0;
add(paneUI.comboBox, c);
c.gridx++;
add(paneUI.backButton, c);
c.gridx++;
add(paneUI.upButton, c);
c.gridx++;
add(paneUI.newFolderButton, c);
c.gridx++;
add(listButton);
JPanel fluff = new JPanel();
fluff.setOpaque(false);
c.gridx++; c.weightx = 1;
add(fluff, c);
Dimension d = paneUI.comboBox.getPreferredSize();
d.width = 525;
paneUI.comboBox.setPreferredSize(d);
paneUI.backButton.setIcon(BACK_ICON);
paneUI.upButton.setIcon(UP_ICON);
paneUI.newFolderButton.setIcon(NEW_FOLDER_ICON);
paneUI.backButton.setText("");
paneUI.upButton.setText("");
paneUI.newFolderButton.setText("");
listButton.setText("");
ButtonUI ui = new XPSubtleButtonUI();
paneUI.backButton.setUI(ui);
paneUI.upButton.setUI(ui);
paneUI.newFolderButton.setUI(ui);
listButton.setUI(ui);
}
示例13: setButtonUI
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
/** Sets the ButtonUI for all the non-checkbox buttons
* in this search bar.
* @param ui the button UI to use for all non-checkbox buttons.
*/
public void setButtonUI(ButtonUI ui) {
for(int a = 0; a<getComponentCount(); a++) {
if(getComponent(a) instanceof JButton) {
((JButton)getComponent(a)).setUI(ui);
} else if(getComponent(a) instanceof JCheckBox) {
//do nothing
} else if(getComponent(a) instanceof JToggleButton) {
((JToggleButton)getComponent(a)).setUI(ui);
}
}
updateLayout(); //must update the UI of the close button correctly
}
示例14: mouseEntered
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
/** A new shimmer to the effects list. */
@Override
public void mouseEntered(MouseEvent e) {
AbstractButton button = (AbstractButton)e.getSource();
ButtonUI ui = button.getUI();
if(ui instanceof FilledButtonUI) {
FilledButtonUI fui = (FilledButtonUI)ui;
fui.getEffects(button).add(new ShimmerPaintUIEffect(button));
}
}
示例15: updateUI
import javax.swing.plaf.ButtonUI; //導入依賴的package包/類
/**
* This method resets the radio button's UI delegate to the default UI for
* the current look and feel.
*/
public void updateUI()
{
/*
I can't see any difference between this and the superclass one,
but Sun reimplements it... there is no RadioButtonUI class for it
to be cast to.
*/
setUI((ButtonUI) UIManager.getUI(this));
}