use of java.awt.event.MouseMotionListener in project JMRI by JMRI.
the class DrawRectangle method makeParamsPanel.
@Override
protected JPanel makeParamsPanel(PositionableShape ps) {
JPanel panel = super.makeParamsPanel(ps);
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
JPanel pp = new JPanel();
_widthText = new JTextField(6);
_width = ps.getWidth();
_widthText.setText(Integer.toString(_width));
_widthText.setHorizontalAlignment(JTextField.RIGHT);
pp.add(_widthText);
pp.add(new JLabel(Bundle.getMessage("width")));
p.add(pp);
p.add(Box.createHorizontalStrut(STRUT_SIZE));
_widthText.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
_shape.setWidth(Integer.parseInt(_widthText.getText()));
updateShape();
}
});
pp = new JPanel();
_heightText = new JTextField(6);
_height = ps.getHeight();
_heightText.setText(Integer.toString(_height));
_heightText.setHorizontalAlignment(JTextField.RIGHT);
pp.add(_heightText);
pp.add(new JLabel(Bundle.getMessage("height")));
p.add(pp);
_heightText.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
_shape.setHeight(Integer.parseInt(_heightText.getText()));
updateShape();
}
});
p.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
updateShape();
}
@Override
public void mouseMoved(MouseEvent e) {
int w = Integer.parseInt(_widthText.getText());
int h = Integer.parseInt(_heightText.getText());
if (w != _shape.getWidth() || h != _shape.getHeight()) {
_shape.setHeight(h);
_shape.setWidth(w);
updateShape();
}
}
});
panel.add(p);
panel.add(Box.createVerticalStrut(STRUT_SIZE));
return panel;
}
use of java.awt.event.MouseMotionListener in project JMRI by JMRI.
the class DrawRoundRect method makeParamsPanel.
@Override
protected JPanel makeParamsPanel(PositionableShape ps) {
JPanel panel = super.makeParamsPanel(ps);
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
JPanel pp = new JPanel();
_radiusText = new JTextField(6);
_radiusText.setText(Integer.toString(((PositionableRoundRect) ps).getCornerRadius()));
_radiusText.setHorizontalAlignment(JTextField.RIGHT);
pp.add(_radiusText);
_radiusText.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((PositionableRoundRect) _shape).setCornerRadius(Integer.parseInt(_radiusText.getText()));
updateShape();
}
});
_radiusText.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
updateShape();
}
@Override
public void mouseMoved(MouseEvent e) {
((PositionableRoundRect) _shape).setCornerRadius(Integer.parseInt(_radiusText.getText()));
updateShape();
}
});
pp.add(new JLabel(Bundle.getMessage("cornerRadius")));
p.add(pp);
panel.add(p);
panel.add(Box.createVerticalStrut(STRUT_SIZE));
return panel;
}
use of java.awt.event.MouseMotionListener in project Purus-Pasta by puruscor.
the class HavenPanel method init.
public void init() {
setFocusTraversalKeysEnabled(false);
newui(null);
addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
synchronized (events) {
events.add(e);
events.notifyAll();
}
}
public void keyPressed(KeyEvent e) {
synchronized (events) {
events.add(e);
events.notifyAll();
}
}
public void keyReleased(KeyEvent e) {
synchronized (events) {
events.add(e);
events.notifyAll();
}
}
});
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
synchronized (events) {
events.add(e);
events.notifyAll();
}
}
public void mouseReleased(MouseEvent e) {
synchronized (events) {
events.add(e);
events.notifyAll();
}
}
});
addMouseMotionListener(new MouseMotionListener() {
public void mouseDragged(MouseEvent e) {
synchronized (events) {
mousemv = e;
}
}
public void mouseMoved(MouseEvent e) {
synchronized (events) {
mousemv = e;
}
}
});
addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(MouseWheelEvent e) {
synchronized (events) {
events.add(e);
events.notifyAll();
}
}
});
inited = true;
}
use of java.awt.event.MouseMotionListener in project com.revolsys.open by revolsys.
the class MouseOverlay method mouseMoved.
@Override
public void mouseMoved(final MouseEvent event) {
updateEventPoint(event);
try {
requestFocusInWindow();
this.mapPanel.mouseMovedCloseSelected(event);
for (final Component overlay : getOverlays()) {
if (overlay instanceof MouseMotionListener) {
final MouseMotionListener listener = (MouseMotionListener) overlay;
listener.mouseMoved(event);
if (event.isConsumed()) {
return;
}
}
}
} catch (final RuntimeException e) {
Logs.error(this, "Mouse move error", e);
}
}
use of java.awt.event.MouseMotionListener in project azure-tools-for-java by Microsoft.
the class VMWizardModel method configStepList.
public void configStepList(JList list, int step) {
list.setListData(getStepTitleList());
list.setSelectedIndex(step);
list.setBorder(new EmptyBorder(10, 0, 10, 0));
list.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList mylist, Object o, int i, boolean b, boolean b1) {
return super.getListCellRendererComponent(mylist, " " + o.toString(), i, b, b1);
}
});
for (MouseListener mouseListener : list.getMouseListeners()) {
list.removeMouseListener(mouseListener);
}
for (MouseMotionListener mouseMotionListener : list.getMouseMotionListeners()) {
list.removeMouseMotionListener(mouseMotionListener);
}
list.setBackground(JBColor.background());
}
Aggregations