menubar
 TODO: check for menu to be flush right (only for last one).
 TODO: repaint only if needed
427276
def repaint
      return if !@visible
      return unless @repaint_required
      @repaint_required = false
      @color_pair = get_color($reversecolor, @color, @bgcolor)
      @window ||= create_window_menubar
      #@window.printstring( 0, 0, "%-*s" % [@cols," "], @color_pair) # this becomes blank in some terms
      c = 1; r = 0;
      @items.each do |item|
        item.row = r; item.col = c; item.coffset = c; item.parent = self
        item.color = @color
        item.bgcolor = @bgcolor
        @window.printstring( r, c, " %s " % item.text, @color_pair)
        # 2011-09-26 V1.3.1 quick dirty highlighting of first menu on menubar
        # on opening since calling highlight was giving bug in parent.width
        #if c == 1
          #att =  Ncurses::A_REVERSE
          #@window.mvchgat(y=r, x=c+1, item.text.length+1, att, @color_pair, nil)
        #end
        c += (item.text.length + 2)
      end
      #@items[0].on_enter # 2011-09-25 V1.3.1  caused issues when toggling, first item fired on DOWN
      @items[0].highlight unless @keep_visible # 2011-09-26 V1.3.1   fixed to take both cases into account
      @window.wrefresh
    end
758085
public void repaintRect (int x, int y, int width, int height)
    {
        // translate back into view coordinates
        x -= _vbounds.x;
        y -= _vbounds.y;
        repaint(x, y, width, height);
    }
780147
def refresh(self):
        
        if self.enabled:
            self._clear_deco()
            if self._color:
                color = self._color
            else:
                color = drift_color(self.editor.background, 110)
            brush = QtGui.QBrush(color)
            self._decoration = TextDecoration(self.editor.textCursor())
            self._decoration.set_background(brush)
            self._decoration.set_full_width()
            self.editor.decorations.append(self._decoration)
726806
public void redraw() {
		if (isAttached()) {
			int width = getElement().getClientWidth();
			int height = getElement().getClientHeight();
			onResize(width, height);
		}
	}
753831
private void updateMenuIcon() {
        List<Image> iconList = null;
        if (rootParent instanceof JFrame) {
            iconList = ((JFrame) rootParent).getIconImages();
        } else if (rootParent instanceof JDialog) {
            iconList = ((JDialog) rootParent).getIconImages();
        }
        
        Image frameIcon = iconList != null && iconList.size() > 0 ? iconList.get(0) : null;

        SeaGlassContext context   = getContext(this);

        if (frameIcon != null) {
            Dimension maxSize   = (Dimension) context.getStyle().get(context, "InternalFrameTitlePane.maxFrameIconSize");
            int       maxWidth  = 16;
            int       maxHeight = 16;

            if (maxSize != null) {
                maxWidth  = maxSize.width;
                maxHeight = maxSize.height;
            }
            menuButton.setIcon(new ImageIcon(frameIcon.getScaledInstance(maxWidth, maxHeight, Image.SCALE_SMOOTH)));
        }

        context.dispose();
    }
112626
function shouldRedraw(f) {
    return f.dirty !== DrawState.DIRTY_LAYOUT || f.dirty === DrawState.DIRTY_LAYOUT && f.element.parentNode.clientWidth !== f.availableWidth;
  }
1041293
function () {
        var self = this;

        self.parent()._lastRect = null;

        DomUtils.css(self.getEl(), { width: '', height: '' });

        self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null;
        self.initLayoutRect();
      }
221809
private void updateButtonBars() {

        List<I_CmsEditableGroupRow> rows = getRows();
        int i = 0;
        for (I_CmsEditableGroupRow row : rows) {
            boolean first = i == 0;
            boolean last = i == (rows.size() - 1);
            row.getButtonBar().setFirstLast(first, last, m_hideAdd);
            i += 1;
        }
    }
