public void paint(Graphics g) { int x = s1.getValue(); int y = s2.getValue(); int z = s3.getValue(); Color c = new Color(x, y, z); setBackground(c); }
public void paint(Graphics g) { msg = "Vertical: " + vertSB.getValue(); msg += ", Horizontal: " + horzSB.getValue(); g.drawString(msg, 6, 160); // show current mouse drag position g.drawString("*", horzSB.getValue(), vertSB.getValue()); }
/** * Called to process scrollbar events. * * @param event to process. */ public void adjustmentValueChanged(AdjustmentEvent event) { try { final Scrollbar hScroll = getScrollbar(Scrollbar.HORIZONTAL); final Scrollbar vScroll = getScrollbar(Scrollbar.VERTICAL); final Point scrollPosition = getScrollPosition(); setScrollPosition( (hScroll != null) ? hScroll.getValue() : scrollPosition.x, (vScroll != null) ? vScroll.getValue() : scrollPosition.y); } catch (final Throwable exp) { exp.printStackTrace(DjVuOptions.err); System.gc(); } }