weimingtom / jythonconsole

Automatically exported from code.google.com/p/jythonconsole
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Console does not work after changing LAF #26

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Change Look And Feel at runtime

After changing the LAF at runtime the console becomes a normal TextPane.
Commands are no longer accepted, instead a New Line Feed is inserted. The
History function does not work anymore and the Popup Window does not appear.

Original issue reported on code.google.com by twillim...@gmail.com on 21 May 2010 at 3:00

GoogleCodeExporter commented 8 years ago
problem solved: you have to add the following PropertyChangeListener to the 
JScrollPane

from java.beans import PropertyChangeListener
from java.lang import Runnable
from javax.swing import SwingUtilities
class KeymapRestoreListener(PropertyChangeListener):
    def __init__(self, text_pane):
        self.text_pane = text_pane
        self.keymap = text_pane.keymap    

    def propertyChange(self, evt):
        if (evt.getPropertyName() == "UI"):
            SwingUtilities.invokeLater(RestoreRunner(self.text_pane, self.keymap))

class RestoreRunner(Runnable):

    def __init__(self, text_pane, keymap):
        self.text_pane = text_pane
        self.keymap = keymap

    def run(self):
        self.text_pane.keymap = self.keymap

Original comment by twillim...@gmail.com on 21 May 2010 at 9:40