微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.ButtonModel的实例源码

项目:incubator-netbeans    文件EditMediator.java   
public static void register(Project project,AntProjectHelper helper,ReferenceHelper refhelper,ListComponent list,ButtonModel addJar,ButtonModel addLibrary,ButtonModel addAntArtifact,ButtonModel remove,ButtonModel moveUp,ButtonModel moveDown,ButtonModel edit,Document libPath,ClasspathUiSupport.Callback callback) {    
    register(project,helper,refhelper,list,addJar,addLibrary,addAntArtifact,remove,moveUp,moveDown,edit,false,libPath,callback);
}
项目:incubator-netbeans    文件EditMediator.java   
public static void register(Project project,boolean allowRemoveClasspath,ClasspathUiSupport.Callback callback) {
    register(project,allowRemoveClasspath,callback,DEFAULT_ANT_ARTIFACT_TYPES,JAR_ZIP_FILTER,JFileChooser.FILES_AND_DIRECTORIES);
}
项目:incubator-netbeans    文件EditMediator.java   
public static void register(Project project,ClasspathUiSupport.Callback callback,String[] antArtifactTypes,FileFilter filter,int fileSelectionMode) {
    register(project,antArtifactTypes,filter,fileSelectionMode);
}
项目:incubator-netbeans    文件ToggleBookmarkAction.java   
@Override
public void setModel(ButtonModel model) {
    ButtonModel oldModel = getModel();
    if (oldModel != null) {
        oldModel.removechangelistener(this);
    }

    super.setModel(model);

    ButtonModel newModel = getModel();
    if (newModel != null) {
        newModel.addchangelistener(this);
    }

    stateChanged(null);
}
项目:incubator-netbeans    文件ProfilerPopup.java   
public Component getDefaultComponent(Container aContainer) {
    Component c = getFirstComponent(aContainer);

    if (c instanceof AbstractButton) {
        ButtonModel bm = ((AbstractButton)c).getModel();
        if (bm instanceof DefaultButtonModel) {
            ButtonGroup bg = ((DefaultButtonModel)bm).getGroup();
            Enumeration<AbstractButton> en = bg == null ? null : bg.getElements();
            while (en != null && en.hasMoreElements()) {
                AbstractButton ab = en.nextElement();
                if (ab.isSelected()) return ab;
            }
        }
    }

    return c;
}
项目:incubator-netbeans    文件FileSearchAction.java   
@Override
@NonNull
public ListCellRenderer getListCellRenderer(
        @NonNull final JList list,@NonNull final Document nameDocument,@NonNull final ButtonModel caseSensitive,@NonNull final ButtonModel colorPrefered) {
    Parameters.notNull("list",list);   //NOI18N
    Parameters.notNull("nameDocument",nameDocument);   //NOI18N
    Parameters.notNull("caseSensitive",caseSensitive); //NOI18N
    return ItemRenderer.Builder.create(
                list,caseSensitive,new FileDescriptorConvertor(nameDocument)).
            setCamelCaseSeparator(CAMEL_CASE_SEParaTOR).
            setColorPreferedProject(colorPrefered).
            build();
}
项目:incubator-netbeans    文件MnemonicsTest.java   
public void testSetLocalizedTextWithModel() throws Exception {
    ButtonModel m = new DefaultButtonModel();
    JButton b = new JButton();
    Mnemonics.setLocalizedText(b,"Hello &There");
    assertEquals("Hello There",b.getText());
    if( Mnemonics.isAquaLF() ) {
        assertEquals(0,b.getMnemonic());
        assertEquals(-1,b.getdisplayedMnemonicIndex());
    } else {
        assertEquals('T',b.getMnemonic());
        assertEquals(6,b.getdisplayedMnemonicIndex());
    }
    b.setModel(m);
    assertEquals("Hello There",b.getdisplayedMnemonicIndex());
    }
}
项目:rapidminer    文件CheckBoxMenuItemIcon.java   
@Override
public void paintIcon(Component c,Graphics g,int x,int y) {
    JMenuItem b = (JMenuItem) c;
    ButtonModel model = b.getModel();

    g.translate(x,y);

    boolean isSelected = model.isSelected();
    boolean isEnabled = model.isEnabled();

    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);

    // draw check mark
    if (isSelected) {
        g2.setstroke(CHECKBox_stroke);
        if (isEnabled) {
            g2.setColor(Colors.CHECKBox_CHECKED);
        } else {
            g2.setColor(Colors.CHECKBox_CHECKED_disABLED);
        }
        g2.drawLine(2,6,5,8);
        g2.drawLine(5,8,9,1);
    }
    g.translate(-x,-y);
}
项目:json2java4idea    文件SettingsPanel.java   
@Nonnull
@CheckReturnValue
public Style getStyle() {
    final ButtonModel selected = styleGroup.getSelection();
    return getStyleButtonStream()
            .filter(button -> {
                final ButtonModel model = button.getModel();
                return model.equals(selected);
            })
            .map(button -> {
                final String name = button.getText();
                return Style.fromName(name,Style.NONE);
            })
            .findFirst()
            .orElse(Style.NONE);
}
项目:openjdk-jdk10    文件DefaultButtonModelCrashTest.java   
private void go() {

        frame = new JFrame();
        frame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
        Container contentPane = frame.getContentPane();
        ButtonModel model = new DefaultButtonModel();

        JCheckBox check = new JCheckBox("a bit broken");
        check.setModel(model);
        panel = new JPanel(new BorderLayout());
        panel.add(new JTextField("Press Tab (twice?)"),BorderLayout.norTH);
        panel.add(check);
        contentPane.add(panel);
        frame.setLocationRelativeto(null);
        frame.pack();
        frame.setVisible(true);
    }
项目:xdman    文件XDMMenuUI.java   
@Override
    protected void paintBackground(Graphics g,JMenuItem menuItem,Color bgColor) {
        ButtonModel model = menuItem.getModel();
        Color oldColor = g.getColor();
        if (model.isArmed()
                || (menuItem instanceof JMenu && model.isSelected())) {
            paintButtonpressed(g,menuItem);
        } else {
            g.setColor(this.colorBg);
            //g.fillRect(0,menuItem.getWidth(),menuItem.getHeight());//(0,gap + 1,menuItem.getHeight());
//          g.drawLine(gap + 1,menuItem.getHeight());
//          if (menuItem.getIcon() != null) {
//              int gap = menuItem.getIcon().getIconWidth() + 2;
//              g.setColor(this.darkColor);
//              g.drawLine(gap,gap,menuItem.getHeight());
//              g.setColor(this.lightColor);
//              g.drawLine(gap + 1,menuItem.getHeight());
//          }
        }
        g.setColor(oldColor);
    }
项目:btrace.nb    文件DeployAction.java   
@Override
public void setModel(ButtonModel model) {
    ButtonModel oldModel = getModel();
    if (oldModel != null) {
        oldModel.removechangelistener(this);
    }

    super.setModel(model);

    ButtonModel newModel = getModel();
    if (newModel != null) {
        newModel.addchangelistener(this);
    }

    stateChanged(null);
}
项目:DataRecorder    文件ToolBarButtonUI.java   
/**
 * Paints the Button
 * 
 * @param g
 *            The graphics
 * @param c
 *            The component
 */
