本文整理汇总了Python中javax.swing.BorderFactory.createEmptyBorder方法的典型用法代码示例。如果您正苦于以下问题:Python BorderFactory.createEmptyBorder方法的具体用法?Python BorderFactory.createEmptyBorder怎么用?Python BorderFactory.createEmptyBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.BorderFactory
的用法示例。
在下文中一共展示了BorderFactory.createEmptyBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initComponents
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
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)
示例2: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def __init__(self, parent, title, modal, app):
self.app = app
self.setSize(400, 450)
border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
self.getContentPane().setBorder(border)
self.setLayout(BorderLayout(5, 5))
#Intro
introLbl = JLabel("<html>%s</html>" % self.app.strings.getString("error_info_intro"))
#Panel for displaying error info
self.infoPanel = HtmlPanel()
self.infoPanel.getEditorPane().addHyperlinkListener(self)
self.scrollPane = JScrollPane(self.infoPanel)
#OK button
btnPanel = JPanel(FlowLayout(FlowLayout.CENTER))
okBtn = JButton(self.app.strings.getString("OK"),
ImageProvider.get("ok"),
actionPerformed=self.on_okBtn_clicked)
btnPanel.add(okBtn)
#Layout
self.add(introLbl, BorderLayout.PAGE_START)
self.add(self.scrollPane, BorderLayout.CENTER)
self.add(btnPanel, BorderLayout.PAGE_END)
self.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE)
示例3: initComponents
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
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)
示例4: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def __init__(self, parent, title, modal, app):
JDialog.__init__(self, parent, title, modal)
#Download and Read Dialog
border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
self.getContentPane().setBorder(border)
self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))
panel = JPanel()
panel.setAlignmentX(0.5)
panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS))
panel.add(Box.createRigidArea(Dimension(0, 10)))
self.progressLbl = JLabel(app.strings.getString("downloading_and_reading_errors"))
panel.add(self.progressLbl)
panel.add(Box.createRigidArea(Dimension(0, 10)))
self.progressBar = JProgressBar(0, 100, value=0)
panel.add(self.progressBar)
self.add(panel)
self.add(Box.createRigidArea(Dimension(0, 20)))
cancelBtn = JButton(app.strings.getString("cancel"),
ImageProvider.get("cancel"),
actionPerformed=app.on_cancelBtn_clicked)
cancelBtn.setAlignmentX(0.5)
self.add(cancelBtn)
self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
self.pack()
示例5: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def __init__(self):
"""
Line numbers need to be displayed in a separate panel with different
styling.
"""
# Align right
para_attribs = SimpleAttributeSet()
StyleConstants.setAlignment(para_attribs, StyleConstants.ALIGN_RIGHT)
self.setParagraphAttributes(para_attribs, True)
# Use default font style
default_attribs = SimpleAttributeSet()
StyleConstants.setFontFamily(default_attribs, "Monaco")
StyleConstants.setFontSize(default_attribs, 14)
StyleConstants.setForeground(default_attribs, Color.gray)
self.setCharacterAttributes(default_attribs, True)
# Initialize content
border = BorderFactory.createEmptyBorder(4, 4, 4, 4)
self.border = border
self.setText("1: \n")
self.setEditable(False)
# Prevent auto scroll down when line numbers are repainted
caret = self.getCaret()
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE)
示例6: add_template
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def add_template(self,name,constructor,image):
icon = ImageIcon(image)
if icon.iconWidth>self.max_icon_width:
icon = ImageIcon(icon.image.getScaledInstance(self.max_icon_width,icon.iconHeight*self.max_icon_width/icon.iconWidth,Image.SCALE_SMOOTH))
panel = JPanel(layout = BorderLayout(),opaque = False)
button = JButton(icon = icon,toolTipText = name.replace('\n',' '),
borderPainted = False,focusPainted = False,contentAreaFilled = False,margin = java.awt.Insets(0,0,0,0),
verticalTextPosition = AbstractButton.BOTTOM,horizontalTextPosition = AbstractButton.CENTER,
mousePressed = lambda e: e.source.transferHandler.exportAsDrag(e.source,e,TransferHandler.COPY))
button.transferHandler = self
panel.add(button)
text = '<html><center>%s</center></html>'%name.replace('\n','<br/>')
label = JLabel(text,horizontalAlignment = SwingConstants.CENTER,foreground = Color.WHITE)
self.labels.append(label)
panel.add(label,BorderLayout.SOUTH)
self.panels.append(panel)
panel.alignmentY = Component.CENTER_ALIGNMENT
panel.border = BorderFactory.createEmptyBorder(2,1,2,1)
panel.maximumSize = panel.preferredSize
self.panel.add(panel)
self.templates[button] = constructor
示例7: initComponents
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
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)
示例8: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def __init__(self, controller):
'''
Creates default empty text area in a panel.
It will contain the ATF file content, and allow text edition.
It should highlight reserved words and suggest autocompletion or
possible typos, a la IDEs like Eclipse.
It might need refactoring so that there is a parent panel with two modes
or contexts, depending on user choice: text view or model view.
'''
#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 text edition area
self.editArea = JTextArea()
self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4)
self.editArea.font = Font("Monaco", Font.PLAIN, 14)
#Will need scrolling controls
scrollingText = JScrollPane(self.editArea)
scrollingText.setPreferredSize(Dimension(1,500))
#Add to parent panel
self.add(scrollingText, BorderLayout.CENTER)
示例9: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
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)
示例10: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def __init__(self, controller):
# This custom StyledEditorKit fixes broken line wrapping.
self.setEditorKit(MyStyledEditorKit())
self.controller = controller
self.border = BorderFactory.createEmptyBorder(4, 4, 4, 4)
# If this is not done, no tooltips appear
self.setToolTipText("")
# Consume mouse events when over this JTextPane
listener = CustomMouseListener(self)
self.addMouseListener(listener)
示例11: initUI
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def initUI(self):
global outputTextField
self.panel = JPanel()
self.panel.setLayout(BorderLayout())
toolbar = JToolBar()
openb = JButton("Choose input file", actionPerformed=self.onClick)
outputLabel = JLabel(" Enter output file name: ")
outputTextField = JTextField("hl7OutputReport.txt", 5)
print outputTextField.getText()
toolbar.add(openb)
toolbar.add(outputLabel)
toolbar.add(outputTextField)
self.area = JTextArea()
self.area.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10))
self.area.setText("Select your HL7 ORU messages text file to be converted to tab-delimited flat \nfile with select HL7 fields.\n")
self.area.append("You can enter the path + file name for your output file or it will default to the current \nfile name in the text field above in your current working directory.")
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, BorderLayout.NORTH)
self.setTitle("HL7 ORU Results Reporter")
self.setSize(600, 300)
self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
self.setLocationRelativeTo(None)
self.setVisible(True)
return outputTextField.getText()
示例12: initComponents
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
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)
示例13: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
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.edit_area = JEditorPane()
# Although most of the styling is done using css, we need to set these
# properties to ensure the html is rendered properly in the console
self.edit_area.border = BorderFactory.createEmptyBorder(6, 6, 6, 6)
self.edit_area.setContentType("text/html")
# Disable writing in the console - required to render hyperlinks
self.edit_area.setEditable(False)
# Map CSS color strings to Java Color objects
self.colors = {'Gray': Color(238, 238, 238),
'Black': Color(0, 0, 0),
'Yellow': Color(255, 255, 0)}
# Initial call to refresh console to set the console style properties
self.refreshConsole()
# Set up a hyperlink listener
listener = addEventListener(self.edit_area, HyperlinkListener,
'hyperlinkUpdate', self.handleEvent)
# Will need scrolling controls
scrollingText = JScrollPane(self.edit_area)
scrollingText.setPreferredSize(Dimension(1, 150))
# Make text area auto scroll down to last printed line
caret = self.edit_area.getCaret()
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE)
# Add to parent panel
self.add(scrollingText, BorderLayout.CENTER)
示例14: createAuxPanelWrapper
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
def createAuxPanelWrapper(self, auxPanel, auxTitle):
# Initialize auxillary panel
leftPanel = JPanel()
leftPanel.layout = BorderLayout()
leftPanel.addFocusListener(LeftFocusListener(self))
# NengoStyle.applyStyle(leftPanel);
if self.showTitle:
# Create auxillary panel's title bar
titleBar = JPanel()
titleBar.border = BorderFactory.createEmptyBorder(0, 0, 5, 0))
NengoStyle.applyStyle(titleBar)
titleBar.background = NengoStyle.COLOR_BACKGROUND2
titleBar.opaque = True
titleBar.layout = BorderLayout()
titleLabel = JLabel(title)
titleLabel.font = NengoStyle.FONT_BIG
NengoStyle.applyStyle(titleLabel)
titleLabel.background = NengoStyle.COLOR_BACKGROUND2
titleLabel.opaque = True
hideButtonTxt = " >> " if self.orientation == 'right' else " << "
hideButton = JLabel(hideButtonTxt)
NengoStyle.applyStyle(hideButton)
hideButton.background = NengoStyle.COLOR_BACKGROUND2
hideButton.opaque = True
# Keep in this order, Swing puts items added first on top.
# We want the button to be on top
titleBar.add(hideButton, BorderLayout.EAST)
titleBar.add(titleLabel, BorderLayout.WEST)
hideButton.addMouseListener(HideButtonListener(self, hideButton))
leftPanel.add(titleBar, BorderLayout.NORTH)
leftPanel.minimumSize = self.minimumSize
if auxPanel is not None:
# NengoStyle.applyStyle(auxPanel)
leftPanel.add(auxPanel, BorderLayout.CENTER)
return leftPanel
示例15: __init__
# 需要导入模块: from javax.swing import BorderFactory [as 别名]
# 或者: from javax.swing.BorderFactory import createEmptyBorder [as 别名]
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)