public static Font getFont(Font initial)
		{
		if (initial == null)
			initial = new Font("Arial",Font.PLAIN,12);

		map = new Hashtable<TextAttribute,Object>();
		map.put(TextAttribute.FAMILY, initial.getFamily());
		map.put(TextAttribute.SIZE, initial.getSize());
		if (initial.isBold())
			map.put(TextAttribute.WEIGHT,TextAttribute.WEIGHT_BOLD);
		else
			map.put(TextAttribute.WEIGHT,TextAttribute.WEIGHT_REGULAR);
		
		if (initial.isItalic())
			map.put(TextAttribute.POSTURE,TextAttribute.POSTURE_OBLIQUE);
		else
			map.put(TextAttribute.POSTURE,TextAttribute.POSTURE_REGULAR);
		
		if (initial.getAttributes().get(TextAttribute.UNDERLINE) == null)
			map.put(TextAttribute.UNDERLINE,-1);
		else
			map.put(TextAttribute.UNDERLINE,initial.getAttributes().get(TextAttribute.UNDERLINE));
		
		font = new Font(map);
		
		String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
		
		d = new JDialog((JFrame) null,Resources.getString("FontDialog.TITLE"));
		d.setModal(true);
		d.setLayout(new BorderLayout());
		d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		d.setResizable(false);
		d.addWindowListener(new WindowAdapter()
			{
				public void windowClosing(WindowEvent e)
					{
					font = null;
					}
			});
		
		JPanel gridPanel = new JPanel();
		gridPanel.setLayout(new GridLayout(3,1));
		
		JPanel topPanel = new JPanel();
		topPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
		
		topPanel.add(new JLabel(Resources.getString("FontDialog.FONT")));
		fonts = new JComboBox<String>(fontNames);
		fonts.setSelectedItem(font.getName());
		fonts.addActionListener(action);
		topPanel.add(fonts);

		topPanel.add(new JLabel(Resources.getString("FontDialog.SIZE")));
		size = new JSpinner(new SpinnerNumberModel(font.getSize(),1,2000,1));
		size.addChangeListener(change);
		topPanel.add(size);
		
		gridPanel.add(topPanel);
		
		JPanel stylePanel = new JPanel();
		stylePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
		bold = new JToggleButton(Resources.getIconForKey("FontDialog.BOLD"));
		bold.addActionListener(action);
		stylePanel.add(bold);
		italic = new JToggleButton(Resources.getIconForKey("FontDialog.ITALIC"));
		italic.addActionListener(action);
		stylePanel.add(italic);
		underlined = new JToggleButton(Resources.getIconForKey("FontDialog.UNDERLINED"));
		underlined.addActionListener(action);
		stylePanel.add(underlined);
		
		gridPanel.add(stylePanel);
		gridPanel.add(new JLabel(Resources.getString("FontDialog.PREVIEW")));
		d.add(gridPanel, BorderLayout.NORTH);
		
		preview = new JTextArea();
		preview.setFont(font);
		preview.setText("AaBbCc0123456789");
		preview.setPreferredSize(new Dimension(160, 128));
		d.add(preview, BorderLayout.CENTER);
		
		JPanel bottomPanel = new JPanel();
		bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
		bottomPanel.add(okButton = new JButton(Resources.getString("FontDialog.OK")));
		okButton.addActionListener(action);
		bottomPanel.add(cancelButton = new JButton(Resources.getString("FontDialog.CANCEL")));
		cancelButton.addActionListener(action);
		d.add(bottomPanel, BorderLayout.SOUTH);

		d.pack();
		Dimension res = Toolkit.getDefaultToolkit().getScreenSize();
		d.setLocation(res.width / 2 - d.getWidth() / 2,res.height / 2 - d.getHeight() / 2);
		d.setVisible(true);
		
		return font;
		}