0% found this document useful (0 votes)
51 views2 pages

GUI

Uploaded by

sivarwshyar1982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views2 pages

GUI

Uploaded by

sivarwshyar1982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import javax.swing.

*;
import javax.swing.JLabel;
import javax.swing.border.Border;
import javax.swing.BorderFactory;
import java.awt.*;

public class GUI {


public static void main(String[]args){
JLabel label=new JLabel();
label.setText("hello iam a new programmer !");
ImageIcon image=new ImageIcon("logo.jpg");
Border border=BorderFactory.createLineBorder(Color.green,18); //
bakarde bo chwar chewa !

label.setIcon(image);
label.setHorizontalTextPosition(JLabel.CENTER);
label.setVerticalTextPosition(JLabel.TOP);
label.setHorizontalAlignment(JLabel.CENTER);
label.setVerticalAlignment(JLabel.TOP);
label.setFont(new Font("MV Boli",Font.BOLD,60));
label.setIconTextGap(10);
label.setForeground(Color.green);
label.setBackground(Color.black);
label.setOpaque(true);
label.setBorder(border);
//label.setBounds(200,150,600,600); ama boxoy labelaka abat jyay akatawa la framaka
!

JFrame frame=new JFrame();


// frame.setSize(900,800); labar away packman bakar henawa boya .
// frame.setLayout(null); lagal setbounds daya.
frame.setTitle("SIVAR");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(true);
frame.getContentPane().setBackground(Color.black);
frame.setIconImage(image.getImage());
frame.setVisible(true);
frame.add(label);
frame.pack();

}
}

/*import javax.swing.JPanel;
import javax.swing.ImageIcon;
import javax.swing.*;
import java.awt.*;

public class panel {


public static void main(String[]args){
// JPanel = a GUI component that functions as a container to hold other
component.
ImageIcon image=new ImageIcon("img.png");
JLabel label=new JLabel();
label.setText("software");
label.setIcon(image);
label.setForeground(Color.GREEN);
label.setFont(new Font("MV Boli",Font.BOLD,50));
label.setBounds(0,-70,300,300);

JPanel rpanel=new JPanel();


rpanel.setBackground(Color.green);
rpanel.setBounds(0,0,750,300);

JPanel bpanel=new JPanel();


bpanel.setBackground(Color.orange);
bpanel.setBounds(0,250,750,300);

JPanel gpanel=new JPanel();


gpanel.setBackground(Color.red);
gpanel.setBounds(0,500,750,350);

JFrame frame =new JFrame();


frame.setIconImage(image.getImage());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(750,900);
frame.setVisible(true);
frame.add(label);
frame.setLayout(null);
frame.add(rpanel);
bpanel.add(label);
frame.add(bpanel);
frame.add(gpanel);

}
}*/

You might also like