本文整理汇总了Python中javax.swing.JComboBox.repaint方法的典型用法代码示例。如果您正苦于以下问题:Python JComboBox.repaint方法的具体用法?Python JComboBox.repaint怎么用?Python JComboBox.repaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComboBox
的用法示例。
在下文中一共展示了JComboBox.repaint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EventsPane
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import repaint [as 别名]
#.........这里部分代码省略.........
self.building_objects_box = True
self.objects_box.removeAllItems()
self.geos = self.api.getAllGeos()
for geo in self.geos:
tp = API.Geo.getTypeString(geo)
label = API.Geo.getLabel(geo)
self.objects_box.addItem(tp + " " + label)
finally:
self.building_objects_box = False
if not self.geos:
self.current = None
self.objects_box.enabled = False
self.events_box.enabled = False
self.language_box.enabled = False
self.script_area.input = ""
self.script_area.component.enabled = False
else:
changed = False
if self.current is None:
index, event = 0, 1
changed = True
else:
geo, event = self.current
try:
index = self.geos.index(geo)
except ValueError:
index, event = 0, 1
changed = True
self.events_box.selectedIndex = event
self.objects_box.selectedIndex = index
self.events_box.enabled = True
self.objects_box.enabled = True
self.language_box.enabled = True
self.script_area.component.enabled = True
if changed:
self.update_script_area()
self.objects_box.repaint()
self.events_box.repaint()
def event_listener(self, evt, target):
if self.active:
self.update_geos()
else:
self.must_update_geos = True
def current_script_changed(self):
self.save_btn.enabled = True
def set_save_btn(self, state):
self.save_btn.enabled = state
def save_current_script(self):
if self.current is not None:
geo, evt = self.current
lang = self.language_box.selectedIndex
evt, lang = self.event_types[evt], self.languages[lang]
script = self.script_area.input
self.api.setScript(geo, script, evt, lang)
def update_script_area(self):
self.save_current_script()
geo_index = self.objects_box.selectedIndex
if geo_index == -1:
self.current = None
else:
geo = self.geos[geo_index]
evt = self.events_box.selectedIndex
self.current = geo, evt
script = API.Geo.getScript(geo, self.event_types[evt])
if script is None:
self.script_area.input = ""
else:
self.script_area.input = API.getScriptText(script)
self.language_box.selectedIndex = API.getScriptType(script).ordinal()
self.script_area.reset_undo()
later(self.set_save_btn, False)
def reset(self):
self.current = None
self.update_geos()
# Implementation of ActionListener
def actionPerformed(self, evt):
if self.building_objects_box:
return
if evt.actionCommand == "language":
self.save_btn.enabled = True
else:
self.update_script_area()
# Implementation of DocumentListener
def changedUpdate(self, evt):
self.current_script_changed()
def removeUpdate(self, evt):
self.current_script_changed()
def insertUpdate(self, evt):
self.current_script_changed()