Scroll Bar state Problem

I'm trying to implement a new control that needs a scrollbar, worked fine until I tried to collapse few properties..
The scroll bar must appear only if the BlockOffset (which is an integer that draws properties, and if the last property was drawn below the maximum window's client height, it enables the scrollbar and gives it a nMax value as great as the last drawn pixel's
y value) sees that few properties has been expanded and the last drawn pixel is below the control's client height (200 px in this picture)
Note what happens if I scroll down and collapse back again the 2nd and 3rd properties
The scrollbar disappear with all it's glory and i'm stuck with half-window content
It happens because as soon as I collapse these properties the BlocksOffset gets down 200px (client height) and setting an nMax to the SCROLLINFO below the clients height will make the scrollbar disappear
Here the most relevant customProc cases :
//temporary global variable
int BlockOffset = 20;
static LRESULT CALLBACK
CustomProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ retrieves the pointer to the control data, to be used in the message handlers below:
GridClass* pData = (GridClass*)GetWindowLongPtr(hwnd, 0);
static BOOL fScroll;
SCROLLINFO si;
static int yMinScroll; // minimum vertical scroll value
static int yCurrentScroll; // current vertical scroll value
static int yMaxScroll;
switch (uMsg) {
#pragma region PropProc
case WM_NCCREATE:
break;
case WM_CREATE:
fScroll = FALSE;
// Initialize the vertical scrolling variables.
yMinScroll = 0;
yCurrentScroll = 0;
yMaxScroll = 5250;
break;
case WM_SIZE:
RECT rcClient;
GetClientRect(hwnd, &rcClient);
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = yMinScroll;
si.nMax = BlocksOffset;
si.nPage = rcClient.bottom; //used HIWORD(lParam); before
si.nPos = yCurrentScroll;
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
break;
case WM_VSCROLL:
int xDelta = 0;
int yDelta; // yDelta = new_pos - current_pos
int yNewPos; // new position
switch (LOWORD(wParam))
// User clicked the scroll bar shaft above the scroll box.
case SB_PAGEUP:
yNewPos = yCurrentScroll - 50;
break;
// User clicked the scroll bar shaft below the scroll box.
case SB_PAGEDOWN:
yNewPos = yCurrentScroll + 50;
break;
// User clicked the top arrow.
case SB_LINEUP:
yNewPos = yCurrentScroll - 5;
break;
// User clicked the bottom arrow.
case SB_LINEDOWN:
yNewPos = yCurrentScroll + 5;
break;
// User dragged the scroll box.
case SB_THUMBPOSITION:
yNewPos = HIWORD(wParam);
break;
default:
yNewPos = yCurrentScroll;
// New position must be between 0 and the screen height.
yNewPos = max(0, yNewPos);
yNewPos = min(yMaxScroll, yNewPos);
// If the current position does not change, do not scroll.
if (yNewPos == yCurrentScroll)
break;
// Set the scroll flag to TRUE.
fScroll = TRUE;
// Determine the amount scrolled (in pixels).
yDelta = yNewPos - yCurrentScroll;
// Reset the current scroll position.
yCurrentScroll = yNewPos;
RECT rcUpdate;
// Scroll the window. (The system repaints most of the
// client area when ScrollWindowEx is called; however, it is
// necessary to call UpdateWindow in order to repaint the
// rectangle of pixels that were invalidated.)
ScrollWindowEx(hwnd, -xDelta, -yDelta, (CONST RECT *) NULL, (CONST RECT *) NULL, (HRGN)NULL, (PRECT)&rcUpdate, SW_INVALIDATE);
//InvalidateRect(hwnd, &rcUpdate, TRUE);
BOOL come = UpdateWindow(hwnd);
// Reset the scroll bar.
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = yCurrentScroll;
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
break;
#pragma endregion PropProc
case WM_PAINT:
/* Paints whatever it needs to be painted, thus increasing
the BlocksOffset which is the last vertical drawn pixel + 10 or so
more pixels, then forces a WM_SIZE message to change the scrollbar's
nMax value according to the BlocksOffset */
SendMessage(hwnd, WM_SIZE, 0, 0);
EndPaint(hwnd, &ps);
return 0;
case WM_NCDESTROY:
return 0;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
return DefWindowProc(hwnd, uMsg, wParam, lParam);
I'm new to scrollbars and I have no idea how I'm supposed to handle such situation
Thanks in advance for any answer

I'm trying to implement a new control that needs a scrollbar, worked fine until I tried to collapse few properties..
The scroll bar must appear only if the BlockOffset (which is an integer that draws properties, and if the last property was drawn below the maximum window's client height, it enables the scrollbar and gives it a nMax value as great as the last drawn pixel's
y value) sees that few properties has been expanded and the last drawn pixel is below the control's client height (200 px in this picture)
Note what happens if I scroll down and collapse back again the 2nd and 3rd properties
The scrollbar disappear with all it's glory and i'm stuck with half-window content
It happens because as soon as I collapse these properties the BlocksOffset gets down 200px (client height) and setting an nMax to the SCROLLINFO below the clients height will make the scrollbar disappear
Here the most relevant customProc cases :
//temporary global variable
int BlockOffset = 20;
static LRESULT CALLBACK
CustomProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ retrieves the pointer to the control data, to be used in the message handlers below:
GridClass* pData = (GridClass*)GetWindowLongPtr(hwnd, 0);
static BOOL fScroll;
SCROLLINFO si;
static int yMinScroll; // minimum vertical scroll value
static int yCurrentScroll; // current vertical scroll value
static int yMaxScroll;
switch (uMsg) {
#pragma region PropProc
case WM_NCCREATE:
break;
case WM_CREATE:
fScroll = FALSE;
// Initialize the vertical scrolling variables.
yMinScroll = 0;
yCurrentScroll = 0;
yMaxScroll = 5250;
break;
case WM_SIZE:
RECT rcClient;
GetClientRect(hwnd, &rcClient);
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = yMinScroll;
si.nMax = BlocksOffset;
si.nPage = rcClient.bottom; //used HIWORD(lParam); before
si.nPos = yCurrentScroll;
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
break;
case WM_VSCROLL:
int xDelta = 0;
int yDelta; // yDelta = new_pos - current_pos
int yNewPos; // new position
switch (LOWORD(wParam))
// User clicked the scroll bar shaft above the scroll box.
case SB_PAGEUP:
yNewPos = yCurrentScroll - 50;
break;
// User clicked the scroll bar shaft below the scroll box.
case SB_PAGEDOWN:
yNewPos = yCurrentScroll + 50;
break;
// User clicked the top arrow.
case SB_LINEUP:
yNewPos = yCurrentScroll - 5;
break;
// User clicked the bottom arrow.
case SB_LINEDOWN:
yNewPos = yCurrentScroll + 5;
break;
// User dragged the scroll box.
case SB_THUMBPOSITION:
yNewPos = HIWORD(wParam);
break;
default:
yNewPos = yCurrentScroll;
// New position must be between 0 and the screen height.
yNewPos = max(0, yNewPos);
yNewPos = min(yMaxScroll, yNewPos);
// If the current position does not change, do not scroll.
if (yNewPos == yCurrentScroll)
break;
// Set the scroll flag to TRUE.
fScroll = TRUE;
// Determine the amount scrolled (in pixels).
yDelta = yNewPos - yCurrentScroll;
// Reset the current scroll position.
yCurrentScroll = yNewPos;
RECT rcUpdate;
// Scroll the window. (The system repaints most of the
// client area when ScrollWindowEx is called; however, it is
// necessary to call UpdateWindow in order to repaint the
// rectangle of pixels that were invalidated.)
ScrollWindowEx(hwnd, -xDelta, -yDelta, (CONST RECT *) NULL, (CONST RECT *) NULL, (HRGN)NULL, (PRECT)&rcUpdate, SW_INVALIDATE);
//InvalidateRect(hwnd, &rcUpdate, TRUE);
BOOL come = UpdateWindow(hwnd);
// Reset the scroll bar.
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = yCurrentScroll;
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
break;
#pragma endregion PropProc
case WM_PAINT:
/* Paints whatever it needs to be painted, thus increasing
the BlocksOffset which is the last vertical drawn pixel + 10 or so
more pixels, then forces a WM_SIZE message to change the scrollbar's
nMax value according to the BlocksOffset */
SendMessage(hwnd, WM_SIZE, 0, 0);
EndPaint(hwnd, &ps);
return 0;
case WM_NCDESTROY:
return 0;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
return DefWindowProc(hwnd, uMsg, wParam, lParam);
I'm new to scrollbars and I have no idea how I'm supposed to handle such situation
Thanks in advance for any answer
After the expand and collapse events, you have to recompute the document height and set the scrollbar info.

Similar Messages

  • Web Gallery Scroll Bar Slider Problem

    Hi,
    I'm running Windows XP Professional and Lightroom 1.3.1. I seem to have a problem with the functionality of the sliders in the scroll bars of the web galleries that I make. I use the Flash templates.
    I can drag the slider to move through the thumbnails. But when I click in the open area of the scroll bar to scroll forward or backward a page at a time, nothing happens. That functionality seems to be missing. My cursor will change to a pointed finger when it moves across the slider bar, and the up and down arrows at the ends of the scroll bar. It will not change when I place it in the open area of the scroll bar, indicating that the functionality does not exist.
    This seems very odd and contrary to the global behavior of slider bars in all other applications, including within Lightroom.
    Any idea what's going on and any solutions?
    Thanks,
    Steve

    Hi...
    Please check in your application parameters. Did you declare wdtablenavigation parameter?
    and check table properties like scrollbarvisible always  or none...
    Check this link for application parameters.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/7b/fb57412df8091de10000000a155106/content.htm
    Regards
    Srinivas

  • Horizontal Scroll bar CSS problem

    I am having some issues with my horizontal scroll bar. I
    looked up the horizontal scroll properties and I believe I have
    them correct? What is happening is on my horizontal scroll bar it
    is giving me up and down arrows instead of left and right and yes
    my images are correct I have checked them a few times now
    Any ideas this is what I have for my css
    HScrollBar {
    downArrowUpSkin:
    Embed(source="../assets/images/leftArrow.png");
    downArrowOverSkin:
    Embed(source="../assets/images/leftArrow.png");
    downArrowDownSkin:
    Embed(source="../assets/images/leftArrow.png");
    upArrowUpSkin:
    Embed(source="../assets/images/rightArrow.png");
    upArrowOverSkin:
    Embed(source="../assets/images/rightArrow.png");
    upArrowDownSkin:
    Embed(source="../assets/images/rightArrow.png");
    thumbDownSkin:
    Embed(source="../assets/images/thumb.png",
    scaleGridLeft="7", scaleGridTop="5",
    scaleGridRight="8", scaleGridBottom="7");
    thumbUpSkin:
    Embed(source="../assets/images/thumb.png",
    scaleGridLeft="7", scaleGridTop="5",
    scaleGridRight="8", scaleGridBottom="7");
    thumbOverSkin:
    Embed(source="../assets/images/thumb.png",
    scaleGridLeft="7", scaleGridTop="5",
    scaleGridRight="8", scaleGridBottom="7");
    trackSkin:
    Embed(source="../assets/images/scrolltrackH.png",
    scaleGridLeft="7", scaleGridTop="4",
    scaleGridRight="8", scaleGridBottom="6" );
    }

    Please reduce the container size in the screen thru SE51 that automatically create the scroll
    or check whether in the attributes of the screen "Hold scroll positio" not to be checked

  • DataTable Scroll bar Position Changing

    Hi,
    I have a datatable with scroll bar on 'A' screen and when I go to 'B' screen and come back to 'A' screen again the data table reloads and showing the table from the first record onwards instead of showing the selected n th record by holding the scroll bar state.
    Is there any way to scroll the scroll bar of a data table to the particular record either by backend logic or by java script.
    I used h:PanelGroup to the data table for scroll bar.

    That's getting harder. Put the tables in a block element, e.g. div, and onload set div.scrollTop to the amount of pixels it have to be scrolled. I am not going to give raw code here as you're here in a Java/JSF forum, not a Javascript/DHTML forum. If you still stucks, even after googling on the given keywords, consult DHTML forums like dhtmlcentral.com and dynamicdrive.com.

  • Problems with scroll bars in list view

    Hello,
    I am using Xcelsius 2008 (Build Number 12,2,166).  I am still having trouble with scroll bars on my list view control. Other list views in my dashboard seem to be ok. It seems that this list view is not ignoring the blank cells in my excel file. I have gone through many things to correct this problem. I have added a new list view, I have copied other list views that work correctly but still no success. It seems that the "Ignore Blank Cells" property is not working correctly. Does anyone have a solution for this?
    Much Thx!

    Hi Yusufel,
    Please check the data whether the cells are really blank or having any space which could not be seen, etc.
    With best wishes
    BaaRaa.

  • JTextArea w/Scroll bar wont scroll AND code drops through if statements

    Hi, I'm still having trouble with the text area in the following code. When you run the code, you get the top arrow on the scroll bar, but the bottom is cut off. Also, a big problem is that no matter what choice is selected from the combo box, the code drops through to the last available value each time. Someone on the forums suggested using an array list for the values in the combo box, but I have not been able to figure out how to do that. A quick example would be apprciated.
    Thank you in advance for any help
    //Import required libraries
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    import java.io.*;
    import java.text.*;
    import java.math.*;
    import java.util.*;
    //Create the class
    public class Week3Assignment407B extends JFrame implements ActionListener
         //Panels used in container
         private JPanel jPanelRateAndTermSelection;         
         //Variables for Menu items
         private JMenuBar menuBar;    
         private JMenuItem exitMenuItem; 
         private JMenu fileMenu; 
         //Variables for user instruction and Entry       
         private JLabel jLabelPrincipal;   
         private JPanel jPanelEnterPrincipal;  
         private JLabel jLabelChooseRateAndTerm; 
         private JTextField jTextFieldMortgageAmt;
         //Variables for combo box and buttons
         private JComboBox TermAndRate;
         private JButton buttonCompute;
         private JButton buttonNew; 
         private JButton buttonClose;
         //Variables display output
         private JPanel jPanelPaymentOutput;
         private JLabel jLabelPaymentOutput;
         private JPanel jPanelErrorOutput;
         private JLabel jLabelErrorOutput;  
         private JPanel jPanelAmoritizationSchedule;
         private JTextArea jTextAreaAmoritization;
         // Constructor 
         public Week3Assignment407B() {            
              super("Mortgage Application");      
               initComponents();      
         // create a method that will initialize the main frame for the GUI
          private void initComponents()
              setSize(700,400);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      
              Container pane = getContentPane();
              GridLayout grid = new GridLayout(15, 1);
              pane.setLayout(grid);       
              //declare all of the panels that will go inside the main frame
              // Set up the menu Bar
              menuBar = new JMenuBar();
              fileMenu = new JMenu();
              fileMenu.setText("File");        
              exitMenuItem = new JMenuItem(); 
               exitMenuItem.setText("Exit");
              fileMenu.add(exitMenuItem); 
              menuBar.add(fileMenu);       
              pane.add(menuBar);
              //*******************TOP PANEL ENTER PRINCIPAL*****************************//
              // Create a label that will advise user to enter a principle amount
              jPanelEnterPrincipal = new JPanel(); 
              jLabelPrincipal = new JLabel("Amt to borrow in whole numbers");
              jTextFieldMortgageAmt = new JTextField(10);
              GridLayout Principal = new GridLayout(1,2);
              jPanelEnterPrincipal.setLayout(Principal); 
                jPanelEnterPrincipal.add(jLabelPrincipal);
              jPanelEnterPrincipal.add(jTextFieldMortgageAmt);
              pane.add(jPanelEnterPrincipal);
              //****************MIDDLE PANEL CHOOSE INTEREST RATE AND TERM*****************//
              // Create a label that will advise user to choose an Int rate and term combination
              // from the combo box
              jPanelRateAndTermSelection = new JPanel();
              jLabelChooseRateAndTerm = new JLabel("Choose the Rate and Term");
              buttonCompute = new JButton("Compute Mortgage");
              buttonNew = new JButton("New Mortgage");
              buttonClose = new JButton("Close");
              GridLayout RateAndTerm = new GridLayout(1,5);
              //FlowLayout RateAndTerm = new FlowLayout(FlowLayout.LEFT);
              jPanelRateAndTermSelection.setLayout(RateAndTerm);
              jPanelRateAndTermSelection.add(jLabelChooseRateAndTerm);
              TermAndRate = new JComboBox();
              jPanelRateAndTermSelection.add(TermAndRate);
              TermAndRate.addItem("7 years at 5.35%");
              TermAndRate.addItem("15 years at 5.5%");
              TermAndRate.addItem("30 years at 5.75%");
              jPanelRateAndTermSelection.add(buttonCompute);
              jPanelRateAndTermSelection.add(buttonNew);
              jPanelRateAndTermSelection.add(buttonClose);
              pane.add(jPanelRateAndTermSelection);
              //**************BOTTOM PANEL TEXT AREA FOR AMORITIZATION SCHEDULE***************//
              jPanelAmoritizationSchedule = new JPanel();
              jTextAreaAmoritization = new JTextArea(26,50);
              // add scroll pane to output text area
                   JScrollPane scrollBar = new JScrollPane(jTextAreaAmoritization, 
                   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                     JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
              jPanelAmoritizationSchedule.add(scrollBar);
                pane.add(jPanelAmoritizationSchedule);
              //***************ADD THE ACTION LISTENERS TO THE GUI COMPONENTS*****************//
              // Add ActionListener to the buttons and menu item
              exitMenuItem.addActionListener(this);
              buttonCompute.addActionListener(this);         
              buttonNew.addActionListener(this);
              buttonClose.addActionListener(this);
              TermAndRate.addActionListener(this);
              jTextFieldMortgageAmt.addActionListener(this);
              //*************** Set up the Error output area*****************//
              jPanelErrorOutput = new JPanel();
              jLabelErrorOutput = new JLabel();
              FlowLayout error = new FlowLayout();
              jPanelErrorOutput.setLayout(error);
              pane.add(jLabelErrorOutput);
              setContentPane(pane);
              pack();
              setVisible(true);
         //Display error messages
         private void OutputError(String ErrorMsg){
              jLabelErrorOutput.setText(ErrorMsg);
              jPanelErrorOutput.setVisible(true);
         //create a method that will clear all fields when the New Mortgage button is chosen
         private void clearFields()
              jTextAreaAmoritization.setText("");
              jTextFieldMortgageAmt.setText("");
         //**************CREATE THE CLASS THAT ACTUALLY DOES SOMETHING WITH THE EVENT*****//
         //This is the section that receives the action source and directs what to do with it
         public void actionPerformed(ActionEvent e)
              Object source = e.getSource();
              String ErrorMsg;
              double principal;
              double IntRate;
              int Term;
              double monthlypymt;
              double TermInYears = 0 ;
              if(source == buttonClose)
                   System.exit(0);
              if (source == exitMenuItem) {      
                       System.exit(0);
              if (source == buttonNew)
                   clearFields();
              if (source == buttonCompute)
                   //Make sure the user entered valid numbers
                   try
                        principal = Double.parseDouble(jTextFieldMortgageAmt.getText());
                   catch(NumberFormatException nfe)
                        ErrorMsg = (" You Entered an invalid Mortgage amount"
                                  + " Please try again. Please do not use commas or decimals");
                        jTextAreaAmoritization.setText(ErrorMsg);
                   principal = Double.parseDouble(jTextFieldMortgageAmt.getText());
                    if (TermAndRate.getSelectedItem() == "7 years at 5.35%") ;
                        Term = 7;
                        IntRate = 5.35;
                    if (TermAndRate.getSelectedItem()  == "15 years at 5.5%") ;
                        Term = 15;
                        IntRate = 5.5;
                    if (TermAndRate.getSelectedItem() == "30 years at 5.75%") ;
                        Term = 30;
                        IntRate = 5.75;
                   //Variables have been checked for valid input, now calculate the monthly payment
                   NumberFormat formatter = new DecimalFormat ("$###,###.00");
                   double intdecimal = intdecimal = IntRate/(12 * 100);
                   int months = Term * 12;
                   double monthlypayment = principal *(intdecimal / (1- Math.pow((1 + intdecimal),-months)));
                   //Display the Amoritization schedule
                   jTextAreaAmoritization.setText(" Loan amount of " + formatter.format(principal)
                                                    + "\n"
                                                    + " Interest Rate is " +  IntRate + "%"
                                            + "\n"
                                            + " Term in Years "  + Term
                                            + " Monthly payment "+  formatter.format(monthlypayment)
                                            + "\n"
                                            + "  Amoritization is as follows:  "
                                            + "------------------------------------------------------------------------");
         public Insets getInsets()
              Insets around = new Insets(35,20,20,35);
              return around;
         //Main program     
         public static void main(String[]args) { 
              Week3Assignment407B frame = new Week3Assignment407B(); 
       }

    here's your initComponents with a couple of changes, the problem was the Gridlayout(15,1)
    also, the scrollpane needed a setPreferredSize()
      private void initComponents()
        setSize(700,400);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Container pane = getContentPane();
        JPanel pane = new JPanel();
        //GridLayout grid = new GridLayout(15, 1);
        GridLayout grid = new GridLayout(2, 1);
        pane.setLayout(grid);
        menuBar = new JMenuBar();
        fileMenu = new JMenu();
        fileMenu.setText("File");
        exitMenuItem = new JMenuItem();
        exitMenuItem.setText("Exit");
        fileMenu.add(exitMenuItem);
        menuBar.add(fileMenu);
        //pane.add(menuBar);
        setJMenuBar(menuBar);
        jPanelEnterPrincipal = new JPanel();
        jLabelPrincipal = new JLabel("Amt to borrow in whole numbers");
        jTextFieldMortgageAmt = new JTextField(10);
        GridLayout Principal = new GridLayout(1,2);
        jPanelEnterPrincipal.setLayout(Principal);
          jPanelEnterPrincipal.add(jLabelPrincipal);
        jPanelEnterPrincipal.add(jTextFieldMortgageAmt);
        pane.add(jPanelEnterPrincipal);
        jPanelRateAndTermSelection = new JPanel();
        jLabelChooseRateAndTerm = new JLabel("Choose the Rate and Term");
        buttonCompute = new JButton("Compute Mortgage");
        buttonNew = new JButton("New Mortgage");
        buttonClose = new JButton("Close");
        GridLayout RateAndTerm = new GridLayout(1,5);
        jPanelRateAndTermSelection.setLayout(RateAndTerm);
        jPanelRateAndTermSelection.add(jLabelChooseRateAndTerm);
        TermAndRate = new JComboBox();
        jPanelRateAndTermSelection.add(TermAndRate);
        TermAndRate.addItem("7 years at 5.35%");
        TermAndRate.addItem("15 years at 5.5%");
        TermAndRate.addItem("30 years at 5.75%");
        jPanelRateAndTermSelection.add(buttonCompute);
        jPanelRateAndTermSelection.add(buttonNew);
        jPanelRateAndTermSelection.add(buttonClose);
        pane.add(jPanelRateAndTermSelection);
        jPanelAmoritizationSchedule = new JPanel();
        jTextAreaAmoritization = new JTextArea(26,50);
        JScrollPane scrollBar = new JScrollPane(jTextAreaAmoritization,
          JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        scrollBar.setPreferredSize(new Dimension(500,100));//<------------------------
        jPanelAmoritizationSchedule.add(scrollBar);
        getContentPane().add(pane,BorderLayout.NORTH);
        getContentPane().add(jPanelAmoritizationSchedule,BorderLayout.CENTER);
        exitMenuItem.addActionListener(this);
        buttonCompute.addActionListener(this);
        buttonNew.addActionListener(this);
        buttonClose.addActionListener(this);
        TermAndRate.addActionListener(this);
        jTextFieldMortgageAmt.addActionListener(this);
        jPanelErrorOutput = new JPanel();
        jLabelErrorOutput = new JLabel();
        FlowLayout error = new FlowLayout();
        jPanelErrorOutput.setLayout(error);
        //pane.add(jLabelErrorOutput);not worrying about this one
        //setContentPane(pane);
        pack();
        setVisible(true);
      }instead of
    if (TermAndRate.getSelectedItem() == "7 years at 5.35%") ;
    Term = 7;
    IntRate = 5.35;
    you would be better off setting up arrays
    int[] term = {7,15,30};
    double[] rate = {5.35,5.50,5.75};
    then using getSelectedIndex()
    int loan = TermAndRate.getSelectedIndex()
    Term = term[loan];
    IntRate = rate[loan];

  • Scroll bar problems ..Please help!!!!!!

    This is what the program looks like. topPanel has newItemPanel on top of it. when you click continue newItemPanel becomes invisible and newItemDescriptionPanel becomes visible. When you click continue newItemDescriptionPanel becomes invisible and priceEnterPanel becomes visible.
    I want newItemDescriptionPanel and priceEnterPanel to have a scroll bar. but everything I have tried hasn't worked. I am new. You will see the code is ugly and there is an attempt to add a scrollbar.
    Please help
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.border.*;
    import java.lang.System;
    public class MainPanel extends      JFrame implements     ActionListener
         private boolean      firstRun = true;
         private final int     ITEM_PLAIN     =     0;     // Item types
         private final int     ITEM_CHECK     =     1;
         private final int     ITEM_RADIO     =     2;
         private     JPanel          topPanel;
         private JPanel          newItemPanel;
         private JRadioButton onlineAuctionRadio;
         private JRadioButton fixedPriceRadio;
         private ButtonGroup bg;
         private JButton     continueButton;
         private JLabel      blankLabel;       //used to give space between things
         private JPanel           newItemDescriptionPanel;
         private JPanel      takeAdditionalSpacePanelCheckBox;
         private JPanel      takeAdditionalSpacePanel;
         private JPanel          takeAdditionalSpacePanelLabel;
         private JPanel          takeAdditionalSpacePanelLabel2;
         private JPanel      takeAdditionalSpacePanel2;
         private JPanel      takeAdditionalSpacePanel3;
         private JPanel           takeAdditionalSpacePanel4;
         private JPanel           takeAdditionalSpacePanel5;
         JScrollPane displayScroller;
         JEditorPane itemDescriptionTextArea;
         GridBagLayout gridbag;
         GridBagConstraints gbc;
         private JCheckBox   secondCategoryCheckBox;
         private JLabel          itemTitleLabel;
         private JLabel          requiredLabel, requiredLabel2;
         private JLabel      requiredStarLabel;
         private JTextField  itemTitleTextField;
         private JLabel           subtitleLabel;
         private JTextField      subtitleTextField;
         private JLabel          itemDescriptionLabel;
         private JButton     itemDescriptionContinueButton;
         private JLabel          percentageLabel;
         //------- price enter page ----------------
         private JLabel          startingPriceLabel;
         private JLabel           dollarSignLabel;
         private JTextField     startingPriceTextField;
         private JPanel          fillUpSpacePanel;
         private JPanel          fillUpSpacePanel1;
         private JPanel          fillUpSpacePanel2;
         private JLabel          buyItNowLabel;
         private JPanel          fillUpSpacePanel3;
         private JLabel          dollarSignLabel2;
         private JTextField     buyItNowTextField;
         private JPanel          fillUpSpacePanel4;
         private JPanel          fillUpSpacePanel5;
         private JPanel          fillUpSpacePanel6;
         private JPanel          fillUpSpacePanel7;
         private JPanel          fillUpSpacePanel8;
         private JPanel          fillUpSpacePanel9;
         private JPanel          fillUpSpacePanel10;
         private JPanel          fillUpSpacePanel11;
         private JPanel          fillUpSpacePanel12;
         private JPanel          fillUpSpacePanel13;
         private JPanel          fillUpSpacePanel14;
         private JPanel          fillUpSpacePanel15;
         private JPanel          fillUpSpacePanel16;
         private JPanel          fillUpSpacePanel17;
         private JPanel          fillUpSpacePanel18;
         private JLabel          donatePercentageLabel;
         private JTextField     donatePercentageTextField;
         private JPanel          fSp; // fill space panel
         private JPanel          fSp1;
         private JPanel          fSp2;
         private JPanel          fSp3;
         private JPanel          fSp4;
         private JPanel          fSp5;
         private JPanel          fSp6;
         private JPanel          fSp7;
         private JPanel          fSp8;
         private JPanel          fSp9;
         private JLabel           numberOfPicturesLabel;
         private JTextField     numberOfPicturesTextField;
         private JCheckBox     superSizePicturesCheckBox;
         private JLabel          superSizePicturesLabel;
         private JRadioButton standardPictureRadioButton;
         private JRadioButton picturePackRadioButton;
         private JCheckBox     listingDesignerCheckBox;
         private ButtonGroup bgPictures;
         private JCheckBox      valuePackCheckBox;
         private JCheckBox     galleryPictureCheckBox;
         private JCheckBox     subtitleCheckBox;
         private JCheckBox     boldCheckBox;
         private JCheckBox     borderCheckBox;
         private JCheckBox     highlightCheckBox;
         private JCheckBox     featuredPlusCheckBox;
         private JCheckBox     galleryFeaturedCheckBox;
         private JLabel          homePageFeaturedLabel;
         private JComboBox     homePageFeaturedComboBox;
         private JCheckBox     giftCheckBox;
         JScrollPane priceEnterPanelScroll;
         private JButton          backToRadioButton;
         private JButton          backToItemDescriptionButton;
         private JPanel           priceEnterPanel;
         private final static String RADIOPANEL = "JPanel with radios";
         private final static String DESCRIPTIONPANEL = "JPanel with description";
         private final static String PRICEENTERPANEL = "JPanel with price entering";
         private JPanel           cards;
         private     JMenuBar     menuBar;
         private     JMenu          menuFile;
         private     JMenu          menuEdit;
         private     JMenu          menuProperty;
         private     JMenuItem     menuPropertySystem;
         private     JMenuItem     menuPropertyEditor;
         private     JMenuItem     menuPropertyDisplay;
         private     JMenu        menuFileNew;
         private JMenuItem   menuFileNewAccount;
         private JMenuItem   menuFileNewItem;
         private     JMenuItem     menuFileOpen;
         private     JMenuItem     menuFileSave;
         private     JMenuItem     menuFileSaveAs;
         private     JMenuItem     menuFileExit;
         private     JMenuItem     menuEditCopy;
         private     JMenuItem     menuEditCut;
         private     JMenuItem     menuEditPaste;
         public MainPanel()
              requiredLabel = new JLabel ("* Required");
              requiredLabel.setForeground (Color.red);
              requiredLabel2 = new JLabel ("* Required");
              requiredLabel2.setForeground (Color.red);
              requiredStarLabel = new JLabel ("*");
              requiredStarLabel.setForeground (Color.green);
              setTitle( "photo galleries" );
              setSize( 310, 130 );
              topPanel = new JPanel();
              topPanel.setLayout( new BorderLayout() );
              topPanel.setBorder (BorderFactory.createTitledBorder ("TopPanel"));
              //topPanel.setPreferredSize(new Dimension (300,300));
              getContentPane().add( topPanel );
              topPanel.setVisible (false);
              //     For New Item Panel
              ButtonListener ears = new ButtonListener();
              blankLabel = new JLabel ("  ");  // used to give space between radio buttons and continue button
              continueButton = new JButton ("Continue >");
              continueButton.addActionListener (ears);
              backToRadioButton = new JButton ("< back");
              backToRadioButton.addActionListener (ears);
              itemDescriptionContinueButton = new JButton ("Continue >");
              itemDescriptionContinueButton.addActionListener (ears);
              backToItemDescriptionButton = new JButton ("< back");
              backToItemDescriptionButton.addActionListener (ears);
              newItemPanel = new JPanel();
              newItemPanel.setLayout (new BoxLayout(newItemPanel, BoxLayout.Y_AXIS));
              //topPanel.add (newItemPanel, BorderLayout.NORTH);
              newItemPanel.setBorder (BorderFactory.createTitledBorder ("NewItemPanel"));
              newItemPanel.setVisible (false);
              onlineAuctionRadio = new JRadioButton ("Sold item at online Auction"     );
              fixedPriceRadio = new JRadioButton ("Sold at a Fixed Price");
              bg = new ButtonGroup();
              bg.add(onlineAuctionRadio);
              bg.add(fixedPriceRadio);
              onlineAuctionRadio.addActionListener (ears);
              fixedPriceRadio.addActionListener (ears);
              newItemPanel.add (onlineAuctionRadio);
              newItemPanel.add (fixedPriceRadio);
              newItemPanel.add (blankLabel);
              newItemPanel.add (continueButton);
              // ------ After continue pressed ---------
              newItemDescriptionPanel = new JPanel();
              newItemDescriptionPanel.setLayout (new BoxLayout(newItemDescriptionPanel, BoxLayout.Y_AXIS));
              newItemPanel.add (newItemDescriptionPanel, BorderLayout.NORTH);
              newItemDescriptionPanel.setBorder (BorderFactory.createTitledBorder ("newItemDescriptionPanel"));
              secondCategoryCheckBox = new JCheckBox ("The item was listed in a second category");
              newItemDescriptionPanel.setVisible (false);
              itemTitleLabel = new JLabel ("Item title");
              itemTitleTextField = new JTextField (30);
              subtitleLabel = new JLabel ("Subtitle ($0.50)");
              subtitleTextField = new JTextField (30);
              itemDescriptionLabel = new JLabel ("Item description");
              itemDescriptionTextArea = new JEditorPane();
              itemDescriptionTextArea.setContentType( "text/html" );
              itemDescriptionTextArea.setEditable( false );
              itemDescriptionTextArea.setPreferredSize(new Dimension (500,250));
              itemDescriptionTextArea.setFont(new Font( "Serif", Font.PLAIN, 12 ));
              itemDescriptionTextArea.setForeground( Color.black );
              gbc = new GridBagConstraints();
              gbc.gridx = 0;
              gbc.gridy = 4;
              displayScroller = new JScrollPane( itemDescriptionTextArea );
              gridbag = new GridBagLayout ();
              gridbag.setConstraints( displayScroller, gbc );
              itemDescriptionTextArea.setEditable( true );
              takeAdditionalSpacePanelCheckBox = new JPanel(new FlowLayout(FlowLayout.LEFT));
              takeAdditionalSpacePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
              takeAdditionalSpacePanelLabel = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
              takeAdditionalSpacePanelLabel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
              takeAdditionalSpacePanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
              takeAdditionalSpacePanel3 = new JPanel(new FlowLayout(FlowLayout.LEFT));//<--added, to take additional space
              takeAdditionalSpacePanel4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              takeAdditionalSpacePanel5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              //takeAdditionalSpacePanel2.setBorder (BorderFactory.createTitledBorder ("Additonal 2"));
              takeAdditionalSpacePanelCheckBox.add (secondCategoryCheckBox);
              newItemDescriptionPanel.add (takeAdditionalSpacePanelCheckBox);
              //newItemDescriptionPanel.add (blankLabel);
              takeAdditionalSpacePanelLabel.add (itemTitleLabel);
              takeAdditionalSpacePanelLabel.add (requiredLabel);
              newItemDescriptionPanel.add (takeAdditionalSpacePanelLabel);
              //newItemDescriptionPanel.add (itemTitleTextField);
              takeAdditionalSpacePanel.add(itemTitleTextField);//<--add textfield to panel
              newItemDescriptionPanel.add (takeAdditionalSpacePanel);//<--add panel to boxlayout panel
              takeAdditionalSpacePanelLabel2.add (subtitleLabel);
              newItemDescriptionPanel.add (takeAdditionalSpacePanelLabel2);
              takeAdditionalSpacePanel2.add (subtitleTextField);
              newItemDescriptionPanel.add (takeAdditionalSpacePanel2);
              takeAdditionalSpacePanel4.add (itemDescriptionLabel);
              //takeAdditionalSpacePanel4.add (requiredLabel2);
              newItemDescriptionPanel.add (takeAdditionalSpacePanel4);
              takeAdditionalSpacePanel3.add (displayScroller);
              newItemDescriptionPanel.add (takeAdditionalSpacePanel3);
              takeAdditionalSpacePanel5.add (backToRadioButton);
              takeAdditionalSpacePanel5.add (itemDescriptionContinueButton);
              newItemDescriptionPanel.add (takeAdditionalSpacePanel5);
              //newItemDescriptionPanel.setLayout (new BoxLayout(newItemDescriptionPanel, BoxLayout.Y_AXIS));
              //----------- Price Enter Page ----------------
              priceEnterPanel = new JPanel();
              priceEnterPanel.setLayout (new BoxLayout(priceEnterPanel, BoxLayout.Y_AXIS));
              newItemDescriptionPanel.add (priceEnterPanel, BorderLayout.NORTH);
              priceEnterPanel.setBorder (BorderFactory.createTitledBorder ("Price enter Panel"));
              priceEnterPanel.setVisible (false);
              priceEnterPanelScroll = new JScrollPane (priceEnterPanel);
              topPanel.add (priceEnterPanelScroll);
              standardPictureRadioButton = new JRadioButton ("Standard");
              picturePackRadioButton = new JRadioButton ("Picture Pack ($1.00 for up to 6 pictures or $1.50 for 7 to 12 pictures)");
              bgPictures = new ButtonGroup();
              bgPictures.add(standardPictureRadioButton);
              bgPictures.add(picturePackRadioButton);
              standardPictureRadioButton.addActionListener (ears);
              picturePackRadioButton.addActionListener (ears);
              superSizePicturesCheckBox = new JCheckBox ("Supersize Pictures ($0.75)");
              listingDesignerCheckBox = new JCheckBox ("Listing designer $0.10");
              valuePackCheckBox = new JCheckBox ("Get the Essentials for less! Gallery, Subtitle, Listing Designer. $0.65 (save $0.30)");
              superSizePicturesCheckBox.setEnabled (false);
              superSizePicturesCheckBox.addActionListener (ears);
              listingDesignerCheckBox.addActionListener (ears);
              valuePackCheckBox.addActionListener (ears);
              startingPriceLabel = new JLabel ("Starting Price");
              dollarSignLabel = new JLabel ("$");
              startingPriceTextField = new JTextField (10);
              buyItNowLabel = new JLabel ("Buy It Now");
              dollarSignLabel2 = new JLabel ("$");
              buyItNowTextField = new JTextField (10);
              donatePercentageLabel = new JLabel ("Donate percentage of sale");
              donatePercentageTextField = new JTextField (2);
              donatePercentageTextField.setText ("0");
              percentageLabel = new JLabel ("%");
              // Right-justify the text
             donatePercentageTextField.setHorizontalAlignment(JTextField.RIGHT);
              numberOfPicturesLabel = new JLabel ("Number of pictures used");
              numberOfPicturesTextField = new JTextField (1);
              numberOfPicturesTextField.setText ("0");
              galleryPictureCheckBox = new JCheckBox ("Gallery ($0.35) [Requires a picture]");
              subtitleCheckBox = new JCheckBox ("Subtitle ($0.50)");
              boldCheckBox = new JCheckBox ("Bold ($1.00)");
              borderCheckBox = new JCheckBox ("Border ($3.00)");
              highlightCheckBox = new JCheckBox ("Highlight ($5.00)");
              featuredPlusCheckBox = new JCheckBox ("Featured Plus! ($19.95)");
              galleryFeaturedCheckBox = new JCheckBox ("Gallery Featured ($19.95) [Requires a picture]");
              homePageFeaturedLabel = new JLabel ("Home Page Featured ($39.95 for 1 item, $79.95 for 2 or more items)");
              homePageFeaturedComboBox = new JComboBox ();
              homePageFeaturedComboBox.addItem (("None..."));
              homePageFeaturedComboBox.addItem (("1 item"));
              homePageFeaturedComboBox.addItem (("2 or more items"));
              giftCheckBox = new JCheckBox ("Show as a gift ($0.25)");
              fillUpSpacePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel6 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel7 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel8 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel9 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel10 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel11 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel12 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel13 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel14 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel15 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel16 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel17 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel18 = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp1     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp2     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp3     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp4     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp5     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp6     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp7     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp8     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fSp9     = new JPanel(new FlowLayout(FlowLayout.LEFT));
              fillUpSpacePanel.add (startingPriceLabel);
              fillUpSpacePanel.add (requiredLabel2);
              priceEnterPanel.add (fillUpSpacePanel);
              fillUpSpacePanel2.add (dollarSignLabel);
              fillUpSpacePanel2.add (startingPriceTextField);
              priceEnterPanel.add (fillUpSpacePanel2);     
         //     fillUpSpacePanel1.add (backToItemDescriptionButton);
         //     priceEnterPanel.add (fillUpSpacePanel1);
              fillUpSpacePanel3.add (buyItNowLabel);
              priceEnterPanel.add (fillUpSpacePanel3);
              fillUpSpacePanel4.add (dollarSignLabel2);
              fillUpSpacePanel4.add (buyItNowTextField);
              priceEnterPanel.add (fillUpSpacePanel4);
              fillUpSpacePanel1.add (donatePercentageLabel);
              priceEnterPanel.add (fillUpSpacePanel1);
              fillUpSpacePanel5.add (donatePercentageTextField);
              fillUpSpacePanel5.add (percentageLabel);
              priceEnterPanel.add (fillUpSpacePanel5);
              fillUpSpacePanel6.add (numberOfPicturesLabel);
              priceEnterPanel.add (fillUpSpacePanel6);
              fillUpSpacePanel7.add (numberOfPicturesTextField);
              priceEnterPanel.add (fillUpSpacePanel7);
              fillUpSpacePanel8.add (standardPictureRadioButton);
              priceEnterPanel.add (fillUpSpacePanel8);
              fillUpSpacePanel10.add (blankLabel);
              fillUpSpacePanel10.add (superSizePicturesCheckBox);
              priceEnterPanel.add (fillUpSpacePanel10);
              fillUpSpacePanel9.add (picturePackRadioButton);
              priceEnterPanel.add (fillUpSpacePanel10);
              fillUpSpacePanel11.add (picturePackRadioButton);
              priceEnterPanel.add (fillUpSpacePanel11);
              fillUpSpacePanel12.add (listingDesignerCheckBox);
              priceEnterPanel.add (fillUpSpacePanel12);
              fillUpSpacePanel13.add (valuePackCheckBox);
              priceEnterPanel.add (fillUpSpacePanel13);
              fSp.add (galleryPictureCheckBox);
              priceEnterPanel.add (fSp);
              fSp1.add (subtitleCheckBox);
              priceEnterPanel.add (fSp1);
              fSp2.add (boldCheckBox);
              priceEnterPanel.add (fSp2);
              fSp3.add (borderCheckBox);
              priceEnterPanel.add (fSp3);
              fSp4.add (highlightCheckBox);
              priceEnterPanel.add (fSp4);
              fSp5.add (featuredPlusCheckBox);
              priceEnterPanel.add (fSp5);
              fSp6.add (galleryFeaturedCheckBox);
              priceEnterPanel.add (fSp6);
              fSp7.add (homePageFeaturedLabel);
              priceEnterPanel.add (fSp7);
              fSp8.add (homePageFeaturedComboBox);
              priceEnterPanel.add (fSp8);
              fSp9.add (giftCheckBox);
              priceEnterPanel.add (fSp9);
              newItemDescriptionPanel.add (priceEnterPanelScroll);
              //Create the panel that contains the "cards".
              cards = new JPanel(new CardLayout());
              cards.add(newItemPanel, RADIOPANEL);
              cards.add(newItemDescriptionPanel, DESCRIPTIONPANEL);
              cards.add(priceEnterPanel, PRICEENTERPANEL);
              topPanel.add(cards, BorderLayout.NORTH);
              // Create the menu bar
              menuBar = new JMenuBar();
              // Set this instance as the application's menu bar
              setJMenuBar( menuBar );
              // Build the property sub-menu
              menuProperty = new JMenu( "Properties" );
              menuProperty.setMnemonic( 'P' );
              // Create property items
              menuPropertySystem = CreateMenuItem( menuProperty, ITEM_PLAIN,
                                            "System...", null, 'S', null );
              menuPropertyEditor = CreateMenuItem( menuProperty, ITEM_PLAIN,
                                            "Editor...", null, 'E', null );
              menuPropertyDisplay = CreateMenuItem( menuProperty, ITEM_PLAIN,
                                            "Display...", null, 'D', null );
              //Build the File-New sub-menu
              menuFileNew = new JMenu ("New");
              menuFileNew.setMnemonic ('N');
              //Create File-New items
              menuFileNewItem = CreateMenuItem( menuFileNew, ITEM_PLAIN,
                                            "Item", null, 'A', null );
              menuFileNewAccount = CreateMenuItem( menuFileNew, ITEM_PLAIN,
                                            "Account", null, 'A', null );
              // Create the file menu
              menuFile = new JMenu( "File" );
              menuFile.setMnemonic( 'F' );
              menuBar.add( menuFile );
              //Add the File-New menu
              menuFile.add( menuFileNew );
              // Create the file menu
              // Build a file menu items
              menuFileOpen = CreateMenuItem( menuFile, ITEM_PLAIN, "Open...",
                                            new ImageIcon( "open.gif" ), 'O',
                                            "Open a new file" );
              menuFileSave = CreateMenuItem( menuFile, ITEM_PLAIN, "Save",
                                            new ImageIcon( "save.gif" ), 'S',
                                            " Save this file" );
              menuFileSaveAs = CreateMenuItem( menuFile, ITEM_PLAIN,
                                            "Save As...", null, 'A',
                                            "Save this data to a new file" );
              // Add the property menu     
              menuFile.addSeparator();
              menuFile.add( menuProperty );
              menuFile.addSeparator();
              menuFileExit = CreateMenuItem( menuFile, ITEM_PLAIN,
                                            "Exit", null, 'X',
                                            "Exit the program" );
              //menuFileExit.addActionListener(this);
              // Create the file menu
              menuEdit = new JMenu( "Edit" );
              menuEdit.setMnemonic( 'E' );
              menuBar.add( menuEdit );
              // Create edit menu options
              menuEditCut = CreateMenuItem( menuEdit, ITEM_PLAIN,
                                            "Cut", null, 'T',
                                            "Cut data to the clipboard" );
              menuEditCopy = CreateMenuItem( menuEdit, ITEM_PLAIN,
                                            "Copy", null, 'C',
                                            "Copy data to the clipboard" );
              menuEditPaste = CreateMenuItem( menuEdit, ITEM_PLAIN,
                                            "Paste", null, 'P',
                                            "Paste data from the clipboard" );
         public JMenuItem CreateMenuItem( JMenu menu, int iType, String sText,
                                            ImageIcon image, int acceleratorKey,
                                            String sToolTip )
              // Create the item
              JMenuItem menuItem;
              switch( iType )
                   case ITEM_RADIO:
                        menuItem = new JRadioButtonMenuItem();
                        break;
                   case ITEM_CHECK:
                        menuItem = new JCheckBoxMenuItem();
                        break;
                   default:
                        menuItem = new JMenuItem();
                        break;
              // Add the item test
              menuItem.setText( sText );
              // Add the optional icon
              if( image != null )
                   menuItem.setIcon( image );
              // Add the accelerator key
              if( acceleratorKey > 0 )
                   menuItem.setMnemonic( acceleratorKey );
              // Add the optional tool tip text
              if( sToolTip != null )
                   menuItem.setToolTipText( sToolTip );
              // Add an action handler to this menu item
              menuItem.addActionListener( this );
              menu.add( menuItem );
              return menuItem;
         public void actionPerformed( ActionEvent event )
              CardLayout cl = (CardLayout)(cards.getLayout());
              if (event.getSource() == menuFileExit)
                   System.exit(0);
              if (event.getSource() == menuFileNewAccount)
                   System.out.println ("hlkadflkajfalkdjfalksfj");
              if (event.getSource() == menuFileNewItem){
                   if (firstRun){
                        newItemPanel.setVisible (true);
                        topPanel.setVisible (true);
                   cl.show(cards,RADIOPANEL);
                   firstRun = false;
              //System.out.println( event );
         private class ButtonListener implements ActionListener
              public void actionPerformed(ActionEvent event)
                   CardLayout cl = (CardLayout)(cards.getLayout());
             //     cl.show(cards, (String)evt.getItem());
                   if (event.getSource() == continueButton){
                        if (!(onlineAuctionRadio.isSelected()) && !(fixedPriceRadio.isSelected()))
                             JOptionPane.showMessageDialog(null, "You must select at least one.", "Error", JOptionPane.ERROR_MESSAGE);
                        else{
                             if (onlineAuctionRadio.isSelected()){
                                  cl.show (cards, DESCRIPTIONPANEL);
                                  //newItemPanel.setVisible (false);
                                  //newItemDescriptionPanel.setVisible (true);
                   if (event.getSource() == itemDescriptionContinueButton){
                       if (itemTitleTextField.getText().trim().equalsIgnoreCase(""))
                            JOptionPane.showMessageDialog(null, "You must enter a title.", "Error", JOptionPane.ERROR_MESSAGE);
                        else
                             cl.show (cards, PRICEENTERPANEL);
                   if (event.getSource() == backToRadioButton){
                        cl.show (cards, RADIOPANEL);
                   if (event.getSource() == backToItemDescriptionButton){
                        cl.show(cards, DESCRIPTIONPANEL);
                   if (standardPictureRadioButton.isSelected()){
                        superSizePicturesCheckBox.setEnabled (true);
                   if (picturePackRadioButton.isSelected()){
                        superSizePicturesCheckBox.setEnabled (false);
              } //end of action performed
    }

    Mostly I see there is about 100 times as much code as I care to look at.
    So you don't know how to get a panel in a scroll pane, and then get that scroll pane into your GUI? Then try doing that by itself, not encumbered with 10000 lines of irrelevant code. Once you have it working, plug it into the big lump of code. Or if you can't get it working, ask about the small problem here.

  • JTabel Horizontal scroll bar problem

    Hi,
    I want a horizontal scroll bar added to my table
    hence I do this
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    but the problem is If I increase the size of frame
    the cells do not resize hence there is a gap after
    the last column.
    How do I remove this gap

    Please reduce the container size in the screen thru SE51 that automatically create the scroll
    or check whether in the attributes of the screen "Hold scroll positio" not to be checked

  • Horizontal Scroll bar problem with CL_GUI_ALV_GRID

    Hi Experts,
    I have created Dynamic ALV by using CL_GUI_ALV_GRID . Everthing is working fine if all the data is displaying in single screen. But if the number of columns increase with the output of data the horizontal scroll bar is not working.
    It is visible but when I click to scroll it to the end of screen it is not working. Can anybody help me that what can be the problem?

    Please reduce the container size in the screen thru SE51 that automatically create the scroll
    or check whether in the attributes of the screen "Hold scroll positio" not to be checked

  • Horizontal scroll bar problem in Portal????

    Hi Guys,
    I am facing some problem when i open any thread. Horizontal scrollong bar is coming at the end of the thread.
    eg: If i have some text in the thread which is more than width of the screen and has some 10 replies to that thread, Then i should be able to scrool at that position itself. But now i have to scroll down till end of all the replies and then i have to scroll the horizontal bar to right/left and scroll up to particular reply to see what is there.
    Is there any enhancement going on in portal or it is specific to my system? Please do let me know.
    Thanks,
    Vinod.

    I too am facing this problem with the horizontal scroll bar. 
    There are many other bugs, but I am reluctant to spend my time reporting them as last time I reported a problem here, I got a rude response.
    Al Lal

  • Scroll Bar Problem after Printing a web page containing multiple page data

    Hi All,
    I have a web application which has two DIV, one is main and one is child. I am having problem in printing multiple pages. There is a lot of data in the child DIV and i am using JavaScript functions to control the print functionality. When i print using window.print(), only the data on the main page currently being showed is printed. I further researched and checked out the Style.Overflow property.
    Now i am using divMain.style.overflow = "visible"
    After this the complete print comes. But in Firefox, the scroll bar disappears and only single page is left with no scroll bar .
    Now if after print i give divMain.style.overflow = "Auto" OR divMain.style.overflow = "Scroll", still the scroll bar doesn't come and if it comes then its inactive. I am unable to see the complete data on the page after the print is taken.
    The problem is not coming in I.E and the full data with scroll bar is recovered in I.E.
    Please help me how to get the normal page with full data and scroll bar after printing in Firefox.
    Thanks,
    Manuj

    hi, i would update my reader first to the newest version.
    does the size of the textfield never change, independant how much text is in it?
    perhaps check your subforms, if they are type "position" size does not change in my opinion, except your parent subforms expand to fit....
    or use "flowed" subforms...and regard the parent subforms too!

  • I have a problem with interactive report in  horizontal scroll bar

    hi all,
      in my interactive report the horizontal scroll bar is not visible and i have created a scroll bar with the html code and i have a problem in that scroll bar when ever i will click the select list and if i will move the scroll bar and the select list is also moving but it the select list dont have to move .pls give me a solution for this urgent.
    thanks in advance 

    Kishore suresh wrote:
    hi all,
      in my interactive report the horizontal scroll bar is not visible and i have created a scroll bar with the html code and i have a problem in that scroll bar when ever i will click the select list and if i will move the scroll bar and the select list is also moving but it the select list dont have to move .pls give me a solution for this urgent.
    thanks in advance
    Hi,
    How you think anybody can help if you do not post single line how you have try create that scrolling report ?
    And if your issue is urgent, you are seeking help from wrong place.
    Regards,
    Jari

  • Plzzzz solve my problem my side scroll bar does nt appear due to which i have to face the problem in scrolling page up and dowen quicly.

    i am using latest version of mozilla suddenly on mozilla searching page side scroll bar is not appearing due to which i have to face prob in scrolling the page which i see i am not understanding what has happened.plz solve this problem as soon as possible.

    Here you go.

  • Easy question - scroll bar position in listbox problem

    hello again
    this time my question is simple...
    is there a way to set the initial position of a vertical scroll bar of a listbox?
    sometimes - if i make more runnings - remain in memory the last position...and if the new listbox is smaller then the last one i see a white listbox and i think that something went wrong in my program
    Using LabVIEW 7.1
    Solved!
    Go to Solution.

    Hi gigi85,
    Okay in that case,Please create property node with Multiple lines property, and click on the blue square shown in the diagram and expand it downwards, Labview should automatically add these parameters. added screenshot for your reference.
    Let me know if u've any queries.
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13
    Attachments:
    Screenshot_TopRow_PropertyNode.png ‏8 KB

  • ICal - long notes disappear/scroll bar problem

    I'm having issues typing in long notes in iCal. When I'm typing in the "Note" field, and I'm typing a lot, at some point my text disappears below the bottom of the pop up box (e.g. the box doesn't keep scrolling down as I type). Then I have to manually click and drag the scroll bar down to reveal what I just typed. But if I start typing again, the scroll bar jumps back up, hiding what I'm typing again. Has anyone else experienced this?

    -> 3) Changed the default Window width to 5 and it's height to 12
    Don't do that. That apparently guarantees the problem you have.
    The Window size should be no larger than will fit on the user's screen, and the user running the lowest screen resolution should be your target. We create forms no larger than will fit on the 800x600 layout. Our forms always use the Real,Pixel coordinate system, and I create forms with the window size set to a maximum of 784x442. Those reduced numbers allow the form to fit within a browser window in web forms. Our forms run under both 6i Client/Server AND Web, and there is a pre-form that adjusts the web form window size a little larger, but that is all.
    Also, when you run your form, that scrollbar you see is there because your window is not maximized. Our forms always maximize the window, and even have a when-window-resized trigger with this:
    <pre><font face = "Lucida Console, Courier New, Courier, Fixed" size = "1" color = "navy">DECLARE
    W0 Window := Find_Window('WINDOW0');
    BEGIN
    If Get_Window_Property(W0,Window_State)<>'MAXIMIZE' then
    Set_Window_Property(W0,Window_State,Maximize);
    End if;
    END;</font></pre>
    The wwr trigger ensures the user never sees the Window0 border -- it is useless unless you are running a form with multiple windows, which we never do.
    So.... Maximize your Window0, and then you will see the behavior I have been describing. Create a stacked canvas with a vertical scrollbar, and it will behave even better.

Maybe you are looking for

  • Why won't additional pages work when site is published?

    I created a site in iWeb and posted it using FTP to my domain. I created a page before my home page with some pictures and inserted a hyperlink off of a graphic to link to the home page. That link worked great! However, all of the the links in the he

  • Use one as Many

    Hi When we use this node function why we need the third parameter ? We already mentioned the parameter to be used many times and the number of times it should appear by the first two parameters itself ? So why we need the third paramter ? I went thro

  • CASTING in PL/SQL

    Can i cast a varchar2 to int in PL/SQL. I dont want to cast in a select statement. I want to some thing like num number; var varchar2; num:=1; var:='asd'; i want to concat these to variables and cast it into a number. Is this possible ,if yes ,then h

  • White lines crossing through my illustrations

    Hey there, Oftenwhen using the save for web feature, a series of white horizontal lines will appear, intersecting my artwork. Is this a common problem? What would you reccomend!? Thankyou

  • Upgrade elements 9 for i-Mac 27 inch

    is there a possibility to upgrade elements 9 for i-Mac. I've been told by Adobe thats it is not possible and that I should buy the new version (elements 11) I have just used one license of the version 9 and bought it in august 2011. Solutions welcome