Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import javax.swing.ImageIcon;
- import javax.swing.JFrame;
- import java.awt.Container;
- import javax.swing.JLabel;
- public class Frame extends JFrame{
- private ImageIcon icon;//for setting icon creating a ImageIcon object
- private Container c;
- private JLabel label;
- Frame()
- {
- setVisible(true);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(200,50,300,500);
- setTitle("Title");
- iconMethod();
- }
- public void iconMethod()
- {
- c=this.getContentPane();
- c.setLayout(null);
- c.setBackground(Color.PINK);
- label=new JLabel();
- label.setText("Enter Your Name : ");
- label.setBounds(50,20,150,50);
- c.add(label);
- icon=new ImageIcon(getClass().getResource("illustrator.png"));//icon setting
- this.setIconImage(icon.getImage()); //icon getting
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement