Ortga tugmachasini bosish orqali boshqa obida tanlanadigan oynaga o’tishimiz mumkin va boshqa tarixiy yodgorlikni tanlashimiz mumkin.
Dastur kodi:
package course_work;
import java.awt.Image;
import javax.swing.Icon;
import javax.swing.ImageIcon;
public class window_1 extends javax.swing.JFrame {
public window_1() {
initComponents();
this.setResizable(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("0.jpg").getImage().getScaledInstance(500, 500, Image.SCALE_DEFAULT));
jLabel1.setIcon(imageIcon);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
window_2 win_2= new window_2();
win_2.show();
this.setVisible(false);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
window_3 win_3=new window_3();
win_3.show();
this.setVisible(false);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new window_1().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
// End of variables declaration
package course_work;
import java.awt.Image;
import javax.swing.ImageIcon;
public class window_3 extends javax.swing.JFrame {
public window_3() {
initComponents();
this.setResizable(false);
}
package course_work;
public class window_2 extends javax.swing.JFrame {
public window_2() {
initComponents();
this.setResizable(false);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
window_1 win_1=new window_1();
win_1.show();
this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
String str="Ushbu dastur java dasturlash tilda yaratilgan bo'lib ,"
+ "u mamlakatimizda mavjud tarixiy \n obidalar haqida ma'lumot beruvchi dastur \n hisoblanadi. "
+ "Dasturdan foydalanish tartibi : \n Kerakli viloyatni tanlang va "
+ "o'sha viloyatda \n joylashgan kerakli tarixiy obida yoki \n maqbarani tanlang . \n "
+ "Keyingi oynada siz tanlagan tarixiy obida \n yoki maqbara bo'yicha "
+ "kerakli ma'lumotlarga ega bo'lishingiz mumkin.";
jTextArea1.setText(str);
jTextArea1.setLineWrap(true);
jTextArea1.setEditable(false);
jTextArea1.setFocusable(false);
} public static void main(String args[]) {
ava.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new window_2().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration
} private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
window_1 win_1 = new window_1();
win_1.show();
this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
window_4 win_4=new window_4();
win_4.k=0;
ImageIcon imageIcon=new ImageIcon(new ImageIcon("buxoro_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("buxoro_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(true);
jRadioButton4.setVisible(true);
jRadioButton1.setText("Namozgoh Masjidi");
jRadioButton2.setText("Mir Arab madrasasi");
jRadioButton3.setText("Minorai kalon");
jRadioButton4.setText("Ko'kaldosh madrasasi");
}
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
if (jComboBox1.getSelectedIndex() == 0) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("buxoro_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("buxoro_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(true);
jRadioButton4.setVisible(true);
jRadioButton1.setText("Namozgoh Masjidi");
jRadioButton2.setText("Mir Arab madrasasi");
jRadioButton3.setText("Minorai kalon");
jRadioButton4.setText("Ko'kaldosh madrasasi");
}
if (jComboBox1.getSelectedIndex() == 1) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("fargona_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("fargona_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(false);
jRadioButton4.setVisible(false);
jRadioButton1.setText("Ahmad al-Farg'oniy majmuasi");
jRadioButton2.setText("Burxoniddin Marg'inoniy maqbarasi") }
if (jComboBox1.getSelectedIndex() == 2) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("namangan_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("namangan_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(true);
jRadioButton4.setVisible(false);
jRadioButton1.setText("Mulla Qirg'iz madrasasi");
jRadioButton2.setText("Mullo Bozor Oxund maqbarasi");
jRadioButton3.setText("Xo'ja Amin maqbarasi");}
if (jComboBox1.getSelectedIndex() == 3) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("navoiy_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("navoiy_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(false);
jRadioButton4.setVisible(false);
jRadioButton1.setText("Mirsaid Bahrom maqbarasi");
jRadioButton2.setText("Qosim Shayx Azizxon maqbarasi");
}
if (jComboBox1.getSelectedIndex() == 4) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("qashqadaryo_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("qashqadaryo_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(false);
jRadioButton4.setVisible(false);
jRadioButton1.setText("Husam ota majmuasi");
jRadioButton2.setText("Langar ota majmuasi");
}
if (jComboBox1.getSelectedIndex() == 5) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("samarqand_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("samarqand_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(true);
jRadioButton4.setVisible(true);
jRadioButton1.setText("Bibixonim masjidi");
jRadioButton2.setText("Imom al-Buxoriy yodgorlik majmuasi");
jRadioButton3.setText("Ruhobod maqbarasi");
jRadioButton4.setText("Shohizinda maqbaralar majumasi"); }
if (jComboBox1.getSelectedIndex() == 6) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("surxondaryo_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("surxondaryo_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(false);
jRadioButton4.setVisible(false);
jRadioButton1.setText("Hakim at-Termiziy yodgorlik majmuasi");
jRadioButton2.setText("Jarqo'rg'on minorasialar majumasi");
}
if (jComboBox1.getSelectedIndex() == 7) {
ImageIcon imageIcon=new ImageIcon(new ImageIcon("toshkent_1.jpg").getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT));
jLabel2.setIcon(imageIcon);
imageIcon=new ImageIcon(new ImageIcon("toshkent_2.jpg").getImage().getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), Image.SCALE_DEFAULT));
jLabel3.setIcon(imageIcon);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(false);
jRadioButton4.setVisible(false);
jRadioButton1.setText("Baroqxon maqbarasi");
jRadioButton2.setText("Ko'kaldosh madrasasi");
}
}
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
window_4 win_4=new window_4();
win_4.r=1;
if(jComboBox1.getSelectedIndex()==0) win_4.k=0;
if(jComboBox1.getSelectedIndex()==1) win_4.k=1;
if(jComboBox1.getSelectedIndex()==2) win_4.k=2;
if(jComboBox1.getSelectedIndex()==3) win_4.k=3;
if(jComboBox1.getSelectedIndex()==4) win_4.k=4;
if(jComboBox1.getSelectedIndex()==5) win_4.k=5;
if(jComboBox1.getSelectedIndex()==6) win_4.k=6;
if(jComboBox1.getSelectedIndex()==7) win_4.k=7;
if(jComboBox1.getSelectedIndex()==8) win_4.k=8;
if(jComboBox1.getSelectedIndex()==9) win_4.k=9;
win_4.show();
this.setVisible(false);
}
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
window_4 win_4=new window_4();
win_4.r=2;
if(jComboBox1.getSelectedIndex()==0) win_4.k=0;
if(jComboBox1.getSelectedIndex()==1) win_4.k=1;
if(jComboBox1.getSelectedIndex()==2) win_4.k=2;
if(jComboBox1.getSelectedIndex()==3) win_4.k=3;
if(jComboBox1.getSelectedIndex()==4) win_4.k=4;
if(jComboBox1.getSelectedIndex()==5) win_4.k=5;
if(jComboBox1.getSelectedIndex()==6) win_4.k=6;
if(jComboBox1.getSelectedIndex()==7) win_4.k=7;
if(jComboBox1.getSelectedIndex()==8) win_4.k=8;
if(jComboBox1.getSelectedIndex()==9) win_4.k=9;
win_4.show();
this.setVisible(false);
}
private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {
window_4 win_4=new window_4();
win_4.r=3;
if(jComboBox1.getSelectedIndex()==0) win_4.k=0;
if(jComboBox1.getSelectedIndex()==1) win_4.k=1;
if(jComboBox1.getSelectedIndex()==2) win_4.k=2;
if(jComboBox1.getSelectedIndex()==3) win_4.k=3;
if(jComboBox1.getSelectedIndex()==4) win_4.k=4;
if(jComboBox1.getSelectedIndex()==5) win_4.k=5;
if(jComboBox1.getSelectedIndex()==6) win_4.k=6;
if(jComboBox1.getSelectedIndex()==7) win_4.k=7;
if(jComboBox1.getSelectedIndex()==8) win_4.k=8;
if(jComboBox1.getSelectedIndex()==9) win_4.k=9;
win_4.show();
this.setVisible(false);
}
private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {
window_4 win_4=new window_4();
win_4.r=4;
if(jComboBox1.getSelectedIndex()==0) win_4.k=0;
if(jComboBox1.getSelectedIndex()==1) win_4.k=1;
if(jComboBox1.getSelectedIndex()==2) win_4.k=2;
if(jComboBox1.getSelectedIndex()==3) win_4.k=3;
if(jComboBox1.getSelectedIndex()==4) win_4.k=4;
if(jComboBox1.getSelectedIndex()==5) win_4.k=5;
if(jComboBox1.getSelectedIndex()==6) win_4.k=6;
if(jComboBox1.getSelectedIndex()==7) win_4.k=7;
if(jComboBox1.getSelectedIndex()==8) win_4.k=8;
if(jComboBox1.getSelectedIndex()==9) win_4.k=9;
win_4.show();
this.setVisible(false);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new window_3().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.ButtonGroup buttonGroup1;
public javax.swing.JButton jButton1;
public javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
public javax.swing.JRadioButton jRadioButton1;
public javax.swing.JRadioButton jRadioButton2;
public javax.swing.JRadioButton jRadioButton3;
public javax.swing.JRadioButton jRadioButton4;
// End of variables declaration
}
Do'stlaringiz bilan baham: |