473,434 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

JScrollPane Problems

I've been having trouble implementing a JScrollPane. Nothing shows up inside the JScrollPane but the other component (an exit button) shows up below it like it should. Can anyone help me resolve this issue? Is it maybe that JScrollBar would fit better within my program's needs?
Apr 2 '08 #1
3 1854
Whoops, forgot the source code to help with this.

public String main(ArrayListSerial list) {
x=0;
g=false;
JScrollBar scroll = new JScrollBar();
int r = 0;
JPanel uber = new JPanel();
uber.setLayout(new BorderLayout());
x=0;
JPanel panel = new JPanel();
while(r<list.size()){
JPanel panel2 = new JPanel();
panel2.add(getSingle(list.get(r)));
panel2.addMouseListener(this);
panel2.setName("Z"+r);
panel2.setPreferredSize(new Dimension(200,500));
System.out.println(panel2.getName());
panel.add(panel2);
r++;
}
uber.add(panel);
scroll.add(uber);

scroll.setLocation(0, 0);
add(scroll, "North");
JButton exit = new JButton("Exit");
exit.setName("Exit");
exit.addMouseListener(this);
add(exit, "South");
setSize(500, 500);

setLocationRelativeTo(null);
setVisible(true);
while(x==0){
if(g){
return ""+number+"2";
}
}
return "003";
}
Apr 2 '08 #2
sukatoa
539 512MB
<Link removed>


Have some experiments on it...

Hope it helps...

sukatoa
Apr 3 '08 #3
r035198x
13,262 8TB
This is how you use a scroll panes.
Apr 3 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: hiwa | last post by:
When we put a lengthy line-wrapped String in a not-so-large JTextArea which is enclosed in a JScrollPane, it automatically scrolls down to the end of the string. That is, the string is displayed...
1
by: 123456prakash | last post by:
Does anyone know if it is possible to set programmatically the position of a JScrollPane vertical scrollbar slider? I load a some components like textfield editorpane labels etc into a panel...
0
by: madumm | last post by:
Hi all; How can i set a Background Image to this JScrollPane? JLabel imageLabel; JScrollPane jsp = new JScrollPane(imageLabel); Pls need your sugessions... Thanking in advance Madumm
2
by: gmioannou | last post by:
hi, can i clone JScrollPane or JPanel and its components? many thanks George Ioannou
2
by: blackraven1425 | last post by:
It displays the information off the left of the screen instead of in a line. Any ideas? I'll post the code here too. I know it returns nothing at the moment, it's a work in progress. public...
1
TheMan1
by: TheMan1 | last post by:
Hi guys. I have a mouse event on my frame that enlarges the size of a JPanel that in on a JScrollPane. When the JPanel's size changes, the JScrollPane's scrollbars don't "refresh" ie. their max...
2
by: Gangreen | last post by:
I have a Jscrollpane, holding a Jpanel on which I draw. Now, I have made buttons to zoom in and out. They will simply change the value of variables that hold the size of my Jpanel and the drawing on...
4
by: chanshaw | last post by:
I'm trying to add a verticle scroll bar to my scrollPane so it can go up and down the list as needed what sort of lines do I need to add to get this to work. private void refreshScrollPane(int...
6
BSCode266
by: BSCode266 | last post by:
Hey everyone, I'll cut right to the case. I have a JPanel and i call setLayout(null) on it. Simply because I would like to position everything myself and haven't seen a handy manager yet. Now i...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.