Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Please help me (Data mining Program)

Anthony_ReaperMay 25 2015 — edited May 27 2015

Hey guys I am needing to create a data mining program in Java code. I am using NetBeans and created a JavaFX application. I need this program to read a file, analyze the data (calculate percentages based on total sales of each group to overall sales of company, and add an organizational value code to each group), then write this information to a new file. So far I have been able to code to find the file and open it but I cannot figure out how to do the analysis portion. Could you please help me figure this out. I have attached the code I have come up with so far.

 

package businesssalesdataanalysis;

 

 

import javafx.application.Application;

 

import javafx.event.ActionEvent;

 

import javafx.event.EventHandler;

 

import javafx.geometry.Insets;

 

import javafx.scene.Scene;

 

import javafx.scene.control.Button;

 

import javafx.scene.layout.Pane;

 

import javafx.scene.layout.GridPane;

 

import javafx.scene.layout.VBox;

 

import javafx.stage.Stage;

 

import javafx.stage.FileChooser;

 

import java.awt.Desktop;

 

import java.io.File;

 

import java.io.IOException;

 

import java.util.logging.Level;

 

import java.util.logging.Logger;

 

 

 

/**

 

*

 

* @author Anthony

 

*/

 

public final class BusinessSalesDataAnalysis extends Application {

 

      

 

    private final Desktop desktop = Desktop.getDesktop();

 

   

 

    @Override

 

    public void start(final Stage primaryStage) {

 

        primaryStage.setTitle("Business Sales Data Analysis");

 

       

 

        final FileChooser fileChooser = new FileChooser();

 

       

 

        final Button uploadButton = new Button("Upload a file");

 

       

 

        uploadButton.setOnAction(

 

                new EventHandler<ActionEvent>(){

 

                    @Override

 

                    public void handle(final ActionEvent e){

 

                        configureFileChooser(fileChooser);

 

                        File file = fileChooser.showOpenDialog(primaryStage);

 

                        if (file != null){

 

                            openFile(file);

 

                        }

 

                    }

 

                });

 

 

        final GridPane inputGridPane = new GridPane();

 

       

 

        GridPane.setConstraints(uploadButton, 100, 50);

 

        inputGridPane.setHgap(6);

 

        inputGridPane.setVgap(6);

 

        inputGridPane.getChildren().addAll(uploadButton);

 

       

 

        final Pane rootGroup = new VBox(12);

 

        rootGroup.getChildren().addAll(inputGridPane);

 

        rootGroup.setPadding(new Insets(12, 12, 12, 12));

 

       

 

        primaryStage.setScene(new Scene(rootGroup));

 

        primaryStage.show();

 

       

 

    }

 

 

    /**

 

     * @param args the command line arguments

 

     */

 

   

 

    public static void main(String[] args) {

 

        Application.launch(args);

 

    }

 

   

 

    private static void configureFileChooser(final FileChooser fileChooser){

 

        fileChooser.setTitle("Choose a File");

 

        fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));

 

       

 

        fileChooser.getExtensionFilters().addAll(

 

            new FileChooser.ExtensionFilter("All Files", "*.*"),

 

            new FileChooser.ExtensionFilter("DOC", ".doc"),

 

            new FileChooser.ExtensionFilter("DOCX", ".docx")

 

        );                      

 

    }

 

   

 

    private void openFile(File file){

 

        try{

 

            desktop.open(file);

 

        }

 

        catch (IOException ex){

 

            Logger.getLogger(BusinessSalesDataAnalysis.class.getName()).log(Level.SEVERE, null, ex);

 

        }

 

    }

 

   

 

}

 

Comments

Soukaina IDRISSI

Is there any clue or solution ?

Adnen Chebaane

Use dialog close event. Otherwise, try to avoid calling the modal by page redirection.

Franck N

Hi,

how about using Popup LOV. for this instance.

Plus point you do not require any additional implementation to achieve you requirement.

regards,

Franck

1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 24 2015
Added on May 25 2015
29 comments
3,688 views