cast your eyes a little to the left
"Search Forums"
this is the result of searching for 'Clipboard'
http://onesearch.sun.com/search/onesearch/index.jsp?qt=clipboard&subCat=siteforumid%3Ajava57&site=dev&dftab=siteforumid%3Ajava57&chooseCat=javaall&col=developer-forums
Thanks for the link... It says how to paste selected image to the clipboard...
But my problem is,
when i have 2 or 3 images ( Math Type Symbols) in a JTextArea, how do i select a perticular Symbol and copy it ? As far as i tried the mouse pointer is not even getting placed on the symbols....
Plz tell me how to select the images first......
Thank You.
if its just a symbol in a JTextArea, all you have to do is select/highlight it
then use getSelectedText()
something like this
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.datatransfer.StringSelection;
class Testing extends JFrame
{
JTextArea ta = new JTextArea(25,50);
public Testing()
{
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocation(300,100);
ta.setLineWrap(true);
JButton btn = new JButton("Set Clipboard");
getContentPane().add(new JScrollPane(ta),BorderLayout.CENTER);
getContentPane().add(btn,BorderLayout.SOUTH);
pack();
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
setClipboard();}});
}
public void setClipboard()
{
StringSelection ss = new StringSelection(ta.getSelectedText());
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
}
public static void main( String[] args){new Testing().setVisible(true);}
}
Yes. I understand how to copy... But my main problem is i am not even able to select the Math Type images ( like images of matrices, equations etc)
My mouse pointer doesn't get placed or rolled over these symbols . So iam unable to select or highlight it.
So plz tell me how can i fist select these image symbols.
I hope i would get a solution.......
Thank You.
> So plz tell me how can i fist select these image symbols.
Maybe you noticed how Michael took the time to post an executable program for you to test.
Well, I personallly have never used the "Math type symbols", so I don't know why they are different than any other text character.
So maybe if you actually post a simple demo program we can see exactly what you are doing and someone might be able to provide further assistance.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the code retains its original formatting.
> Well, I personallly have never used the "Math type
> symbols", so I don't know why they are different than
> any other text character.
Plz dont get confused with the "Math Symbols" . Let me put it in a simpler way.. Consider i have an image ( any image type) in a JTextArea. I need to select it , copy it and paste it to the System Clipboard [ not a custom clipboard] ......
I hope i ve made myself clear atleast this time......
Do help me out of this......
Thank You.