Java 类javax.swing.plaf.ButtonUI 实例源码

项目:incubator-netbeans    文件:ThemeValue.java   
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;
    }
}
项目:OpenJSharp    文件:WindowsIconFactory.java   
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;
}
项目:jdk8u-jdk    文件:WindowsIconFactory.java   
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;
}
项目:openjdk-jdk10    文件:WindowsIconFactory.java   
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;
}
项目:openjdk9    文件:WindowsIconFactory.java   
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;
}
项目:pumpernickel    文件:ZoomIconPaintUIEffect.java   
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));
    }
}
项目:pumpernickel    文件:ShimmerPaintUIEffect.java   
/** 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++;
            }
        }
    }
}
项目:jdk8u_jdk    文件:WindowsIconFactory.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:WindowsIconFactory.java   
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;
}
项目:intellij-ce-playground    文件:JBCheckBox.java   
/**
 * 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;
}
项目:infobip-open-jdk-8    文件:WindowsIconFactory.java   
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;
}
项目:jdk8u-dev-jdk    文件:WindowsIconFactory.java   
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;
}
项目:jdk7-jdk    文件:WindowsIconFactory.java   
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;
}
项目:openjdk-source-code-learn    文件:WindowsIconFactory.java   
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;
}
项目:OLD-OpenJDK8    文件:WindowsIconFactory.java   
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;
}
项目:openjdk-jdk7u-jdk    文件:WindowsIconFactory.java   
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;
}
项目:spring-rich-client    文件:JTaskPaneCommandButtonConfigurer.java   
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)
    {

    }
}
项目:openjdk-icedtea7    文件:WindowsIconFactory.java   
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;
}
项目:spring-richclient    文件:JTaskPaneCommandButtonConfigurer.java   
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)
    {

    }
}
项目:jediterm    文件:JBCheckBox.java   
/**
 * 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;
}
项目:consulo    文件:StripeTabPanel.java   
@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;
}
项目:incubator-netbeans    文件:BasicSlidingTabDisplayerUI.java   
@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));
}
项目:openjdk-jdk10    文件:AbstractButtonOperator.java   
/**
 * Maps {@code AbstractButton.getUI()} through queue
 */
public ButtonUI getUI() {
    return (runMapping(new MapAction<ButtonUI>("getUI") {
        @Override
        public ButtonUI map() {
            return ((AbstractButton) getSource()).getUI();
        }
    }));
}
项目:openjdk-jdk10    文件:AbstractButtonOperator.java   
/**
 * 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);
        }
    });
}
项目:openjdk9    文件:AbstractButtonOperator.java   
/**
 * Maps {@code AbstractButton.getUI()} through queue
 */
public ButtonUI getUI() {
    return (runMapping(new MapAction<ButtonUI>("getUI") {
        @Override
        public ButtonUI map() {
            return ((AbstractButton) getSource()).getUI();
        }
    }));
}
项目:openjdk9    文件:AbstractButtonOperator.java   
/**
 * 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);
        }
    });
}
项目:orbit-image-analysis    文件:OutlookBarMain.java   
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");
}
项目:pumpernickel    文件:XPDirectoryControls.java   
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);
}
项目:pumpernickel    文件:TextSearchBar.java   
/** 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
}
项目:pumpernickel    文件:ShimmerPaintUIEffect.java   
/** 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));
    }
}
项目:javify    文件:JRadioButton.java   
/**
 * 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));
}
项目:intellij-ce-playground    文件:StickyButton.java   
@Override
public void setUI(ButtonUI ui) {
  if (ui instanceof StickyButtonUI) {
    super.setUI(ui);
  } else {
    super.setUI(createUI());
  }
}
项目:jvm-stm    文件:JRadioButton.java   
/**
 * 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));
}
项目:mindraider    文件:OutlookBarMain.java   
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");
}
项目:metasfresh    文件:Calendar.java   
@Override
public void setUI(final ButtonUI ui)
{
    super.setUI(ui);

    setBorder(BorderFactory.createEmptyBorder());
    setHorizontalTextPosition(SwingConstants.CENTER);
    setVerticalAlignment(SwingConstants.CENTER);
    setMargin(ZERO_INSETS);
    setFocusPainted(false);
    putClientProperty("Plastic.is3D", Boolean.FALSE);

    updateUIFromType();
}
项目:passage    文件:DockWrapper.java   
/**
 * Set the indicated JComponent to transparent or not transparent.
 * 
 * @return true iff this call has changed the state
 */
protected static boolean setTransparent(JComponent child, boolean t) {
    boolean ret = false;
    if (child instanceof JPanel) {
        child.setOpaque(!t);
        ret |= child.isOpaque() == t;
    }
    if (child instanceof JToolBar) {
        child.setOpaque(!t);
        ret |= child.isOpaque() == t;
    }
    if (child instanceof AbstractButton) {
        AbstractButton b = (AbstractButton) child;
        if (t) {
            if (!(b.getUI() instanceof TransparentButtonUI)) {
                b.setContentAreaFilled(false);
                b.setUI((ButtonUI) TransparentButtonUI.createUI(b));
                ret = true;
            }
        } else {
            if (b.getUI() instanceof TransparentButtonUI) {
                b.setContentAreaFilled(true);
                b.setUI((ButtonUI) UIManager.getUI(b));
                ret = true;
            }
        }
    }

    for (int i = 0; i < child.getComponentCount(); i++) {
        Object o = child.getComponent(i);
        if (o instanceof JComponent) {
            JComponent c = (JComponent) o;
            ret |= setTransparent(c, t);
        }
    }
    return ret;
}
项目:cn1    文件:JButtonTest.java   
@Override
public void testUpdateUI() {
    ButtonUI ui = new ButtonUI() {
    };
    jbutton.setUI(ui);
    assertEquals(ui, jbutton.getUI());
    jbutton.updateUI();
    assertNotSame(ui, jbutton.getUI());
}
项目:cn1    文件:JToggleButtonTest.java   
public void testUpdateUI() {
    ButtonUI ui = new ButtonUI() {
    };
    button.setUI(ui);
    assertEquals(ui, button.getUI());
    button.updateUI();
    assertNotSame(ui, button.getUI());
}
项目:cn1    文件:JCheckBoxTest.java   
public void testUpdateUI() {
    ButtonUI ui = new ButtonUI() {
    };
    button.setUI(ui);
    assertEquals(ui, button.getUI());
    button.updateUI();
    assertNotSame(ui, button.getUI());
}
项目:cn1    文件:JRadioButtonTest.java   
public void testUpdateUI() {
    ButtonUI ui = new ButtonUI() {
    };
    button.setUI(ui);
    assertEquals(ui, button.getUI());
    button.updateUI();
    assertNotSame(ui, button.getUI());
}