本文整理汇总了Python中javax.swing.JScrollPane.setAlignmentX方法的典型用法代码示例。如果您正苦于以下问题:Python JScrollPane.setAlignmentX方法的具体用法?Python JScrollPane.setAlignmentX怎么用?Python JScrollPane.setAlignmentX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.setAlignmentX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from javax.swing import JScrollPane [as 别名]
# 或者: from javax.swing.JScrollPane import setAlignmentX [as 别名]
def __init__(self, parent, title, modal, app):
border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
self.getContentPane().setBorder(border)
self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))
#Intro
falsePositivePng = File.separator.join([app.SCRIPTDIR,
"images",
"icons",
"not_error36.png"])
introLbl = JMultilineLabel(app.strings.getString("manual_false_positives_info"))
introLbl.setMaxWidth(600)
#Table
table = JTable()
columns = [app.strings.getString("Tool"),
app.strings.getString("Check"),
app.strings.getString("Error_id"),
app.strings.getString("OSM_id")]
self.tableModel = MyTableModel([], columns)
table.setModel(self.tableModel)
scrollPane = JScrollPane(table)
scrollPane.setAlignmentX(0.0)
#OK button
btnPanel = JPanel(FlowLayout(FlowLayout.CENTER))
okBtn = JButton("OK",
ImageProvider.get("ok"),
actionPerformed=self.on_okBtn_clicked)
btnPanel.add(okBtn)
btnPanel.setAlignmentX(0.0)
#Layout
headerPnl = JPanel()
headerPnl.setLayout(BoxLayout(headerPnl, BoxLayout.X_AXIS))
headerPnl.add(JLabel(ImageIcon(falsePositivePng)))
headerPnl.add(Box.createRigidArea(Dimension(10, 0)))
headerPnl.add(introLbl)
headerPnl.setAlignmentX(0.0)
self.add(headerPnl)
self.add(Box.createRigidArea(Dimension(0, 10)))
self.add(scrollPane)
self.add(Box.createRigidArea(Dimension(0, 10)))
self.add(btnPanel)
self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
self.pack()
示例2: ErrorInfoDialog
# 需要导入模块: from javax.swing import JScrollPane [as 别名]
# 或者: from javax.swing.JScrollPane import setAlignmentX [as 别名]
class ErrorInfoDialog(JDialog, HyperlinkListener):
"""Dialog which shows info regarding the currently selcted error,
so that the user can copy its info and send a message to the user
who possibly made the error.
"""
def __init__(self, app):
#java import
from javax.swing import JPanel, JButton, JLabel, ImageIcon,\
JScrollPane, BorderFactory, WindowConstants,\
BoxLayout, Box
from java.awt import FlowLayout, Dimension, Component
from java.io import File
#josm import
from org.openstreetmap.josm import Main
from org.openstreetmap.josm.tools import ImageProvider
from org.openstreetmap.josm.gui.widgets import HtmlPanel, UrlLabel
JDialog.__init__(self,
Main.parent,
app.strings.getString("error_info_title"),
True)
self.app = app
self.setSize(400, 480)
border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
self.getContentPane().setBorder(border)
self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))
#Intro
intro = HtmlPanel("<html><i>%s</i></html>" % self.app.strings.getString("error_info_intro"))
intro.setAlignmentX(Component.LEFT_ALIGNMENT)
#User info
userLbl = JLabel(self.app.strings.getString("Last_user"))
userLbl.setAlignmentX(JLabel.LEFT_ALIGNMENT)
self.userInfoPanel = HtmlPanel()
self.userInfoPanel.getEditorPane().addHyperlinkListener(self)
self.userInfoPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
#Panel with current error's info
errorLbl = JLabel(self.app.strings.getString("Error_info"))
errorLbl.setAlignmentX(JLabel.LEFT_ALIGNMENT)
self.errorInfoPanel = HtmlPanel()
self.errorInfoPanel.getEditorPane().addHyperlinkListener(self)
self.scrollPane = JScrollPane(self.errorInfoPanel)
self.scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT)
#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)
btnPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
#Layout
self.add(intro)
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(userLbl)
self.add(Box.createRigidArea(Dimension(0, 5)))
self.add(self.userInfoPanel)
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(errorLbl)
self.add(Box.createRigidArea(Dimension(0, 5)))
self.add(self.scrollPane)
self.add(Box.createRigidArea(Dimension(0, 7)))
self.add(btnPanel)
self.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE)
def update(self):
"""Update information shown by the dialog with those of
currently selected error
"""
from java.net import URL, URLEncoder
from javax.xml.parsers import DocumentBuilderFactory
error = self.app.selectedError
check = error.check
view = check.view
tool = view.tool
#user info
if error.user is not None:
errorUserName = error.user.getName()
errorUserId = str(error.user.getId())
#download user info from OSM API
accountDate = None
changesetsNumber = None
if errorUserId in self.app.users:
userInfo = self.app.users[errorUserId]
accountDate = userInfo["account date"]
changesetsNumber = userInfo["changesets number"]
else:
docFactory = DocumentBuilderFactory.newInstance()
docBuilder = docFactory.newDocumentBuilder()
url = URL("http://api.openstreetmap.org/api/0.6/user/" + errorUserId)
try:
stream = url.openStream()
doc = docBuilder.parse(stream)
#.........这里部分代码省略.........