473,406 Members | 2,549 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,406 software developers and data experts.

Scroll bar to image

I am facing problem with appying the scroll bar. I have used JScrollPane, but its knob is nt functional. Can anybody help in how to use knob to see the image??
Also each time i use the scroll bar to shift the image it takes a lot of time to refresh the image?? Please HELP!!!!
Jun 29 '07 #1
2 1768
r035198x
13,262 8TB
I am facing problem with appying the scroll bar. I have used JScrollPane, but its knob is nt functional. Can anybody help in how to use knob to see the image??
Also each time i use the scroll bar to shift the image it takes a lot of time to refresh the image?? Please HELP!!!!
I'm not sure now if the page knob is working or not. But the reason why the image takes long to load may be due to how you have written the code to diplay it. Perhaps if you show that someone may be able to pick where the delay is coming from.
Jun 29 '07 #2
I'm not sure now if the page knob is working or not. But the reason why the image takes long to load may be due to how you have written the code to diplay it. Perhaps if you show that someone may be able to pick where the delay is coming from.
Actually i have not applied any code for the knob. Please supply any code if possible that can be used to scroll the image. Here the code which i have used.
Please HELP!!!
Expand|Select|Wrap|Line Numbers
  1. public FrameBuilder(int type, ChartPanel panel,
  2.             AbstractChartDataModel data, PieChartRenderer chartRenderer) {
  3.         //panel.setVisible(true);
  4.         SelectGraphScreen.frame1.setVisible(false);
  5.         //this.setLayout(null);
  6.         this.setResizable(false);
  7.         this.setUndecorated(false);
  8.         System.out.println("Screen size : " + scrnsize);
  9.         this.setBounds(0, 0, width, height);
  10.         /* to be finalised for actual change in line below */
  11.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  12.         this.data = data;
  13.         this.panel = panel;
  14.         panel.setBounds(0, 0, width - 25, height);
  15.         System.out.println(" chart panel bounds :" + panel.getHeight() + "  "
  16.                 + panel.getWidth());
  17.         panel.setPreferredSize(new Dimension(400, 300));
  18.         this.chartRenderer = chartRenderer;
  19.  
  20.         panel2 = new JPanel();
  21.         panel3 = new JPanel();
  22.  
  23.         backButton = new JButton("Back");
  24.         saveButton = new JButton("Save As");
  25.         closeButton = new JButton("Close");
  26.  
  27.         JPGRadioButton = new JRadioButton("jpg ");
  28.         PNGRadioButton = new JRadioButton("png");
  29.         JPGRadioButton.setBackground(Color.white);
  30.         PNGRadioButton.setBackground(Color.white);
  31.         JPGRadioButton.setSelected(true);
  32.  
  33.         /*JPGRadioButton.setBounds(20,20,10,10);
  34.          PNGRadioButton.setBounds(20,20,24,10);
  35.          saveButton.setBounds(20,20,38,10);
  36.          */
  37.  
  38.         int panelHeight = (int) ((18 * height) / 20);
  39.         int panelWidth = (int) ((2 * width) / 3);
  40.  
  41.         panel2.setBackground(Color.white);
  42.         panel2.setBounds(panelWidth, panelHeight, (width) / 3,
  43.                 (int) (height / 14));
  44.         panel3.setBounds(0, panelHeight, panelWidth, (int) (height / 14));
  45.         panel3.setBackground(Color.white);
  46.  
  47.         backButton.addActionListener(this);
  48.         saveButton.addActionListener(this);
  49.         closeButton.addActionListener(this);
  50.         if (type == Draw.PIE) {
  51.             panel.addMouseMotionListener(this);
  52.         }
  53.  
  54.         ButtonGroup group1 = new ButtonGroup();
  55.         group1.add(JPGRadioButton);
  56.         group1.add(PNGRadioButton);
  57.         panel2.add(backButton);
  58.         panel2.add(closeButton);
  59.         panel2.add(JPGRadioButton);
  60.         panel2.add(PNGRadioButton);
  61.         panel2.add(saveButton);
  62.  
  63.         jp = new JPanel();
  64.         jp.setPreferredSize(new Dimension(width, height));
  65.         jp.add(panel, BorderLayout.CENTER);
  66.         jScrollPane = new JScrollPane(panel);
  67.  
  68.  
  69.  
  70.         System.out.println(" Scrollpane bounds:"
  71.                 + jScrollPane.getViewport().getViewSize());
  72.         jScrollPane
  73.                 .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  74.         // jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  75.         jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
  76.         /* Now trying to add a split pane */
  77.         JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  78.         if (panel == null) {
  79.             System.out.println("its null");
  80.         }
  81.         sp.setTopComponent(jScrollPane);
  82.         sp.setBottomComponent(panel2);
  83.         sp.setDividerLocation(panelHeight);
  84.  
  85.         getContentPane().add(sp);
  86.         this.validate();
  87.         this.repaint();
  88.  
  89.         panel.repaint();
  90.  
  91.         System.out.println("***********************" + panel.isVisible());
  92.         System.out.println("***********************" + this.panel);
  93.  
  94.  
  95.     }
  96.  
  97.  
Jun 29 '07 #3

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

Similar topics

1
by: idriss | last post by:
i want to scroll one frame's or canvas 's whole content (it will contain other subframes and subframes will contain bitmaps) I couldn't find where is my fault. if you can find my fault or have some...
1
by: delong | last post by:
Hi I am trying to display a large image on the form and make the form scrollable. My image is about 4200 x 7000 pixel. private void Form1_Paint(object sender,...
1
by: Greg N. | last post by:
I want to automatically scroll an image horizontally, in a continuous, seamless way. When the page is first displayed, it should show the left part of the image, as much of it as would fit in...
10
by: Tom21 | last post by:
Please answer. I am searching for it so long. Meybe you will be able to tell me what JS I have to include. I know that there are two versions of such script, fo IE and Navigator. Thanks for...
2
by: Leonid Shirmanov | last post by:
Hi, I have a form with control placed on it. Control has the image painted on its graphics. Size of the contol is greater than size of the form and scroll bars appear in the form. I scroll the...
4
by: midicad2001 | last post by:
I have been researching this issue and have come across a number of solutions apparently written for VB5 or 6 and don't work under .NET, yes folks that is progress! Someone in this ng suggested...
5
by: RobertK | last post by:
I have a table that displays one row of images (thumbnails). When a user clicks on an image it opens up a bigger image below it. The row has about 20 cells. I have a <divtag which allows the user...
1
by: can2564 | last post by:
Help I found some code for scrolling images and now want to have a paragraph below each image that changes with each image... But not sure how. This is the scrolling code I'm using and it works,...
3
by: PrabodhanP | last post by:
I have CSS based mouseover scrolling for divContent embeded in my webpage.It works fine in IE,but not working in mozilla-FF. It is located at the location.....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.