de.invation.code.toval.constraint.graphic.ConstraintListRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of TOVAL Show documentation
Show all versions of TOVAL Show documentation
TOVAL comprises a set of java classes for common programming issues. It includes utils for arrays, lists, sets and collections for convenient handling and modification, but also support for mathematic definitions concerning logic (clauses + resolution) together with some algorithms for permutations, powersets and resolution. Additionally it contains a number of types for multisets, matrices with object keys and much more.
The newest version!
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package de.invation.code.toval.constraint.graphic;
import de.invation.code.toval.constraint.NumberOperator;
import de.invation.code.toval.constraint.StringOperator;
import java.awt.Component;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import static javax.swing.SwingConstants.CENTER;
import static javax.swing.SwingConstants.LEFT;
/**
*
* @author stocker
*/
public class ConstraintListRenderer extends JLabel implements ListCellRenderer {
public ConstraintListRenderer() {
setOpaque(true);
setHorizontalAlignment(LEFT);
setVerticalAlignment(CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
setText(value.toString());
if (value instanceof NumberOperator || value instanceof StringOperator) {
// setToolTipText(String.format(((NumberOperator) value).getStringFormat(), value.toString()));
setToolTipText(((NumberOperator) value).getStringFormat());
}
return this;
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy