本文整理汇总了Python中javax.swing.JLabel类的典型用法代码示例。如果您正苦于以下问题:Python JLabel类的具体用法?Python JLabel怎么用?Python JLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JLabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addMetadata
def addMetadata(self, objectID, project, language):
"""
Add a JTable at the top of the object tab containing the metadata of
the object presented in that tab.
"""
metadataPanel = JPanel()
# TODO: Need to count protocols to set up Grid dimension
metadataPanel.setLayout(GridLayout(3, 2))
projectLabel = JLabel("Project: ")
projectValue = JLabel(project)
languageLabel = JLabel("Language: ")
languageValue = JLabel(language)
# If language code is in the settings, then display name instead
# of code
for lang, code in self.languages.iteritems():
if code == language:
languageValue.setText(lang)
# TODO Protocols not yet in parsed object
protocolsLabel = JLabel("ATF Protocols: ")
protocolsBox = JComboBox(self.protocols)
metadataPanel.add(projectLabel)
metadataPanel.add(projectValue)
metadataPanel.add(languageLabel)
metadataPanel.add(languageValue)
metadataPanel.add(protocolsLabel)
metadataPanel.add(protocolsBox)
# Add metadataPanel to object tab in main panel
self.objectTabs[objectID].add(metadataPanel)
示例2: startGui
def startGui(self):
# self.gridPanel = JPanel(GridLayout(self.numRows, self.numCols))
# self.cellButtons = self._doForAllCells(self._createCellButton)
# self.grid = self._doForAllCells(lambda r,c: False)
# frame.add(self.gridPanel)
# buttonPanel = JPanel(FlowLayout())
# stepButton = JButton("Step", actionPerformed=self._step)
# runButton = JToggleButton("Run", actionPerformed=self._run)
# buttonPanel.add(stepButton)
# buttonPanel.add(runButton)
# frame.add(buttonPanel, SOUTH)
# frame.pack()
# frame.locationRelativeTo = None
self.setMenuBar()
image_path = "D:\\wamp\\www\\holdem\\src\\poker\\th\\images\\As.png"
myPicture = ImageIcon(image_path)
myPictureLabel = JLabel("Pocket: ", myPicture, JLabel.LEFT)
cardPanel = JPanel()
cardPanel.setLayout(None)
cardPanel.add(myPictureLabel)
myPictureLabel.setBounds(10,10,36,52);
self._frame.getContentPane().add(cardPanel)
self.msg=JLabel("Hello")
self._frame.add(self.msg, NORTH)
self._frame.locationRelativeTo = None
self._frame.visible = True
示例3: __init__
def __init__(self):
super(AboutDialog, self).__init__()
# Open the files and build a tab pane
self.tabbedPane = tabs = JTabbedPane()
for title, path in self.INFO_FILES:
textPane = JTextPane()
textPane.editable = False
scrollPane = JScrollPane(textPane)
scrollPane.preferredSize = (32767, 32767) # just a large number
with open(path, 'r') as fd:
infoText = fd.read().decode('utf8')
textPane.text = infoText
textPane.caretPosition = 0
tabs.addTab(title, scrollPane)
# Load this tabbed pane into the layout
self.add(tabs, BorderLayout.CENTER)
# Add a label at the top
versionLabel = JLabel(JESVersion.TITLE + " version " + JESVersion.RELEASE)
versionLabel.alignmentX = Component.CENTER_ALIGNMENT
versionPanel = JPanel()
versionPanel.add(versionLabel)
self.add(versionPanel, BorderLayout.PAGE_START)
# Make an OK button
self.okButton = JButton(self.ok)
self.buttonPanel.add(self.okButton)
示例4: __init__
def __init__(self):
# set up the layout
self.__component = JPanel(GridBagLayout())
self.__image = JLabel()
self.__album = JLabel()
self.__artist = JLabel()
self.__application = None
self.__image.setVerticalAlignment(SwingConstants.TOP)
self.__album.setVerticalAlignment(SwingConstants.TOP)
self.__artist.setVerticalAlignment(SwingConstants.TOP)
gbc = GridBagConstraints()
gbc.fill = GridBagConstraints.VERTICAL
gbc.anchor = GridBagConstraints.NORTHWEST
gbc.gridx = 0
gbc.gridy = 0
gbc.weighty = 2
gbc.gridheight = 2
self.__component.add(self.__image, gbc)
gbc.fill = GridBagConstraints.HORIZONTAL
gbc.anchor = GridBagConstraints.NORTHWEST
gbc.gridx = 1
gbc.gridy = 0
gbc.gridheight = 1
gbc.weighty = 0
gbc.insets = Insets(0, 10, 0, 10)
self.__component.add(self.__album, gbc)
gbc.fill = GridBagConstraints.BOTH
gbc.anchor = GridBagConstraints.NORTHWEST
gbc.gridx = 1
gbc.gridy = 1
gbc.weightx = 2
gbc.weighty = 2
gbc.gridheight = 1
self.__component.add(self.__artist, gbc)
示例5: check_label_size
def check_label_size(self):
if(self.show_limits):
limit_label = JLabel(("-%1.2f" % (self.range)))
limit_width = limit_label.getPreferredSize().width - self.sliders[0].width / 2
if(limit_width != self.limit_width):
self.setSize(self.size.width + limit_width - self.limit_width, self.size.height)
self.setLocation(self.x - limit_width + self.limit_width, self.y)
self.limit_width = limit_width
示例6: initUI
def initUI(self):
self.panel = JPanel(size=(50,50))
self.panel.setLayout(FlowLayout( ))
self.panel.setToolTipText("GPU Demo")
#TODO- change this so that it deletes itself when text is entered
self.textfield1 = JTextField('Smoothing Parameter',15)
self.panel.add(self.textfield1)
joclButton = JButton("JOCL",actionPerformed=self.onJocl)
joclButton.setBounds(100, 500, 100, 30)
joclButton.setToolTipText("JOCL Button")
self.panel.add(joclButton)
javaButton = JButton("Java",actionPerformed=self.onJava)
javaButton.setBounds(100, 500, 100, 30)
javaButton.setToolTipText("Java Button")
self.panel.add(javaButton)
qButton = JButton("Quit", actionPerformed=self.onQuit)
qButton.setBounds(200, 500, 80, 30)
qButton.setToolTipText("Quit Button")
self.panel.add(qButton)
newImage = ImageIO.read(io.File(getDataDir() + "input.png"))
resizedImage = newImage.getScaledInstance(600, 600,10)
newIcon = ImageIcon(resizedImage)
label1 = JLabel("Input Image",newIcon, JLabel.CENTER)
label1.setVerticalTextPosition(JLabel.TOP)
label1.setHorizontalTextPosition(JLabel.RIGHT)
label1.setSize(10,10)
label1.setBackground(Color.orange)
self.panel.add(label1)
self.getContentPane().add(self.panel)
self.clockLabel = JLabel()
self.clockLabel.setSize(1,1)
self.clockLabel.setBackground(Color.orange)
self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM)
self.clockLabel.setHorizontalTextPosition(JLabel.LEFT)
myClockFont = Font("Serif", Font.PLAIN, 50)
self.clockLabel.setFont(myClockFont)
self.panel.add(self.clockLabel)
self.setTitle("Structure-oriented smoothing OpenCL Demo")
self.setSize(1200, 700)
self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
self.setLocationRelativeTo(None)
self.setVisible(True)
示例7: initExport
def initExport(self):
#
## init enforcement detector tab
#
exportLType = JLabel("File Type:")
exportLType.setBounds(10, 10, 100, 30)
exportLES = JLabel("Enforcement Statuses:")
exportLES.setBounds(10, 50, 160, 30)
exportFileTypes = ["HTML","CSV"]
self.exportType = JComboBox(exportFileTypes)
self.exportType.setBounds(100, 10, 200, 30)
exportES = ["All Statuses", self._enfocementStatuses[0], self._enfocementStatuses[1], self._enfocementStatuses[2]]
self.exportES = JComboBox(exportES)
self.exportES.setBounds(100, 50, 200, 30)
exportLES = JLabel("Statuses:")
exportLES.setBounds(10, 50, 100, 30)
self.exportButton = JButton("Export",actionPerformed=self.export)
self.exportButton.setBounds(390, 25, 100, 30)
self.exportPnl = JPanel()
self.exportPnl.setLayout(None);
self.exportPnl.setBounds(0, 0, 1000, 1000);
self.exportPnl.add(exportLType)
self.exportPnl.add(self.exportType)
self.exportPnl.add(exportLES)
self.exportPnl.add(self.exportES)
self.exportPnl.add(self.exportButton)
示例8: disp_limits
def disp_limits(self):
if(not self.show_limits):
limit_label = JLabel(("-%1.2f" % (self.range)))
self.limit_width = limit_label.getPreferredSize().width - self.sliders[0].width / 2
self.setSize(self.size.width + self.limit_width, self.size.height)
self.setLocation(self.x - self.limit_width, self.y)
self.limit_hide_timer.stop()
self.limit_color_val = self.limit_color_def
self.show_limits = True
self.repaint()
示例9: build_replace_row
def build_replace_row(self):
'''
Builds the replace row.
'''
panel = JPanel(FlowLayout())
label = JLabel("Replace: ")
panel.add(label)
self.replace_field = JTextField(20, actionPerformed=self.find_next)
label.setLabelFor(self.replace_field)
panel.add(self.replace_field)
return panel
示例10: initConfigurationTab
def initConfigurationTab(self):
#
## init configuration tab
#
self.prevent304 = JCheckBox("Prevent 304 Not Modified status code")
self.prevent304.setBounds(290, 25, 300, 30)
self.ignore304 = JCheckBox("Ignore 304/204 status code responses")
self.ignore304.setBounds(290, 5, 300, 30)
self.ignore304.setSelected(True)
self.autoScroll = JCheckBox("Auto Scroll")
#self.autoScroll.setBounds(290, 45, 140, 30)
self.autoScroll.setBounds(160, 40, 140, 30)
self.doUnauthorizedRequest = JCheckBox("Check unauthenticated")
self.doUnauthorizedRequest.setBounds(290, 45, 300, 30)
self.doUnauthorizedRequest.setSelected(True)
startLabel = JLabel("Authorization checks:")
startLabel.setBounds(10, 10, 140, 30)
self.startButton = JButton("Autorize is off",actionPerformed=self.startOrStop)
self.startButton.setBounds(160, 10, 120, 30)
self.startButton.setBackground(Color(255, 100, 91, 255))
self.clearButton = JButton("Clear List",actionPerformed=self.clearList)
self.clearButton.setBounds(10, 40, 100, 30)
self.replaceString = JTextArea("Cookie: Insert=injected; header=here;", 5, 30)
self.replaceString.setWrapStyleWord(True);
self.replaceString.setLineWrap(True)
self.replaceString.setBounds(10, 80, 470, 180)
self.filtersTabs = JTabbedPane()
self.filtersTabs.addTab("Enforcement Detector", self.EDPnl)
self.filtersTabs.addTab("Detector Unauthenticated", self.EDPnlUnauth)
self.filtersTabs.addTab("Interception Filters", self.filtersPnl)
self.filtersTabs.addTab("Export", self.exportPnl)
self.filtersTabs.setBounds(0, 280, 2000, 700)
self.pnl = JPanel()
self.pnl.setBounds(0, 0, 1000, 1000);
self.pnl.setLayout(None);
self.pnl.add(self.startButton)
self.pnl.add(self.clearButton)
self.pnl.add(self.replaceString)
self.pnl.add(startLabel)
self.pnl.add(self.autoScroll)
self.pnl.add(self.ignore304)
self.pnl.add(self.prevent304)
self.pnl.add(self.doUnauthorizedRequest)
self.pnl.add(self.filtersTabs)
示例11: addSection
def addSection(self, name, fontstyle=None):
"""Creates a new section in the Popup menu."""
if self.isFirstSection:
self.isFirstSection = False
else:
self.menu.addSeparator() # menu.add(JSeparator()) ???
label = JLabel(name)
label.setLocation(4, 4)
if fontstyle is not None:
label.font = fontstyle
self.applyStyle(label)
self.menu.add(label)
示例12: initPanel
def initPanel(self):
IntegerPanel.initPanel(self)
num_avail_devices = NEFGPUInterface.getNumAvailableDevices()
if num_avail_devices < 1:
self.tf.setEnabled(False)
self.tf.setEditable(False)
error_message = " %s" % (NEFGPUInterface.getErrorMessage())
error_message_label = JLabel(error_message)
error_message_label.setForeground(Color.red)
self.add(error_message_label)
示例13: hhwindow
def hhwindow(): #creates a function called hhwindow, this is a function we will call whenever we want to create a new window
global win,mytext #the global statement creates variables “win” and “mytext” that can be referenced outside of just this function
win = swing.JFrame("Inside the Haunted House") #creates a window as a variable we named “win”, the title of the window is inside the quotes
panel = JPanel() #creates a panel inside the window for text as a variable we named “panel”
panel.setLayout(None) #controls layout of panel
panel.setBackground(Color(0, 0, 0)) #sets background color of window
win.setSize(600,400) #sets window size
win.setVisible(True) #makes window visible
mytextLabel = JLabel(mytext) #adds text to the window in the form of a variable, yet to be defined, called “mytext”
mytextLabel.setBounds(20, 20, 500, 400) #sets boundaries for the text, text will be centered by default within these boundaries
panel.add(mytextLabel) #add the label to the panel
win.add(panel) #add the panel to the window
win.show() #show the window
示例14: __init__
def __init__(self):
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
size = Dimension(800, 800)
self.setPreferredSize(size)
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
self.setLocation(screenSize.getSize().width/2 - size.width/2, 100)
self.setTitle("bashED Terminal HQ EXTREME");
self.setUndecorated(True)
self.getRootPane().setOpaque(False)
#self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
self.setBackground(Color(0,128,0, 198))
#j = JDesktopPane()
#j.setOpaque(False)
self.setLayout(None)
self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage())
mp = MainPanel()
self.add(mp)
mp.setBounds(0, 0, size.width, size.height)
imageTest = ImageIcon('bin/gui/media/' + "image.png")
imageTestLabel = JLabel(imageTest)
self.add(imageTestLabel)
imageTestLabel.setBounds(0, 0, size.width, size.height)
#self.getContentPane().add(mp)
#self.getContentPane().add(JLabel("Iglo"))
bb = BorderFactory.createLineBorder(Color.BLACK, 5)
bw1 = BorderFactory.createLineBorder(Color.WHITE, 1)
bw2 = BorderFactory.createLineBorder(Color.WHITE, 1)
mp.setBorder( BorderFactory.createCompoundBorder( bw1, BorderFactory.createCompoundBorder(bb, bw2) ))
#make the window viewable
self.defaultCloseOperation=JFrame.EXIT_ON_CLOSE
self.pack()
self.setVisible(True)
示例15: SummPanel
class SummPanel(JPanel):
def __init__(self, isTemporal):
self.isTemporal = isTemporal
JPanel()
self.setLayout(GridLayout(6,2))
self.add(JLabel('Total data'))
self.add(JLabel(''))
self.add(JLabel('# Pops' if not isTemporal else "# Gens"))
self.totalPops = JLabel('0', SwingConstants.RIGHT)
self.add(self.totalPops)
self.add(JLabel('# Loci'))
self.totalLoci = JLabel('0', SwingConstants.RIGHT)
self.add(self.totalLoci)
self.add(JLabel('Selected'))
self.add(JLabel(''))
self.add(JLabel('# Pops' if not isTemporal else "# Gens"))
self.selPops = JLabel('0', SwingConstants.RIGHT)
self.add(self.selPops)
self.add(JLabel('# Loci'))
self.selLoci = JLabel('0', SwingConstants.RIGHT)
self.add(self.selLoci)
def update(self, rec, popNames, remPops, remLoci):
total_pops = countPops(rec)
sel_pops = total_pops - len (remPops)
total_loci = len(rec.loci_list)
sel_loci = total_loci - len(remLoci)
self.totalPops.setText(str(total_pops))
self.selPops.setText(str(sel_pops))
self.totalLoci.setText(str(total_loci))
self.selLoci.setText(str(sel_loci))