الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

برنامج يظهر من خلاله كيفية التعامل مع الإظهارات

Featured Replies

بتاريخ:

برنامج يظهر من خلاله كيفية التعامل مع الإظهارات في البرامج ..
كما في الصور التالية:
j1.JPG

j2.JPG

j3.JPG

الكود هو التالي:-

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.beans.*;


public class MyHoroscope extends JFrame {

Toolkit tk; //for getting the toolkit
Dimension dim; //for getting the screen resolution

JMenuBar menuBar;
JMenu menuFile, menuHelp, menuView;
JMenuItem itemShow, itemReset, itemExit, itemAbout, itemHelp, itemMetal, itemMotif, itemWindows;

JPanel panelHead, panelHead0, panelHead1;
JLabel lblName, lblBday;
JTextField txtName;
JButton butBday;

GridBagConstraints gbc;	

//myCalendar calendar;

public MyHoroscope() {
	
	super("Leo's Fortune Teller");
	
	menuBar = new JMenuBar();
	setJMenuBar(menuBar);
	
	menuFile = new JMenu("File");
	menuFile.setMnemonic('F');
	
	itemShow = new JMenuItem("Show Me");
	itemReset = new JMenuItem("Reset");
	itemExit = new JMenuItem("Exit");
	
	itemShow.setMnemonic('S');
	itemReset.setMnemonic('R');				
	itemExit.setMnemonic('X');
	
	menuFile.add(itemShow);
	menuFile.add(itemReset);
	menuFile.addSeparator();
	menuFile.add(itemExit);
	
	menuView = new JMenu("View");
	menuView.setMnemonic('V');
	
	itemMetal = new JMenuItem("Metal");
	itemMotif = new JMenuItem("Motifs");
	itemWindows = new JMenuItem("Windows");
	
	itemMetal.setMnemonic('M');
	itemMotif.setMnemonic('O');
	itemWindows.setMnemonic('W');
	
	itemMetal.setActionCommand("metal");
	itemMotif.setActionCommand("motif");
	itemWindows.setActionCommand("windows");
	
	itemMetal.addActionListener(lookandfeel);
	itemMotif.addActionListener(lookandfeel);
	itemWindows.addActionListener(lookandfeel);
	
	menuView.add(itemMetal);
	menuView.add(itemMotif);
	menuView.add(itemWindows);
					
	menuHelp = new JMenu("Help");
	menuHelp.setMnemonic('H');
	
	itemAbout = new JMenuItem("About");
	itemHelp = new JMenuItem("Help");
	
	itemAbout.setMnemonic('A');
	itemHelp.setMnemonic('H');
	
	menuHelp.add(itemAbout);
	menuHelp.add(itemHelp);
	
	menuBar.add(menuFile);
	menuBar.add(menuView);
	menuBar.add(menuHelp);
	
	getContentPane().add(header());
	//getContentPane().add(body());
	
	tk = this.getToolkit();
	dim = tk.getScreenSize();
	
	setBounds(dim.width/4, dim.height/4, 420, 340);
	setResizable(false);
	show();
}




protected JPanel header() {
	
	panelHead = new JPanel();
	panelHead.setLayout(new FlowLayout());
	panelHead0 = new JPanel();
	panelHead0.setLayout(new BorderLayout());
	panelHead1 = new JPanel();
	panelHead1.setLayout(new GridLayout(2,2));
	
	gbc = new GridBagConstraints();
	gbc.fill = GridBagConstraints.BOTH;
	
	lblName = new JLabel("Enter your Name:");
	lblBday = new JLabel("Enter your Birthday:");
	
	butBday = new JButton("Click Here!");
	butBday.addActionListener(months);	
	txtName = new JTextField("",15);

		
	panelHead1.add(lblName);
	panelHead1.add(txtName);
	panelHead1.add(lblBday);
	panelHead1.add(butBday);

	
	panelHead0.add(panelHead1, BorderLayout.CENTER);
	panelHead.add(panelHead0);
	
	return panelHead;
}

ActionListener lookandfeel = new ActionListener(){
	
	public void actionPerformed(ActionEvent ae){
		Object source = ae.getActionCommand();
		String plaf = "";
			
			if (source == "metal")
				plaf = "javax.swing.plaf.metal.MetalLookAndFeel";		
			else if (source == "motif")
				plaf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
			else if (source == "windows")
				plaf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
					
			try {
		
					UIManager.setLookAndFeel(plaf);
					SwingUtilities.updateComponentTreeUI(MyHoroscope.this);
			} catch (Exception e) {

			
		}
			
	}		
	
};



ActionListener months = new ActionListener() {
	
	public void actionPerformed(ActionEvent ae) {
		
		//calendar = new myCalendar();
		//calendar.show();	
		
	}
};

public static void main(String args[]) {
	

	
	MyHoroscope horoscope = new MyHoroscope();
}
}

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.