@Override
public void paint(final Graphics g,final JComponent c) {
    // super.paint(g,c);
    final AbstractButton button = (AbstractButton) c;
    button.setRolloverEnabled(true);
    final ButtonModel model = button.getModel();
    final Rectangle bounds = button.getBounds();

    if (model.ispressed() && model.isArmed()) {
        g.translate(1,1);
        super.paint(g,c);
        g.translate(-1,-1);
        downBorder.paintBorder(c,g,bounds.width,bounds.height);
    } else if (button.isRolloverEnabled() && model.isRollover()) {
        super.paint(g,c);
        upBorder.paintBorder(c,bounds.height);
    } else {
        super.paint(g,c);
    }
}
项目:pumpernickel    文件FilledButtonUI.java   
public void paintIcon(Graphics2D g,ButtonInfo info) {
    AbstractButton button = info.button;
    Icon icon = button.getIcon();
    ButtonModel model = button.getModel();

    if(model.isRollover() && button.getRolloverIcon()!=null)
        icon = button.getRolloverIcon();
    if(model.ispressed() && button.getpressedIcon()!=null)
        icon = button.getpressedIcon();
    if(model.isSelected() && button.getSelectedIcon()!=null)
        icon = button.getSelectedIcon();
    if(model.isRollover() && model.isSelected() && button.getRolloverSelectedIcon()!=null)
        icon = button.getRolloverSelectedIcon();
    if(isEnabled(button)==false && button.getdisabledIcon()!=null)
        icon = button.getdisabledIcon();
    if(isEnabled(button)==false && model.isSelected() && button.getdisabledIcon()!=null)
        icon = button.getdisabledSelectedIcon();

    if(icon!=null) {
        g.setComposite(isEnabled(button) ? AlphaComposite.SrcOver : SRC_OVER_TRANSLUCENT);
        icon.paintIcon(button,info.iconRect.x,info.iconRect.y);
    }
}
项目:pumpernickel    文件FilledButtonUI.java   
public void paintText(Graphics2D g,ButtonInfo info) {
    ButtonModel model = info.button.getModel();
    FontMetrics fm = info.button.getFontMetrics(info.button.getFont());
    int mnemonicIndex = info.button.getdisplayedMnemonicIndex();
    String text = info.button.getText();
    int textShiftOffset = 0;


    g.setComposite(AlphaComposite.SrcOver);
    /* Draw the Text */
    if(isEnabled(info.button)) {
        /*** paint the text normally */
        g.setColor(info.button.getForeground());
        BasicGraphicsUtils.drawStringUnderlineCharat(g,text,mnemonicIndex,info.textRect.x + textShiftOffset,info.textRect.y + fm.getAscent() + textShiftOffset);
    } else {
        /*** paint the text disabled ***/
        g.setColor(info.button.getBackground().brighter());
        BasicGraphicsUtils.drawStringUnderlineCharat(g,info.textRect.x,info.textRect.y + fm.getAscent());
        g.setColor(info.button.getBackground().darker());
        BasicGraphicsUtils.drawStringUnderlineCharat(g,info.textRect.x - 1,info.textRect.y + fm.getAscent() - 1);
    }
}
项目:pumpernickel    文件TexturedButtonUI.java   
@Override
public void paintBackground(Graphics2D g,ButtonInfo info) {
    super.paintBackground(g,info);
    if(info.button.isContentAreaFilled() || info.button.isBorderPainted()) {
        ButtonModel model = info.button.getModel();
        if(model.isSelected() || model.isArmed() || isspacebarpressed(info.button)) {
            g = (Graphics2D)g.create();

            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
            g.clip( info.fill);
            g.setColor(new Color(0,15));
            g.setstroke(outline1);
            g.draw( info.fill );
            g.setstroke(outline2);
            g.draw( info.fill );
            g.setstroke(outline3);
            g.draw( info.fill );
        }
    }
}
项目:littleluck    文件LuckCheckBoxIcon.java   
/**
 * <pre>
 * 根据按钮状态,获取当前状态下图片信息。
 *
 * According to the button state,access to the current
 * state of the picture @R_223_4045@ion.
 * </pre>
 *
 * @param c <code>CheckBoxMenuItem</code> object.
 * @param model <code>ButtonModel</code>
 * @return <code>Image</code> when is selected return current image,otherwise return null.
 */
public Image getPreImg(Component c,ButtonModel model)
{
    if (!model.isSelected())
    {
        return null;
    }

    if (model.isArmed())
    {
        return getRollverImg();
    }
    else
    {
        return getnormalImg();
    }
}
项目:littleluck    文件LuckButtonUI.java   
public void paint(Graphics g,JComponent c)
{
    AbstractButton b = (AbstractButton) c;

    ButtonModel model = b.getModel();

    paintBg(g,(AbstractButton) c);

    // 设置组件偏移,以达到视觉上的按下和弹起效果
    // Set the component offsets to achieve visual depress and bounce
    if(model.ispressed() && model.isArmed() && b.getIcon() == null)
    {
        g.translate(2,1);
    }

    super.paint(g,c);

    if(model.ispressed() && model.isArmed() && b.getIcon() == null)
    {
        g.translate(-2,-1);
    }
}
项目:littleluck    文件LuckArrowIcon.java   
public Image getPreImg(Component c,ButtonModel model)
{
    JMenu menu = (JMenu) c;

    if (menu.getItemCount() > 0)
    {
        if (model.isSelected())
        {
            return getRollverImg();
        }
        else
        {
            return getnormalImg();
        }
    }

    return null;
}
项目:javify    文件MetalToggleButtonUI.java   
/**
 * If the property <code>ToggleButton.gradient</code> is set,then a gradient
 * is painted as background,otherwise the normal superclass behavIoUr is
 * called.
 */
