由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - How to scroll an JInternalFrame
相关主题
Multi-Level JInternalFramedisplay an image from db along with other text on jsp
问个jscrollpane的问题怎样让两个panel的scroller同步?
请教一个 JList + JScrollPane 的问题怎么能够减少image上的锯齿?
Java Telnet Client Implementation v0.991Beta一个GUI问题。
swing紧急求助[合集] Are JSPs Dead?
please help: pass values to jsp from jsEclipse不能保存UTF-8文件?
Re: JTextArea的内容不滚动如何生成一个popup window,当你点击JTextArea里的一行text
questions on repaint()倒霉的Swing代码总是导致Exception, fatal error
相关话题的讨论汇总
话题: scroll话题: jpanel话题: add
进入Java版参与讨论
1 (共1页)
a***e
发帖数: 188
1
I'd like to scroll an JInternalFrame. I add a panel into this frame.
In the panel there is an image which dimension is larger than the
internalframe. I then create a Jscrollpane to accomodate the panel I
add,
but it doesn't work.
Your help will be highly appreciated!
o**n
发帖数: 31
2
you need to setPreferredSize of JScrollPane.

【在 a***e 的大作中提到】
: I'd like to scroll an JInternalFrame. I add a panel into this frame.
: In the panel there is an image which dimension is larger than the
: internalframe. I then create a Jscrollpane to accomodate the panel I
: add,
: but it doesn't work.
: Your help will be highly appreciated!

a***e
发帖数: 188
3
I have tried this just now, but it still doesn't work. I add the
JScrollPanel
instead of JPanel to the internalframe, right?
Do I need to add scrollbar by myself?
Thanks a lot.

frame.
the
I

【在 o**n 的大作中提到】
: you need to setPreferredSize of JScrollPane.
o**n
发帖数: 31
4
right.
I mean, you first add JScrollPane, and set its size, then
add a larger JPanel. Then add your JSP to the container.
should be ok.

【在 a***e 的大作中提到】
: I have tried this just now, but it still doesn't work. I add the
: JScrollPanel
: instead of JPanel to the internalframe, right?
: Do I need to add scrollbar by myself?
: Thanks a lot.
:
: frame.
: the
: I

a***e
发帖数: 188
5
Thanks a lot. Could you please tell me whether I should add
scrollbar manually
on JSP or on my own JPanel? or it can appear automatically?
In addition, should I set the size of JPanel?
Thank you again.

【在 o**n 的大作中提到】
: right.
: I mean, you first add JScrollPane, and set its size, then
: add a larger JPanel. Then add your JSP to the container.
: should be ok.

o**n
发帖数: 31
6
it depends, generally you can let JSP determine the scrollbar
automatically.
For JPanel, if you like, you can setsize, really depends.

【在 a***e 的大作中提到】
: Thanks a lot. Could you please tell me whether I should add
: scrollbar manually
: on JSP or on my own JPanel? or it can appear automatically?
: In addition, should I set the size of JPanel?
: Thank you again.

a***e
发帖数: 188
7
Thanks a lot for your patient reply. But my problem is that I think
the scrollbar should appear(since the Image in JPanel is much larger
than the JPanel and JScrollPanel), but it doesn't.
The other question is that I need to locate some rectangles in the
image. What coordinate system is valid? I think since the image is in
JPanel, it should be JPanel, right?
Thanks again.

【在 o**n 的大作中提到】
: it depends, generally you can let JSP determine the scrollbar
: automatically.
: For JPanel, if you like, you can setsize, really depends.

a***e
发帖数: 188
8
The following is my code. It still doesn't work. In myPanel, I draw
an image.

myPanel.setLayout(null);
JScrollPane scroll = new JScrollPane();
scroll.setPreferredSize(new Dimension(100,100));
scroll.add(myPanel);
(imframe.getContentPane()).add(scroll);
Thanks.

【在 o**n 的大作中提到】
: it depends, generally you can let JSP determine the scrollbar
: automatically.
: For JPanel, if you like, you can setsize, really depends.

o**n
发帖数: 31
9
good luck, try below.

^^^^try new BorderLayout()
^^new JScrollPane(myPanel);

【在 a***e 的大作中提到】
: The following is my code. It still doesn't work. In myPanel, I draw
: an image.
:
: myPanel.setLayout(null);
: JScrollPane scroll = new JScrollPane();
: scroll.setPreferredSize(new Dimension(100,100));
: scroll.add(myPanel);
: (imframe.getContentPane()).add(scroll);
: Thanks.

z****u
发帖数: 15
10

think
in
Correct. The scrollpane is basically a viewport of the underlying
component you want to display. Of course the component's size is
bigger than the view port because that's the sole reason of the
scrollpane's existence. So if your rectangle is relative to the
underlying component, then you should use the component's coordinate
system.
I think the problem here is you did not set the SIZE OF YOUR IMAGE
PANEL (not the scrollpane. There's no need to set the size of the
scrollpane because by

【在 a***e 的大作中提到】
: The following is my code. It still doesn't work. In myPanel, I draw
: an image.
:
: myPanel.setLayout(null);
: JScrollPane scroll = new JScrollPane();
: scroll.setPreferredSize(new Dimension(100,100));
: scroll.add(myPanel);
: (imframe.getContentPane()).add(scroll);
: Thanks.

1 (共1页)
进入Java版参与讨论
相关主题
倒霉的Swing代码总是导致Exception, fatal errorswing紧急求助
Re: JPanel help!please help: pass values to jsp from js
how to paint on a Jpanel?Re: JTextArea的内容不滚动
simple swing questionquestions on repaint()
Multi-Level JInternalFramedisplay an image from db along with other text on jsp
问个jscrollpane的问题怎样让两个panel的scroller同步?
请教一个 JList + JScrollPane 的问题怎么能够减少image上的锯齿?
Java Telnet Client Implementation v0.991Beta一个GUI问题。
相关话题的讨论汇总
话题: scroll话题: jpanel话题: add