• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get rid off flickering in JOptionPane dialog

 
harcharan kanwal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have this problem.When user selects a record,JOptionPane.showInputDialog pops up and it shows the seats available either in JComboBox or JList,but when you scrolldown the JList or JComboBox,the data inside flickers.i was trying to override the showInputDialog so i can get to this JComboBox or JList to fix this. i do not have any clue to fix this.
is their any advice on it.
the same problem was fixed in jtabel with the following code
scrollPane.getViewport().setScrollMode
(JViewport.SIMPLE_SCROLL_MODE);
thanks in advance
harcharan
 
Tybon Wu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can think of 2 ways. There are probably other ways too.
You can create your own Dialog and use double buffering.
You can also get a reference to the dialog created by JOptionPane.showInputDialog(...) by adding a FocusListener on the parent frame, and use double buffering for that dialog.
The first way is better because it's more straightforward.
[ October 03, 2002: Message edited by: Tybon Wu ]
 
harcharan kanwal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Tybon,
can you describe double buffering for me
thanks for your response
harcharan
 
Tybon Wu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Double buffering reduces flickers by rendering to an image buffer first then rendering the image to the screen.
You can enable double buffering by adding this line in your Swing Component:
RepaintManger.currentManager(this).setDoubleBufferingEnabled(true);
 
harcharan kanwal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Tybon
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Double-buffering is enabled by default in Swing...
Swing Connection: Painting in AWT and Swing by Amy Fowler
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic