Inserting an Image on mouse clicked HELP

Hi.
I', trying to make a Tic tac toe game(if you do not understand please run this programme).
The thing I want to happen is:
the user clicks over a "sqare" and when mouse is released the image (X or O) appears on that position.
I can't get my programme to do this.
I'm using the MouseListener Interface to implement the mouse events, but when, for example, I click on one square no image is loaded on that position. what can I do?
Here's my code.
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Gato extends JFrame implements MouseListener{
     Container content = getContentPane();
     JTextArea texto = new JTextArea(1,150);
     Graphics2D g2d;
     Image cruz = Toolkit.getDefaultToolkit().getImage("cruz.gif");
     Image bola = Toolkit.getDefaultToolkit().getImage("bola.gif");
     public static void main(String [] coms){
          new Gato();
     public Gato(){
          content.add(texto, BorderLayout.SOUTH);
setSize(300,300);
setVisible(true);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(this);
     public void paint(Graphics g){
          g2d = (Graphics2D)g;
          g2d.draw3DRect(100,50,1,200,true);
          g2d.draw3DRect(175,50,1,200,true);
          g2d.draw3DRect(35,111,200,1,true);
          g2d.draw3DRect(35,177,200,1,true);
          int x = 3;
          int y = 25;
          g2d.drawImage(cruz, x, y, this);
          x = 260;
          g2d.drawImage(bola, x, y, this);
     public void pon(int x, int y){
          g2d.drawImage(cruz, x, y, this);
     public void mousePressed(MouseEvent e){}
     public void mouseClicked(MouseEvent e){}
     public void mouseReleased(MouseEvent e){
          texto.append(" " + e.getX());
pon(e.getX(),e.getY());
     public void mouseEntered(MouseEvent e){}
     public void mouseExited(MouseEvent e){}
}

Look at this:
import java.awt.*;
import java.awt.event.*;
import java.math.*;
public class TicTac extends Frame implements ActionListener
     Button   bx[]  = new Button[9];
     int      used;
     Font     f1    = new Font("System " , 1, 28);
     MenuItem ng    = new MenuItem("New Game");
public TicTac() 
     super(" TicTacTo ");   
     setLayout(new GridLayout(3,3));
     addWindowListener(new WindowAdapter()
     {     public void windowClosing(WindowEvent ev)
          {     dispose();
               System.exit(0);
     setBounds(60,60,159,179);
     for (int b = 0; b < bx.length; b++)
          bx[b] = new Button("");
          bx.setFont(f1);
          bx[b].setSize(50,50);
bx[b].addActionListener(this);
     add(bx[b]);
     MenuBar mb = new MenuBar();
     Menu mm = new Menu("Option");
     ng.addActionListener(this);
     mb.add(mm);
     mm.add(ng);
     setMenuBar(mb);
     newboard();
     setVisible(true);
public void newboard()
     for (int b = 0; b < bx.length; b++)
          bx[b].setLabel(".");
          bx[b].setEnabled(true);
     used = 0;
public void actionPerformed(ActionEvent be)
     if (be.getSource() == ng)
          newboard();
          return;
     Button but = (Button)be.getSource();
     but.setLabel("X");
     but.setEnabled(false);
     used++;
     if (used != bx.length) Oplay();
public synchronized void Oplay()
     int n = (int)(Math.random()*9);
     while (!bx[n].isEnabled()) n = (int)(Math.random()*9);
     bx[n].setLabel("O");
     bx[n].setEnabled(false);
     used++;
public static void main (String[] args)
     new TicTac();

Similar Messages

  • Draw with single mouse click, help me!!!!

    I am using this code - as you understood from it- to paint with the mouse click.
    please help me either by completing it or by telling me what to do.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class Hello extends JFrame{
         Graphics g;
         ImageIcon icon = new ImageIcon("hello.gif");
         public Hello(){
              super("Hello");
              setSize(200, 200);
              addMouseListener(
                   new MouseAdapter(){
                        public void mouseClicked(MouseEvent e){
                             icon.paintIcon(Hello.this, g, e.getX(), e.getY());
                             g.fillRect(10, 40, 10, 80);
                             JOptionPane.showMessageDialog(Hello.this, e.getX() + ", " + e.getY());
                             //repaint();
         // i have tried to place this listener in the paint method, but no way out.
              setVisible(true);
         public void paint(final Graphics g){
              this.g = g;
              icon.paintIcon(this, g, 100, 50);
         public static void main(String[] args){
              new Hello();
    **

    You can't save a graphics object like that and then paint on it.
    What you need is to use a BufferedImage, paint on that, and then paint that to the screen.
    See my paintarea class. You are welcome to use + modify this class as well as take any code snippets to fit into whatever you have but please add a comment where ever you've incorporated stuff from my class
    PaintArea.java
    ===========
    * Created on Jun 15, 2005 by @author Tom Jacobs
    package tjacobs.ui;
    import java.awt.image.BufferedImage;
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import javax.swing.ImageIcon;
    import javax.swing.JComboBox;
    import javax.swing.JComponent;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JToolBar;
    import javax.swing.SwingUtilities;
    import tjacobs.MathUtils;
    * PaintArea is a component that you can draw in similar to but
    * much simpler than the windows paint program.
    public class PaintArea extends JComponent {
         BufferedImage mImg; //= new BufferedImage();
         int mBrushSize = 1;
         private boolean mSizeChanged = false;
         private Color mColor1, mColor2;
         static class PaintIcon extends ImageIcon {
              int mSize;
              public PaintIcon(Image im, int size) {
                   super(im);
                   mSize = size;
         public PaintArea() {
              super();
              setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
              addComponentListener(new CListener());
              MListener ml = new MListener();
              addMouseListener(ml);
              addMouseMotionListener(ml);
              setBackground(Color.WHITE);
              setForeground(Color.BLACK);
         public void paintComponent(Graphics g) {
              if (mSizeChanged) {
                   handleResize();
              //g.drawImage(mImg, mImg.getWidth(), mImg.getHeight(), null);
              g.drawImage(mImg, 0, 0, null);
              //super.paintComponent(g);
              //System.out.println("Image = " + mImg);
              //System.out.println("Size: " + mImg.getWidth() + "," + mImg.getHeight());
         public void setBackground(Color c) {
              super.setBackground(c);
              if (mImg != null) {
                   Graphics g = mImg.getGraphics();
                   g.setColor(c);
                   g.fillRect(0, 0, mImg.getWidth(), mImg.getHeight());
                   g.dispose();
         public void setColor1(Color c) {
              mColor1 = c;
         public void setColor2(Color c) {
              mColor2 = c;
         public Color getColor1() {
              return mColor1;
         public Color getColor2() {
              return mColor2;
         class ToolBar extends JToolBar {
              ToolBar() {
                   final ColorButton fore = new ColorButton();
                   fore.setToolTipText("Foreground Color");
                   final ColorButton back = new ColorButton();
                   back.setToolTipText("Background Color");
                   JComboBox brushSize = new JComboBox();
                   //super.createImage(1, 1).;
                   FontMetrics fm = new FontMetrics(getFont()) {};
                   int ht = fm.getHeight();
                   int useheight = fm.getHeight() % 2 == 0 ? fm.getHeight() + 1 : fm.getHeight();
                   final BufferedImage im1 = new BufferedImage(useheight, useheight, BufferedImage.TYPE_INT_RGB);
                   Graphics g = im1.getGraphics();
                   g.setColor(Color.WHITE);
                   g.fillRect(0, 0, useheight, useheight);
                   g.setColor(Color.BLACK);
                   g.fillOval(useheight / 2, useheight / 2, 1, 1);
                   g.dispose();
                   //im1.setRGB(useheight / 2 + 1, useheight / 2 + 1, 0xFFFFFF);
                   final BufferedImage im2 = new BufferedImage(useheight, useheight, BufferedImage.TYPE_INT_RGB);
                   g = im2.getGraphics();
                   g.setColor(Color.WHITE);
                   g.fillRect(0, 0, useheight, useheight);
                   g.setColor(Color.BLACK);
                   g.fillOval(useheight / 2 - 1, useheight / 2 - 1, 3, 3);
                   g.dispose();
    //               im2.setRGB(useheight / 2 - 1, useheight / 2 - 1, 3, 3, new int[] {     0, 0xFFFFFF, 0,
    //                                                            0xFFFFFF, 0xFFFFFFF, 0xFFFFFF,
    //                                                            0, 0xFFFFFF, 0}, 0, 1);
                   final BufferedImage im3 = new BufferedImage(useheight, useheight, BufferedImage.TYPE_INT_RGB);
                   g = im3.getGraphics();
                   g.setColor(Color.WHITE);
                   g.fillRect(0, 0, useheight, useheight);
                   g.setColor(Color.BLACK);
                   g.fillOval(useheight / 2 - 2, useheight / 2 - 2, 5, 5);
                   g.dispose();
    //               im3.setRGB(useheight / 2 - 2, useheight / 2 - 2, 5, 5, new int[] {     0, 0, 0xFFFFFF, 0, 0, 
    //                                                            0, 0xFFFFFF, 0xFFFFFFF, 0xFFFFFF, 0,
    //                                                            0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF,
    //                                                            0, 0xFFFFFF, 0xFFFFFFF, 0xFFFFFF, 0,
    //                                                            0, 0, 0xFFFFFF, 0, 0}, 0, 1);
                   //JLabel l1 = new JLabel("1 pt", new ImageIcon(im1), JLabel.LEFT);
                   //JLabel l2 = new JLabel("3 pt", new ImageIcon(im2), JLabel.LEFT);
                   //JLabel l3 = new JLabel("5 pt", new ImageIcon(im3), JLabel.LEFT);
                   brushSize.addItem(new PaintIcon(im1, 1));
                   brushSize.addItem(new PaintIcon(im2, 3));
                   brushSize.addItem(new PaintIcon(im3, 5));
                   //brushSize.addItem("Other");
                   add(fore);
                   add(back);
                   add(brushSize);
                   PropertyChangeListener pl = new PropertyChangeListener() {
                        public void propertyChange(PropertyChangeEvent ev) {
                             Object src = ev.getSource();
                             if (src != fore && src != back) {
                                  return;
                             Color c = (Color) ev.getNewValue();
                             if (ev.getSource() == fore) {
                                  mColor1 = c;
                             else {
                                  mColor2 = c;
                   fore.addPropertyChangeListener("Color", pl);
                   back.addPropertyChangeListener("Color", pl);
                   fore.changeColor(Color.BLACK);
                   back.changeColor(Color.WHITE);
                   brushSize.addItemListener(new ItemListener() {
                        public void itemStateChanged(ItemEvent ev) {
                             System.out.println("ItemEvent");
                             if (ev.getID() == ItemEvent.DESELECTED) {
                                  return;
                             System.out.println("Selected");
                             Object o = ev.getItem();
                             mBrushSize = ((PaintIcon) o).mSize;
                   //Graphics g = im1.getGraphics();
                   //g.fillOval(0, 0, 1, 1);
                   //BufferedImage im1 = new BufferedImage();
                   //BufferedImage im1 = new BufferedImage();
         protected class MListener extends MouseAdapter implements MouseMotionListener {
              Point mLastPoint;
              public void mouseDragged(MouseEvent me) {
                   Graphics g = mImg.getGraphics();
                   if ((me.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
                        g.setColor(mColor1);
                   } else {
                        g.setColor(mColor2);
                   Point p = me.getPoint();
                   if (mLastPoint == null) {
                        g.fillOval(p.x - mBrushSize / 2, p.y - mBrushSize / 2, mBrushSize, mBrushSize);
                        //g.drawLine(p.x, p.y, p.x, p.y);
                   else {
                        g.drawLine(mLastPoint.x, mLastPoint.y, p.x, p.y);
                        //g.fillOval(p.x - mBrushSize / 2, p.y - mBrushSize / 2, mBrushSize, mBrushSize);
                        double angle = MathUtils.angle(mLastPoint, p);
                        if (angle < 0) {
                             angle += 2 * Math.PI;
                        double distance = MathUtils.distance(mLastPoint, p) * 1.5;
                        if (angle < Math.PI / 4 || angle > 7 * Math.PI / 4 || Math.abs(Math.PI - angle) < Math.PI / 4) {
                             for (int i = 0; i < mBrushSize / 2; i ++) {
                                  g.drawLine(mLastPoint.x, mLastPoint.y + i, p.x, p.y + i);
                                  g.drawLine(mLastPoint.x, mLastPoint.y - i, p.x, p.y - i);
    //                              System.out.println("y");
    //                              System.out.println("angle = " + angle / Math.PI * 180);
                        else {
                             for (int i = 0; i < mBrushSize / 2; i ++) {
                                  g.drawLine(mLastPoint.x + i, mLastPoint.y, p.x + i, p.y);
                                  g.drawLine(mLastPoint.x  - i, mLastPoint.y, p.x - i, p.y);
    //                              System.out.println("x");
    //                    System.out.println("new = " + PaintUtils.printPoint(p));
    //                    System.out.println("last = " + PaintUtils.printPoint(mLastPoint));
                        //System.out.println("distance = " + distance);
                        //Graphics2D g2 = (Graphics2D) g;
                        //g2.translate(mLastPoint.x + mBrushSize / 2, mLastPoint.y);
                        //g2.rotate(angle);
                        //g2.fillRect(0, 0, (int) Math.ceil(distance), mBrushSize);
                        //g2.rotate(-angle);
                        //g2.translate(-mLastPoint.x + mBrushSize / 2, -mLastPoint.y);
    //                    g.setColor(Color.RED);
    //                    g.drawRect(p.x, p.y, 1, 1);
                   mLastPoint = p;
                   g.dispose();
                   repaint();
              public void mouseMoved(MouseEvent me) {}
              public void mouseReleased(MouseEvent me) {
                   mLastPoint = null;
         private void handleResize() {
              Dimension size = getSize();
              mSizeChanged = false;
              if (mImg == null) {
                   mImg = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
                   Graphics g = mImg.getGraphics();
                   g.setColor(getBackground());
                   g.fillRect(0, 0, mImg.getWidth(), mImg.getHeight());
                   g.dispose();
              else {
                   int newWidth = Math.max(mImg.getWidth(),getWidth());
                   int newHeight = Math.max(mImg.getHeight(),getHeight());
                   if (newHeight == mImg.getHeight() && newWidth == mImg.getWidth()) {
                        return;
                   BufferedImage bi2 = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
                   Graphics g = bi2.getGraphics();
                   g.setColor(getBackground());
                   g.fillRect(0, 0, bi2.getWidth(), bi2.getHeight());
                   g.drawImage(mImg, mImg.getWidth(), mImg.getHeight(), null);
                   g.dispose();
                   mImg = bi2;
         public JToolBar getToolBar() {
              if (mToolBar == null) {
                   mToolBar = new ToolBar();
              return mToolBar;
         private ToolBar mToolBar;
         public static void main (String args[]) {
              PaintArea pa = new PaintArea();
              JPanel parent = new JPanel();
              parent.setLayout(new BorderLayout());
              parent.add(pa, BorderLayout.CENTER);
              pa.setPreferredSize(new Dimension(150, 150));
              parent.add(pa.getToolBar(), BorderLayout.NORTH);
              WindowUtilities.visualize(parent);
         protected class CListener extends ComponentAdapter {
              public void componentResized(ComponentEvent ce) {
                   mSizeChanged = true;
    }

  • Create image on mouse click

    Hello,
    I'm trying to create an applet that will have a dot (any color) appear when the mouse is clicked. Most places have examples of buttons, but I am having a tough time figuring this one out.
    Thanks,
    -Rain

    Hi,
    you have to divide the process into several steps:
    get the image tag at the caret position
    read it' properties
    bring up a window with ooptions to change those properties
    remove the existing image tag
    place a new image tag with the new properties at the caret position
    alternately you can change the properties of the existing image tag.
    There a reloads of threads in this forum about how to change tag properties or the tag structure of a HTML document, so I omit this. Please try to do a search for such topics in this forum.
    A GUI (Java classes ImageDialog and ImagePreview) for entering image properties is available at http://www.calcom.de/eng/dev/index.htm
    Directly changing a table's width with the mouse is more complex, because you'd have to constantly write new width properties for the table and update the document while the mouse is moved. Probably better would be to bring up a dialog window to change the table properties instead.
    Hope this helps
    Ulrich

  • Inserting an image when a "Click Box" is checked

    Hi,
    I'm working on designing an training activity for a new system which I do not have access to.
    The screen I'm working on involves the users checking off a number of boxes.  How can I make a "check mark" image appear in the box once it has been clicked?
    Please help...I'm faced with a deadline for tomorrow and this roadblock has me stumped.

    Hello,
    It helps if you mention the version you are using. Hoping it is at least Captivate 4. There is indeed a checkboxes widget coming with Captivate that could do what you want, provided you like the checkmark there.
    If not insert as many checkmark images as you will need and set them to invisible. If nothing else has to be executed when the click box is clicked besides showing the checkmark image, you do not need an advanced action but can just apply the action 'Show <image>' as success action where <image> is the ID of the checkmark you want to show. But beware: if all those click boxes are on the same slide, you have to know that the playhead will be released when the click box is clicked and will move beyond the pausing point. To avoid that you'll have to rewind the playhead, and then you'll need an advanced action instead of a simple action with two statements:
    show <image>
    Assign rdcmmndGotoFrame with rdinfoCurrentFrame
    The second statement puts the playhead back before the pausing point.
    Lilybiri

  • Double image on mouse click

    Hi captivators
    I am editing a couple of demo slides. I have moved the
    background images up about 10 pixels as the action takes place
    right at the bottom of the screen. I have raised the mouse pointer
    in line with the buttons and all works fine until the mouse shows a
    click. When it clicks the old lower image appears on top of the new
    one creating a double image. How do I avoid this happening?

    Hi ntompkins
    What sounds like is happening is that maybe you took what was
    originally the background image, modified and reinserted as a
    standard image? If so, you may wish to try right-clicking and
    choosing "merge into background".
    Assuming you either already tried that and it isn't working
    or for some other reason it isn't working, you might try inserting
    a blank slide, configuring the background with the image, then
    select and copy all objects from the errant slide to the new.
    Finally, delete the new slide and maybe adjust the mouse position.
    Cheers... Rick

  • Change images on mouse click

    hi,
    cud anyone help me to change image in a JPanel in JFrame.On MouseClick event. the image should in an panel on mouseclick,plz explain with example source code.
    thank u

    I dvlp MyPanel to accept 2 image file name.
    You can easy change to accept Image instead of file name.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class Test {
    public static void main(String args[]) {
    JFrame f = new JFrame("Test");
    MyPanel p = new MyPanel("YourFirstImage.gif", "YourSecondImage.gif");
    p.add(new JButton("Click on Panel (not Button)"));
    f.setContentPane(p);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setVisible(true);
    class MyPanel extends JPanel implements MouseListener {
    Image image, image1, image2;
    public MyPanel(String image1Name, String image2Name) {
    //load image
    try {
    image1 = getToolkit().getImage(getClass().getResource(image1Name));
    image2 = getToolkit().getImage(getClass().getResource(image2Name));
    MediaTracker mt = new MediaTracker(this);
    mt.addImage(image1, 0);
    mt.addImage(image2, 0);
    mt.waitForAll();
    } catch (Exception e) { e.printStackTrace(); }
    this.image1 = image1;
    this.image2 = image2;
    this.image = image1;
    this.addMouseListener(this);
    public void paintComponent(Graphics g) {
    g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), this);
    public void mouseClicked(MouseEvent e){
    image = (image == image1) ? image2 : image1; // switch between image1, image2
    repaint();
    public Dimension getPreferredSize() {
    Dimension dim = super.getPreferredSize();
    int w = Math.max(image1.getWidth(this), image2.getWidth(this));
    int h = Math.max(image1.getHeight(this), image2.getHeight(this));
    w = Math.max(dim.width, w);
    h = Math.max(dim.height, h);
    return new Dimension(w, h);
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
    public void mousePressed(MouseEvent e) {}
    public void mouseReleased(MouseEvent e) {}

  • Manipulating an image on mouse click

    I've been tinkering with some code I found here:
    http://java.sun.com/docs/books/tutorial/uiswing/painting/example-swing/CoordinatesDemo.java
    It basically paints a dot on the point where the mouse is clicked.
    I've been trying to alter this by adding an image into the pane - my goal being that the dot would appear on top of the image. However the dot is still being painted behind the image and so it's not visible.
    Any ideas on this? I'm completely stumped. Thanks folks.

    That's normal.
    Every child of the panel is painted AFTER the paintComponent
    procedure is called, so that it overlaps the component background.
    Perhaps you should create your own image component that paints
    yout dot after having displayed the image, or you can overlap
    a trasparent (Jpanel derived) component over the image component
    and draw in its own paintComponent.
    For more info, read the chapter
    Creating an Gui with JFC-Swing/Swing features and Concepts/Painting,
    in the Java Tutorial.
    Regards
    Maurizio

  • Using mouse click to return image coordinates.

    Ok so I've been trying to figure out how to do this and it seems very complicated for something that really seems straightforward.
    Anyway. I have a camera that updates an image object on the front panel using a while loop. I have another image object that is updated with a still image when the "snap" button is pressed. Now what I want to do is to click on a point in the snapped image and have the VI return the coordinates of that pixel in the image coordinate frame.
    What I've got so far is an event structure in the while loop with the following to occur in the event "image object -> mouse down":
    Server reference (reference to the image object) -> Property node (last mouse position) -> output screen coordinates.
    I've got two errors that don't make a whole lot of sense to me (I haven't worked with event structures before): "event data node contains unwired or bad terminal" and "event structure one or more event cases have no events defined". This second one seems strange since I don't actually want anything to happen if there's no mouse click. The first one seems to refer to the element box on the left hand side of the event structure.
    The above is my lastest attmpt at sorting this problem and as far as I can see it should work. whatever about the errors, am I even taking the right approach with this? I'd have thought image cordinates would be a common enough thing but search the boards here, it would appear not...
    Kinda stumped here. Any help is much appreciated.
    Message Edited by RoBoTzRaWsUm on 04-14-2009 08:34 AM
    Solved!
    Go to Solution.

    Hello RoBoTzRaWsUm,
    I have taken a look at your VI, which has been taking a correct approach to the data you are looking for.  As you are using and event structure, you should be looking for an event to occur.  When using a Property Node, you are trying read an attribute of a control.  However, in an Event Structure, I believe you should be using an Invoke Node.  An Invoke Node allows your to read an event or write a method with the Control Class in LabVIEW. 
    1. Place down and Invoke Node from the Functions Palette in 'Programming'->'Application Control'
    2. Wire your Image Control reference to it
    3. Click Method, and select 'Get Last Event'
    4. Right click on 'Which Events' and 'Create Constant'.  Make the constant '1' in the array
    5. Read the 'Coordinates' Cluster from the left hand side of the Event Case by right clicking  and 'Create Indicator'
    You will find a piece of example code attached.
    Regards
    George T.
    Applications Engineering Specialist
    National Instruments UK and Ireland
    Attachments:
    UKSupportMouseClick.vi ‏39 KB

  • Catching mouse click on an irrigular shape image

    Is it possible to catch the mouse click on an irrigular shape image on a JPanel? Can I simply attach a mouse listener to the image?

    Hi,
    you should use a mouseListener, and test the coordinates of the click in the mouseClicked() method, then you can use the inside() method of the Shape to see if the click occured in the shape.
    Hope this will help,
    Regards.

  • Unable to select an image with right click of the mouse

    When in Library mode using grid view, right clicking on a thumbnail does not select the thumbnail, and previously selected items remain selected. If you then try to delete the item, you can inadvertently delete multiple items that you did not intend to delete and not the item you wanted to delete.
    Right clicking on an already selected image or one of a group of selected images works and all selected images can be deleted. However a right click on a non selected image should should drop any current selections and select only the image clicked. (This can be verified in Bridge)
    I am using Lightroom 1.3.1 in Windows XP SP2 with 2 gig of ram.

    Have you switched your mouse buttons i.e have you changed assignments to your mouse buttons in the control panel?
    If not, then clicking on an image will select it, CTRL-Click will select non-contiguous images, SHIFT-Click will select contiguous images.
    Right-clicking will show a context menu. (and the context menu will change if you have single multiple images selected: e.g if you select two images you will see a menu item Open in Compare that is not there if only a single image is selected, Delete Photo... becomes Delete Photos... etc)
    Also, in grid or filmstrip view you will see up to three levels of brightness on the frames around thumbnails:
    -lightest frame: the active image i.e. the one that will be opened if you go to develop mode, or will be used as "source" for synchronize command etc
    -medium: other images that you have selected.
    -darkest: images that are not selected.
    Selected images will also have a white frame immediately around the thumbnail.

  • Mouse clicks inside image in applet

    How can I respond to mouse clicks inside particular regions in an image loaded as part of an applet in a browser? ie, I want to send these clicks onto the server for the server to handle it and the server should change the image according to the mouse clicks.
    Thanks,

    /*  <applet code="ImageMouse" width="400" height="400"></applet>
    *  use: >appletviewer ImageMouse.java
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import java.net.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    public class ImageMouse extends JApplet
        JLabel label;
        public void init()
            ImageMousePanel panel = new ImageMousePanel();
            ImageMouser mouser = new ImageMouser(panel, this);
            panel.addMouseMotionListener(mouser);
            getContentPane().add(panel);
            getContentPane().add(getLabel(), "South");
        private JLabel getLabel()
            label = new JLabel(" ");
            label.setHorizontalAlignment(JLabel.CENTER);
            label.setBorder(BorderFactory.createTitledBorder("image coordinates"));
            Dimension d = label.getPreferredSize();
            d.height = 35;
            label.setPreferredSize(d);
            return label;
        public static void main(String[] args)
            JApplet applet = new ImageMouse();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(applet);
            f.setSize(400,400);
            f.setLocation(200,200);
            applet.init();
            f.setVisible(true);
    class ImageMousePanel extends JPanel
        BufferedImage image;
        Rectangle r;
        public ImageMousePanel()
            loadImage();
            r = new Rectangle(getPreferredSize());
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            int imageWidth = image.getWidth();
            int imageHeight = image.getHeight();
            r.x = (w - imageWidth)/2;
            r.y = (h - imageHeight)/2;
            g2.drawImage(image, r.x, r.y, this);
            //g2.setPaint(Color.red);
            //g2.draw(r);
        public Dimension getPreferredSize()
            return new Dimension(image.getWidth(), image.getHeight());
        private void loadImage()
            String s = "images/greathornedowl.jpg";
            try
                URL url = getClass().getResource(s);
                image = ImageIO.read(url);
            catch(MalformedURLException mue)
                System.err.println("url: " + mue.getMessage());
            catch(IOException ioe)
                System.err.println("read: " + ioe.getMessage());
    class ImageMouser extends MouseMotionAdapter
        ImageMousePanel panel;
        ImageMouse applet;
        boolean outsideImage;
        public ImageMouser(ImageMousePanel imp, ImageMouse applet)
            panel = imp;
            this.applet = applet;
            outsideImage = true;
        public void mouseMoved(MouseEvent e)
            Point p = e.getPoint();
            if(panel.r.contains(p))
                int x = p.x - panel.r.x;
                int y = p.y - panel.r.y;
                applet.label.setText("x = " + x + "  y = " + y);
                if(outsideImage)
                    outsideImage = false;
            else if(!outsideImage)
                outsideImage = true;
                applet.label.setText("outside image");
    }

  • Mouse 'clicks' itself! Help!

    My Macbook's "mouse" clicks itself!
    Sometimes when I'm typing, my Macbook's "mouse" will click itself and put the cursor wherever the mouse happens to be at the time. If it is behind it, it highlights everything I have already typed, and when I type the next letter, it all gets deleted. This is getting ridiculous. Help?
    It is NOT set to "tap to click," it just sometimes randomly clicks itself.
    I'm not the only one with this issue (someone over on Yahoo forums has the same).
    Help?

    Hi loveistheonlyway and welcome to Apple Discussions!
    It sounds very much like you have a hardware issue with your MacBook. If it is still under warranty or if you purchase an AppleCare Protection Plan, contact Apple (800-275-2273) and see about getting a repair set up. Alternatively you can carry the MacBook in to an Apple retail store for the repair. Be sure to [make an appointment|http://www.apple.com/retail/geniusbar> first as otherwise you may spend a long time waiting to talk to a Mac Genius.
    You can do the same things if you are out of warranty, but you may have to pay for the repair.
    Best of luck.

  • HELP - mouse click no longer working - Tiger bug?

    Hi Guys,
    I had a weird issue with Tiger (10.4.10) on my PowerBook G4 this evening. I was dragging a file to the trash, and "dropped" it onto the dock by mistake, just missing the trash. I was slightly to the left of the trashcan. I expected the icon to jump back to the desktop, as the place I had dropped it was invalid, but to my surprise, as I moved the pointer across the screen with the mouse button unclicked, a ghost version of the icon was still attached to the mouse pointer.
    I was unable to click on anything, as the OS still believed for some reason that I was dragging this icon around. I used the keyboard to reboot the laptop, and when it came back up, the mouse click was not working - I can drag around, but can't click on anything. This is with the on board trackpad. I also have a bluetooth apple mouse, which exhibits exactly the same behaviour.
    I've rebooted several times (and shutdown and removed the battery), zapped the PRAM. Nothing has helped. I've tried logging in as a different user, but the click still doesn't work with the on-board or external mouse. It's like something within the OS has been corrupted, but I don't know what I can do. I have loads of data on the laptop, so I am not rebuilding. There is something on the help pages about resetting my PowerBook PMU, but I don't think this should be required.
    This is a major, urgent issue for me, as I can't use the laptop until I figure out how to resolve this.
    Anyone - please help
    Thanks,
    Robin

    Thanks for the feedback. Since resetting the PMU fixed the problem, it's not a bug but some conflict in the original setup.
    If you want to report this to Apple, either send Feedback or send bug reports and enhancement requests to Apple via its Bug Reporter system. Join the Apple Developer Connection (ADC)—it's free and available for all Mac users and gets you a look at some development software. Since you already have an Apple username/ID, use that. Once a member, go to Apple BugReporter and file your bug report/enhancement request. The nice thing with this procedure is that you get a response and a follow-up number; thus, starting a dialog with engineering.

  • My iMac doesn't recognize mouse clicks... HELP!

    Ok, I reset the SMC and PRAM (and repaired permissions)that made the mouse work until I shut down then I would have the problem again when I started up so I would have to zap the PRAM again.  I downloaded Mountain Lion and loaded it thinking this would overwrite any errors but now I can't log in at all. Even zapping the PRAM can't get it to recognize mouse clicks (the courser does move) .  Somebody please give me some advice I have total work stopage and I'm desperate!

    Bootup holding CMD+r, or the Option/alt key to boot from the Restore partitirion & use Disk Utility from there to Repair the Disk, then Repair Permissions.
    If that doesn't help Reinstall the OS.

  • Figuring out where a mouse click is under an image

    I want to create a JFrame (or JPanel) where the whole area is one big gif (or icon etc) and I want to make some areas of this panel react to mouse clicks and other areas display messages.
    There are two ways that I can think of doing this.
    The first is that I figure out the x and y coordinates of each area and check to see if each mouse click is within that area.
    The second way is to see if I can figure out how to put something like transparent JButtons over the areas that I want to accept mouse clicks (all the areas will be rectangular) and just do what JButtons do normally.
    The second way sounds easier but I don't know how to do that.
    Does anyone have opinions on which way I should do it?
    Thanks

    To me the first method sounds eaiser.
    A third possible idea? Add a bunch of JPanels to the frame and have split the image into several pieces that are painted by each JPanel. Then use a mouse listener to detect clicks. (Seems easier than trying to make JButton transparent and placing it at the correct point).

Maybe you are looking for

  • How about a 'suggestions' section? or something like that?

    How about make a section where users can suggest features that they wish implemented on apple products? For a start, I would like to make a suggestion to itunes. How about give an option to choose which part of the ipod/iphone/ipad to sync? For examp

  • Error in extracting String value from MS ACCESS via JDBC

    Something wierd occurs in my program. I have a ACCESS database table named FormDetail. The attributes are: name memo val memo The actual data store in such a table is haihe 2 String test="SELECT name, val FROM FormDetail"; rs = stmt.executeQuery(test

  • Where is the 'tools' menu in Firefox 18?

    I can't open .pdf files (like IRS forms) and I'm directed to the tools menu to allow this, but I can't find the 'tools menu.

  • Button URL Redirect - Issue passing %null% from LOV

    I have issue when attempting to pass %null% from a LOV to a subsequent target page. The URL Redirect works fine when a value in selected in the LOV but passes gibberish "?ll" when no value is selected from the LOV. Can anyone shed some light on what'

  • Foggy LED Cinema Display

    I just came back from the Holidays, booted up my computer connected to my LED Cinema Display screen, and within 15 minutes, a large gray blurring blob was projected on my screen. It takes up nearly half of the screen. I've never had any issues with t