الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

تحويل الى اليمين في الحقول

مغلق
بدأه سامي عبدالله في 24 فبراير 2004 · 1 رد · 733 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

اخواني كيف اجعل الحقل اتجاه الكتاب فيه من اليمين وليست من اليسار

#2

سلام عليكم....

معليش شكلي اتخترت عليك

عموما انا احط الجواب هنا للفائدة.....

للتحويل من اليمين لليسار

شرح :

يوجد كلاس اسمه ComponentOrientation

وهو كلاس "فاينال final" ثابت

كل الكلاسات الموجودة في awt تستخدمه

There are four different orientations used in modern languages as in the following table.


 LT          RT          TL          TR   
 A B C       C B A       A D G       G D A
 D E F       F E D       B E H       H E B
 G H I       I H G       C F I       I F C

(In the header, the two-letter abbreviation represents the item direction in the first letter, and the line direction in the second. For example, LT means "items left-to-right, lines top-to-bottom", BL means "items bottom-to-top, lines bottom-to-top", and so on.) 
The orientations are: 

LT - Western Europe (optional for Japanese, Chinese, Korean) 
RT - Middle East (Arabic, Hebrew) 
TR - Japanese, Chinese, Korean 
TL - Mongolian 
Components whose view and controller code depends on orientation should use the isLeftToRight() and isHorizontal() methods to determine their behavior. They should not include switch-like code that keys off of the constants, such as: 
 
if (orientation == LEFT_TO_RIGHT) {
   ...
 } else if (orientation == RIGHT_TO_LEFT) {
   ...
 } else {
   // Oops
 }

 This is unsafe, since more constants may be added in the future and since it is not guaranteed that orientation objects will be unique.

كيفية الاستخدام :

أولا اي "كومبوننت component " يستخدم هذا الكلاس

Component.setComponentOrientation(ComponentOrientation o) 
          Set the language-sensitive orientation that is to be used to order the elements or text within this component.

طيب فإذا عندك textField مثلا

يجب ان تعمل الآتي

TextField tf = new TextField();
tf.setComponentOrientation( ComponentOrientation.RIGHT_TO_LEFT );

وخلاص سلامتك

وهذا الكلاس نفسة اذا حبيت تشوفه

java.awt 
Class ComponentOrientation
java.lang.Object
  |
  +--java.awt.ComponentOrientation


Field Summary 
static ComponentOrientation LEFT_TO_RIGHT 
          Items run left to right and lines flow top to bottom Examples: English, French. 
static ComponentOrientation RIGHT_TO_LEFT 
          Items run right to left and lines flow top to bottom Examples: Arabic, Hebrew. 
static ComponentOrientation UNKNOWN 
          Indicates that a component's orientation has not been set. 
  Method Summary 
static ComponentOrientation getOrientation(Locale locale) 
          Return the orientation that is appropriate for the given locale 
static ComponentOrientation getOrientation(ResourceBundle bdl) 
          Return the orientation appropriate for the given ResourceBundle's localization. 
 boolean isHorizontal() 
          Are lines horizontal? This will return true for horizontal, left-to-right writing systems such as Roman. 
 boolean isLeftToRight() 
          HorizontalLines: Do items run left-to-right?
Vertical Lines: Do lines run left-to-right?
This will return true for horizontal, left-to-right writing systems such as Roman.

ملاحظة

فيه كود مؤخذ من موقع صن

http://java.sun.com/j2se/1.3/docs/api/java...rientation.html

لماذا تكون الليغو اللعبة الأكثر عبقرية في العالم؟

لأنها غير قابلة للتجزئة ، وتختلف فيما بينها بالألوان و الأشكال ، وتمتلك القدرة على تكوين علاقات مع بعض. نستطيع أن نقول أن أجزاء الليغو أبدية. وهي تشبه الذرات في تراكيبها للكون

-----

وائل بن أحمد كابلي

مستشار تطوير برمجيات | مايكروسوفت للخدمات الاستشارية

MCSE | MCTS SharePoint Infrastructure | MCTS SharePoint - Development | MCP | MSF Essentials

http://blogs.msdn.com/wael

@waelkabli

هذا الموضوع مغلق.

مواضيع مشابهة