public void update(Graphics g,JComponent c)
{
  AbstractButton b = (AbstractButton) c;
  ButtonModel m = b.getModel();
  if (b.getBackground() instanceof UIResource
      && b.isContentAreaFilled()
      && b.isEnabled() && ! m.isArmed() && ! m.ispressed()
      && UIManager.get(getPropertyPrefix() + "gradient") != null)
    {
      MetalUtils.paintGradient(g,c.getWidth(),c.getHeight(),SwingConstants.VERTICAL,getPropertyPrefix() + "gradient");
      paint(g,c);
    }
  else
    super.update(g,c);
}
项目:javify    文件BasicArrowButton.java   
/**
 * Paints the arrow button. The painting is delegated to the
 * paintTriangle method.
 *
 * @param g The Graphics object to paint with.
 */
public void paint(Graphics g)
{
  super.paint(g);

  int height = getHeight();
  int size = height / 4;

  int x = (getWidth() - size) / 2;
  int y = (height - size) / 2;

  ButtonModel m = getModel();
  if (m.isArmed())
    {
      x++;
      y++;
    }

  paintTriangle(g,x,y,size,direction,isEnabled());
}
项目:javify    文件BasicBorders.java   
/**
 * Paints the ButtonBorder around a given component.
 *
 * @param c the component whose border is to be painted.
 * @param g the graphics for painting.
 * @param x the horizontal position for painting the border.
 * @param y the vertical position for painting the border.
 * @param width the width of the available area for painting the border.
 * @param height the height of the available area for painting the border.
 *
 * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawBezel
 */
public void paintBorder(Component c,Graphics  g,int y,int width,int height)
{
  ButtonModel bmodel = null;

  if (c instanceof AbstractButton)
    bmodel = ((AbstractButton) c).getModel();

  BasicGraphicsUtils.drawBezel(
    g,width,height,/* pressed */ (bmodel != null)
                    && /* mouse button pressed */ bmodel.ispressed()
                    && /* mouse inside */ bmodel.isArmed(),/* default */ (c instanceof JButton)
                    && ((JButton) c).isDefaultButton(),shadow,darkShadow,highlight,lightHighlight);
}
项目:javify    文件BasicmenuItemUI.java   
/**
 * Paints background of the menu item
 *
 * @param g
 *          The graphics context used to paint this menu item
 * @param menuItem
 *          menu item to paint
 * @param bgColor
 *          Background color to use when painting menu item
 */
protected void paintBackground(Graphics g,Color bgColor)
{
  // Menu item is considered to be highlighted when it is selected.
  // But we don't want to paint the background of JCheckBoxMenuItems
  ButtonModel mod = menuItem.getModel();
  Color saved = g.getColor();
  if (mod.isArmed() || ((menuItem instanceof JMenu) && mod.isSelected()))
    {
      g.setColor(bgColor);
      g.fillRect(0,menuItem.getHeight());
    }
  else if (menuItem.isOpaque())
    {
      g.setColor(menuItem.getBackground());
      g.fillRect(0,menuItem.getHeight());
    }
  g.setColor(saved);
}
项目:javify    文件BasicButtonListener.java   
/**
 * Performs the action.
 */
public void actionPerformed(ActionEvent event)
{
  Object cmd = getValue("__command__");
  AbstractButton b = (AbstractButton) event.getSource();
  ButtonModel m = b.getModel();
  if (pressed.equals(cmd))
    {
      m.setArmed(true);
      m.setpressed(true);
      if (! b.isFocusOwner())
        b.requestFocus();
    }
  else if (RELEASED.equals(cmd))
    {
      m.setpressed(false);
      m.setArmed(false);
    }
}
项目:javify    文件BasicButtonListener.java   
/**
 * Accept a mouse press event and arm the button.
 *
 * @param e The mouse press event to accept
 */
public void mousepressed(MouseEvent e)
{
  if (e.getSource() instanceof AbstractButton)
    {
      AbstractButton button = (AbstractButton) e.getSource();
      ButtonModel model = button.getModel();
      if (SwingUtilities.isLeftMouseButton(e))
        {
          // It is important that these transitions happen in this order.
          model.setArmed(true);
          model.setpressed(true);

          if (! button.isFocusOwner() && button.isRequestFocusEnabled())
            button.requestFocus();
        }
    }
}
项目:javify    文件BasicButtonUI.java   
/**
 * Paint the icon for this component. Depending on the state of the
 * component and the availability of the button's varIoUs icon
 * properties,this might mean painting one of several different icons.
 *
 * @param g Graphics context to paint with
 * @param c Component to paint the icon of
 * @param iconRect Rectangle in which the icon should be painted
 */
