Java AWT Color create from hexadecimal integer value

Description

Java AWT Color create from hexadecimal integer value

import java.awt.Color;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;

public class Main extends JFrame {
  public Main() {
    super("JButton");

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new FlowLayout());

    JButton bn = new JButton("Close");

    bn.setForeground(new Color(0xffffdd));
    //from ww  w  . j av  a  2s.co m
    getContentPane().add(bn);
  }

  public static void main(String[] args) {
    Main frame = new Main();
    frame.pack();
    frame.setVisible(true);
  }
}



PreviousNext

Related