Import java awt.*; import javax swing. Jframe; public class



Download 15,29 Kb.
Sana25.11.2019
Hajmi15,29 Kb.
#27025
Bog'liq
Javada Grafika

JAVADA GRAFIKA

import java.awt.*;


import javax.swing.JFrame;

public class DisplayGraphics extends Canvas{

public void paint(Graphics g) {
g.drawString("Java garfikasi bilan ishlash",40,40);
setBackground(Color.WHITE);
g.fillRect(130, 30,100, 80);
g.drawOval(30,130,50, 60);
setForeground(Color.RED);
g.fillOval(130,130,50, 60);
g.drawArc(30, 200, 40,50,90,60);
g.fillArc(30, 130, 40,50,180,40);

}
public static void main(String[] args) {


DisplayGraphics m=new DisplayGraphics();
JFrame f=new JFrame();
f.add(m);
f.setTitle("Javada grafika");
f.setSize(400,400);
//f.setLayout(null);
f.setVisible(true);
}

}

JAVADA IMAGE ICON



import java.awt.*;
class IconExample {
IconExample(){
Frame f=new Frame();
Image icon = Toolkit.getDefaultToolkit().getImage("D:\\input\\app.png");
f.setIconImage(icon);
f.setLayout(null);
f.setSize(400,400);
f.setVisible(true);
}
public static void main(String args[]){
new IconExample();
}
}

JAVA SWING 2TA OYNA

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
* Created by Akmal on 28.05.2019.
*/
public class AddGui {
public static void main(String[] args) {
Addition obj=new Addition();
}
}
class Addition extends JFrame implements ActionListener{
JTextField t1,t2;
JButton b;
JLabel l;
public Addition(){
t1=new JTextField(20);
t2=new JTextField(20);
b=new JButton("ok");
l=new JLabel("Result");
add(t1);
add(t2);
add(b);
add(l);

b.addActionListener(this);
setLayout(new FlowLayout());
setVisible(true);
setSize(400,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

@Override


public void actionPerformed(ActionEvent e) {

}
}_________________________________________________________


import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Caller {
public static void main(String[] args) {
X obj=new X();
}
}
class X extends JFrame{
public X(){
JButton b=new JButton("Add Form");
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new Addition();
dispose();
}
});
add(b);
setLayout(new FlowLayout());
setVisible(true);
setSize(400,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}
}
Download 15,29 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish