• Post Reply Bookmark Topic Watch Topic
  • New Topic

Anchor for HyperLinks in Swing  RSS feed

 
vidya archana
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
How can I use html refernce(anchor) for links in Swing...

and also, can i use the requestFocus() method for a panel inside another panel.
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your first question: if you want to display html and hyperlinks, use JEditorPane. The API provides examples for loading html pages.
your second question: requestFocus() works only if the component that requests focus is visible. use the ancestor listener to listen when its added to its ancestor. by this time it should be visible.
chantal
 
allen turner
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
Seems like you have a very nice problem. But are u using JEditor pane through out, for all your html pages in that case u get the anchor in that by itself. Maybe u are mixing panes and HTML
 
vidya archana
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i ma using editor pane, but my problem is, thr r two separate panels .. in the left panel i am giving the links and on clicking the link, correspondong section in the right panel needs to be shown.. can to help?
 
allen turner
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This does not seem to be a problem of the Editor pane. But your desing seems to be having some problem. you seem to want to navigate a set of panels using a HTML page on a JEditor pane. Maybe u must change it a little bit and try loading the panels dynamically or use some gridlayout and put the required panel on the first grid in response to a click.
hope that helps
 
vidya archana
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but in such a case, i have to reload the whole thing each time, no? is thr any alternative like setting the focus to that panel on each click? we r dynamically generating the panels.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!