keep sending a number of lines as Strings at a time to the panel. Which lines to be sent will depend on the mouse wheel movement. 1. If you need to define the first line to display, use the method...

keep sending a number of lines as Strings at a time to the panel. Which lines to be sent will depend on the mouse wheel movement. 1. If you need to define the first line to display, use the method setFirstLineToDisplay(int n) 2. If you need to retrieve the first line to display, use the method getFirstLineToDisplay() 3. the number of lines to go up or down is given by the method "getUnitsToScroll()"(from the mouse wheel event variable) as the mouse is scrolled up or down 4. adding getUnitsToScroll() to FirstLineToDisplay gives you the new value that will be used to retrieve lines from the data table and send them to be displayed. 5. you will need to check if the final value of FirstLineToDisplay is not below or above the data array size. If you try to retrieve lines that are not in the data table you will probably get an error message saying "array out of bounds exception"


L04B_ Assignment - Scrolling_ Add On to the Basic Window and Data Assignment.pdf 4/3/2021 L04B: Assignment - Scrolling: Add On to the Basic Window and Data Assignment https://psu.instructure.com/courses/2105477/assignments/12465254 1/4 L04B: Assignment - Scrolling: Add On to the Basic Win‐ dow and Data Assignment Due Sunday by 11:59pm Points 10 Submitting a file upload File Types zip Available until Apr 6 at 11:59pm Start Assignment After reading all L04 content pages in Lesson 04: Graphical User Interfaces, you will complete this assignment according to the following information: Assignment Objectives 1. Practice on implementing a MVC project 2. Keep working with Java Graphics 3. Implement Listener Interfaces 1. MouseWheelListener 2. ActionListener Deliverables A zipped Java project according to the How to submit Labs and Assignments guide. O.O. Requirements (these items will be part of your grade) 1. One class, one file. Don't create multiple classes in the same .java file 2. Don't use static variables and methods 3. Encapsulation: make sure you protect your class variables and provide access to them through get and set methods 4. all the classes are required to have a constructor that receives all the attributes as parameters and update the attributes accordingly 5. Follow Horstmann's Java Language Coding Guidelines (http://higheredbcs.wiley.com/legacy/college/horstmann/1118087887/style_guide/styleguide.htm) 6. Organized in packages (MVC - Model - View Controller) Contents Same classes as the last assignment but with increased functionality. 4/3/2021 L04B: Assignment - Scrolling: Add On to the Basic Window and Data Assignment https://psu.instructure.com/courses/2105477/assignments/12465254 2/4 4/3/2021 L04B: Assignment - Scrolling: Add On to the Basic Window and Data Assignment https://psu.instructure.com/courses/2105477/assignments/12465254 3/4 Starting from the last assignment (fully functional), you will Add a MouseWheelListener to enable scrolling Add an ActionListener to enable listening of specific buttons See a video of the assignment functionality at work. Scrolling The scrolling functionality will be implemented with the Interface MouseWheelListener see the lesson L04B: Anonymous Inner Classes as Listeners You cannot use a JScrollPane or any other embedded Java scrolling functionality. You need to write the scrolling functionality yourself using MouseWheelListener implemented as an inner listener. Strategies to implement scrolling 1. keep sending a number of lines as Strings at a time to the panel. Which lines to be sent will depend on the mouse wheel movement. 1. If you need to define the first line to display, use the method setFirstLineToDisplay(int n) 2. If you need to retrieve the first line to display, use the method getFirstLineToDisplay() 3. the number of lines to go up or down is given by the method "getUnitsToScroll()"(from the mouse wheel event variable) as the mouse is scrolled up or down 4. adding getUnitsToScroll() to FirstLineToDisplay gives you the new value that will be used to retrieve lines from the data table and send them to be displayed. 5. you will need to check if the final value of FirstLineToDisplay is not below or above the data array size. If you try to retrieve lines that are not in the data table you will probably get an error message saying "array out of bounds exception" 6. See L04B: Anonymous Inner Classes as Listeners 7. Examples from the lesson 1. MouseWheelInnerListener_Example.zip (https://psu.instructure.com/courses/2105477/files/118038927/download?download_frd=1) 4/3/2021 L04B: Assignment - Scrolling: Add On to the Basic Window and Data Assignment https://psu.instructure.com/courses/2105477/assignments/12465254 4/4 and MouseWheelRegularListener Example.zip (https://psu.instructure.com/courses/2105477/files/118039293/download?download_frd=1) . Listening to the Headers The listening to the headers functionality will be implemented using the Interface ActionListener. It will be implemented as an inner listener check the lesson on L04B: Anonymous Inner Classes as Listeners one ActionListener for each header button once the button is clicked it should be highlighted using a different color. All other buttons will then be reset to the standard color Everything else is as defined in the previous assignment, L04AC.
Nov 14, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here