المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Little Help in Java :>



wildkitty
28-10-2007, 02:04 AM
السلام عليكم

شلونكم شخباركم :p

أنا قاعده أسوي مشروعي بالجافا نتعامل مع جي يو اي يعني مو الشاشه السوده الي تطلع (البرموت وندو)
فابي شنو بالضبط الاوامر

مثلا :يطلع منيو فيها المواد وجبالهم مربعين واليوزر ينقي راديو بوتوم
الماده الوله المجتازه وغير مجتازه
الماده الثانيه مجتاز غير مجتاز
الماده الثالثه مجتاز غير مجتاز

بعد الحوس والدواره خل اوريكم الكود الي لقيته انا فهمته يعني بس ماعرفت شلون احرف فيه عدل عشان يعطيني الي ابيه وعدلتها يسوي ربع الي ابيه اهو مال الفونت بس انا غيرت فيه شوي


.
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;

public class RadioButtonFrame extends JFrame
{
private JTextField textField; // used to display font changes
private Font plainFont; // font for plain text
private Font boldFont; // font for bold text
private Font italicFont; // font for italic text
private Font boldItalicFont; // font for bold and italic text
private JRadioButton plainJRadioButton; // selects plain text
private JRadioButton boldJRadioButton; // selects bold text
private JRadioButton italicJRadioButton; // selects italic text
private JRadioButton boldItalicJRadioButton; // bold and italic
private ButtonGroup radioGroup; // buttongroup to hold radio buttons

// RadioButtonFrame constructor adds JRadioButtons to JFrame
public RadioButtonFrame()
{
super( "RadioButton Test" );
setLayout( new FlowLayout() ); // set frame layout

textField = new JTextField( "ELU 240 java program", 25 );
add( textField ); // add textField to JFrame

// create radio buttons
plainJRadioButton = new JRadioButton( "taken", true );
boldJRadioButton = new JRadioButton( "untaken", false );

add( plainJRadioButton ); // add plain button to JFrame
add( boldJRadioButton ); // add bold button to JFrame



// create logical relationship between JRadioButtons
radioGroup = new ButtonGroup(); // create ButtonGroup
radioGroup.add( plainJRadioButton ); // add plain to group
radioGroup.add( boldJRadioButton ); // add bold to group


// create font objects
plainFont = new Font( "Serif", Font.PLAIN, 14 );
boldFont = new Font( "Serif", Font.BOLD, 14 );
textField.setFont( plainFont ); // set initial font to plain

// register events for JRadioButtons
plainJRadioButton.addItemListener(
new RadioButtonHandler( plainFont ) );
boldJRadioButton.addItemListener(
new RadioButtonHandler( boldFont ) );

} // end RadioButtonFrame constructor

// private inner class to handle radio button events
private class RadioButtonHandler implements ItemListener
{
private Font font; // font associated with this listener

public RadioButtonHandler( Font f )
{
font = f; // set the font of this listener
} // end constructor RadioButtonHandler

// handle radio button events
public void itemStateChanged( ItemEvent event )
{
textField.setFont( font ); // set font of textField
} // end method itemStateChanged
} // end private inner class RadioButtonHandler
public static void main(String args[])
{
RadioButtonFrame radioButtonFrame = new RadioButtonFrame();
radioButtonFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
radioButtonFrame.setSize( 300, 100 ); // set frame size
radioButtonFrame.setVisible( true ); // display frame

}
} // end class RadioButtonFrame

RealNoooH
12-11-2007, 09:54 PM
السلام عليكم

الرجاء التوضيح أكثر ، كما يفضل أستخدام اللغة العربية الفصحى ، وإن شاء الله يصل المطلوب بعد التوضيح مباشرةً

تحياتي (RealNoooH)