本文整理汇总了Python中javax.swing.JFrame.getPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Python JFrame.getPreferredSize方法的具体用法?Python JFrame.getPreferredSize怎么用?Python JFrame.getPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.getPreferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import getPreferredSize [as 别名]
def __init__(self, imgData):
n = imgData.size()
win = JFrame("Point Marker Panel")
win.setPreferredSize(Dimension(350, 590))
win.setSize(win.getPreferredSize())
pan = JPanel()
pan.setLayout(BoxLayout(pan, BoxLayout.Y_AXIS))
win.getContentPane().add(pan)
progressPanel = JPanel()
progressPanel.setLayout(BoxLayout(progressPanel, BoxLayout.Y_AXIS))
positionBar = JProgressBar()
positionBar.setMinimum(0)
positionBar.setMaximum(n)
positionBar.setStringPainted(True)
progressPanel.add(Box.createGlue())
progressPanel.add(positionBar)
progressBar = JProgressBar()
progressBar.setMinimum(0)
progressBar.setMaximum(n)
progressBar.setStringPainted(True)
progressPanel.add(progressBar)
progressPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(progressPanel)
pan.add(Box.createRigidArea(Dimension(5,5)))
savePanel = JPanel()
savePanel.setLayout(BoxLayout(savePanel, BoxLayout.Y_AXIS))
saveMessageLabel = JLabel("<html><u>Save Often</u></html>")
savePanel.add(saveMessageLabel)
savePanel.setAlignmentX(Component.CENTER_ALIGNMENT)
savePanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(savePanel)
# pan.add(saveMessageLabel)
pan.add(Box.createRigidArea(Dimension(5,5)))
calPanel = JPanel()
calPanel.setLayout(BoxLayout(calPanel, BoxLayout.Y_AXIS))
calPanelIn = JPanel()
calPanelIn.setLayout(BoxLayout(calPanelIn, BoxLayout.X_AXIS))
pixelSizeText = JTextField(12)
pixelSizeText.setHorizontalAlignment(JTextField.RIGHT)
# pixelSizeText.setMaximumSize(pixelSizeText.getPreferredSize())
unitText = JTextField(10)
# unitText.setMaximumSize(unitText.getPreferredSize())
pixelSizeText.setText("Enter Pixel Size Here")
calPanelIn.add(pixelSizeText)
unitText.setText("Unit")
calPanelIn.add(unitText)
calPanelIn.setAlignmentX(Component.CENTER_ALIGNMENT)
calPanelIn.setBorder(BorderFactory.createTitledBorder("Custom Calibration"))
calPanel.add(calPanelIn)
calPanelIn.setAlignmentX(Component.CENTER_ALIGNMENT)
calPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(calPanel)
pan.add(Box.createRigidArea(Dimension(5,5)))
helpPanel = JPanel()
helpPanel.setLayout(BoxLayout(helpPanel, BoxLayout.Y_AXIS))
helpLable = JLabel("<html><ul>\
<li>Focus on Image Window</li>\
<li>Select multi-point Tool</li>\
<li>Click to Draw Points</li>\
<li>Drag to Move Points</li>\
<li>\"Alt\" + Click to Erase Points</li>\
<li>Optional: Customize Calibration Above\
and Refresh Images\
(won't be written to files)</li>\
</html>")
helpLable.setBorder(BorderFactory.createTitledBorder("Usage"))
keyTagOpen = "<span style=\"background-color: #FFFFFF\"><b><kbd>"
keyTagClose = "</kbd></b></span>"
keyLable = JLabel("<html><ul>\
<li>Next Image --- " + keyTagOpen + "<" + \
keyTagClose + "</li>\
<li>Previous Image --- " + keyTagOpen + ">" + \
keyTagClose + "</li>\
<li>Save --- " + keyTagOpen + "`" + keyTagClose + \
" (upper-left to TAB key)</li>\
<li>Next Unmarked Image --- " + keyTagOpen + \
"TAB" + keyTagClose + "</li></ul>\
</html>")
keyLable.setBorder(BorderFactory.createTitledBorder("Keyboard Shortcuts"))
helpPanel.add(helpLable)
helpPanel.add(keyLable)
helpPanel.setAlignmentX(Component.CENTER_ALIGNMENT)
helpPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(helpPanel)
# pan.add(Box.createRigidArea(Dimension(0, 10)))
infoPanel = JPanel()
infoPanel.setLayout(BoxLayout(infoPanel, BoxLayout.Y_AXIS))
infoLabel = JLabel()
infoLabel.setBorder(BorderFactory.createTitledBorder("Project Info"))
infoPanel.add(infoLabel)
infoPanel.setAlignmentX(Component.CENTER_ALIGNMENT)
infoPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10))
pan.add(infoPanel)
#.........这里部分代码省略.........