DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    2

    JTextField in applet problem?

    ok say i have the following code

    Code:
    // create label and text field for Amount
    		AmountLabel = new JLabel( "           Amount  ");
    		container.add( AmountLabel );
    		AmountField = new JTextField( 15 );
    		
    		container.add( AmountField );
    		
    				
    		// create label and text field for salesTax
    		salesTaxLabel = new JLabel( "       Sales Tax  " );
    		container.add( salesTaxLabel );
    		salesTaxField = new JTextField( 15 );
    		salesTaxField.setEditable( false );
    		container.add( salesTaxField );
    How do i make it so that in those text fields that the data right aligns instead of left aligns?

  2. #2
    Join Date
    Mar 2003
    Posts
    86

    setHorizontalAlignment(int alignment)

    Did you try using the alignment method?

    Sharbov.

  3. #3
    Join Date
    Jul 2003
    Posts
    2
    I tried some method like that and it said RIGHT_ALIGNMENT but it did not work and im not sure i used it right. Can someone show me the correct way to use it??

  4. #4
    Join Date
    Jul 2003
    Posts
    4
    Check the API, JTextField inherits a RIGHT_ALIGNMENT field from JComponent. Try using that.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links