コード例 #1
0
ファイル: gui.py プロジェクト: Serabe/geogebra
 def __init__(self, textpane):
     self.component = JTextPane(
         font=textpane.font,
         border=BorderFactory.createEmptyBorder(5, 5, 5, 5),
         editable=False,
         background=awtColor(220, 220, 220),
     )
     self.doc = self.component.document
     self.component.setParagraphAttributes(
         textpane.paragraphAttributes, True
     )
     self.linecount = 0
     self.style = new_style(self.doc, "default",
         foreground=awtColor(100, 100, 100),
     )
     self.reset(1)
     textpane.document.addDocumentListener(self)
コード例 #2
0
ファイル: gui.py プロジェクト: Serabe/geogebra
 def new_style(name, color=None, bold=None, italic=None, underline=None):
     style = self.doc.addStyle(name, self.parent_style)
     if color is not None:
         if isinstance(color, str):
             color = awtColor(
                 int(color[0:2], 16),
                 int(color[2:4], 16),
                 int(color[4:6], 16)
             )
         StyleConstants.setForeground(style, color)
     if bold is not None:
         StyleConstants.setBold(style, bold)
     if italic is not None:
         StyleConstants.setItalic(style, italic)
     if underline is not None:
         StyleConstants.setUnderline(style, underline)
     return style