Example usage for javax.swing JButton hashCode

List of usage examples for javax.swing JButton hashCode

Introduction

In this page you can find the example usage for javax.swing JButton hashCode.

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:kolacer.Kolacer.java

private void jBut_barva_grad_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBut_barva_grad_ActionPerformed
    JButton sauc = (JButton) evt.getSource();
    short gradID = -1;
    int saucHash = sauc.hashCode();

    if (saucHash == jBut_barva_grad_A.hashCode()) {
        gradID = 0;//from  w  w w  . j  a va  2s. c  o  m
    } else if (saucHash == jBut_barva_grad_B.hashCode()) {
        gradID = 1;
    } else {
        System.err.println("Invailt gradient color change from: " + sauc.getName());
        return;
    }

    Color bar = ziskejBarvu(false);
    if (bar == null)
        return;
    switch (gradID) {
    case 0:
        jBut_barva_grad_A.setBackground(barvaGradA = bar);
        break;
    case 1:
        jBut_barva_grad_B.setBackground(barvaGradB = bar);
        break;
    }

}