File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onclick of hyperlink

 
Reshma Reddy
Ranch Hand
Posts: 197
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have one table with two fields, One is number and second is chart(this is hyper link), on click of this hyperlink I need to display another standalone program output (output is one chart with price and time).

How can I call this program on click of this hyperlink.


thanks in advance.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you using? HTML? JSP? Swing?
 
Reshma Reddy
Ranch Hand
Posts: 197
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi maneesh,


I am using swing

main class
=======




onclick of hyperlink calling this method,

HyperTextEditor.java
================



Onclick of this hyperlink, control needs to go another class(I need to mention that in this method) and run that class give that class output (chat is that class output).

thanks.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the JOptionPane#showXXX methods, you will notice the message is of type Object.
What you can do is create a JPanel instance, embed your graph onto it and pass the panel to the JOptionPane
 
Reshma Reddy
Ranch Hand
Posts: 197
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi maneesh,

I am very new to this swing/awt can you please give me any sudo code to slove this, it is very urgent.

and my chart class name is:: BarChartDemo1.java (control needs to come this class and needs to run this)

thanks is advance.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://faq.javaranch.com/java/EaseUp

1) Subclass JPanel. Let us call it ChartPanel
2) Create a new instance of ChartPanel and draw the required chart onto it.
3) Invoke JOptionPane#showXXX dialog and pass the chart panel instance as the "message"
 
Reshma Reddy
Ranch Hand
Posts: 197
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi maneesh,

In BarChartDemo1.java is generating chart and it extends ApplicationFrame.

if I will take BarChartDemo1 instance and pass this instance to JPanel subclass and take this JPanel subclass instance and pass this to JOptionPane#showXXX , is it work or ?

thanks,
 
Rob Spoor
Sheriff
Pie
Posts: 20371
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of calling JOptionPane.showXXX, just show the frame itself using setVisible(true):
 
Reshma Reddy
Ranch Hand
Posts: 197
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks maneesh,

It working....

once again thanks...
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vardhan reddy wrote:thanks maneesh,

You mean Thanks Rob

I do not think having multiple frame instances in an application is a good idea. That is what Dialogs were designed for.
 
Rob Spoor
Sheriff
Pie
Posts: 20371
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know. Sometimes a frame has an advantage over a dialog. It's not modal (but you can turn that off for dialogs as well), but it shows up in the task bar as well. That can be exactly what you want. Just be careful with EXIT_ON_CLOSE as the default close operation; it will close all your frames and exit the JVM. I doubt that's what you want for all frames, it's probably only desirable for the main frame.
 
Reshma Reddy
Ranch Hand
Posts: 197
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks rob/maneesh,

for your timely help,

rob, yes it is closing all frames if I will close one frame I don't want this where I need to change.

and I have one doubt in my table I have ten fields and with respect charts if i will click any hyperlink it is showing only one chart(this chart is generated by BarChartDemo1.java), I need different chart for each instrument number, any suggestion



thanks.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pass your instrument type in the constructor of BarChartDemo1 and construct the chart accordingly.
 
Rob Spoor
Sheriff
Pie
Posts: 20371
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vardhan reddy wrote:rob, yes it is closing all frames if I will close one frame I don't want this where I need to change.

BarChartDemo1 extends ApplicationFrame which in turn extends JFrame, so just call setDefaultCloseOperation to DISPOSE_ON_CLOSE instead for those.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic