اظهار الجداول من الجهه اليمنى (JArabicTable)
صفحة 1 من اصل 1
اظهار الجداول من الجهه اليمنى (JArabicTable)
السلام عليكم
في هذا الدرس سنتعلم ان شاء الله
كيفية اظهار
الجداول من الجهة اليمنى.
لعمل ذلك نقوم بوراثة الكائن JTable
ثم ننشأ
الرسام الخاص بنا الذي يطبق دوال TableCellRenderer
الفئة JArabicTable تقوم بتحديد
الرسام الخاص
بها وهو في هذه الحالة ArabicCellRenderer:
public class
JArabicTable extends JTable {
public TableCellRenderer getCellRenderer(int row, int column) {
return new ArabicCellRenderer();
}
}
الان نقوم بتطبيق
الرسام وما
يهمنا هنا هو ان نحدد اتجاه الخانات:
class
ArabicCellRenderer implements TableCellRenderer {
public Component getTableCellRendererComponent(JTable
table,Objectvalue,boolean isSelected,boolean hasFocus,int row,int
column) {
final JLabel l = new JLabel();
l.setText(value.toString());
if(isSelected) {
l.setBackground(new Color(68,134,250));
}
else {
l.setBackground(Color.white);
}
l.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
return l;
}
}
الان قم باستعمال JArabicTable بدل
JTable
بالبرامج.
بهذا نصل الى نهاية الدرس الذي قمنا من خلاله بشرح كيفية اظهار
الجداول من
الجهة اليمنى.
في هذا الدرس سنتعلم ان شاء الله
كيفية اظهار
الجداول من الجهة اليمنى.
لعمل ذلك نقوم بوراثة الكائن JTable
ثم ننشأ
الرسام الخاص بنا الذي يطبق دوال TableCellRenderer
الفئة JArabicTable تقوم بتحديد
الرسام الخاص
بها وهو في هذه الحالة ArabicCellRenderer:
public class
JArabicTable extends JTable {
public TableCellRenderer getCellRenderer(int row, int column) {
return new ArabicCellRenderer();
}
}
الان نقوم بتطبيق
الرسام وما
يهمنا هنا هو ان نحدد اتجاه الخانات:
class
ArabicCellRenderer implements TableCellRenderer {
public Component getTableCellRendererComponent(JTable
table,Objectvalue,boolean isSelected,boolean hasFocus,int row,int
column) {
final JLabel l = new JLabel();
l.setText(value.toString());
if(isSelected) {
l.setBackground(new Color(68,134,250));
}
else {
l.setBackground(Color.white);
}
l.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
return l;
}
}
الان قم باستعمال JArabicTable بدل
JTable
بالبرامج.
بهذا نصل الى نهاية الدرس الذي قمنا من خلاله بشرح كيفية اظهار
الجداول من
الجهة اليمنى.
Ebisu- مبرمج جيد
- عدد المساهمات : 45
السٌّمعَة : 50
تاريخ التسجيل : 11/06/2010
العمر : 43
صفحة 1 من اصل 1
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى