Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adjustment Listener  RSS feed

 
Mohan Lavu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone!
I am new to Java.I have a problem with handling the Adjustment event.I have an Applet which draws 'n' number of rectangles.There are some Buttons and textfields and scrollbars.
When the paint method draws the n number of rectangles(Using drawRect(.....)) i need to scroll and show the rectangles which were initially invisible.I tried to do something but was not able to get it correctly.Hope some one is gonna help me out!!!.
I will be glad to have a small Applet code to demonstrate this.
Thank You.
 
subha chary
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi mohan,
try using the default constructors of ur JScrollBar class coz they give u the default settings for the srollbar .jus handle the vent appropriatelty after that and it worls perfectly!!!
any troubles do get back
subha
 
Mohan Lavu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi subha,
The problem is not with the scrollbars and values.The problem fo rme is implementing the listener code.what should i do before i repaint it.Lemme put it more elaborately.My Applet has a width which is enough to view 5 rectangles.In the first run it is showing me the first five.when i scroll (horizontally)
Now the first one should disappear and Rectangles from 2 to 6 should appear.I dunno swing.So please stick to scrollbars instead of jscrollbars.Now i am doing AWT's.The problem is with code to be written for adjustmentValueChanged().
Thank you,
Mohan.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!