本文整理了Java中javax.swing.JLabel.addMouseMotionListener()
方法的一些代码示例,展示了JLabel.addMouseMotionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.addMouseMotionListener()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:addMouseMotionListener
暂无
代码示例来源:origin: kevin-wayne/algs4
draw.addMouseMotionListener(this);
代码示例来源:origin: kevin-wayne/algs4
draw.addMouseMotionListener(std);
代码示例来源:origin: org.netbeans.api/org-openide-awt
/** Overridden to do nothing for performance reasons */
public @Override void addMouseMotionListener(MouseMotionListener ml) {
if (swingRendering) {
super.addMouseMotionListener(ml);
}
}
代码示例来源:origin: apache/pdfbox
private void initUI()
{
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
String pageLabelText = pageIndex < 0 ? "Page number not found" : "Page " + (pageIndex + 1);
// append PDF page label, if available
String lbl = PDFDebugger.getPageLabel(document, pageIndex);
if (lbl != null)
{
pageLabelText += " - " + lbl;
}
JLabel pageLabel = new JLabel(pageLabelText);
pageLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
pageLabel.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 20));
pageLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
panel.add(pageLabel);
label = new JLabel();
label.addMouseMotionListener(this);
label.addMouseListener(this);
label.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(label);
panel.addAncestorListener(this);
zoomMenu = ZoomMenu.getInstance();
zoomMenu.changeZoomSelection(zoomMenu.getPageZoomScale());
startRendering();
}
代码示例来源:origin: stackoverflow.com
final JLabel label = ...
label.addMouseMotionListener(new MouseListener() {
...
public void mouseEntered(MouseEvent me) {
hoveredLabel = (JLabel)me.getSource();
}
public void mouseExited(MouseEvent me) {
hoveredLabel = null;
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
/** Overridden to do nothing for performance reasons */
public void addMouseMotionListener (MouseMotionListener ml) {
if (swingRendering) {
super.addMouseMotionListener (ml);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
/** Overridden to do nothing for performance reasons */
public void addMouseMotionListener (MouseMotionListener ml) {
if (swingRendering) {
super.addMouseMotionListener (ml);
}
}
代码示例来源:origin: stackoverflow.com
JLabel nameLabel = new JLabel("Name:");
nameLabel.addMouseMotionListener(new MouseMotionAdapter() {
//override the method
public void mouseDragged(MouseEvent arg0) {
// to do .........................
}
});
代码示例来源:origin: stackoverflow.com
ImageIcon icon = new ImageIcon("C:/image.jpg"); //Path to the image
JLabel label = new JLabel(icon); //add image to the label
label.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseDragged(MouseEvent arg0) {
// TODO Auto-generated method stub
}
});
代码示例来源:origin: stackoverflow.com
public class Paint extends JPanel implements ActionListener {
Mouse swim = new Mouse();
Timer tm = new Timer(7, this);
public void paintComponent(Graphics g) {
// Try this:
ImageIcon swimminghold = new ImageIcon(render.class.getResource("resources/Swimmingpoolns.png"));
swimmingpool = swimminghold.getImage();
JLabel label = new JLabel();
label.setIcon(swimminghold);
label.addMouseMotionListener(swim);
addMouseMotionListener(swim);
label.addMouseMotionListener(swim);
addMouseMotionListener(swim);
//Do something
/* ...*/
}
代码示例来源:origin: stackoverflow.com
JLabel image1 = new JLabel( new ImageIcon(...) );
image1.setSize( image1.getPreferredSize() );
image1.addMouseListener(...);
image1.addMouseMotionListener(...);
JPanel dragPanel = new JPanel();
dragPanel.setLayout(null);
dragPanel.add( image1 );
frame.add(dragPanel, BorderLayout.CENTER);
代码示例来源:origin: org.cytoscape/network-analyzer-impl
/**
* Creates and lays out the controls inside this dialog.
* <p>
* This method is called upon initialization only.
* </p>
*/
private void initControls() {
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBackground(Color.WHITE);
JLabel labContents = new JLabel(Utils.getImage("AboutBox.png", ""));
contentPane.add(labContents, BorderLayout.CENTER);
labContents.addMouseListener(this);
labContents.addMouseMotionListener(this);
setContentPane(contentPane);
pack();
}
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
protected void installListeners(JLabel c) {
super.installListeners(c);
// Forse PropertyChangeListener
String oldText = c.getText();
if (oldText != null) {
c.setText(null);
c.setText(oldText);
}
oldText = c.getToolTipText();
if (oldText != null) {
c.setToolTipText(null);
c.setToolTipText(oldText);
}
adapter = new RepresentativeAnchorMouseAdapter();
c.addMouseListener(adapter);
c.addMouseMotionListener(adapter);
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
protected void installListeners(JLabel c) {
super.installListeners(c);
// Forse PropertyChangeListener
String oldText = c.getText();
if (oldText != null) {
c.setText(null);
c.setText(oldText);
}
oldText = c.getToolTipText();
if (oldText != null) {
c.setToolTipText(null);
c.setToolTipText(oldText);
}
adapter = new RepresentativeAnchorMouseAdapter();
c.addMouseListener(adapter);
c.addMouseMotionListener(adapter);
descriptor.getToolWindow().addPlafPropertyChangeListener(this);
}
代码示例来源:origin: com.github.stephenc.monte/monte-screen-recorder
public void setLabel(JLabel newValue) {
if (label != null) {
label.removeMouseListener(handler);
label.removeMouseMotionListener(handler);
label.setCursor(Cursor.getDefaultCursor());
}
label = newValue;
if (label != null) {
label.addMouseListener(handler);
label.addMouseMotionListener(handler);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
/**
* Description of the Method
*/
protected void installListeners() {
mouseInputListener = createMouseInputListener();
iconPane.addMouseMotionListener(mouseInputListener);
iconPane.addMouseListener(mouseInputListener);
if (propertyChangeListener == null) {
propertyChangeListener = createPropertyChangeListener();
}
desktopIcon.getInternalFrame().addPropertyChangeListener(propertyChangeListener);
}
代码示例来源:origin: ru.sbtqa/monte-media
public void setLabel(JLabel newValue) {
if (label != null) {
label.removeMouseListener(handler);
label.removeMouseMotionListener(handler);
label.setCursor(getDefaultCursor());
}
label = newValue;
if (label != null) {
label.addMouseListener(handler);
label.addMouseMotionListener(handler);
}
}
代码示例来源:origin: chungkwong/MathOCR
@Override
protected void onCreated(Pair<TextLine,BufferedImage> src){
box=src.getKey().getBox();
candidates=CharacterSegmenters.REGISTRY.get().segment(src.getKey());
icon=new PageIcon(src.getValue(),this);
icon.getContent().addMouseListener(this);
icon.getContent().addMouseMotionListener(this);
index=new JSpinner(new SpinnerNumberModel(0,0,candidates.size()-1,1));
index.addChangeListener((e)->icon.repaint());
bar.add(index);
add(new JScrollPane(icon),BorderLayout.CENTER);
}
@Override
代码示例来源:origin: chungkwong/MathOCR
public PageIcon(){
super(new BorderLayout());
content.setVerticalAlignment(SwingConstants.TOP);
content.setHorizontalAlignment(SwingConstants.LEFT);
content.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
content.addMouseMotionListener(this);
add(content,BorderLayout.CENTER);
JFormattedTextField scaler=new JFormattedTextField(DecimalFormat.getPercentInstance());
scaler.setValue(1.0);
scaler.addActionListener((e)->{
setScale(((Number)scaler.getValue()).doubleValue());
});
add(scaler,BorderLayout.SOUTH);
}
public PageIcon(BufferedImage page,IconPaint painter){
代码示例来源:origin: Exslims/MercuryTrade
@Override
public void onViewInit() {
this.setOpacity(this.applicationConfig.get().getMaxOpacity() / 100f);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
ImageIcon icon = this.componentsFactory.getImage("app/helpIGImg.png");
Image image = icon.getImage(); // transform it
Image newimg = image.getScaledInstance(dim.width - MARGIN, -1, java.awt.Image.SCALE_SMOOTH);
if(dim.height-MARGIN < newimg.getHeight(null)) {
newimg = image.getScaledInstance(-1, dim.height - MARGIN, java.awt.Image.SCALE_SMOOTH);
}
icon = new ImageIcon(newimg);
JLabel img = new JLabel(icon);
this.add(img);
img.addMouseListener(new DraggedFrameMouseListener());
img.addMouseMotionListener(new DraggedFrameMotionListener());
img.setCursor(new Cursor(Cursor.MOVE_CURSOR));
this.pack();
this.setLocation(dim.width/2-this.getSize().width/2, 0);
}
内容来源于网络,如有侵权,请联系作者删除!