jRadiobutton Metro style

 Image Icon

  • Sediakan 3 buah icon untuk radio button, 20x20 pixel, hover, checked dan uncheck
  • Buat package/folder icon pada folder src {sourch packages), dan simpan ketiga icon di  dalamnya
 
 
Download Icon DISINI
 

Create Java Class

Example : jRadioButtonMetrostyle.java

import java.awt.Color;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JRadioButton;
/**
 *
 * @author AndiRustandi
 */
public class jRadioButtonMetrostyle extends JRadioButton {
    public jRadioButtonMetrostyle() {
        this.setIcon(new ImageIcon(getClass().getResource("/icon/RDUncheck.png")));
        this.setRolloverIcon(new ImageIcon(getClass().getResource("/icon/RDHover.png")));
        this.setSelectedIcon(new ImageIcon(getClass().getResource("/icon/RDCheked.png")));
        this.setFont(new Font("Segoe UI", Font.PLAIN, 12));
        this.setForeground(Color.white);
        this.setOpaque(false);
    }
}

Clean and Build

Right click java project, select clean and build

How to Use

  • Create Jframe 
  • Drag and drop jRadioButtonMetrostyle.java into jframe

 

Posting Komentar

0 Komentar