This paper discusses an article titled "Teaching Software Componentization: A Bar Chart Java Bean" by Michel Mitri. The work tackles two programming elements that include the construction of a component and how to use the component that has been constructed. The author states that the Java world implements graphical software components in the form of JavaBeans. One benefit of JavaBeans is the ability to offer rapid application development because they can provide developers with appropriate ready-made modular functional units, which can be embedded in Java Applications by use of form-building design tools of Integrated Development Environment (IDE).
The BarchartPanel class is a GUI component, which can be put into another Java Swing container, such as an applet, a frame, or another panel. This component makes use of two arrays for its input data, namely an array of double values and an array of strings. In this case, the strings usually form the labels of the bars, as the numeric values are used to determine bar heights. The frame has buttons and text fields that are not part of the component, specific to the tester application. The BarChartPanel component contains bars and labels. All bars are designed by indexes of their associated data arrays. In addition, the selected bar in the component is given a unique color that distinguishes it from the rest of the colors. Every time the user clicks on a given bar within the component, the BarChartPanel recognizes the click, and it instantly sends an ‘event' to the application. This process is done by the use of the event-processing convention of Java, which registers object implement as BarChartListeners. The BarChartPanel itself is designed to call an event handler method for these objects that are registered. If an assumption is made that the application is a listener for the event, then the application responds and uses information from the bar chart as the user clicks a bar. The BarChartPanel will then send the index number of the bar that was clicked to the application. Once the index number of the bar has been sent to the application, the application can retrieve the value and label at that position. When the user drags at a bar up or down, the associated data values of the bars adjust accordingly, then the bars in the component adjust in real-time to reflect these changes. Therefore, the application can use this vital component to manipulate data as well as to display it. This component can design applications interfaces to employee data that consist of employees, types of jobs, departments, and projects using JDBC middleware. Such data may contain the one-to-many relationship between departments and employees as well as the many-to-many relationship between projects and employees.
Delegate your assignment to our experts and they will do the rest.
In addition, this application performs significant tasks in aggregate join queries with the purpose of obtaining statistics from the database. The return queries usually return different sets that include employee counts per department and the employee counts per project. The employee count per department usually requires a two-table joint combined with group aggregation, while the employee-counts per project entail a three-table joint combined with group aggregation. Once the aggregation has been performed, the application then instantiates BarChartPanel objects with the aim of displaying the required information. Besides, the application can listen for events that BarChartPanel generates. In this case, when users click on a bar representing a project or a department in the chart, the application retrieves the selected label of the bar and uses it in a query to acquire and display drill-down details about particular employees in that department or project. The ability of the application to listen events is a clear manifestation of how BarChartPanel can be used both for displaying of summary information and for user-requested drill-down to specific details.
Application of java graphics
One of the applications of Java graphics in education is designing pie charts, which are used to display comparable data and usually each category represents the percentage provided next to the appropriate corresponding slice of pie. The pie charts can represent data of containing different groups of students in academic institutions based on various parameters such as course, year of study, gender, age groups, ethnicity, and religion among other categories. In this case, the user instantiates the pie chart class and define that data. He or she then assign the data items to the pie chart object, and add the chart to the application. The number of pie chart data objects defined should be as many as what the user wishes to appear. Each pie chart data usually has two fields namely the specific name of the pie chart slice and the corresponding value attached to each slice.
Bar chart commands
Some of the commands for drawing bar charts are frequencies, color, and width of the bars. Frequency refers to the count or the number of occurrences of a particular value or category. In bar charts, the heights of the columns of equal widths indicate the frequencies for particular intervals of values. On the hand, colors are vital for highlighting different sets of data in bar chart graphical displays. The colors chosen must be distinct enough for clarity. The width of the bar also gives the number of count of occurrence for the given data. Therefore, the width of the bar in each category is directly proportional to the width or size of each category.
Updating new information
One of the common tools for this task is java.swing.Timer that can be used to modify a bar chart with the aim of updating for new information. The user updates the model, and the listening view will follow. Java.swing.Timer helps in animating updates without blocking the event dispatch thread.