JTextField in applet problem?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: JTextField in applet problem?

  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.

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center