Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Java setContentFrame over lapping JLabel? How do I fix it (https://www.askmehelpdesk.com/showthread.php?t=811155)

  • Apr 28, 2015, 06:33 PM
    jakob991
    Java setContentFrame over lapping JLabel? How do I fix it
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;


    public class Gui_Window extends JFrame {
    /**
    *
    */
    private static final long serialVersionUID = 1L;
    private JLabel Main_L;

    public Gui_Window() {
    setLayout(new FlowLayout());

    Main_L = new JLabel("Did you know it is possible to bind keys?");
    add(Main_L);
    }

    public static void main (String args[]) {
    Gui_Window gui = new Gui_Window();
    try{
    gui.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("C:/Users/Owner/Desktop/test/test.JPG")))));

    }catch(IOException e)

    {
    System.out.println("Image Not Found");
    }
    gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ;
    gui.setTitle("Gamers AudioMute");
    gui.setResizable(false);
    gui.setSize(1200,800);
    gui.setBackground(Color.YELLOW);
    gui.setVisible(true);

  • All times are GMT -7. The time now is 08:12 AM.