本文整理汇总了Python中javax.swing.JTable.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Python JTable.addMouseListener方法的具体用法?Python JTable.addMouseListener怎么用?Python JTable.addMouseListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTable
的用法示例。
在下文中一共展示了JTable.addMouseListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __initTable
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import addMouseListener [as 别名]
def __initTable(self):
table = JTable(HitListModel())
scrollpane = JScrollPane(table)
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF)
table.addMouseListener(HitListMouseListener())
self.add(scrollpane, self.__createTableConstraints())
scrollpane.addComponentListener(PanelSizeChangeListener(table))
return table
示例2: DataPanel
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import addMouseListener [as 别名]
class DataPanel(JPanel,MouseListener):
def __init__(self,view):
JPanel.__init__(self)
self.view=view
self.background=Color.white
self.layout=BorderLayout()
self.popup=JPopupMenu()
self.popup_items={}
self.add(self.make_controls(),BorderLayout.SOUTH)
data,title=self.extract_data()
self.table=JTable(DefaultTableModel(data,title))
scroll=JScrollPane(self.table)
self.add(scroll)
scroll.addMouseListener(self)
self.table.tableHeader.addMouseListener(self)
self.table.addMouseListener(self)
self.fileChooser=JFileChooser()
self.fileChooser.setFileFilter(CSVFilter())
self.fileChooser.setSelectedFile(File('%s.csv'%self.view.network.name))
def make_controls(self):
from timeview.components.timecontrol import Icon, ShadedIcon
panel=JPanel(background=self.background)
panel.add(JButton(Icon.refresh,actionPerformed=self.refresh,rolloverIcon=ShadedIcon.refresh,toolTipText='refresh',borderPainted=False,focusPainted=False,contentAreaFilled=False))
filter=JPanel(layout=BorderLayout(),opaque=False)
self.filter = JSpinner(SpinnerNumberModel(self.view.tau_filter,0,0.5,0.01),stateChanged=self.refresh)
filter.add(self.filter)
filter.add(JLabel('filter'),BorderLayout.NORTH)
filter.maximumSize=filter.preferredSize
panel.add(filter)
decimals=JPanel(layout=BorderLayout(),opaque=False)
self.decimals = JSpinner(SpinnerNumberModel(3,0,10,1),stateChanged=self.refresh)
decimals.add(self.decimals)
decimals.add(JLabel('decimal places'),BorderLayout.NORTH)
decimals.maximumSize=decimals.preferredSize
panel.add(decimals)
panel.add(JButton(Icon.save,actionPerformed=self.save,rolloverIcon=ShadedIcon.save,toolTipText='save',borderPainted=False,focusPainted=False,contentAreaFilled=False))
return panel
def extract_data(self):
pause_state=self.view.paused
self.view.paused=True
while self.view.simulating:
java.lang.Thread.sleep(10)
tau=float(self.filter.value)
dt=self.view.dt
if tau<dt: dt_tau=None
else: dt_tau=dt/tau
decimals=int(self.decimals.value)
format='%%1.%df'%decimals
start_index=max(0,self.view.timelog.tick_count-self.view.timelog.tick_limit+1)
count=min(self.view.timelog.tick_limit,self.view.timelog.tick_count)
start_time=start_index*self.view.dt
data=None
title=['t']
keys = self.view.watcher.active.keys()
keys.sort()
for key in keys:
watch = self.view.watcher.active[key]
name,func,args=key
code='%s.%s%s'%(name,func.__name__,args)
if code not in self.popup_items:
state=True
if 'spike' in func.__name__: state=False
if 'voltage' in func.__name__: state=False
self.popup_items[code]=JCheckBoxMenuItem(code,state,stateChanged=self.refresh)
self.popup.add(self.popup_items[code])
if self.popup_items[code].state is False: continue
d=watch.get(dt_tau=dt_tau,start=start_index,count=count)
n=len(watch.get_first())
if data is None:
data=[]
while len(data)<len(d):
data.append(['%0.4f'%(start_time+(len(data)+0)*self.view.dt)])
for i in range(n):
title.append('%s[%d]'%(code,i))
for j in range(len(data)):
dd=d[j]
#.........这里部分代码省略.........
示例3: QatDialog
# 需要导入模块: from javax.swing import JTable [as 别名]
# 或者: from javax.swing.JTable import addMouseListener [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
#.........这里部分代码省略.........