165731
def repaint
      if @parent
        @row = @parent.row+1
        @col = @parent.col + @parent.width - 1
        @length = @parent.height - 2
        @list_length = @parent.row_count 
        @current_index ||= @parent.current_index
        @border_attrib ||= @parent.border_attrib
      end
      raise ArgumentError, "current_index must be provided" unless @current_index
      raise ArgumentError, "list_length must be provided" unless @list_length
      my_win = @form ? @form.window : @target_window
      @graphic = my_win unless @graphic
      return unless @repaint_required

      # 2016-01-14 - replacing 1 with space in mvvline since junk is showing up in some cases.
      space_char = " ".codepoints.first

      # first print a right side vertical line
      #bc = $bottomcolor  # dark blue
      bc = $datacolor
      bordercolor = @border_color || bc
      borderatt = @border_attrib || Ncurses::A_REVERSE
      #$log.debug "SCROLL bordercolor #{bordercolor} , #{borderatt} " if $log.debug? 


      @graphic.attron(Ncurses.COLOR_PAIR(bordercolor) | borderatt)
      #$log.debug " XXX SCROLL #{@row} #{@col} #{@length} "
      @graphic.mvvline(@row+0, @col, space_char, @length-0)
      @graphic.attroff(Ncurses.COLOR_PAIR(bordercolor) | borderatt)

      # now calculate and paint the scrollbar
      pht = @length
      listlen = @list_length * 1.0
      @current_index = 0 if @current_index < 0
      @current_index = listlen-1 if @current_index >= listlen
      sclen = (pht/listlen)* @length
      sclen = 1 if sclen < 1 # sometimes 0.7 for large lists 100 items 2011-10-1 
      scloc = (@current_index/listlen)* @length
      scloc = (@length - sclen) if scloc > @length - sclen # don't exceed end
      if @current_index == @list_length - 1
        scloc = @length - sclen + 0 # earlier 1, but removed since sclen min 1 2011-10-1 
      end
      @graphic.attron(Ncurses.COLOR_PAIR(@scroll_pair) | borderatt)
      r = @row + scloc
      c = @col + 0
      #$log.debug " XXX SCROLLBAR #{r} #{c} #{sclen} "
      @graphic.mvvline(r, c, space_char, sclen)
      @graphic.attroff(Ncurses.COLOR_PAIR(@scroll_pair) | borderatt)
      @repaint_required = false
    end
1041614
function prefChangeHandler() {
        var prefs = getPreferences();

        if (prefs.closeBelow !== menuEntriesShown.closeBelow) {
            if (prefs.closeBelow) {
                workingSetListCmenu.addMenuItem(closeBelow, "", Menus.AFTER, Commands.FILE_CLOSE);
            } else {
                workingSetListCmenu.removeMenuItem(closeBelow);
            }
        }

        if (prefs.closeOthers !== menuEntriesShown.closeOthers) {
            if (prefs.closeOthers) {
                workingSetListCmenu.addMenuItem(closeOthers, "", Menus.AFTER, Commands.FILE_CLOSE);
            } else {
                workingSetListCmenu.removeMenuItem(closeOthers);
            }
        }

        if (prefs.closeAbove !== menuEntriesShown.closeAbove) {
            if (prefs.closeAbove) {
                workingSetListCmenu.addMenuItem(closeAbove, "", Menus.AFTER, Commands.FILE_CLOSE);
            } else {
                workingSetListCmenu.removeMenuItem(closeAbove);
            }
        }

        menuEntriesShown = prefs;
    }
133783
def repaint
      acolor = get_color($reversecolor, @color, @bgcolor)
      #@parent.window.printstring( @row, 0, "|%s|" % ("-"*@width), acolor)
      @parent.window.mvwhline( @row, 1, Ncurses::ACS_HLINE, @width)
      # these 2 are probably overwritten by the borders
      @parent.window.mvaddch( @row, 0, Ncurses::ACS_LTEE)
      @parent.window.mvaddch( @row, @width+1, Ncurses::ACS_RTEE)
    end
73690
protected void onMenuClose(CmsSitemapHoverbar hoverbar) {

        m_button.setDown(false);
        if (!hoverbar.isHovered()) {
            hoverbar.hide();
        } else {
            hoverbar.setLocked(false);
        }
    }
