Search in sources :

Example 1 with RedGreenColourGradient

use of uk.ac.babraham.SeqMonk.Gradients.RedGreenColourGradient in project SeqMonk by s-andrews.

the class GradientScaleBar method main.

public static void main(String[] args) {
    JFrame frame = new JFrame("Gradient test");
    frame.setContentPane(new GradientScaleBar(new RedGreenColourGradient(), -5, 5));
    frame.setSize(50, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}
Also used : RedGreenColourGradient(uk.ac.babraham.SeqMonk.Gradients.RedGreenColourGradient) JFrame(javax.swing.JFrame)

Example 2 with RedGreenColourGradient

use of uk.ac.babraham.SeqMonk.Gradients.RedGreenColourGradient in project SeqMonk by s-andrews.

the class DisplayPreferences method setGradient.

public void setGradient(int gradientType) {
    if (equalsAny(new int[] { GRADIENT_GREYSCALE, GRADIENT_HOT_COLD, GRADIENT_RED_GREEN, GRADIENT_MAGENTA_GREEN, GRADIENT_RED_WHITE }, gradientType)) {
        currentGradientValue = gradientType;
        switch(gradientType) {
            case GRADIENT_GREYSCALE:
                currentGradient = new GreyscaleColourGradient();
                break;
            case GRADIENT_HOT_COLD:
                currentGradient = new HotColdColourGradient();
                break;
            case GRADIENT_RED_GREEN:
                currentGradient = new RedGreenColourGradient();
                break;
            case GRADIENT_MAGENTA_GREEN:
                currentGradient = new MagentaGreenColourGradient();
                break;
            case GRADIENT_RED_WHITE:
                currentGradient = new RedWhiteColourGradient();
                break;
        }
        if (invertGradient) {
            currentGradient = new InvertedGradient(currentGradient);
        }
        optionsChanged();
    } else {
        throw new IllegalArgumentException("Value " + gradientType + " is not a valid gradient type");
    }
}
Also used : HotColdColourGradient(uk.ac.babraham.SeqMonk.Gradients.HotColdColourGradient) GreyscaleColourGradient(uk.ac.babraham.SeqMonk.Gradients.GreyscaleColourGradient) RedGreenColourGradient(uk.ac.babraham.SeqMonk.Gradients.RedGreenColourGradient) InvertedGradient(uk.ac.babraham.SeqMonk.Gradients.InvertedGradient) MagentaGreenColourGradient(uk.ac.babraham.SeqMonk.Gradients.MagentaGreenColourGradient) RedWhiteColourGradient(uk.ac.babraham.SeqMonk.Gradients.RedWhiteColourGradient)

Aggregations

RedGreenColourGradient (uk.ac.babraham.SeqMonk.Gradients.RedGreenColourGradient)2 JFrame (javax.swing.JFrame)1 GreyscaleColourGradient (uk.ac.babraham.SeqMonk.Gradients.GreyscaleColourGradient)1 HotColdColourGradient (uk.ac.babraham.SeqMonk.Gradients.HotColdColourGradient)1 InvertedGradient (uk.ac.babraham.SeqMonk.Gradients.InvertedGradient)1 MagentaGreenColourGradient (uk.ac.babraham.SeqMonk.Gradients.MagentaGreenColourGradient)1 RedWhiteColourGradient (uk.ac.babraham.SeqMonk.Gradients.RedWhiteColourGradient)1