All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mmb.menu.components.ImageTextList Maven / Gradle / Ivy

Go to download

Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world. THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<

There is a newer version: 0.6
Show newest version
/**
 * 
 */
package mmb.menu.components;

import javax.swing.*;

import mmb.menu.components.ImageTextList.ImageAndText;

import java.awt.*;

/**
 * @author oskar
 *
 */
public class ImageTextList extends JList {
	public ImageTextList() {
		super();
		setCellRenderer(new CellRenderer());
	}

	/**
		 * @author oskar
		 *
		 */
	public class ImageAndText {
		public Image img;
		public String s;
	}

	protected class CellRenderer implements ListCellRenderer{

		@Override
		public Component getListCellRendererComponent(JList list, ImageAndText value, int index, boolean isSelected, boolean cellHasFocus) {
			JLabel label = new JLabel();
			label.setText(value.s);
			label.setIcon(new ImageIcon(value.img));
			return label;
		}
		
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy