本文整理汇总了Python中javax.swing.JComboBox.setMaximumSize方法的典型用法代码示例。如果您正苦于以下问题:Python JComboBox.setMaximumSize方法的具体用法?Python JComboBox.setMaximumSize怎么用?Python JComboBox.setMaximumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComboBox
的用法示例。
在下文中一共展示了JComboBox.setMaximumSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addLine
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setMaximumSize [as 别名]
def addLine(self, objectID, category, text):
"""
Add a new panel containing the text corresponding to one line in the
ATF file.
This panel will show the line type (ruling, comment, text,
translation...), followed by the line content and a group of icons to
add, edit or remove the line.
"""
linePanel = JPanel()
linePanel.setLayout(BorderLayout())
label = JLabel(category)
combo = JComboBox(text)
combo.setEditable(True)
combo.setPreferredSize(Dimension(500, 20))
combo.setSize(combo.getPreferredSize())
combo.setMinimumSize(combo.getPreferredSize())
combo.setMaximumSize(combo.getPreferredSize())
buttonsPanel = JPanel()
addButton = JButton("Add")
editButton = JButton("Edit")
deleteButton = JButton("Delete")
buttonsPanel.add(addButton)
buttonsPanel.add(editButton)
buttonsPanel.add(deleteButton)
linePanel.add(label, BorderLayout.WEST)
linePanel.add(combo, BorderLayout.CENTER)
linePanel.add(buttonsPanel, BorderLayout.EAST)
# Add metadataPanel to object tab in main panel
self.objectTabs[objectID].add(linePanel)
示例2: __init__
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setMaximumSize [as 别名]
def __init__(self, chartFun, isTemporal = False):
self.isTemporal = isTemporal
JPanel()
#self.setBackground(Color.LIGHT_GRAY)
self.chartFun = chartFun
self.enableChartFun = False
self.setLayout(GridLayout(6,2))
self.add(JLabel('CPU Cores'))
cores = JComboBox(['1', '2', '4', '8', '16', '32', '64', '128'])
nprocs = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()
pos = min([7, log(ceil(nprocs)) / log(2)])
cores.setSelectedIndex(int(pos))
cores.setMaximumSize(cores.getPreferredSize())
self.cores = cores
self.add(self.cores)
self.add(JLabel('# of sims (x1000) '))
numSims = JComboBox(
map(lambda x: str((10+x)*5), range(10)) +
map(lambda x: str(x*100), range(1,11))
)
numSims.setMaximumSize(numSims.getPreferredSize())
self.numSims = numSims
self.add(self.numSims)
if isTemporal:
self.add(JLabel('"Neutral" Ne'))
self.neutral = JCheckBox()
self.neutral.addActionListener(self)
self.add(self.neutral)
else:
self.add(JLabel('"Neutral" mean Fst'))
self.neutral = JCheckBox()
self.neutral.addActionListener(self)
self.add(self.neutral)
self.add(JLabel('Force mean Fst'))
self.force = JCheckBox()
self.force.addActionListener(self)
self.add(self.force)
self.add(JLabel('Confidence interval '))
ci = JComboBox(['0.95', '0.99', '0.995'])
ci.addItemListener(self)
ci.setMaximumSize(cores.getPreferredSize())
self.ci = ci
self.add(self.ci)
self.add(JLabel('False Disc. Rate'))
fdr = JFormattedTextField(
NumberFormat.getNumberInstance(Locale.US))
fdr.setValue(0.1)
fdr.addPropertyChangeListener(self)
self.add(fdr)
self.fdr = fdr
示例3: NewAtfView
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setMaximumSize [as 别名]
#.........这里部分代码省略.........
# Create necessary components and add them to panel.
project_label = JLabel('Project: ')
self.right_combo = JComboBox()
self.right_combo.setEditable(True)
def create_project_list():
'''
Prepares list of projects and subprojects ordered with the default
one first.
'''
default_project = self.projects['default'][0].split('/')[0]
if '/' in self.projects['default']:
default_subproject = self.projects['default'].split('/')[1]
else:
default_subproject = ''
projects = [default_project]
subprojects = [default_subproject]
# User created projects might not be in default dictionary
for project in self.projects.keys():
if (project != default_project and project != 'default'):
projects.append(project)
# Default project might not have subproject
if default_project in self.projects.keys():
if default_subproject:
for subproject in self.projects[default_project]:
if (subproject != default_subproject):
subprojects.append(subproject)
return projects, subprojects
self.left_combo = JComboBox(create_project_list()[0])
# Make left combo keep size no matter how long project names are
self.left_combo.setPreferredSize(Dimension(125, 30))
self.left_combo.setMinimumSize(self.left_combo.getPreferredSize())
self.left_combo.setMaximumSize(self.left_combo.getPreferredSize())
self.left_combo.setSize(self.left_combo.getPreferredSize())
self.right_combo = JComboBox(create_project_list()[1])
# Prevent right combo to change sizes dynamically
self.right_combo.setPreferredSize(Dimension(100, 30))
self.right_combo.setMinimumSize(self.left_combo.getPreferredSize())
self.right_combo.setMaximumSize(self.left_combo.getPreferredSize())
self.right_combo.setSize(self.left_combo.getPreferredSize())
action_listener = ComboActionListener(self.right_combo,
self.projects)
self.left_combo.addActionListener(action_listener)
self.left_combo.setEditable(True)
self.right_combo.setEditable(True)
slash_label = JLabel('/')
tooltip_text = ("<html><body>Choose project from list or insert a new "
"one.<br/>You can leave the right-hand field blank."
"</body><html>")
help_label = self.build_help_label(tooltip_text)
panel.add(project_label)
panel.add(self.left_combo)
panel.add(slash_label)
panel.add(self.right_combo)
panel.add(help_label)
# Set up constraints to tell panel how to position components.
layout.putConstraint(SpringLayout.WEST,
project_label,
15,
SpringLayout.WEST,
panel)
示例4: ConfigTab
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setMaximumSize [as 别名]
class ConfigTab( ITab, JPanel ):
def __init__( self, callbacks ):
self._callbacks = callbacks
self._helpers = callbacks.getHelpers()
self.__initLayout__()
def __initLayout__( self ):
self._levelComboBox = JComboBox()
levelComboBoxSize = Dimension( 300, 30 )
self._levelComboBox.setPreferredSize( levelComboBoxSize )
self._levelComboBox.setMaximumSize( levelComboBoxSize )
for level in range( 0, 6 ):
self._levelComboBox.addItem( str( level ) )
self._techRenderedCheckBox = JCheckBox( 'Rendered', True )
self._techTimebasedCheckBox = JCheckBox( 'Time-based', True )
self._plugin_groups = {}
for plugin in plugins:
parent = plugin.__base__.__name__
if not self._plugin_groups.has_key( parent ):
self._plugin_groups[ parent ] = []
self._plugin_groups[ parent ].append( plugin )
self._pluginCheckBoxes = []
for pluginGroup in self._plugin_groups.values():
for plugin in pluginGroup:
self._pluginCheckBoxes.append( PluginCheckBox( plugin ) )
self._positionReplaceCheckBox = JCheckBox( 'Replace', True )
self._positionAppendCheckBox = JCheckBox( 'Append', False )
displayItems = (
{
'label': 'Level',
'components': ( self._levelComboBox, ),
'description': 'Level of code context escape to perform (1-5, Default:0).'
},
{
'label': 'Techniques',
'components': ( self._techRenderedCheckBox, self._techTimebasedCheckBox, ),
'description': 'Techniques R(endered) T(ime-based blind). Default: RT.'
},
{
'label': 'Template Engines',
'components': self._pluginCheckBoxes,
'description': 'Force back-end template engine to this value(s).'
},
{
'label': 'Payload position',
'components': ( self._positionReplaceCheckBox, self._positionAppendCheckBox, ),
'description': 'Scan payload position. This feature only appears in BurpExtension.'
}
)
layout = GroupLayout( self )
self.setLayout( layout )
layout.setAutoCreateGaps( True )
layout.setAutoCreateContainerGaps( True )
labelWidth = 200
hgroup = layout.createParallelGroup( GroupLayout.Alignment.LEADING )
vgroup = layout.createSequentialGroup()
for displayItem in displayItems:
label = JLabel( displayItem.get( 'label' ) )
label.setToolTipText( displayItem.get( 'description' ) )
_hgroup = layout.createSequentialGroup().addComponent( label, labelWidth, labelWidth, labelWidth )
_vgroup = layout.createParallelGroup( GroupLayout.Alignment.BASELINE ).addComponent( label )
for component in displayItem.get( 'components' ):
_hgroup.addComponent( component )
_vgroup.addComponent( component )
hgroup.addGroup( _hgroup )
vgroup.addGroup( _vgroup )
layout.setHorizontalGroup( hgroup )
layout.setVerticalGroup( vgroup )
def getTabCaption( self ):
return 'Tplmap'
def getUiComponent( self ):
return self
def getLevel( self ):
return self._levelComboBox.getSelectedIndex()
def getTechniques( self ):
return '%s%s' % ( 'R' if self._techRenderedCheckBox.isSelected() else '', 'T' if self._techTimebasedCheckBox.isSelected() else '' )
def getEngines( self ):
return [ checkbox.getPlugin() for checkbox in self._pluginCheckBoxes if checkbox.isSelected() ]
def getPayloadPosition( self ):
return { 'replace': self._positionReplaceCheckBox.isSelected(), 'append': self._positionAppendCheckBox.isSelected() }