protected void paintIcon(Graphics g,JComponent c,Rectangle iconRect)
{
  AbstractButton b = (AbstractButton) c;
  Icon i = currentIcon(b);

  if (i != null)
    {
      ButtonModel m = b.getModel();
      if (m.ispressed() && m.isArmed())
        {
          int offs = getTextShiftOffset();
          i.paintIcon(c,iconRect.x + offs,iconRect.y + offs);
        }
      else
        i.paintIcon(c,iconRect.x,iconRect.y);
    }
}
项目:xdm    文件XDMMenuItemUI.java   
protected void paintBackground(Graphics g,Color bgColor) {
   ButtonModel model = menuItem.getModel();
   Color oldColor = g.getColor();
   int menuWidth = menuItem.getWidth();
   int menuHeight = menuItem.getHeight();
   g.setColor(this.colorBg);
   g.fillRect(0,menuWidth,menuHeight);
   if(model.isArmed() || menuItem instanceof JMenu && model.isSelected()) {
      this.paintButtonpressed(g,menuItem);
   }

   if(menuItem instanceof JCheckBoxMenuItem) {
      ((JCheckBoxMenuItem)menuItem).isSelected();
   }

   g.setColor(oldColor);
}
项目:xdm    文件XDMButtonUI.java   
public void paint(Graphics g,JComponent c) {
   try {
      AbstractButton b = (AbstractButton)c;
      ButtonModel bm = b.getModel();
      if(bm.isRollover()) {
         this.paintButtonRollover(g,b);
      } else {
         this.paintButtonnormal(g,b);
      }

      super.paint(g,c);
   } catch (Exception var5) {
      ;
   }

}
项目:seaglass    文件SeaGlassButtonUI.java   
/**
 * Returns the Icon to use in painting the button.
 *
 * @param  b the button.
 *
 * @return the icon.
 */
