Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8970259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:42:20+00:00 2026-06-15T17:42:20+00:00

I am working on this program, using swing. Every time I export the program,

  • 0

I am working on this program, using swing. Every time I export the program, and run it, the GUI I atempt to set up doesn’t appear. The JFrame does, but not the inner components. Thanks in advance ~Airis

Code:

import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.*;

public class Login {
    public static void login_Interface(){

        //Start GUI style//
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (ClassNotFoundException e1) {
            e1.printStackTrace();
        } catch (InstantiationException e1) {
            e1.printStackTrace();
        } catch (IllegalAccessException e1) {
            e1.printStackTrace();
        } catch (UnsupportedLookAndFeelException e1) {
            e1.printStackTrace();
        }
        //      End     //

        JFrame login_Frame = new JFrame("Login - LetsMeet");
        login_Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        login_Frame.setSize(750, 650);
        login_Frame.setResizable(true);

        JPanel panel_Title = new JPanel();                            //PANEL Title
        panel_Title.setBounds(0, 0, 750, 150);
        panel_Title.setLayout(null);
        Image logo = null;
        try {
            logo = ImageIO.read(new File("Data/images/logo_letsmeet.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        Graphics2D logo_out = ((BufferedImage) logo).createGraphics();
        panel_Title.paint(logo_out);

        JPanel login_Panel = new JPanel();                            //LOGIN Panel
        login_Panel.setBounds(0, 150, 350, 150);
        login_Panel.setLayout(null);
        JTextField username_login = new JTextField("Username");
        username_login.setBounds(100, 50, 100, 25);
        JPasswordField password_login = new JPasswordField();
        password_login.setBounds(200, 50, 100, 25);
        JButton login_go = new JButton("Login");
        login_go.setBounds(200, 50, 100, 25);
        login_Panel.add(password_login);
        login_Panel.add(username_login);


        JPanel panel_Divider = new JPanel();                          //PANEL Divider
        login_Panel.setBounds(350, 150, 50, 150);
        panel_Divider.setSize(50, 100);
        panel_Divider.setLayout(null);
        Image sep = null;
        try {
            sep = ImageIO.read(new File("Data/images/sep.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        Graphics2D div = ((BufferedImage) sep).createGraphics();
        panel_Title.paint(div);

        JPanel register_Panel = new JPanel();                         //REGISTER Panel
        register_Panel.setBounds(400, 150, 350, 150);
        register_Panel.setLayout(null);

        login_Frame.add(panel_Title);
        login_Frame.add(login_Panel);
        login_Frame.add(panel_Divider);
        login_Frame.add(register_Panel);
        login_Frame.setVisible(true);
    }
}

Errors: None

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:42:21+00:00Added an answer on June 15, 2026 at 5:42 pm

    Besides all the suggestion made by @MadProgammer, you need to add your controls to the JFrame content pane, like this:

    login_Frame.getContentPane().add(panel_Title);
    login_Frame.getContentPane().add(login_Panel);
    ...
    

    Then your controls should appear

    Update:

    Running your actual code, and adding a colored border to the containers (JPanels), I got the following:

    panel_Title.setBorder(BorderFactory.createLineBorder(Color.BLUE));
    login_Panel.setBorder(BorderFactory.createLineBorder(Color.RED));
    panel_Divider.setBorder(BorderFactory.createLineBorder(Color.GREEN));
    register_Panel.setBorder(BorderFactory.createLineBorder(Color.YELLOW));
    

    enter image description here

    Basically your code has layout configuration problems. Again, follow the suggestion of @MadProgammer. You could use this border trick in future to debug your layouts

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a picture select/crop program and using this code below: http://www.androidworks.com/crop_large_photos_with_android/comment-page-1#comment-969 As
i am working on a program in Python and using Pygame. this is what
I've been working on this elevator program for quite some time now and finally
I was working on this program and I noticed that using %f for a
So I am working on an x86 Assembly program for Linux using NASM. This
I need to understand the working of this particular program, It seems to be
I have this program that I am working on for class, I think the
I am working on a bug in this program where it should be able
I've been working on an android program. One portion of this program interacts with
My friend and I are working on a program. This program is going to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.