1155797
def flush(self):
        
        if not self._buffer:
            # Only flush stdout buffer. (It could be that Python still has
            # something in its buffer. -- We want to be sure to print that in
            # the correct color.)
            self.stdout.flush()
            return

        data = ''.join(self._buffer)

        if _DEBUG_RENDER_OUTPUT:
            self.LOG.write(('%r' % data).encode('utf-8') + b'\n')
            self.LOG.flush()

        # Print characters one by one. This appears to be the best soluton
        # in oder to avoid traces of vertical lines when the completion
        # menu disappears.
        for b in data:
            written = DWORD()

            retval = windll.kernel32.WriteConsoleW(self.hconsole, b, 1, byref(written), None)
            assert retval != 0

        self._buffer = []
654843
private void defineMenus(UIDefaults d) {
        d.put("menuItemBackgroundBase", new Color(0x5b7ea4));

        // Initialize Menu
        String c = PAINTER_PREFIX + "MenuPainter";
        String p = "Menu";
        d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 5));
        d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText"));
        d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
        d.put(p + "[Enabled+Selected].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[Enabled+Selected].backgroundPainter", new LazyPainter(c, MenuPainter.Which.BACKGROUND_ENABLED_SELECTED));
        d.put(p + "[Disabled].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_DISABLED));
        d.put(p + "[Enabled].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_ENABLED));
        d.put(p + "[Enabled+Selected].arrowIconPainter", new LazyPainter(c, MenuPainter.Which.ARROWICON_ENABLED_SELECTED));
        d.put(p + ".arrowIcon", new SeaGlassIcon(p + "", "arrowIconPainter", 9, 10));
        d.put(p + ".checkIcon", new SeaGlassIcon(p + "", "checkIconPainter", 6, 10));

        p = "Menu:MenuItemAccelerator";
        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));

        // We don't paint MenuBar backgrounds. Remove the painters.
        c = PAINTER_PREFIX + "MenuBarPainter";
        p = "MenuBar";
        d.put(p + ".contentMargins", new InsetsUIResource(2, 6, 2, 6));

        if (d.get(p + "[Enabled].backgroundPainter") != null) {
            d.remove(p + "[Enabled].backgroundPainter");
        }

        if (d.get(p + "[Enabled].borderPainter") != null) {
           d.remove(p + "[Enabled].borderPainter");
        }

        // Rossi: "Selected Menu" color changed to dark blue. Not tested with "unified" title/menu/toolbar
        c = PAINTER_PREFIX + "MenuItemPainter";
        p = "MenuBar:Menu";
        d.put(p + ".States", "Enabled,Selected,Disabled,NotUnified");
        d.put(p + ".NotUnified", new MenuNotUnified());
        d.put(p + ".contentMargins", new InsetsUIResource(1, 4, 2, 4));
        
        d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
        d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[Selected].textForeground", new ColorUIResource(Color.BLACK));
        d.put(p + "[Selected].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER_UNIFIED));

        d.put(p + "[Enabled+NotUnified].textForeground", new ColorUIResource(Color.BLACK));
        d.put(p + "[Enabled+Selected+NotUnified].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[Enabled+Selected+NotUnified].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER));

        p = "MenuBar:Menu:MenuItemAccelerator";
        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));

        // Initialize MenuItem
        c = PAINTER_PREFIX + "MenuItemPainter";
        p = "MenuItem";
        d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
        d.put(p + ".textIconGap", new Integer(5));
        d.put(p + ".acceleratorFont", new DerivedFont("defaultFont", 1.0f, null, null));
        d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
        d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
        d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, MenuItemPainter.Which.BACKGROUND_MOUSEOVER));

        p = "MenuItem:MenuItemAccelerator";
        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
        d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));

        // Initialize CheckBoxMenuItem
        c = PAINTER_PREFIX + "CheckBoxMenuItemPainter";
        p = "CheckBoxMenuItem";
        d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
        d.put(p + ".textIconGap", new Integer(5));
        d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
        d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
        d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, CheckBoxMenuItemPainter.Which.BACKGROUND_MOUSEOVER));
        d.put(p + "[MouseOver+Selected].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[MouseOver+Selected].backgroundPainter",
              new LazyPainter(c, CheckBoxMenuItemPainter.Which.BACKGROUND_SELECTED_MOUSEOVER));

        d.put(p + "[Disabled+Selected].checkIconPainter",
              new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_DISABLED_SELECTED));
        d.put(p + "[Enabled+Selected].checkIconPainter",
              new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED_SELECTED));
