The first two for the moment Display availble fonts in a choice box below and swing has a custom class called JColorChooser to make easy selecting colours:
Code:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class FontView extends JFrame{
private String fontNames[];
private GraphicsEnvironment gEnv;
private Choice fontChoices;
private ItemListener listListener=new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(ie.getStateChange()==ItemEvent.SELECTED)
System.out.println("You selected " + fontChoices.getSelectedItem());
}
};
public FontView(){
gEnv=GraphicsEnvironment.getLocalGraphicsEnvironment();
fontNames=gEnv.getAvailableFontFamilyNames();
fontChoices=new Choice();
fontChoices.addItemListener(listListener);
setupFontChoices();
setSize(400,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().add(fontChoices);
show();
}
private void setupFontChoices(){
for(int i=0; i<fontNames.length;i++)
fontChoices.add(fontNames[i]);
}
public static void main(String args[]){
FontView fv=new FontView();
}
}