本文整理汇总了Python中javax.swing.JTextField.getBorder方法的典型用法代码示例。如果您正苦于以下问题:Python JTextField.getBorder方法的具体用法?Python JTextField.getBorder怎么用?Python JTextField.getBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.getBorder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NewZoneDialog
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import getBorder [as 别名]
class NewZoneDialog(JDialog, ActionListener, WindowListener):
"""Dialog for favourite zone editing
"""
def __init__(self, parent, title, modal, app):
from java.awt import CardLayout
self.app = app
border = BorderFactory.createEmptyBorder(5, 7, 7, 7)
self.getContentPane().setBorder(border)
self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))
self.FAVAREALAYERNAME = "Favourite zone editing"
info = JLabel(self.app.strings.getString("Create_a_new_favourite_zone"))
info.setAlignmentX(Component.LEFT_ALIGNMENT)
#Name
nameLbl = JLabel(self.app.strings.getString("fav_zone_name"))
self.nameTextField = JTextField(20)
self.nameTextField.setMaximumSize(self.nameTextField.getPreferredSize())
self.nameTextField.setToolTipText(self.app.strings.getString("fav_zone_name_tooltip"))
namePanel = JPanel()
namePanel.setLayout(BoxLayout(namePanel, BoxLayout.X_AXIS))
namePanel.add(nameLbl)
namePanel.add(Box.createHorizontalGlue())
namePanel.add(self.nameTextField)
#Country
countryLbl = JLabel(self.app.strings.getString("fav_zone_country"))
self.countryTextField = JTextField(20)
self.countryTextField.setMaximumSize(self.countryTextField.getPreferredSize())
self.countryTextField.setToolTipText(self.app.strings.getString("fav_zone_country_tooltip"))
countryPanel = JPanel()
countryPanel.setLayout(BoxLayout(countryPanel, BoxLayout.X_AXIS))
countryPanel.add(countryLbl)
countryPanel.add(Box.createHorizontalGlue())
countryPanel.add(self.countryTextField)
#Type
modeLbl = JLabel(self.app.strings.getString("fav_zone_type"))
RECTPANEL = "rectangle"
POLYGONPANEL = "polygon"
BOUNDARYPANEL = "boundary"
self.modesStrings = [RECTPANEL, POLYGONPANEL, BOUNDARYPANEL]
modesComboModel = DefaultComboBoxModel()
for i in (self.app.strings.getString("rectangle"),
self.app.strings.getString("delimited_by_a_closed_way"),
self.app.strings.getString("delimited_by_an_administrative_boundary")):
modesComboModel.addElement(i)
self.modesComboBox = JComboBox(modesComboModel,
actionListener=self,
editable=False)
#- Rectangle
self.rectPanel = JPanel()
self.rectPanel.setLayout(BoxLayout(self.rectPanel, BoxLayout.Y_AXIS))
capturePane = JPanel()
capturePane.setLayout(BoxLayout(capturePane, BoxLayout.X_AXIS))
capturePane.setAlignmentX(Component.LEFT_ALIGNMENT)
josmP = JPanel()
self.captureRBtn = JRadioButton(self.app.strings.getString("capture_area"))
self.captureRBtn.addActionListener(self)
self.captureRBtn.setSelected(True)
self.bboxFromJosmBtn = JButton(self.app.strings.getString("get_current_area"),
actionPerformed=self.on_bboxFromJosmBtn_clicked)
self.bboxFromJosmBtn.setToolTipText(self.app.strings.getString("get_capture_area_tooltip"))
josmP.add(self.bboxFromJosmBtn)
capturePane.add(self.captureRBtn)
capturePane.add(Box.createHorizontalGlue())
capturePane.add(self.bboxFromJosmBtn)
manualPane = JPanel()
manualPane.setLayout(BoxLayout(manualPane, BoxLayout.X_AXIS))
manualPane.setAlignmentX(Component.LEFT_ALIGNMENT)
self.manualRBtn = JRadioButton(self.app.strings.getString("use_this_bbox"))
self.manualRBtn.addActionListener(self)
self.bboxTextField = JTextField(20)
self.bboxTextField.setMaximumSize(self.bboxTextField.getPreferredSize())
self.bboxTextField.setToolTipText(self.app.strings.getString("fav_bbox_tooltip"))
self.bboxTextFieldDefaultBorder = self.bboxTextField.getBorder()
self.bboxTextField.getDocument().addDocumentListener(TextListener(self))
manualPane.add(self.manualRBtn)
manualPane.add(Box.createHorizontalGlue())
manualPane.add(self.bboxTextField)
group = ButtonGroup()
group.add(self.captureRBtn)
group.add(self.manualRBtn)
previewPane = JPanel()
previewPane.setLayout(BoxLayout(previewPane, BoxLayout.X_AXIS))
previewPane.setAlignmentX(Component.LEFT_ALIGNMENT)
bboxPreviewInfo = JTextField(self.app.strings.getString("coordinates"),
editable=0,
border=None)
bboxPreviewInfo.setMaximumSize(bboxPreviewInfo.getPreferredSize())
self.bboxPreviewTextField = JTextField(20,
editable=0,
border=None)
#.........这里部分代码省略.........
示例2: ChannelPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import getBorder [as 别名]
class ChannelPanel(JPanel):
gbc = GridBagConstraints()
def __init__(self):
JPanel.__init__(self)
self.setLayout(GridBagLayout())
self.setBorder(TitledBorder("Channel"))
# some helper constants
REL = GridBagConstraints.RELATIVE
REM = GridBagConstraints.REMAINDER
HORIZ = GridBagConstraints.HORIZONTAL
NW = GridBagConstraints.NORTHWEST
CENTER = GridBagConstraints.CENTER
# --- title
label = JLabel("Title:")
self.constrain(label, REL, REL, REL, 1,
HORIZ, CENTER, 1.0, 1.0,
2, 2, 2, 2)
self.field_title = JTextField()
self.field_title.setEditable(0)
self.constrain(self.field_title, REL, REL, REM, 1,
HORIZ, CENTER, 1.0, 1.0,
2, 2, 2, 2)
# --- description
label = JLabel("Description:")
self.constrain(label, REL, REL, REL, 1,
HORIZ, NW, 1.0, 1.0,
2, 2, 2, 2)
self.field_descr = JTextArea(3, 40)
self.field_descr.setEditable(0)
# wrap long lines
self.field_descr.setLineWrap(1)
# allow only full words to be wrapped
self.field_descr.setWrapStyleWord(1)
# ensure that the border look is the same
self.field_descr.setBorder(self.field_title.getBorder())
self.constrain(self.field_descr, REL, REL, REM, 1,
HORIZ, NW, 1.0, 1.0,
2, 2, 2, 2)
# --- location
label = JLabel("Location:")
self.constrain(label, REL, REL, REL, 1,
HORIZ, NW, 1.0, 1.0,
2, 2, 2, 2)
self.field_location = JTextField()
self.constrain(self.field_location, REL, REL, REM, REL,
HORIZ, NW, 1.0, 1.0,
2, 2, 2, 2)
# --- last update
label = JLabel("Last Update:")
self.constrain(label, REL, REL, REL, REM,
HORIZ, NW, 1.0, 1.0,
2, 2, 2, 2)
self.field_lastupdate = JTextField()
self.field_lastupdate.setEditable(0)
self.constrain(self.field_lastupdate, REL, REL, REM, REM,
HORIZ, NW, 1.0, 1.0,
2, 2, 2, 2)
def setChannel(self, channel):
self.channel = channel
self.field_title.setText(channel.getTitle())
self.field_descr.setText(channel.getDescription())
self.field_location.setText(channel.getLocation().toString())
self.field_lastupdate.setText(channel.getSubscription().getLastUpdated().toString())
def refresh(self):
self.setChannel(self.channel)
def constrain(self, component,
grid_x, grid_y, grid_width, grid_height,
fill, anchor, weight_x, weight_y,
top, left, bottom, right):
container = self
c = self.gbc
c.gridx = grid_x
c.gridy = grid_y
c.gridwidth = grid_width
c.gridheight = grid_height
c.fill = fill
c.anchor = anchor
c.weightx = weight_x
c.weighty = weight_y
if (top + bottom + left + right > 0):
c.insets = Insets(top, left, bottom, right)
container.getLayout().setConstraints(component, c)
container.add(component)
示例3: PreferencesFrame
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import getBorder [as 别名]
class PreferencesFrame(JFrame, ActionListener, WindowListener, ItemListener, HyperlinkListener):
"""Dialog with preferences
"""
def __init__(self, parent, title, app):
from javax.swing import JCheckBox, JRadioButton, ButtonGroup
self.app = app
border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
self.getContentPane().setBorder(border)
self.getContentPane().setLayout(BorderLayout(0, 5))
self.tabbedPane = JTabbedPane()
#1 Tab: general
panel1 = JPanel()
panel1.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7))
panel1.setLayout(BoxLayout(panel1, BoxLayout.PAGE_AXIS))
#Checkbutton to enable/disable update check when script starts
self.updateCBtn = JCheckBox(self.app.strings.getString("updateCBtn"))
self.updateCBtn.setToolTipText(self.app.strings.getString("updateCBtn_tooltip"))
#Download tools
downloadBtn = JButton(self.app.strings.getString("updatesBtn"),
ImageProvider.get("dialogs", "refresh"),
actionPerformed=self.on_downloadBtn_clicked)
downloadBtn.setToolTipText(self.app.strings.getString("updatesBtn_tooltip"))
#Checkbuttons for enabling/disabling tools
toolsPanel = JPanel(BorderLayout(0, 5))
title = self.app.strings.getString("enable_disable_tools")
toolsPanel.setBorder(BorderFactory.createTitledBorder(title))
infoLbl = JLabel(self.app.strings.getString("JOSM_restart_warning"))
infoLbl.setFont(infoLbl.getFont().deriveFont(Font.ITALIC))
toolsPanel.add(infoLbl, BorderLayout.PAGE_START)
toolsStatusPane = JPanel(GridLayout(len(self.app.realTools), 0))
self.toolsCBtns = []
for tool in self.app.realTools:
toolCBtn = JCheckBox()
toolCBtn.addItemListener(self)
toolLbl = JLabel(tool.title, tool.bigIcon, JLabel.LEFT)
self.toolsCBtns.append(toolCBtn)
toolPane = JPanel()
toolPane.setLayout(BoxLayout(toolPane, BoxLayout.X_AXIS))
toolPane.add(toolCBtn)
toolPane.add(toolLbl)
toolsStatusPane.add(toolPane)
toolsPanel.add(toolsStatusPane, BorderLayout.CENTER)
#Radiobuttons for enabling/disabling layers when a new one
#is added
layersPanel = JPanel(GridLayout(0, 1))
title = self.app.strings.getString("errors_layers_manager")
layersPanel.setBorder(BorderFactory.createTitledBorder(title))
errorLayersLbl = JLabel(self.app.strings.getString("errors_layers_info"))
errorLayersLbl.setFont(errorLayersLbl.getFont().deriveFont(Font.ITALIC))
layersPanel.add(errorLayersLbl)
self.layersRBtns = {}
group = ButtonGroup()
for mode in self.app.layersModes:
layerRBtn = JRadioButton(self.app.strings.getString("%s" % mode))
group.add(layerRBtn)
layersPanel.add(layerRBtn)
self.layersRBtns[mode] = layerRBtn
#Max number of errors text field
self.maxErrorsNumberTextField = JTextField()
self.maxErrorsNumberTextField.setToolTipText(self.app.strings.getString("maxErrorsNumberTextField_tooltip"))
self.maxErrorsNumberTFieldDefaultBorder = self.maxErrorsNumberTextField.getBorder()
self.maxErrorsNumberTextField.getDocument().addDocumentListener(ErrNumTextListener(self))
#layout
self.updateCBtn.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(self.updateCBtn)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
downloadBtn.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(downloadBtn)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
toolsPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(toolsPanel)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
layersPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(layersPanel)
panel1.add(Box.createRigidArea(Dimension(0, 15)))
maxErrP = JPanel(BorderLayout(5, 0))
maxErrP.add(JLabel(self.app.strings.getString("max_errors_number")), BorderLayout.LINE_START)
maxErrP.add(self.maxErrorsNumberTextField, BorderLayout.CENTER)
p = JPanel(BorderLayout())
p.add(maxErrP, BorderLayout.PAGE_START)
p.setAlignmentX(Component.LEFT_ALIGNMENT)
panel1.add(p)
self.tabbedPane.addTab(self.app.strings.getString("tab_1_title"),
None,
panel1,
None)
#2 Tab: favourite zones
panel2 = JPanel(BorderLayout(5, 15))
panel2.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7))
#.........这里部分代码省略.........