// Rossi: Added painter that shows an "indicator" that menu item is a "selectable checkbox"
        d.put(p + "[Enabled].checkIconPainter",
            new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED));
        d.put(p + "[MouseOver].checkIconPainter",
            new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_ENABLED_MOUSEOVER));
        d.put(p + "[MouseOver+Selected].checkIconPainter",
              new LazyPainter(c, CheckBoxMenuItemPainter.Which.CHECKICON_SELECTED_MOUSEOVER));
        d.put(p + ".checkIcon", new SeaGlassIcon(p, "checkIconPainter", 9, 10));

        p = "CheckBoxMenuItem:MenuItemAccelerator";
        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));

        // Initialize RadioButtonMenuItem
        c = PAINTER_PREFIX + "RadioButtonMenuItemPainter";
        p = "RadioButtonMenuItem";
        d.put(p + ".contentMargins", new InsetsUIResource(1, 12, 2, 13));
        d.put(p + ".textIconGap", new Integer(5));
        d.put(p + "[Disabled].textForeground", d.getColor("seaGlassDisabledText"));
        d.put(p + "[Enabled].textForeground", new ColorUIResource(Color.BLACK));
        d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, RadioButtonMenuItemPainter.Which.BACKGROUND_MOUSEOVER));
        d.put(p + "[MouseOver+Selected].textForeground", new ColorUIResource(Color.WHITE));
        d.put(p + "[MouseOver+Selected].backgroundPainter",
              new LazyPainter(c, RadioButtonMenuItemPainter.Which.BACKGROUND_SELECTED_MOUSEOVER));
        
        d.put(p + "[Disabled+Selected].checkIconPainter",
              new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_DISABLED_SELECTED));
        d.put(p + "[Enabled+Selected].checkIconPainter",
              new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED_SELECTED));
        // Rossi: Added painter that shows an "indicator" that menu item is a "selectable radio button"
        d.put(p + "[Enabled].checkIconPainter",
            new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED));
        d.put(p + "[MouseOver].checkIconPainter",
            new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_ENABLED_MOUSEOVER));
        d.put(p + "[MouseOver+Selected].checkIconPainter",
              new LazyPainter(c, RadioButtonMenuItemPainter.Which.CHECKICON_SELECTED_MOUSEOVER));
        d.put(p + ".checkIcon", new SeaGlassIcon(p, "checkIconPainter", 9, 10));

        p = "RadioButtonMenuItem:MenuItemAccelerator";
        d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
        d.put(p + "[MouseOver].textForeground", new ColorUIResource(Color.WHITE));
    }
780002
public void repaintCurrentRow()
    {
        m_jTableScreen.removeEditor();  // This is needed to make sure editors for the delete button are removed.
        int iRow = m_jTableScreen.getSelectedRow();
        int iColumn = m_jTableScreen.getColumnCount() - 1;
        Rectangle rect = m_jTableScreen.getCellRect(iRow, iColumn, false);
        rect.width = rect.width + rect.x;
        rect.x = 0;
        m_jTableScreen.repaint(rect);
    }
504671
function () {
            var self = this, cur = self, last;
            do {
                // 沿着 menu，menuitem 链
                last = cur;
                cur = cur.get('parent');
            } while (cur && (cur.isMenuItem || cur.isMenu));
            return last;
        }
405171
def refresh(self):
        
        if self.enabled and self.line:
            self._clear_deco()
            brush = QtGui.QBrush(self._color)
            self._decoration = TextDecoration(
                self.editor.textCursor(), start_line=self.line)
            self._decoration.set_background(brush)
            self._decoration.set_full_width()
            self._decoration.draw_order = 255
            self.editor.decorations.append(self._decoration)