Enabling shortcut keys in a panel

Hi,

I have used JDK6 + Swing + JasperReports 1.3.0.

Then, I had customized JasperViewer default viewer from JasperReports, to enable some usable buttons in top of viewer. The class JasperViewer.java is a JDialog with a Panel into, where JasperReports puts their components.

Now, I'd like to allow keys:

- up/down arrows to move into report page;

- pgdown/pgup: to move fastly to down/up of report page and to change to other pages.

I'd like to know if there is some behaviour in JPanel to enable these shortcut keys to move the page.

[578 byte] By [Edilmar_Alvesa] at [2007-11-27 7:54:34]
# 1
Sure, you where shown how to do this way back in Feb http://forum.java.sun.com/thread.jspa?threadID=5135280
camickra at 2007-7-12 19:35:52 > top of Java-index,Desktop,Core GUI APIs...
# 2

Hi,

I tried something like this before sending the message to the forum, but I thought would be some default behaviour in JPanel to allow up/down arrows to move into this. It is very strange this basic move behaviour doesn't be default for JPanel component. Must I calculate how big should be the move up/down in the scrollbar and make some code to change the actual scrollbar position in the window?

Edilmar_Alvesa at 2007-7-12 19:35:52 > top of Java-index,Desktop,Core GUI APIs...
# 3

> I thought would be some default behaviour in JPanel to allow up/down arrows to move into this.

Why would you think that?

> It is very strange this basic move behaviour doesn't be default for JPanel component.

I think its strange that you think it should be supported.

> It is very strange this basic move behaviour doesn't be default for JPanel component.

If you question is about scrolling a panel in a scroll pane, which was not very obvious to me from the original question, then this is already supported by using the "PageUp" and "PageDown" keys.

camickra at 2007-7-12 19:35:52 > top of Java-index,Desktop,Core GUI APIs...
# 4
OK, I will try to change the JasperViewer to allow a JScrollPane instead of JPanel, to allow default behaviour.
Edilmar_Alvesa at 2007-7-12 19:35:52 > top of Java-index,Desktop,Core GUI APIs...