protected Icon getIcon(AbstractButton b) {
    Icon        icon  = b.getIcon();
    ButtonModel model = b.getModel();

    if (!model.isEnabled()) {
        icon = getSynthdisabledIcon(b,icon);
    } else if (model.ispressed() && model.isArmed()) {
        icon = getpressedIcon(b,getSelectedIcon(b,icon));
    } else if (b.isRolloverEnabled() && model.isRollover()) {
        icon = getRolloverIcon(b,icon));
    } else if (model.isSelected()) {
        icon = getSelectedIcon(b,icon);
    } else {
        icon = getEnabledIcon(b,icon);
    }

    if (icon == null) {
        return getDefaultIcon(b);
    }

    return icon;
}
项目:rapidminer-studio    文件CheckBoxMenuItemIcon.java   
@Override
public void paintIcon(Component c,-y);
}
项目:beautyeye    文件BECheckBoxMenuItemUI.java   
public void paintIcon(Component c,int y) 
        {
            AbstractButton b = (AbstractButton) c;
            ButtonModel model = b.getModel();

            Image selectedImg = __IconFactory__.getInstance().getCheckBoxMenuItemSelectednormalIcon().getimage();
            boolean isSelected = model.isSelected();
//          boolean isArmed = model.isArmed();
            if (isSelected) 
            {
//              if(isArmed)
//                  selectedImg = __IconFactory__.getInstance().getCheckBoxMenuItemSelectedRoverIcon().getimage();
            }
            else
                selectedImg = __IconFactory__.getInstance().getCheckBoxMenuItemNoneIcon().getimage();

            g.drawImage(selectedImg,x+(usedForVista?5:-4)//* 注意:当用于windows平台专用主类且处于Vista及更高版win时要做不一样的处理哦,y - 3,null);
        }
项目:confluence.keygen    文件PlasticXPBorders.java   
public void paintBorder(Component c,int w,int h)
/* 101:    */     {
/* 102:176 */       AbstractButton button = (AbstractButton)c;
/* 103:177 */       ButtonModel model = button.getModel();
/* 104:179 */       if (!model.isEnabled())
/* 105:    */       {
/* 106:180 */         PlasticXPUtils.drawdisabledButtonBorder(g,w,h);
/* 107:181 */         return;
/* 108:    */       }
/* 109:184 */       boolean ispressed = (model.ispressed()) && (model.isArmed());
/* 110:185 */       boolean isDefault = ((button instanceof JButton)) && (((JButton)button).isDefaultButton());
/* 111:    */       
/* 112:187 */       boolean isFocused = (button.isFocusPainted()) && (button.hasFocus());
/* 113:189 */       if (ispressed) {
/* 114:190 */         PlasticXPUtils.drawpressedButtonBorder(g,h);
/* 115:191 */       } else if (isFocused) {
/* 116:192 */         PlasticXPUtils.drawFocusedButtonBorder(g,h);
/* 117:193 */       } else if (isDefault) {
/* 118:194 */         PlasticXPUtils.drawDefaultButtonBorder(g,h);
/* 119:    */       } else {
/* 120:196 */         PlasticXPUtils.drawPlainButtonBorder(g,h);
/* 121:    */       }
/* 122:    */     }
项目:seaglass    文件SeaGlasstabbedPaneUI.java   
/**
 * Paint the background for a tab scroll button.
 *
 * @param ss           the tab subregion SynthContext.
 * @param g            the Graphics context.
 * @param scrollButton the button to paint.
 */
protected void paintScrollButtonBackground(SeaGlassContext ss,JButton scrollButton) {
    Rectangle tabRect = scrollButton.getBounds();
    int       x       = tabRect.x;
    int       y       = tabRect.y;
    int       height  = tabRect.height;
    int       width   = tabRect.width;

    boolean flipSegments = (orientation == ControlOrientation.HORIZONTAL && !tabPane.getComponentOrientation().isLeftToRight());

    SeaGlassLookAndFeel.updateSubregion(ss,tabRect);

    tabPane.putClientProperty("JTabbedPane.Tab.segmentPosition",((scrollButton == scrollBackwardButton) ^ flipSegments) ? "first" : "last");

    int         oldState    = tabContext.getComponentState();
    ButtonModel model       = scrollButton.getModel();
    int         ispressed   = model.ispressed() && model.isArmed() ? pressed : 0;
    int         buttonState = SeaGlassLookAndFeel.getComponentState(scrollButton) | ispressed;

    tabContext.setComponentState(buttonState);
    tabContext.getPainter().paintTabbedPaneTabBackground(tabContext,-1,tabPlacement);
    tabContext.getPainter().paintTabbedPaneTabBorder(tabContext,tabPlacement);
    tabContext.setComponentState(oldState);
}
项目:jo-widgets    文件JoArrowButton.java   
@Override
public void paintIcon(final Component component,final Graphics graphics,final int x,final int y) {
    final AbstractButton button = (AbstractButton) component;
    final ButtonModel buttonModel = button.getModel();

    final int width = WIDTH - 2;
    final int height = HEIGHT;

    graphics.translate(x,y);

    String colorUI = null;
    if (buttonModel.isEnabled()) {
        colorUI = "controlText";
    }
    else {
        colorUI = "textInactiveText";
    }
    graphics.setColor(UIManager.getColor(colorUI));

    for (int i = 0; i < height; i++) {
        graphics.drawLine(i + 1,i,width - i,i);
    }
    graphics.translate(-x,-y);
}
项目:confluence.keygen    文件PlasticArrowButton.java   
private void paint3D(Graphics g)
/* 286:    */   {
/* 287:334 */     ButtonModel buttonModel = getModel();
/* 288:335 */     if (((buttonModel.isArmed()) && (buttonModel.ispressed())) || (buttonModel.isSelected())) {
/* 289:336 */       return;
/* 290:    */     }
/* 291:338 */     int width = getWidth();
/* 292:339 */     int height = getHeight();
/* 293:340 */     if (getDirection() == 3) {
/* 294:341 */       width -= 2;
/* 295:342 */     } else if (getDirection() == 5) {
/* 296:343 */       height -= 2;
/* 297:    */     }
/* 298:345 */     Rectangle r = new Rectangle(1,1,height);
/* 299:346 */     boolean isHorizontal = (getDirection() == 3) || (getDirection() == 7);
/* 300:347 */     PlasticUtils.addLight3DEffekt(g,r,isHorizontal);
/* 301:    */   }
项目:SmartTokens    文件HudCheckBoxUI.java   
/**
 * Draws the check in the check Box using the appropriate color based on the
 * {@link ButtonModel#ispressed} state. Note that part of the check will be drawn outside
 * it's bounds. Because this icon is actually being drawn inside a larger component (a
 * {@link javax.swing.JCheckBox}),this shouldn't be an issue.
 */
private void drawcheckmark(Graphics2D graphics,ButtonModel model) {
    int x1 = CHECK_Box_SIZE / 4;
    int y1 = CHECK_Box_SIZE / 3;
    int x2 = x1 + CHECK_Box_SIZE / 6;
    int y2 = y1 + CHECK_Box_SIZE / 4;
    int x3 = CHECK_Box_SIZE - 2;
    int y3 = -1;

    Color color = model.ispressed() ?
            HudPaintingUtils.pressed_MARK_COLOR : fontColor;

    graphics.setstroke(new Basicstroke(1.65f,Basicstroke.CAP_SQUARE,Basicstroke.JOIN_ROUND));
    graphics.setColor(color);
    graphics.drawLine(x1,y1,x2,y2);
    graphics.drawLine(x2,y2,x3,y3);
}
项目:confluence.keygen    文件PlasticBorders.java   
public void paintBorder(Component c,int h)
/* 278:    */     {
/* 279:410 */       AbstractButton button = (AbstractButton)c;
/* 280:411 */       ButtonModel model = button.getModel();
/* 281:413 */       if (model.isEnabled())
/* 282:    */       {
/* 283:414 */         boolean ispressed = (model.ispressed()) && (model.isArmed());
/* 284:416 */         if (ispressed) {
/* 285:417 */           PlasticUtils.drawpressed3DBorder(g,h);
/* 286:    */         } else {
/* 287:419 */           PlasticUtils.drawButtonBorder(g,h,false);
/* 288:    */         }
/* 289:    */       }
/* 290:    */       else
/* 291:    */       {
/* 292:421 */         PlasticUtils.drawdisabledBorder(g,w - 1,h - 1);
/* 293:    */       }
/* 294:    */     }
项目:confluence.keygen    文件PlasticBorders.java   
public void paintBorder(Component c,int h)
/* 497:    */     {
/* 498:598 */       JMenuItem b = (JMenuItem)c;
/* 499:599 */       ButtonModel model = b.getModel();
/* 500:601 */       if ((model.isArmed()) || (model.isSelected()))
/* 501:    */       {
/* 502:602 */         g.setColor(PlasticLookAndFeel.getControlDarkShadow());
/* 503:603 */         g.drawLine(0,w - 2,0);
/* 504:604 */         g.drawLine(0,h - 1);
/* 505:    */         
/* 506:    */ 
/* 507:607 */         g.setColor(PlasticLookAndFeel.getPrimaryControlHighlight());
/* 508:608 */         g.drawLine(w - 1,h - 1);
/* 509:    */       }
/* 510:609 */       else if (model.isRollover())
/* 511:    */       {
/* 512:610 */         g.translate(x,y);
/* 513:611 */         PlasticUtils.drawFlush3DBorder(g,h);
/* 514:612 */         g.translate(-x,-y);
/* 515:    */       }
/* 516:    */     }
项目:confluence.keygen    文件PlasticBorders.java   
public void paintBorder(Component c,int h)
/* 585:    */     {
/* 586:666 */       AbstractButton b = (AbstractButton)c;
/* 587:667 */       ButtonModel model = b.getModel();
/* 588:669 */       if (!model.isEnabled()) {
/* 589:670 */         return;
/* 590:    */       }
/* 591:672 */       if (!(c instanceof JToggleButton))
/* 592:    */       {
/* 593:673 */         if ((model.isRollover()) && ((!model.ispressed()) || (model.isArmed()))) {
/* 594:674 */           super.paintBorder(c,h);
/* 595:    */         }
/* 596:676 */         return;
/* 597:    */       }
/* 598:683 */       if (model.isRollover())
/* 599:    */       {
/* 600:684 */         if ((model.ispressed()) && (model.isArmed())) {
/* 601:685 */           PlasticUtils.drawpressed3DBorder(g,h);
/* 602:    */         } else {
/* 603:687 */           PlasticUtils.drawFlush3DBorder(g,h);
/* 604:    */         }
/* 605:    */       }
/* 606:689 */       else if (model.isSelected()) {
/* 607:690 */         PlasticUtils.drawDark3DBorder(g,h);
/* 608:    */       }
/* 609:    */     }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。