Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to use JScrollBar class?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 15-02-2010
Member
 
Join Date: Dec 2009
Posts: 41
How to use JScrollBar class?
  

Hello Guys,

I am new to the java programming. I am getting trouble while understanding the concept of 'JScrollBar class'. So need I need your help to be aware about the functionality of JScrollBar class of java. I also want be aware about the constructors and methods of JScrollBar class. If you have enough knowledge about the JScrollBar class of java, then please let me know the same. Your any help over JScrollBar class will be greatly appreciated.

Reply With Quote
  #2  
Old 15-02-2010
Member
 
Join Date: Jan 2008
Posts: 1,513
Re: How to use JScrollBar class?

A JScrollBar class used for an implementation of a scrollbar. The user positions the knob in the scrollbar to determine the contents of the viewing area. The program typically adjusts the display so that the end of the scrollbar represents the end of the displayable contents, or 100% of the contents. The start of the scrollbar is the beginning of the displayable contents, or 0%. The position of the knob within those bounds then translates to the corresponding percentage of the displayable contents.
Reply With Quote
  #3  
Old 15-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,946
Re: How to use JScrollBar class?

Hi,

Please following example of JScrollBar class of java:
Code:
import javax.swing.JScrollBar;
import java.awt.BorderLayout;
import javax.swing.JFrame;

public class JScrollBarDM {
  public static void main(String argsn[]) throws Exception {
    JFrame FL = new JFrame();
    FL.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    FL.add(oneJScrollBar, BorderLayout.NORTH);
    FL.setSize(300, 44);
    FL.setVisible(true);

  }

}
Reply With Quote
  #4  
Old 15-02-2010
Member
 
Join Date: May 2008
Posts: 2,004
Re: How to use JScrollBar class?

Following are some most important methods of the JScrollBar class, please review them carefully:
  1. setVisibleAmount(int extnt)
  2. setValues(int newValue, int newExtnt, int Min, int Max)
  3. setValueIsAdjusting(boolean bl)
  4. setUnitIncrement(int unitIncrmnt)
  5. setOrientation(int orn)
  6. setModel(BoundedRangeModel newMdl)
Reply With Quote
  #5  
Old 15-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,999
Re: How to use JScrollBar class?

Hello friend,

Below is the java code which is show you how to use methods of JScrollBar class:
Code:
import javax.swing.JScrollBar;

public class JSMainClass {
  public static void main(String argsp[]) throws Exception {
    AdjustmentListener adjustmentListener = new AdjustmentListener() {
      public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) {
        System.out.println("Adjusted: " + adjustmentEvent.getValue());
      }
    };
    JScrollBar oneJScrollBar1 = new JScrollBar(JScrollBar.HORIZONTAL);
    oneJScrollBar1.addAdjustmentListener(adjustmentListener);

    JFrame GW = new JFrame("ScrollBars R Us");
    GW.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GW.add(oneJScrollBar, BorderLayout.NORTH);

    GW.setSize(300, 200);
    GW.setVisible(true);
  }

}
Reply With Quote
  #6  
Old 15-02-2010
Member
 
Join Date: May 2008
Posts: 2,289
Re: How to use JScrollBar class?

Hi,

I suggest you to go through following constructors of JScrollBar class:
  • JScrollBar(): This constructor is used for the creation of vertical scrollbar
  • JScrollBar(int ortn):This constructo is used for the creation of scrollbar with a particular specification
  • JScrollBar(int orientation, int val, int extnt, int min1, int max1): This constructor is used for the creation of scrollbar with a particular specification such as max, min.
Reply With Quote
  #7  
Old 16-02-2010
Member
 
Join Date: Nov 2009
Posts: 652
Re: How to use JScrollBar class?

Following are some nested classes of the JScrollBar class, please review them carefully:
  1. JScrollBar.AccessibleJScrollBar
  2. Component.BltBufferStrategy
  3. JComponent.AccessibleJComponent
  4. Component.AccessibleAWTComponent
  5. Container.AccessibleAWTContainer
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use JScrollBar class?"
Thread Thread Starter Forum Replies Last Post
Upgrade Sony Ericsson Xperia Play Micro SD card from class 2 8GB to class 4 32GB Aaryan2011 Portable Devices 8 08-10-2011 11:06 PM
What is the difference between Local class and global class in C++? Dėfrim Software Development 4 03-01-2011 09:44 PM
How to initialize a derived class with an instance of the base class in c#? KAIRU26 Software Development 5 12-02-2010 05:23 PM
Ultra solid drives:Imation M-Class and S-Class Regina Portable Devices 1 03-04-2009 10:34 AM
Good news for CBSE CLASS X & CLASS IX - visit learnnext surya_expert Education Career and Job Discussions 0 13-12-2008 11:09 AM


All times are GMT +5.5. The time now is 11:49 PM.