本文整理汇总了Python中javax.swing.JTextArea类的典型用法代码示例。如果您正苦于以下问题:Python JTextArea类的具体用法?Python JTextArea怎么用?Python JTextArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JTextArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getControlPanel
def getControlPanel():
global controlPanel
controlPanel = JPanel()
controlPanel.setLayout(BoxLayout(controlPanel, BoxLayout.Y_AXIS))
for row in keyLayout:
rowPanel = JPanel()
rowPanel.setLayout(BoxLayout(rowPanel, BoxLayout.X_AXIS))
controlPanel.add(rowPanel)
for key in row:
button = JButton(key[0], actionPerformed=handleKeyButton)
button.setActionCommand(key[1])
rowPanel.add(button)
global terminalResult
terminalResult = JTextArea()
scroller = JScrollPane(terminalResult)
terminalResult.setLineWrap(True)
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS)
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)
controlPanel.add(scroller)
global terminalInput
termInputPanel = JPanel()
termInputPanel.setLayout(BoxLayout(termInputPanel, BoxLayout.X_AXIS))
termInputLabel = JLabel("Command")
termInputPanel.add(termInputLabel)
terminalInput = JTextField(actionPerformed=handleTerminalInput)
minimumSize = terminalInput.getMinimumSize()
maximumSize = terminalInput.getMaximumSize()
terminalInput.setMaximumSize(Dimension(maximumSize.width, minimumSize.height))
termInputPanel.add(terminalInput)
controlPanel.add(termInputPanel)
return controlPanel
示例2: ConversationWindow
class ConversationWindow(Conversation):
"""A GUI window of a conversation with a specific person"""
def __init__(self, person, chatui):
"""ConversationWindow(basesupport.AbstractPerson:person)"""
Conversation.__init__(self, person, chatui)
self.mainframe = JFrame("Conversation with "+person.name)
self.display = JTextArea(columns=100,
rows=15,
editable=0,
lineWrap=1)
self.typepad = JTextField()
self.buildpane()
self.lentext = 0
def buildpane(self):
buttons = JPanel(doublebuffered)
buttons.add(JButton("Send", actionPerformed=self.send))
buttons.add(JButton("Hide", actionPerformed=self.hidewindow))
mainpane = self.mainframe.getContentPane()
mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS))
mainpane.add(JScrollPane(self.display))
self.typepad.actionPerformed = self.send
mainpane.add(self.typepad)
mainpane.add(buttons)
def show(self):
self.mainframe.pack()
self.mainframe.show()
def hide(self):
self.mainframe.hide()
def sendText(self, text):
self.displayText("\n"+self.person.client.name+": "+text)
Conversation.sendText(self, text)
def showMessage(self, text, metadata=None):
self.displayText("\n"+self.person.name+": "+text)
def contactChangedNick(self, person, newnick):
Conversation.contactChangedNick(self, person, newnick)
self.mainframe.setTitle("Conversation with "+newnick)
#GUI code
def displayText(self, text):
self.lentext = self.lentext + len(text)
self.display.append(text)
self.display.setCaretPosition(self.lentext)
#actionlisteners
def hidewindow(self, ae):
self.hide()
def send(self, ae):
text = self.typepad.getText()
self.typepad.setText("")
if text != "" and text != None:
self.sendText(text)
示例3: getListCellRendererComponent
def getListCellRendererComponent(self, lst, value, index, isSelected, cellHasFocus):
text = value["text"]
renderer = JTextArea(text=text)
renderer.foreground = self.colormap[value["type"]]
renderer.font = self.font
if isSelected:
renderer.background = Color.YELLOW
return renderer
示例4: run_fn
def run_fn(event):
log_window = JFrame('Galahad Log')
log_text_area = JTextArea()
log_text_area.editable = False
log_window.setSize(400, 500)
log_window.add(log_text_area)
log_window.show()
log_text_area.append('sdfsdfsdfsdfsd %d' % 3)
示例5: initComponents
def initComponents(self):
self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
#self.setLayout(GridLayout(0,1))
self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
self.panel1 = JPanel()
self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent)
self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent)
self.text1 = JLabel("*** Only run this once otherwise it adds it to the data again.")
self.text2 = JLabel(" ")
self.text3 = JLabel("*** Format is a comma delimited text ie: 8001, 8002")
self.panel1.add(self.checkbox)
self.panel1.add(self.text1)
self.panel1.add(self.text2)
self.panel1.add(self.checkbox4)
self.panel1.add(self.text3)
self.add(self.panel1)
self.area = JTextArea(5,25)
#self.area.addKeyListener(self)
self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
self.pane = JScrollPane()
self.pane.getViewport().add(self.area)
#self.pane.addKeyListener(self)
#self.add(self.area)
self.add(self.pane)
示例6: initComponents
def initComponents(self):
self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
#self.setLayout(GridLayout(0,1))
self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
self.panel1 = JPanel()
self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
self.checkbox = JCheckBox("All Logs", actionPerformed=self.checkBoxEvent)
self.checkbox1 = JCheckBox("Application.Evtx", actionPerformed=self.checkBoxEvent)
self.checkbox2 = JCheckBox("Security.EVTX", actionPerformed=self.checkBoxEvent)
self.checkbox3 = JCheckBox("System.EVTX", actionPerformed=self.checkBoxEvent)
self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent)
self.panel1.add(self.checkbox)
self.panel1.add(self.checkbox1)
self.panel1.add(self.checkbox2)
self.panel1.add(self.checkbox3)
self.panel1.add(self.checkbox4)
self.add(self.panel1)
self.area = JTextArea(5,25)
#self.area.addKeyListener(self)
self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
self.pane = JScrollPane()
self.pane.getViewport().add(self.area)
#self.pane.addKeyListener(self)
#self.add(self.area)
self.add(self.pane)
示例7: __init__
def __init__(self, controller):
'''
Creates default empty console-looking panel.
It should be separated from the rest of the GUI so that users can choose
to show or hide the console. Or should it be a split panel?
This panel will display log and validation/lemmatization messages.
It might need its own toolbar for searching, etc.
It will also accept commands in later stages of development, if need be.
'''
#Give reference to controller to delegate action response
self.controller = controller
#Make text area occupy all available space and resize with parent window
self.setLayout(BorderLayout())
#Create console-looking area
self.editArea = JTextArea()
self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4)
self.editArea.font = Font("Courier New", Font.BOLD, 14)
self.editArea.background = Color.BLACK
self.editArea.foreground = Color.WHITE
self.editArea.text = "Console started. Nammu's log will appear here.\n\n"
#Will need scrolling controls
scrollingText = JScrollPane(self.editArea)
scrollingText.setPreferredSize(Dimension(1,150))
#Make text area auto scroll down to last printed line
caret = self.editArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
#Add to parent panel
self.add(scrollingText, BorderLayout.CENTER)
示例8: __init__
def __init__(self):
self.frame = JFrame("Python Window")
self.historyList = JList(DefaultListModel())
self.historyList.cellRenderer = MyListCellRenderer()
#self.historyPanel.layout = BoxLayout(
# self.historyPanel,
# BoxLayout.Y_AXIS
#)
scrollpane = JScrollPane()
# JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
# JScrollPane.HORIZONTAL_SCROLLBAR_NEVER
#)
# scrollpane.preferredSize = 400, 800
inputPanel = JPanel()
inputPanel.layout = GridLayout(1, 1)
self.input = JTextArea("")
self.input.border = BorderFactory.createEmptyBorder(5, 5, 5, 5)
self.input.tabSize = 4
self.input.font = Font("Monospaced", Font.PLAIN, 12)
#self.input.preferredSize = 500, 200
self.input.addKeyListener(self)
#self.button = JButton('Run', actionPerformed=self.run)
inputPanel.add(self.input)
#inputPanel.add(self.button)
scrollpane.viewport.view = self.historyList
self.frame.add(scrollpane, BorderLayout.CENTER)
self.frame.add(inputPanel, BorderLayout.PAGE_END)
self.frame.size = 500, 600
self.frame.visible = False
示例9: initComponents
def initComponents(self):
self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
#self.setLayout(GridLayout(0,1))
self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
self.panel1 = JPanel()
self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent)
self.label0 = JLabel(" ")
self.label1 = JLabel("Input in SQLite DB's in area below,")
self.label2 = JLabel("seperate values by commas.")
self.label3 = JLabel("then check the box above.")
self.label4 = JLabel(" ")
self.panel1.add(self.checkbox)
self.panel1.add(self.label0)
self.panel1.add(self.label1)
self.panel1.add(self.label2)
self.panel1.add(self.label3)
self.panel1.add(self.label4)
self.add(self.panel1)
self.area = JTextArea(5,25)
#self.area.getDocument().addDocumentListener(self.area)
#self.area.addKeyListener(listener)
self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
self.pane = JScrollPane()
self.pane.getViewport().add(self.area)
#self.pane.addKeyListener(self.area)
#self.add(self.area)
self.add(self.pane)
示例10: LowHangingFruitUISettingsPanel
class LowHangingFruitUISettingsPanel(IngestModuleIngestJobSettingsPanel):
def __init__(self, settings):
self.local_settings = settings
self.initComponents()
def initComponents(self):
self.panel = JPanel()
self.panel.setLayout(BorderLayout())
toolbar = JToolBar()
openb = JButton("Select", actionPerformed=self.onClick)
toolbar.add(openb)
self.area = JTextArea()
self.area.setBorder(BorderFactory.createEmptyBorder(10, 100, 10, 100))
pane = JScrollPane()
pane.getViewport().add(self.area)
self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10))
self.panel.add(pane)
self.add(self.panel)
self.add(toolbar)
def onClick(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("SQLite", ["sqlite"])
chooseFile.addChoosableFileFilter(filter)
ret = chooseFile.showDialog(self.panel, "Select SQLite")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
text = self.readPath(file)
self.area.setText(text)
def readPath(self, file):
global filename
filename = file.getCanonicalPath()
return filename
def getSettings(self):
return self.local_settings
示例11: __init__
def __init__(self, frame):
JWindow.__init__(self, frame)
self.textarea = JTextArea()
# TODO put this color with all the other colors
self.textarea.setBackground(Color(225,255,255))
self.textarea.setEditable(0)
self.jscrollpane = JScrollPane(self.textarea)
self.getContentPane().add(self.jscrollpane)
示例12: __init__
def __init__(self, group, chatui):
GroupConversation.__init__(self, group, chatui)
self.mainframe = JFrame(self.group.name)
self.headers = ["Member"]
self.memberdata = UneditableTableModel([], self.headers)
self.display = JTextArea(columns=100, rows=15, editable=0, lineWrap=1)
self.typepad = JTextField()
self.buildpane()
self.lentext = 0
示例13: loadPanel
def loadPanel(self):
panel = JPanel()
panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS))
bottomButtonBarPanel = JPanel()
bottomButtonBarPanel.setLayout(BoxLayout(bottomButtonBarPanel, BoxLayout.X_AXIS))
bottomButtonBarPanel.setAlignmentX(1.0)
self.runButton = JButton("Run", actionPerformed=self.start)
self.cancelButton = JButton("Close", actionPerformed=self.cancel)
bottomButtonBarPanel.add(Box.createHorizontalGlue());
bottomButtonBarPanel.add(self.runButton)
bottomButtonBarPanel.add(self.cancelButton)
# Dimension(width,height)
bottom = JPanel()
bottom.setLayout(BoxLayout(bottom, BoxLayout.X_AXIS))
bottom.setAlignmentX(1.0)
self.progressBar = JProgressBar()
self.progressBar.setIndeterminate(False)
self.progressBar.setMaximum(100)
self.progressBar.setValue(0)
bottom.add(self.progressBar)
self.statusTextArea = JTextArea()
self.statusTextArea.setEditable(False)
scrollPane = JScrollPane(self.statusTextArea)
scrollPanel = JPanel()
scrollPanel.setLayout(BoxLayout(scrollPanel, BoxLayout.X_AXIS))
scrollPanel.setAlignmentX(1.0)
scrollPanel.add(scrollPane)
panel.add(scrollPanel)
panel.add(bottomButtonBarPanel)
panel.add(bottom)
self.add(panel)
self.setTitle("Determine Session Cookie(s)")
self.setSize(450, 300)
self.setLocationRelativeTo(None)
self.setVisible(True)
original_request_bytes = self.selected_message.getRequest()
http_service = self.selected_message.getHttpService()
helpers = self.callbacks.getHelpers()
request_info = helpers.analyzeRequest(http_service, original_request_bytes)
parameters = request_info.getParameters();
cookie_parameters = [parameter for parameter in parameters if parameter.getType() == IParameter.PARAM_COOKIE]
num_requests_needed = len(cookie_parameters) + 2
self.statusTextArea.append("This may require up to " + str(num_requests_needed) + " requests to be made. Hit 'Run' to begin.\n")
示例14: initConfigurationTab
def initConfigurationTab(self):
#
## init configuration tab
#
self.prevent304 = JCheckBox("Prevent 304 Not Modified status code")
self.prevent304.setBounds(290, 25, 300, 30)
self.ignore304 = JCheckBox("Ignore 304/204 status code responses")
self.ignore304.setBounds(290, 5, 300, 30)
self.ignore304.setSelected(True)
self.autoScroll = JCheckBox("Auto Scroll")
#self.autoScroll.setBounds(290, 45, 140, 30)
self.autoScroll.setBounds(160, 40, 140, 30)
self.doUnauthorizedRequest = JCheckBox("Check unauthenticated")
self.doUnauthorizedRequest.setBounds(290, 45, 300, 30)
self.doUnauthorizedRequest.setSelected(True)
startLabel = JLabel("Authorization checks:")
startLabel.setBounds(10, 10, 140, 30)
self.startButton = JButton("Autorize is off",actionPerformed=self.startOrStop)
self.startButton.setBounds(160, 10, 120, 30)
self.startButton.setBackground(Color(255, 100, 91, 255))
self.clearButton = JButton("Clear List",actionPerformed=self.clearList)
self.clearButton.setBounds(10, 40, 100, 30)
self.replaceString = JTextArea("Cookie: Insert=injected; header=here;", 5, 30)
self.replaceString.setWrapStyleWord(True);
self.replaceString.setLineWrap(True)
self.replaceString.setBounds(10, 80, 470, 180)
self.filtersTabs = JTabbedPane()
self.filtersTabs.addTab("Enforcement Detector", self.EDPnl)
self.filtersTabs.addTab("Detector Unauthenticated", self.EDPnlUnauth)
self.filtersTabs.addTab("Interception Filters", self.filtersPnl)
self.filtersTabs.addTab("Export", self.exportPnl)
self.filtersTabs.setBounds(0, 280, 2000, 700)
self.pnl = JPanel()
self.pnl.setBounds(0, 0, 1000, 1000);
self.pnl.setLayout(None);
self.pnl.add(self.startButton)
self.pnl.add(self.clearButton)
self.pnl.add(self.replaceString)
self.pnl.add(startLabel)
self.pnl.add(self.autoScroll)
self.pnl.add(self.ignore304)
self.pnl.add(self.prevent304)
self.pnl.add(self.doUnauthorizedRequest)
self.pnl.add(self.filtersTabs)
示例15: registerExtenderCallbacks
def registerExtenderCallbacks(self, callbacks):
# properties
self._title = "Generate Python Template"
self._templatePath = '###### ----> PUT HERE THE ABSOLUTE PATH TO template.py <--- ####'
# set our extension name
callbacks.setExtensionName(self._title)
# keep a reference to our callbacks object
self._callbacks = callbacks
# obtain an extension helpers object
self._helpers = callbacks.getHelpers()
# obtain std streams
self._stdout = PrintWriter(callbacks.getStdout(), True)
self._stderr = PrintWriter(callbacks.getStderr(), True)
# main pane (top/bottom)
self._mainpane = JPanel()
self._mainpane.setLayout( GridLayout(2,1) )
# configure bottom pane for buttons
self._botPane = JPanel()
flowLayout = FlowLayout()
self._botPane.setLayout( flowLayout )
self._botPane.add( JButton("Generate", actionPerformed=self.regeneratePy) )
self._botPane.add( JButton("Export", actionPerformed=self.exportPy) )
# Configure pyViewer (JTextArea) for python output --> top pane
self._pyViewer = JTextArea(5, 20);
scrollPane = JScrollPane(self._pyViewer);
self._pyViewer.setEditable(True);
self._pyViewer.setText( "Waiting request ..." );
### Assign top / bottom components
self._mainpane.add(scrollPane)
self._mainpane.add(self._botPane)
# customize our UI components
callbacks.customizeUiComponent(self._mainpane)
# add the custom tab to Burp's UI
callbacks.addSuiteTab(self)
# register ourselves as a ContextMenuFactory
callbacks.registerContextMenuFactory(self)
return