本文整理汇总了Python中javax.swing.JButton.setAlignmentX方法的典型用法代码示例。如果您正苦于以下问题:Python JButton.setAlignmentX方法的具体用法?Python JButton.setAlignmentX怎么用?Python JButton.setAlignmentX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setAlignmentX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setAlignmentX [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()
示例2: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setAlignmentX [as 别名]
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))
#status
topPanel = JPanel()
#.........这里部分代码省略.........
示例3: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setAlignmentX [as 别名]
def __init__(self, parent, title, modal, app):
from javax.swing import JTextArea
border = BorderFactory.createEmptyBorder(5, 7, 7, 7)
self.getContentPane().setBorder(border)
self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))
#Icon
icon = ImageIcon(File.separator.join([app.SCRIPTDIR,
"images",
"icons",
"logo.png"]))
iconLbl = JLabel(icon)
iconLbl.setAlignmentX(JLabel.CENTER_ALIGNMENT)
#Name
titleLbl = JLabel("Quality Assurance Tools script")
titleLbl.setAlignmentX(JLabel.CENTER_ALIGNMENT)
#Version
p = JPanel()
versionPanel = JPanel(GridLayout(2, 2))
versionPanel.add(JLabel("script: "))
versionPanel.add(JLabel(app.SCRIPTVERSION))
versionPanel.add(JLabel("tools: "))
self.toolsVersionLbl = JLabel(app.TOOLSVERSION)
versionPanel.add(self.toolsVersionLbl)
versionPanel.setAlignmentX(Component.CENTER_ALIGNMENT)
p.add(versionPanel)
#Wiki
wikiLblPanel = JPanel(FlowLayout(FlowLayout.CENTER))
wikiLbl = UrlLabel(app.SCRIPTWEBSITE, "Wiki", 2)
wikiLblPanel.add(wikiLbl)
wikiLblPanel.setAlignmentX(JLabel.CENTER_ALIGNMENT)
#Author, contributors and credits
creditsTextArea = JTextArea(15, 35, editable=False)
creditsTextArea.setBackground(None)
contribFile = open(File.separator.join([app.SCRIPTDIR, "CONTRIBUTORS"]), "r")
contribText = contribFile.read()
contribFile.close()
creditsTextArea.append(contribText)
creditsTextArea.setCaretPosition(0)
creditScrollPane = JScrollPane(creditsTextArea)
#OK button
okBtn = JButton("OK",
ImageProvider.get("ok"),
actionPerformed=self.on_okBtn_clicked)
okBtn.setAlignmentX(JButton.CENTER_ALIGNMENT)
#Layout
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(iconLbl)
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(titleLbl)
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(p)
self.add(wikiLblPanel)
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(creditScrollPane)
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(okBtn)
self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
self.pack()