Thursday 15 September 2011

java - Making a stock ticker wrap around in Swing -


I currently have a set of TickerSimbol () objects that scroll through the screen in my swing geometry. I'm not sure how to wrap it, though in terms of logic ..

  safe wired chetan (new timer (TIMA Dedley, new timer listener)). } @ Override Protected Zero Paint Comonant (Graphics G) {SuperPaintConant (G); Graphics 2DG2 = (Graphics 2D) G; G.setFont (BG_STRING_FONT); G.setColor (Color.LIGHT_GRAY); G2.setRenderingHint (Rendering Hints. KEY_TEXT_ANTIALASING, Rendering Hints. VALUE_TEXT_ANTIALIAS_ON); & Lt; TickerSymbol & gt; Ticker = ticker Guitars (); {TickerSimbol TS: Ticker} {// Create formatted string with ticker information ... This part works fine ...}}} Private class timer executes execution execution {public Zero Action-participated (java.awt.event.ActionEvent E) {// TODO is required to make a ticker sheet instead of hard coding (IMGX and LT; = -2000) {imgX = getWidth (); } And {imgX - = 1; } Color (); }; }   

As you can see above, I have currently stiffened the position on which to get Width () for 'IMGX' reset. This means that the string will reset its position in the right corner of the app.

I have tried to use "Iterables.cycle" from the live project but it ends because of generating memory overflow.

  Iterable & lt; TickerSymbol & gt; Live = ethereabals Bicycle (ticker); While (live.iterator (). HasNext ()) {....   

Any help is appreciated!

check out. This allows you to scroll a panel that contains components. So you can make a panel with a jlabel in which you want to scroll, or you can add more than one label to the panel which allows you to dynamically update the label as a scrolling circle.

No comments:

Post a Comment