Andrew said:
No, I suggested something different!
(sighs) I'll try again..
(or - the Java code *shown* on this usenet thread)
It sounds like this project is attempting to 'screen scrape',
which ads up to stealing information from other web sites.
Stop that! If there is a worthy link, put a link on the
web page or open the page in a new window.
Andrew T.
Hi,
Here is my code in which we able to get an image anywhere on
applet by using mouse click and someother functions.Here we got a
JoptionPane by giving rightclick.But instead of that we need to call a
jsp tree structure in new window by giving right click. I hope you will
help me in next mail by giving appropriate code for getting jsp tree
structure .
Thanks for ur help.
Code:
package netbeanprojects;
import java.applet.*;
import java.awt.event.*;
import java.awt.event.InputEvent;
import java.net.MalformedURLException;
import java.net.URL;
import java.awt.*;
import java.awt.Image;
import javax.swing.*;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.ImageIcon;
/*
<applet code="ImageDemo" width="1100" height="400">
</applet> */
public class ImageDemo extends Applet implements MouseListener,
ActionListener{
int x = 100,y = 100;
Image img,image1,image2,OSC;
JButton BS,SS,GTW,rou;
Graphics OSG;
public void init()
{
setLayout(new GridLayout(0, 8));
setBackground(Color.white);
Panel pan1= new Panel();
pan1.setLayout(new GridLayout(5, 1, 0, 80));
ImageIcon image1 = new
ImageIcon("/usr/share/pixmaps/gnome-home.png");
BS = new JButton(image1);
ImageIcon image2 = new
ImageIcon("/usr/share/icons/Bluecurve/48x48/apps/kandy.png");
SS = new JButton(image2);
JButton mk = new JButton("Link");
ImageIcon image3 = new
ImageIcon("/usr/share/icons/Bluecurve/48x48/apps/panel-logout.png");
GTW = new JButton(image3);
ImageIcon image4 = new
ImageIcon("/usr/share/icons/Bluecurve/48x48/apps/sawfish-workspaces.png");
rou = new JButton(image4);
pan1.setBackground(Color.GRAY);
try {
img = getImage(new
URL("file:///usr/share/pixmaps/gnome-mini-commander.png"));
} catch (Exception ex) {
ex.printStackTrace();
}
BS.addActionListener(this);
SS.addActionListener(this);
mk.addActionListener(this);
GTW.addActionListener(this);
rou.addActionListener(this);
addMouseListener(this);
pan1.add(BS);
pan1.add(SS);
pan1.add(mk);
pan1.add(rou);
pan1.add(GTW);
add(pan1);
}
boolean Link = false;
public void actionPerformed(ActionEvent e){
Link = false;
String s = e.getActionCommand();
setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
try {
if(e.getSource() == BS)
{
img = getImage(new
URL("file:///usr/share/pixmaps/gnome-home.png"));
}
else if(e.getSource() == SS){
img = getImage(new
URL("file:///usr/share/icons/Bluecurve/48x48/apps/kandy.png"));
}
else if(e.getSource() == GTW) {
img = getImage(new
URL("file:///usr/share/icons/Bluecurve/48x48/apps/panel-logout.png"));
}
else if(e.getSource() == rou) {
img = getImage(new
URL("file:///usr/share/icons/Bluecurve/48x48/apps/sawfish-workspaces.png"));
}
else if(s.equals("Link"))
{
Link = true;
OSC = createImage(getSize().width,getSize().height);
OSG = OSC.getGraphics();
}
} catch (Exception ex) {
// ex.printStackTrace();
System.out.print(ex);
}
}
int prevDragX; // During dragging, these record the x and y
coordinates of the
int prevDragY; // previous position of the mouse.
public void mouseExited(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mousePressed(MouseEvent e)
{
int modifiers = e.getModifiers();
if((modifiers & InputEvent.BUTTON3_MASK) ==
InputEvent.BUTTON3_MASK)
{
String response = JOptionPane.showInputDialog(null + "Type
your name and click a button.");
}
if(Link)
{
prevDragX = e.getX();
prevDragY = e.getY();
}
}
public void mouseReleased(MouseEvent e)
{
int x = e.getX();
int y = e.getY();
if(Link){
Graphics g = getGraphics();
g.drawLine(prevDragX,prevDragY,x,y);
g.dispose();
}
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
public void mouseClicked(MouseEvent e)
{
x = e.getX();
y = e.getY();
System.out.print(x+""+y);
repaint();
}
public void update(Graphics g){
paint(g);
}
public void paint(Graphics g){
g.drawImage(img,x,y,this);
img = null;
}
}
I had tried url and showDocument() function it.But i failed to get my
treestructure which is either it html or jsp file. Please help me for
getting my requirement by giving code.
-Raju