krysalis-jcharts/src/java/org/krysalis/jcharts/designer/common/font StylesCombo.java,1.2,1.3 FontChooser.java,1.2,1.3

"Nathaniel G. Auvil" <[email protected]> Wed, 09 Jun 2004 01:43:58 +0000
Newsgroups gmane.comp.krysalis.jcharts.cvs
Message-ID <[email protected]>
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/common/font
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22123/src/java/org/krysalis/jcharts/designer/common/font

Modified Files:
	StylesCombo.java FontChooser.java 
Log Message:


Index: FontChooser.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/common/font/FontChooser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FontChooser.java	25 May 2004 01:04:08 -0000	1.2
--- FontChooser.java	9 Jun 2004 01:43:56 -0000	1.3
***************
*** 1,4 ****
  
- 
  package org.krysalis.jcharts.designer.common.font;
  
--- 1,3 ----
***************
*** 6,13 ****
--- 5,14 ----
  import org.krysalis.jcharts.designer.common.LabelledCombo;
  import org.krysalis.jcharts.designer.common.LabelledTextfield;
+ import org.krysalis.jcharts.designer.common.paint.PaintChooser;
  import org.krysalis.jcharts.designer.exceptions.DesignerException;
  import org.krysalis.jcharts.properties.util.ChartFont;
  
  import javax.swing.*;
+ 
  import java.awt.*;
  
***************
*** 19,67 ****
  	{
  		Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
! 		ALL_FONT_NAMES = new String[ allFonts.length ];
  
  		for( int i = 0; i < allFonts.length; i++ )
  		{
! 			ALL_FONT_NAMES[ i ] = allFonts[ i ].getName();
  		}
  	}
  
- 
- 	private String title;
  	private LabelledCombo fontCombo;
  	private LabelledTextfield size;
  	private LabelledCombo styleCombo;
  
! 
! 	/***********************************************************************************
! 	 *
  	 * @param title
! 	 **********************************************************************************/
  	public FontChooser( String title )
  	{
! 		super();
!       this.title= title;
! 
! 		super.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( this.title ),
! 																			  BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) ) );
  
! 		this.setLayout( new FlowLayout() );
  
  		this.fontCombo = new LabelledCombo( "Name:", ALL_FONT_NAMES );
! 		this.add( this.fontCombo );
  
! 		this.size= new LabelledTextfield( "Size:", 3 );
  		this.size.setText( "12" );
! 		this.add( this.size );
  
! 		this.styleCombo= new StylesCombo();
! 		this.add( this.styleCombo );
  	}
  
  
!  	/*********************************************************************************
! 	 *
  	 * @return ChartFont
! 	 ********************************************************************************/
  	public ChartFont getChartFont() throws DesignerException
  	{
--- 20,70 ----
  	{
  		Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
! 		ALL_FONT_NAMES = new String[allFonts.length];
  
  		for( int i = 0; i < allFonts.length; i++ )
  		{
! 			ALL_FONT_NAMES[i] = allFonts[i].getName();
  		}
  	}
  
  	private LabelledCombo fontCombo;
  	private LabelledTextfield size;
  	private LabelledCombo styleCombo;
+ 	private PaintChooser paintChooser;
+ 	
  
! 	/***************************************************************************************
! 	 * 
  	 * @param title
! 	 **************************************************************************************/
  	public FontChooser( String title )
  	{
! 		super.setBorder( BorderFactory.createTitledBorder( title ) );		
! 		this.setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) );
  
! 		JPanel jPanel= new JPanel();
  
  		this.fontCombo = new LabelledCombo( "Name:", ALL_FONT_NAMES );
! 		jPanel.add( this.fontCombo );
  
! 		this.size = new LabelledTextfield( "Size:", 3 );
  		this.size.setText( "12" );
! 		jPanel.add( this.size );
  
! 		this.styleCombo = new StylesCombo();
! 		jPanel.add( this.styleCombo );
! 		
! 		this.add( jPanel );
! 
! 		
! 		this.paintChooser= new PaintChooser( false, Color.black, Color.white );
! 		this.add( this.paintChooser );
  	}
  
  
! 	/***************************************************************************************
! 	 * 
  	 * @return ChartFont
! 	 **************************************************************************************/
  	public ChartFont getChartFont() throws DesignerException
  	{
***************
*** 71,79 ****
  		}
  
  
! 		Font font= new Font( this.fontCombo.getSelected(), this.styleCombo.getSelectedIndex(), Integer.parseInt( this.size.getText() ) );
! //todo Paint implementation?
!       ChartFont chartFont= new ChartFont( font, Color.black );
  		return chartFont;
  	}
! }
--- 74,83 ----
  		}
  
+ 		Font font = new Font( this.fontCombo.getSelected(),
+ 													this.styleCombo.getSelectedIndex(),
+ 													Integer.parseInt( this.size.getText() ) );
  
! 		ChartFont chartFont = new ChartFont( font, this.paintChooser.getPaint() );
  		return chartFont;
  	}
! }
\ No newline at end of file

Index: StylesCombo.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/designer/common/font/StylesCombo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** StylesCombo.java	25 May 2004 01:04:07 -0000	1.2
--- StylesCombo.java	9 Jun 2004 01:43:56 -0000	1.3
***************
*** 1,8 ****
  /***********************************************************************************************
-  * File Info: Id: $
-  * Copyright (C) 2002
-  * Author: Nathaniel G. Auvil
-  * Contributor(s):
-  *
   * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
   *
--- 1,3 ----
***************
*** 38,42 ****
   ************************************************************************************************/
  
- 
  package org.krysalis.jcharts.designer.common.font;
  
--- 33,36 ----
***************
*** 45,60 ****
  
  
! public class StylesCombo extends LabelledCombo
  {
  	private static String[] ALL_STYLES;
!    static
  	{
! 		ALL_STYLES= new String[]{ "PLAIN", "BOLD", "ITALIC" };
  	}
  
  
! 	/*******************************************************************************
! 	 *
! 	 ********************************************************************************/
  	public StylesCombo()
  	{
--- 39,59 ----
  
  
! /*****************************************************************************************
!  * 
!  * @author Nathaniel Auvil
!  * @version $Id$
!  ****************************************************************************************/
! class StylesCombo extends LabelledCombo
  {
  	private static String[] ALL_STYLES;
! 	static
  	{
! 		ALL_STYLES = new String[] { "PLAIN", "BOLD", "ITALIC"};
  	}
  
  
! 	/***************************************************************************************
! 	 *  
! 	 **************************************************************************************/
  	public StylesCombo()
  	{
***************
*** 62,64 ****
  	}
  
! }
--- 61,63 ----
  	}
  
! }
\ No newline at end of file



-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org