本文整理汇总了Python中javax.swing.JButton.setToolTipText方法的典型用法代码示例。如果您正苦于以下问题:Python JButton.setToolTipText方法的具体用法?Python JButton.setToolTipText怎么用?Python JButton.setToolTipText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setToolTipText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def init(self):
jbNew = JButton( PaneOpsProgAction() )
jbNew.setIcon( NamedIcon("resources/decoderpro.gif","resources/decoderpro.gif") )
jbNew.addMouseListener(self.getMouseListeners()[0]) # In order to get the popupmenu on the button too
jbNew.setToolTipText( jbNew.getText() )
jbNew.setText( None )
self.add(jbNew)
示例2: init
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def init(self):
jbNew= JButton( LoadDefaultXmlThrottlesLayoutAction() )
jbNew.setIcon( NamedIcon("resources/Throttles.gif","resources/Throttles.gif") )
jbNew.addMouseListener(self.getMouseListeners()[0]) # In order to get the popupmenu on the button too
jbNew.setToolTipText( jbNew.getText() )
jbNew.setText( None )
self.add(jbNew)
示例3: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def __init__(self, controller):
#Give reference to controller to delegate action response
self.controller = controller
#TODO Refactor to avoid duplication - See issue#16
#https://github.com/UCL-RITS/nammu/issues/16
#Content needs to be displayed in an orderly fashion so that buttons are
#placed where we expect them to be, not in the ramdon order dicts have.
#We also can't create the tooltips dict e.g.:
#tooltips = { 'a' : 'A', 'b' : 'B', 'c' : 'C' }
#because it will still be randomly ordered. Elements need to be added to
#the dict in the order we want them to be placed in the toolbar for
#OrderedDict to work
tooltips = {}
tooltips = collections.OrderedDict()
tooltips['newFile'] = 'Creates empty ATF file for edition'
tooltips['openFile'] = 'Opens ATF file for edition'
tooltips['saveFile'] = 'Saves current file'
tooltips['closeFile'] = 'Closes current file'
tooltips['printFile'] = 'Prints current file'
tooltips['undo'] = 'Undo last action'
tooltips['redo'] = 'Redo last undone action'
tooltips['copy'] = 'Copy text selection'
tooltips['cut'] = 'Cut text selection'
tooltips['validate'] = 'Check current ATF correctness'
tooltips['paste'] = 'Paste clipboard content'
tooltips['lemmatise'] = 'Obtain lemmas for current ATF text'
tooltips['unicode'] = 'Use Unicode characters'
tooltips['console'] = 'View/Hide Console'
tooltips['displayModelView'] = 'Change to ATF data model view'
tooltips['editSettings'] = 'Change Nammu settings'
tooltips['showHelp'] = 'Displays ATF documentation'
tooltips['showAbout'] = 'Displays information about Nammu and ORACC'
tooltips['quit'] = 'Exits Nammu'
for name, tooltip in tooltips.items():
icon = ImageIcon(self.findImageResource(name))
button = JButton(icon, actionPerformed = getattr(self, name))
button.setToolTipText(tooltips[name])
self.add(button)
#Work out is separator is needed
if name in ['printFile', 'redo', 'paste', 'lemmatise', 'unicode',
'console', 'displayModelView', 'showAbout']:
self.addSeparator()
示例4: initUI
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def initUI(self):
panel = JPanel()
self.getContentPane().add(panel)
panel.setLayout(None)
panel.setToolTipText("A panel container")
button = JButton("Button")
button.setBounds(100, 60, 100, 30)
button.setToolTipText("A button component")
panel.add(button)
self.setTitle("Tooltips")
self.setSize(300, 200)
self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
self.setLocationRelativeTo(None)
self.setVisible(True)
示例5: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def __init__(self, controller):
#Give reference to controller to delegate action response
self.controller = controller
tooltips = {}
tooltips = collections.OrderedDict()
tooltips['newFile'] = 'Creates empty ATF file for edition'
tooltips['openFile'] = 'Opens ATF file for edition'
tooltips['saveFile'] = 'Saves current file'
tooltips['closeFile'] = 'Closes current file'
for name, tooltip in tooltips.items():
print name, tooltip
icon = ImageIcon(self.findImageResource(name))
button = JButton(icon, actionPerformed = getattr(self, name))
button.setToolTipText(tooltips[name])
self.add(button)
#Work out is separator is needed
if name in ['openFile', 'redo']:
self.addSeparator()
示例6: initUI
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
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: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def __init__(self):
super(WorkHelper, self).__init__()
self.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
#############################################################
# Layout:
layout = GroupLayout(self.getContentPane())
self.getContentPane().setLayout(layout)
layout.setAutoCreateGaps(True)
layout.setAutoCreateContainerGaps(True)
#############################################################
#############################################################
# Frame Area:
Larea1 = JLabel("InputArea:")
Sarea1 = JScrollPane()
self.area1 = JTextArea()
self.area1.setToolTipText("Input Area")
self.area1.setEditable(True)
self.area1.setBorder(BorderFactory.createLineBorder(Color.gray))
Sarea1.setPreferredSize(Dimension(300,100))
Sarea1.getViewport().setView((self.area1))
bClear = JButton("Clear", actionPerformed=self.bClear)
bClear.setToolTipText("Clears the text form both Input and Output text Areas")
bCopyToInput = JButton("Copy to Input", actionPerformed=self.bCopyToInput)
bCopyToInput.setToolTipText("Copy the text from the Output Area to the Input Area for further Operations")
self.cCtClipB = JCheckBox("Auto-Copy");
self.cCtClipB.setToolTipText("When 'Checked' after the Categories are created they will added to the clipboard")
self.cCtClipB.setSelected(1)
Larea2 = JLabel("OutputArea:")
Sarea2 = JScrollPane()
self.area2 = JTextArea()
self.area2.setToolTipText("Output Area")
self.area2.setEditable(False)
self.area2.setBorder(BorderFactory.createLineBorder(Color.gray))
Sarea2.setPreferredSize(Dimension(300,100))
Sarea2.getViewport().setView((self.area2))
#############################################################
# Tabbed Area:
tabPane = JTabbedPane(JTabbedPane.TOP)
self.getContentPane().add(tabPane)
#####################################################
# Text Edit pane
panel_TEdit = JPanel()
layout2 = GroupLayout(panel_TEdit)
layout2.setAutoCreateGaps(True)
layout2.setAutoCreateContainerGaps(True)
panel_TEdit.setLayout(layout2)
bRemoveNBSP_L = JButton("Clean LText", actionPerformed=self.bRemoveNBSP_L)
bRemoveNBSP_L.setToolTipText("Removes Spaces, Tabs from the start of every text line from the input Area")
bRemoveNBSP_R = JButton("Clean RText", actionPerformed=self.bRemoveNBSP_R)
bRemoveNBSP_R.setToolTipText("Removes Spaces, Tabs from the end of every text line from the input Area")
self.ReplaceThis = JTextField()
self.ReplaceThis = JTextField(maximumSize=Dimension(120,25))
self.ReplaceThis.setToolTipText("Text to be replaced")
self.ReplaceThat = JTextField()
self.ReplaceThat = JTextField(maximumSize=Dimension(120,25))
self.ReplaceThat.setToolTipText("Text to be placed")
bSandReplace = JButton("Replace Text", actionPerformed=self.bSandReplace)
bSandReplace.setToolTipText("Replace the text from This with Text from That in the Text from the Input Area and displays it in the Output Area")
bRemNumbers = JButton("Rem Numbers", actionPerformed=self.RemNumbers)
bRemNumbers.setToolTipText("Removes numbers from the start of every line")
#####################################################
# Dimension pane
panel_Dimensions = JPanel()
layout3 = GroupLayout(panel_Dimensions)
layout3.setAutoCreateGaps(True)
layout3.setAutoCreateContainerGaps(True)
panel_Dimensions.setLayout(layout3)
self.cCurly = JCheckBox("Curly");
self.cCurly.setToolTipText("When 'Checked' Curly Brackets will surround the Categories")
self.cCurly.setSelected(1)
self.cSemiC = JCheckBox("SemiColumn");
self.cSemiC.setToolTipText("When 'Checked' after the Categories are created at the end will be a semicolomn")
self.cSemiC.setSelected(1)
self.iStart = JTextField(maximumSize=Dimension(40,25))
self.iStart.setToolTipText("The Start Index for the Making of the Categories")
self.RThis = JTextField()
self.RThis = JTextField(maximumSize=Dimension(120,25))
self.RThis.setToolTipText("The Starting Index used in creating the Categorical")
self.RThat = JTextField()
#.........这里部分代码省略.........
示例8: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def __init__(self, parent, title, modal, app):
from java.awt import CardLayout
self.app = app
border = BorderFactory.createEmptyBorder(5, 7, 7, 7)
self.getContentPane().setBorder(border)
self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))
self.FAVAREALAYERNAME = "Favourite zone editing"
info = JLabel(self.app.strings.getString("Create_a_new_favourite_zone"))
info.setAlignmentX(Component.LEFT_ALIGNMENT)
#Name
nameLbl = JLabel(self.app.strings.getString("fav_zone_name"))
self.nameTextField = JTextField(20)
self.nameTextField.setMaximumSize(self.nameTextField.getPreferredSize())
self.nameTextField.setToolTipText(self.app.strings.getString("fav_zone_name_tooltip"))
namePanel = JPanel()
namePanel.setLayout(BoxLayout(namePanel, BoxLayout.X_AXIS))
namePanel.add(nameLbl)
namePanel.add(Box.createHorizontalGlue())
namePanel.add(self.nameTextField)
#Country
countryLbl = JLabel(self.app.strings.getString("fav_zone_country"))
self.countryTextField = JTextField(20)
self.countryTextField.setMaximumSize(self.countryTextField.getPreferredSize())
self.countryTextField.setToolTipText(self.app.strings.getString("fav_zone_country_tooltip"))
countryPanel = JPanel()
countryPanel.setLayout(BoxLayout(countryPanel, BoxLayout.X_AXIS))
countryPanel.add(countryLbl)
countryPanel.add(Box.createHorizontalGlue())
countryPanel.add(self.countryTextField)
#Type
modeLbl = JLabel(self.app.strings.getString("fav_zone_type"))
RECTPANEL = "rectangle"
POLYGONPANEL = "polygon"
BOUNDARYPANEL = "boundary"
self.modesStrings = [RECTPANEL, POLYGONPANEL, BOUNDARYPANEL]
modesComboModel = DefaultComboBoxModel()
for i in (self.app.strings.getString("rectangle"),
self.app.strings.getString("delimited_by_a_closed_way"),
self.app.strings.getString("delimited_by_an_administrative_boundary")):
modesComboModel.addElement(i)
self.modesComboBox = JComboBox(modesComboModel,
actionListener=self,
editable=False)
#- Rectangle
self.rectPanel = JPanel()
self.rectPanel.setLayout(BoxLayout(self.rectPanel, BoxLayout.Y_AXIS))
capturePane = JPanel()
capturePane.setLayout(BoxLayout(capturePane, BoxLayout.X_AXIS))
capturePane.setAlignmentX(Component.LEFT_ALIGNMENT)
josmP = JPanel()
self.captureRBtn = JRadioButton(self.app.strings.getString("capture_area"))
self.captureRBtn.addActionListener(self)
self.captureRBtn.setSelected(True)
self.bboxFromJosmBtn = JButton(self.app.strings.getString("get_current_area"),
actionPerformed=self.on_bboxFromJosmBtn_clicked)
self.bboxFromJosmBtn.setToolTipText(self.app.strings.getString("get_capture_area_tooltip"))
josmP.add(self.bboxFromJosmBtn)
capturePane.add(self.captureRBtn)
capturePane.add(Box.createHorizontalGlue())
capturePane.add(self.bboxFromJosmBtn)
manualPane = JPanel()
manualPane.setLayout(BoxLayout(manualPane, BoxLayout.X_AXIS))
manualPane.setAlignmentX(Component.LEFT_ALIGNMENT)
self.manualRBtn = JRadioButton(self.app.strings.getString("use_this_bbox"))
self.manualRBtn.addActionListener(self)
self.bboxTextField = JTextField(20)
self.bboxTextField.setMaximumSize(self.bboxTextField.getPreferredSize())
self.bboxTextField.setToolTipText(self.app.strings.getString("fav_bbox_tooltip"))
self.bboxTextFieldDefaultBorder = self.bboxTextField.getBorder()
self.bboxTextField.getDocument().addDocumentListener(TextListener(self))
manualPane.add(self.manualRBtn)
manualPane.add(Box.createHorizontalGlue())
manualPane.add(self.bboxTextField)
group = ButtonGroup()
group.add(self.captureRBtn)
group.add(self.manualRBtn)
previewPane = JPanel()
previewPane.setLayout(BoxLayout(previewPane, BoxLayout.X_AXIS))
previewPane.setAlignmentX(Component.LEFT_ALIGNMENT)
bboxPreviewInfo = JTextField(self.app.strings.getString("coordinates"),
editable=0,
border=None)
bboxPreviewInfo.setMaximumSize(bboxPreviewInfo.getPreferredSize())
self.bboxPreviewTextField = JTextField(20,
editable=0,
border=None)
self.bboxPreviewTextField.setMaximumSize(self.bboxPreviewTextField.getPreferredSize())
previewPane.add(bboxPreviewInfo)
previewPane.add(Box.createHorizontalGlue())
#.........这里部分代码省略.........
示例9: NewZoneDialog
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
class NewZoneDialog(JDialog, ActionListener, WindowListener):
"""Dialog for favourite zone editing
"""
def __init__(self, parent, title, modal, app):
from java.awt import CardLayout
self.app = app
border = BorderFactory.createEmptyBorder(5, 7, 7, 7)
self.getContentPane().setBorder(border)
self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))
self.FAVAREALAYERNAME = "Favourite zone editing"
info = JLabel(self.app.strings.getString("Create_a_new_favourite_zone"))
info.setAlignmentX(Component.LEFT_ALIGNMENT)
#Name
nameLbl = JLabel(self.app.strings.getString("fav_zone_name"))
self.nameTextField = JTextField(20)
self.nameTextField.setMaximumSize(self.nameTextField.getPreferredSize())
self.nameTextField.setToolTipText(self.app.strings.getString("fav_zone_name_tooltip"))
namePanel = JPanel()
namePanel.setLayout(BoxLayout(namePanel, BoxLayout.X_AXIS))
namePanel.add(nameLbl)
namePanel.add(Box.createHorizontalGlue())
namePanel.add(self.nameTextField)
#Country
countryLbl = JLabel(self.app.strings.getString("fav_zone_country"))
self.countryTextField = JTextField(20)
self.countryTextField.setMaximumSize(self.countryTextField.getPreferredSize())
self.countryTextField.setToolTipText(self.app.strings.getString("fav_zone_country_tooltip"))
countryPanel = JPanel()
countryPanel.setLayout(BoxLayout(countryPanel, BoxLayout.X_AXIS))
countryPanel.add(countryLbl)
countryPanel.add(Box.createHorizontalGlue())
countryPanel.add(self.countryTextField)
#Type
modeLbl = JLabel(self.app.strings.getString("fav_zone_type"))
RECTPANEL = "rectangle"
POLYGONPANEL = "polygon"
BOUNDARYPANEL = "boundary"
self.modesStrings = [RECTPANEL, POLYGONPANEL, BOUNDARYPANEL]
modesComboModel = DefaultComboBoxModel()
for i in (self.app.strings.getString("rectangle"),
self.app.strings.getString("delimited_by_a_closed_way"),
self.app.strings.getString("delimited_by_an_administrative_boundary")):
modesComboModel.addElement(i)
self.modesComboBox = JComboBox(modesComboModel,
actionListener=self,
editable=False)
#- Rectangle
self.rectPanel = JPanel()
self.rectPanel.setLayout(BoxLayout(self.rectPanel, BoxLayout.Y_AXIS))
capturePane = JPanel()
capturePane.setLayout(BoxLayout(capturePane, BoxLayout.X_AXIS))
capturePane.setAlignmentX(Component.LEFT_ALIGNMENT)
josmP = JPanel()
self.captureRBtn = JRadioButton(self.app.strings.getString("capture_area"))
self.captureRBtn.addActionListener(self)
self.captureRBtn.setSelected(True)
self.bboxFromJosmBtn = JButton(self.app.strings.getString("get_current_area"),
actionPerformed=self.on_bboxFromJosmBtn_clicked)
self.bboxFromJosmBtn.setToolTipText(self.app.strings.getString("get_capture_area_tooltip"))
josmP.add(self.bboxFromJosmBtn)
capturePane.add(self.captureRBtn)
capturePane.add(Box.createHorizontalGlue())
capturePane.add(self.bboxFromJosmBtn)
manualPane = JPanel()
manualPane.setLayout(BoxLayout(manualPane, BoxLayout.X_AXIS))
manualPane.setAlignmentX(Component.LEFT_ALIGNMENT)
self.manualRBtn = JRadioButton(self.app.strings.getString("use_this_bbox"))
self.manualRBtn.addActionListener(self)
self.bboxTextField = JTextField(20)
self.bboxTextField.setMaximumSize(self.bboxTextField.getPreferredSize())
self.bboxTextField.setToolTipText(self.app.strings.getString("fav_bbox_tooltip"))
self.bboxTextFieldDefaultBorder = self.bboxTextField.getBorder()
self.bboxTextField.getDocument().addDocumentListener(TextListener(self))
manualPane.add(self.manualRBtn)
manualPane.add(Box.createHorizontalGlue())
manualPane.add(self.bboxTextField)
group = ButtonGroup()
group.add(self.captureRBtn)
group.add(self.manualRBtn)
previewPane = JPanel()
previewPane.setLayout(BoxLayout(previewPane, BoxLayout.X_AXIS))
previewPane.setAlignmentX(Component.LEFT_ALIGNMENT)
bboxPreviewInfo = JTextField(self.app.strings.getString("coordinates"),
editable=0,
border=None)
bboxPreviewInfo.setMaximumSize(bboxPreviewInfo.getPreferredSize())
self.bboxPreviewTextField = JTextField(20,
editable=0,
border=None)
#.........这里部分代码省略.........
示例10: QatDialog
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
class QatDialog(ToggleDialog):
"""ToggleDialog for error type selection and buttons for reviewing
errors in sequence
"""
def __init__(self, name, iconName, tooltip, shortcut, height, app):
ToggleDialog.__init__(self, name, iconName, tooltip, shortcut, height)
self.app = app
tools = app.tools
#Main panel of the dialog
mainPnl = JPanel(BorderLayout())
mainPnl.setBorder(BorderFactory.createEmptyBorder(0, 1, 1, 1))
### First tab: errors selection and download ###########################
#ComboBox with tools names
self.toolsComboModel = DefaultComboBoxModel()
for tool in tools:
self.add_data_to_models(tool)
self.toolsCombo = JComboBox(self.toolsComboModel,
actionListener=ToolsComboListener(app))
renderer = ToolsComboRenderer(self.app)
renderer.setPreferredSize(Dimension(20, 20))
self.toolsCombo.setRenderer(renderer)
self.toolsCombo.setToolTipText(app.strings.getString("Select_a_quality_assurance_tool"))
#ComboBox with categories names ("views"), of the selected tool
self.viewsCombo = JComboBox(actionListener=ViewsComboListener(app))
self.viewsCombo.setToolTipText(app.strings.getString("Select_a_category_of_error"))
#Popup for checks table
self.checkPopup = JPopupMenu()
#add favourite check
self.menuItemAdd = JMenuItem(self.app.strings.getString("Add_to_favourites"))
self.menuItemAdd.setIcon(ImageIcon(File.separator.join([self.app.SCRIPTDIR,
"tools",
"data",
"Favourites",
"icons",
"tool_16.png"])))
self.menuItemAdd.addActionListener(PopupActionListener(self.app))
self.checkPopup.add(self.menuItemAdd)
#remove favourite check
self.menuItemRemove = JMenuItem(self.app.strings.getString("Remove_from_favourites"))
self.menuItemRemove.setIcon(ImageIcon(File.separator.join([self.app.SCRIPTDIR,
"tools",
"data",
"Favourites",
"icons",
"black_tool_16.png"])))
self.menuItemRemove.addActionListener(PopupActionListener(self.app))
self.checkPopup.add(self.menuItemRemove)
#Help link for selected check
self.menuItemHelp = JMenuItem(self.app.strings.getString("check_help"))
self.menuItemHelp.setIcon(ImageIcon(File.separator.join([self.app.SCRIPTDIR,
"images",
"icons",
"info_16.png"])))
self.checkPopup.add(self.menuItemHelp)
self.menuItemHelp.addActionListener(PopupActionListener(self.app))
#Table with checks of selected tool and view
self.checksTable = JTable()
self.iconrenderer = IconRenderer()
self.iconrenderer.setHorizontalAlignment(JLabel.CENTER)
scrollPane = JScrollPane(self.checksTable)
self.checksTable.setFillsViewportHeight(True)
tableSelectionModel = self.checksTable.getSelectionModel()
tableSelectionModel.addListSelectionListener(ChecksTableListener(app))
self.checksTable.addMouseListener(ChecksTableClickListener(app,
self.checkPopup,
self.checksTable))
#Favourite area status indicator
self.favAreaIndicator = JLabel()
self.update_favourite_zone_indicator()
self.favAreaIndicator.addMouseListener(FavAreaIndicatorListener(app))
#label with OSM id of the object currently edited and number of
#errors still to review
self.checksTextFld = JTextField("",
editable=0,
border=None,
background=None)
#checks buttons
btnsIconsDir = File.separator.join([app.SCRIPTDIR, "images", "icons"])
downloadIcon = ImageIcon(File.separator.join([btnsIconsDir, "download.png"]))
self.downloadBtn = JButton(downloadIcon,
actionPerformed=app.on_downloadBtn_clicked,
enabled=0)
startIcon = ImageIcon(File.separator.join([btnsIconsDir, "start_fixing.png"]))
self.startBtn = JButton(startIcon,
actionPerformed=app.on_startBtn_clicked,
enabled=0)
self.downloadBtn.setToolTipText(app.strings.getString("Download_errors_in_this_area"))
self.startBtn.setToolTipText(app.strings.getString("Start_fixing_the_selected_errors"))
#tab layout
#.........这里部分代码省略.........
示例11: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def __init__(self, instructionsURI=''):
self.instructionsURI = instructionsURI
self.logger = logging.getLogger('sasi_runner_gui')
self.logger.addHandler(logging.StreamHandler())
def log_fn(msg):
self.log_msg(msg)
self.logger.addHandler(FnLogHandler(log_fn))
self.logger.setLevel(logging.DEBUG)
self.selected_input_file = None
self.selected_output_file = None
self.frame = JFrame(
"SASI Runner",
defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE,
)
self.frame.size = (650, 600,)
self.main_panel = JPanel()
self.main_panel.layout = BoxLayout(self.main_panel, BoxLayout.Y_AXIS)
self.frame.add(self.main_panel)
self.top_panel = JPanel(SpringLayout())
self.top_panel.alignmentX = Component.CENTER_ALIGNMENT
self.main_panel.add(self.top_panel)
self.stageCounter = 1
def getStageLabel(txt):
label = JLabel("%s. %s" % (self.stageCounter, txt))
self.stageCounter += 1
return label
# Instructions link.
self.top_panel.add(getStageLabel("Read the instructions:"))
instructionsButton = JButton(
('<HTML><FONT color="#000099">'
'<U>open instructions</U></FONT><HTML>'),
actionPerformed=self.browseInstructions)
instructionsButton.setHorizontalAlignment(SwingConstants.LEFT);
instructionsButton.setBorderPainted(False);
instructionsButton.setOpaque(False);
instructionsButton.setBackground(Color.WHITE);
instructionsButton.setToolTipText(self.instructionsURI);
self.top_panel.add(instructionsButton)
# 'Select input' elements.
self.top_panel.add(getStageLabel(
"Select a SASI .zip file or data folder:"))
self.top_panel.add(
JButton("Select input...", actionPerformed=self.openInputChooser))
# 'Select output' elements.
self.top_panel.add(getStageLabel("Specify an output file:"))
self.top_panel.add(
JButton("Specify output...", actionPerformed=self.openOutputChooser))
# 'Set result fields' elements.
result_fields = [
{'id': 'gear_id', 'label': 'Gear', 'selected': True,
'enabled': False},
{'id': 'substrate_id', 'label': 'Substrate', 'selected': True},
{'id': 'energy_id', 'label': 'Energy', 'selected': False},
{'id': 'feature_id', 'label': 'Feature', 'selected': False},
{'id': 'feature_category_id', 'label': 'Feature Category',
'selected': False}
]
self.selected_result_fields = {}
resolutionLabelPanel = JPanel(GridLayout(0,1))
resolutionLabelPanel.add(getStageLabel("Set result resolution:"))
resolutionLabelPanel.add(
JLabel(("<html><i>This sets the specificity with which<br>"
"results will be grouped. Note that enabling<br>"
"more fields can *greatly* increase resulting<br>"
"output sizes and run times.</i>")))
#self.top_panel.add(getStageLabel("Set result resolution:"))
self.top_panel.add(resolutionLabelPanel)
checkPanel = JPanel(GridLayout(0, 1))
self.top_panel.add(checkPanel)
self.resultFieldCheckBoxes = {}
for result_field in result_fields:
self.selected_result_fields.setdefault(
result_field['id'], result_field['selected'])
checkBox = JCheckBox(
result_field['label'], result_field['selected'])
checkBox.setEnabled(result_field.get('enabled', True))
checkBox.addItemListener(self)
checkPanel.add(checkBox)
self.resultFieldCheckBoxes[checkBox] = result_field
# 'Run' elements.
self.top_panel.add(getStageLabel("Run SASI: (this might take a while)"))
self.run_button = JButton("Run...", actionPerformed=self.runSASI)
self.top_panel.add(self.run_button)
SpringUtilities.makeCompactGrid(
self.top_panel, self.stageCounter - 1, 2, 6, 6, 6, 6)
# Progress bar.
self.progressBar = JProgressBar(0, 100)
#.........这里部分代码省略.........
示例12: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def __init__(self, instructionsURI=""):
self.instructionsURI = instructionsURI
self.logger = logging.getLogger("sasi_gridder_gui")
self.logger.addHandler(logging.StreamHandler())
def log_fn(msg):
self.log_msg(msg)
self.logger.addHandler(FnLogHandler(log_fn))
self.logger.setLevel(logging.DEBUG)
self.selected_input_file = None
self.selected_output_file = None
self.frame = JFrame("SASI Gridder", defaultCloseOperation=WindowConstants.EXIT_ON_CLOSE)
self.frame.size = (650, 600)
self.main_panel = JPanel()
self.main_panel.layout = BoxLayout(self.main_panel, BoxLayout.Y_AXIS)
self.frame.add(self.main_panel)
self.top_panel = JPanel(SpringLayout())
self.top_panel.alignmentX = Component.CENTER_ALIGNMENT
self.main_panel.add(self.top_panel)
self.stageCounter = 1
def getStageLabel(txt):
label = JLabel("%s. %s" % (self.stageCounter, txt))
self.stageCounter += 1
return label
# Instructions link.
self.top_panel.add(getStageLabel("Read the instructions:"))
instructionsButton = JButton(
('<HTML><FONT color="#000099">' "<U>open instructions</U></FONT><HTML>"),
actionPerformed=self.browseInstructions,
)
instructionsButton.setHorizontalAlignment(SwingConstants.LEFT)
instructionsButton.setBorderPainted(False)
instructionsButton.setOpaque(False)
instructionsButton.setBackground(Color.WHITE)
instructionsButton.setToolTipText(self.instructionsURI)
self.top_panel.add(instructionsButton)
# Select input elements.
self.top_panel.add(getStageLabel("Select an input data folder:"))
self.top_panel.add(JButton("Select input...", actionPerformed=self.openInputChooser))
# Select output elements.
self.top_panel.add(getStageLabel("Specify an output file:"))
self.top_panel.add(JButton("Specify output...", actionPerformed=self.openOutputChooser))
# Run elements.
self.top_panel.add(getStageLabel("Run SASI Gridder: (this might take a hwile"))
self.run_button = JButton("Run...", actionPerformed=self.runSASIGridder)
self.top_panel.add(self.run_button)
SpringUtilities.makeCompactGrid(self.top_panel, self.stageCounter - 1, 2, 6, 6, 6, 6)
# Progress bar.
self.progressBar = JProgressBar(0, 100)
self.main_panel.add(self.progressBar)
# Log panel.
self.log_panel = JPanel()
self.log_panel.alignmentX = Component.CENTER_ALIGNMENT
self.log_panel.setBorder(EmptyBorder(10, 10, 10, 10))
self.main_panel.add(self.log_panel)
self.log_panel.setLayout(BorderLayout())
self.log = JTextArea()
self.log.editable = False
self.logScrollPane = JScrollPane(self.log)
self.logScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS)
self.log_panel.add(self.logScrollPane, BorderLayout.CENTER)
# File selectors
self.inputChooser = JFileChooser()
self.inputChooser.fileSelectionMode = JFileChooser.FILES_AND_DIRECTORIES
self.outputChooser = JFileChooser()
self.outputChooser.fileSelectionMode = JFileChooser.FILES_ONLY
defaultOutputFile = os.path.join(System.getProperty("user.home"), "gridded_efforts.csv")
self.outputChooser.setSelectedFile(File(defaultOutputFile))
self.frame.setLocationRelativeTo(None)
self.frame.visible = True
示例13: __init__
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def __init__(self):
super(WorkHelper, self).__init__()
self.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
#self.initUI()
#def initUI(self):
#panel = JPanel()
#self.getContentPane().add(panel)
#############################################################
# Layout
layout = GroupLayout(self.getContentPane())
self.getContentPane().setLayout(layout)
layout.setAutoCreateGaps(True)
layout.setAutoCreateContainerGaps(True)
#############################################################
#############################################################
# Scroll Area Input + Output
Larea1 = JLabel("InputArea:")
Larea2 = JLabel("OutputArea:")
Sarea1 = JScrollPane()
Sarea2 = JScrollPane()
self.area1 = JTextArea()
self.area1.setToolTipText("Input Area")
self.area1.setEditable(True)
self.area1.setBorder(BorderFactory.createLineBorder(Color.gray))
Sarea1.setPreferredSize(Dimension(300,100))
Sarea1.getViewport().setView((self.area1))
self.area2 = JTextArea()
self.area2.setToolTipText("Output Area")
self.area2.setEditable(False)
self.area2.setBorder(BorderFactory.createLineBorder(Color.gray))
Sarea2.setPreferredSize(Dimension(300,100))
Sarea2.getViewport().setView((self.area2))
#############################################################
#############################################################
# Buttons
self.cCurly = JCheckBox("Curly");
self.cCurly.setToolTipText("When 'Checked' Curly Brackets will surround the Categories")
self.cCurly.setSelected(1)
self.cCtClipB = JCheckBox("Auto-Copy");
self.cCtClipB.setToolTipText("When 'Checked' after the Categories are created they will added to the clipboard")
self.cCtClipB.setSelected(1)
self.cSemiC = JCheckBox("SemiColumn");
self.cSemiC.setToolTipText("When 'Checked' after the Categories are created at the end will be a semicolomn")
self.cSemiC.setSelected(1)
bRemoveNBSP_L = JButton("Clean LText", actionPerformed=self.bRemoveNBSP_L)
bRemoveNBSP_L.setToolTipText("Removes Spaces, Tabs from the start of every text line from the input Area")
bRemoveNBSP_R = JButton("Clean RText", actionPerformed=self.bRemoveNBSP_R)
bRemoveNBSP_R.setToolTipText("Removes Spaces, Tabs from the end of every text line from the input Area")
bCopyToInput = JButton("Copy to Input", actionPerformed=self.bCopyToInput)
bCopyToInput.setToolTipText("Copy the text from the Output Area to the Input Area for further Operations")
bClear = JButton("Clear", actionPerformed=self.bClear)
bClear.setToolTipText("Clears the text form both Input and Output text Areas")
self.iStart = JTextField(maximumSize=Dimension(40,25))
self.iStart.setToolTipText("The Start Index for the Making of the Categories")
self.RThis = JTextField()
self.RThis = JTextField(maximumSize=Dimension(120,25))
self.RThis.setToolTipText("Text to be replaced or The Starting C_Index")
self.RThat = JTextField()
self.RThat = JTextField(maximumSize=Dimension(120,25))
self.RThat.setToolTipText("Text to be placed or The Finish C_Index")
bSandReplace = JButton("Replace Text", actionPerformed=self.bSandReplace)
bSandReplace.setToolTipText("Replace the text from This with Thext from That in the Text from the Input Area and displays it in the Output Area")
bcCat = JButton("CreatCateg", actionPerformed=self.bcCat)
bcCat.setToolTipText("Create a categorical form starting C_Index to finish C_Index; Use the above text boxes to define the indexes")
bC_S = JButton("Create _Series", actionPerformed=self.bC_S)
bC_S.setToolTipText("Create a series form starting C_Index to finish C_Index; Use the above text boxes to define the indexes; It will create a series for every row in the Input Area")
bM_Categories = JButton("Categories", actionPerformed=self.mCategories)
bM_Categories.setToolTipText("Make Categories using the lines from the Input Area")
#bM_Categories = JButton(maximumSize=Dimension(40,25))
# de incercat daca merge cu ; sa grupezi in [dsa] elementele
#############################################################
#.........这里部分代码省略.........
示例14: build_ui
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
def build_ui(self):
"""Builds the configuration screen"""
labels = JPanel(GridLayout(21, 1))
checkbox = JCheckBox("Attempt to parse files for URL patterns?",
False, actionPerformed=self.set_parse)
stats_box = JCheckBox("Show stats?", True,
actionPerformed=self.set_show_stats)
# The two year old in me is laughing heartily
plug_butt = JButton("Specify plugins location",
actionPerformed=self.set_plugin_loc)
load_plug_butt = JButton("Select plugins",
actionPerformed=self.p_build_ui)
parse_butt = JButton("Parse directory", actionPerformed=self.parse)
clear_butt = JButton("Clear text", actionPerformed=self.clear)
spider_butt = JButton("Send to Spider", actionPerformed=self.scan)
save_butt = JButton("Save config", actionPerformed=self.save)
rest_butt = JButton("Restore config", actionPerformed=self.restore)
source_butt = JButton("Input Source File/Directory",
actionPerformed=self.get_source_input)
# Build grid
labels.add(source_butt)
labels.add(self.curr_conf)
labels.add(JLabel("String Delimiter:"))
labels.add(self.delim)
labels.add(JLabel("Extension Whitelist:"))
labels.add(self.ext_white_list)
labels.add(JLabel("URL:"))
labels.add(self.url)
labels.add(JLabel("Path Variables"))
labels.add(self.path_vars)
# Leaving these here for now.
# labels.add(JLabel("Cookies:"))
# labels.add(self.cookies)
# labels.add(JLabel("HTTP Headers:"))
# labels.add(self.headers)
labels.add(checkbox)
labels.add(stats_box)
labels.add(plug_butt)
labels.add(parse_butt)
labels.add(JButton("Show all endpoints",
actionPerformed=self.print_endpoints))
labels.add(clear_butt)
labels.add(spider_butt)
labels.add(JLabel(""))
labels.add(save_butt)
labels.add(rest_butt)
labels.add(load_plug_butt)
# Tool tips!
self.delim.setToolTipText("Use to manipulate the final URL. "
"See About tab for example.")
self.ext_white_list.setToolTipText("Define a comma delimited list of"
" file extensions to parse. Use *"
" to parse all files.")
self.url.setToolTipText("Enter the target URL")
checkbox.setToolTipText("Parse files line by line using plugins"
" to enumerate language/framework specific"
" endpoints")
parse_butt.setToolTipText("Attempt to enumerate application endpoints")
clear_butt.setToolTipText("Clear status window and the parse results")
spider_butt.setToolTipText("Process discovered endpoints")
save_butt.setToolTipText("Saves the current config settings")
rest_butt.setToolTipText("<html>Restores previous config settings:"
"<br/>-Input Directory<br/>-String Delim"
"<br/>-Ext WL<br/>-URL<br/>-Plugins")
source_butt.setToolTipText("Select the application's "
"source directory or file to parse")
self.path_vars.setToolTipText("Supply a JSON object with values"
"for dynamically enumerated query"
"string variables")
return labels
示例15: PreferencesFrame
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setToolTipText [as 别名]
class PreferencesFrame(JFrame, ActionListener, WindowListener, ItemListener, HyperlinkListener):
"""Dialog with preferences
"""
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))
#.........这里部分代码省略.........