JTabbedPane Malfunctioning

40 views Asked by At

I have a problem with my code. I am trying to get into user interfaces in Java, and have started using JOptionPane. At the moment, I'm experimenting with JTabbedPane, but I have a problem with it. My problem is the following: when I try to run the code, so that a panel with one tab appears reading 'You are using the program "CarDealership".', nothing happens. I don't know what's the problem, but my terminal reads the following when I compile and run my program...:

Terminal...: TerminalOutput

My code...: ProgramCode

I'm coding in Visual Studio Code, and, as you can tell by reviewing the code, I am from México. I translated the variables used in the program in a comment. Thank you for reading!

Code in text...:

/*

The name of the program translates to 'ProgCarDealership'.

Variables used...:
Example: 'Type/NameInSpanish/NameInEnglish'

- JTabbedPane/Pestañas/Tabs
- JLabel/Contenido/Content
- JPanel/Pestaña1/Tab1

*/

import javax.swing.*;
public class ProgLoteDeCarros extends JFrame
{
public VentanaPrincipal()
{
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setExtendedState(MAXIMIZED_BOTH);
    setVisible(true);
    setTitle("Programa Lote de Carros");

    JTabbedPane Pestañas = new JTabbedPane();

    JPanel Pestaña1 = new JPanel();
    JLabel Contenido = new JLabel ("Estas usando el programa 'Lote de Carros'.");
    Pestaña1.add(Contenido);
    Pestañas.addTab("Información", Pestaña1);

    getContentPane().add(Pestañas);

}

public static void main (String [] Yoshi)
{
    ProgLoteDeCarros VentanaPrincipal = new ProgLoteDeCarros();
}
0

There are 0 answers