• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

how to get rid off flickering in JOptionPane dialog

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Tybon
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Double-buffering is enabled by default in Swing...
Swing Connection: Painting in AWT and Swing by Amy Fowler
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic