Example usage for javafx.scene.paint Color toString

List of usage examples for javafx.scene.paint Color toString

Introduction

In this page you can find the example usage for javafx.scene.paint Color toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns a string representation of this Color .

Usage

From source file:snpviewer.SnpViewer.java

public void saveColours(ActionEvent e) {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Save Colour Scheme (.svcols) As...");
    FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("SNP Viewer Colour Scheme",
            "*.svcols");
    fileChooser.getExtensionFilters().add(extFilter);
    File colorFile = fileChooser.showSaveDialog(mainWindow);
    if (colorFile != null) {
        if (!colorFile.getName().endsWith(".svcols")) {
            colorFile = new File(colorFile.getAbsolutePath() + ".svcols");
        }/*from www .j ava 2s .  com*/

        try {
            FileOutputStream fos = new FileOutputStream(colorFile);
            try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fos))) {
                for (Color c : colorComp) {
                    out.writeObject(c.toString());
                }
                out.close();
                projectLabel.setText("Project: " + projectFile.getName());
            }
        } catch (IOException ex) {
            Dialogs.showErrorDialog(null, "Could not save colour scheme - IO error", "Save Failed",
                    "SNP Viewer", ex);
        }
    }
}

From source file:snpviewer.SnpViewer.java

public boolean saveProject(File saveFile) {
    try {/*w  ww.ja v  a  2s .  c  o  m*/
        FileOutputStream fos = new FileOutputStream(saveFile);
        try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fos))) {
            out.writeObject(projectFile);
            out.writeObject(affFiles);
            out.writeObject(unFiles);
            out.writeObject(genomeVersion);
            out.writeObject(qualityFilter);
            out.writeObject(snpViewSaveDirectory);
            out.writeObject(savedRegions);
            for (Color c : colorComp) {
                out.writeObject(c.toString());
            }

            out.close();
            projectLabel.setText("Project: " + projectFile.getName());
        }
        return true;
    } catch (IOException ex) {
        //ex.printStackTrace();
        Dialogs.showErrorDialog(null, "Could not save project file - IO error", "Save Failed", "SNP Viewer",
                ex);
        return false;
    }
}