How to put title in Jdesktoppane?

Asked

Viewed 198 times

1

I am developing software for a video rental company with Pattern MVC (Model-view-controller) design with the Java Persistent Api Framework and XML language. My question is this: How do you put and edit title in JDesktopPane?

Example:

Foto da tela principal

I wanted to change the name from "simple" to "video rental system". How does it?

Screen source code:

package formularios;
import classes_persistencia.AcessoDAO;
import classes_registros.Acesso;
import java.awt.BorderLayout;
import java.beans.PropertyVetoException;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import classes_utilitarias.AlteraFundo;
import classes_utilitarias.GravaPosicao;
import java.awt.Color;
import java.awt.Component;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JInternalFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;





public class FrmPrincipal extends javax.swing.JFrame {

    private AcessoDAO conexaoAcesso = new AcessoDAO();
    private Acesso registroAcesso = new Acesso();
    private ArrayList<Acesso> registrosAcesso = new ArrayList<>();

    public static int altera = 1;
    public static int elimina = 1;
    public static int insere = 1;
    public static int cadastroAtor = 1;
    public static int cadastroDiretor = 1;
    public static int cadastroGenero = 1;
    public static int cadastroFaixa = 1;

    private Date date = new Date();

    public static JInternalFrame enderecoJanelaAgenda = new JInternalFrame();
    public static JInternalFrame enderecoJanelaCliente = new JInternalFrame();
    public static JInternalFrame enderecoJanelaTitulo = new JInternalFrame();
    public static JInternalFrame enderecoJanelaUsuario = new JInternalFrame();
    public static JInternalFrame enderecoJanelaFornecedor = new JInternalFrame();
    public static JInternalFrame enderecoJanelaCalendario = new JInternalFrame();
    public static JInternalFrame enderecoJanelaAtores = new JInternalFrame();
    public static JInternalFrame enderecoJanelaGeneros = new JInternalFrame();
    public static JInternalFrame enderecoJanelaDiretores = new JInternalFrame();
    public static JInternalFrame enderecoJanelaPrecos = new JInternalFrame();
    public static JInternalFrame enderecoJanelaRelatorios = new JInternalFrame();
    public static JInternalFrame enderecoJanelaLocacoes = new JInternalFrame();
    public static JInternalFrame enderecoJanelaConfig = new JInternalFrame();
    public static JInternalFrame enderecoJanelaDevolucao = new JInternalFrame();
    private static String caminhoFundo = "";

    public FrmPrincipal(String usuarioLogado, int nivelAcesso) throws FileNotFoundException, IOException {

        initComponents();
        if(nivelAcesso == 4){

        }
        else{
            configuraAcessos(nivelAcesso);
        }

        File pasta= new File("c:/Singelo");
        File pasta1= new File("c:/Singelo/Imagens");
        pasta.mkdir();
        pasta1.mkdirs();


        add( mdi_principal, BorderLayout.CENTER );         
        FrmStatus status = new FrmStatus(usuarioLogado);
        mdi_principal.add(status);
        status.setVisible(true);

    }

Obs: mdi_principal is the JDesktopPane and Frm_principal is the JFrame.

1 answer

3


The image title is from JFrame. The method setTitle() is changing the title of JFrame and, consequently, the window:

setTitle("sistema de videolocadora");

Just add this way in the constructor method of your class Frm_principal.

  • As it does for arrow?

  • @Igorcontini has a command in the answer, just add it in your Jframe class.

  • What command and how do I add it? I’m a beginner yet...

  • @Igorcontini see if the edition improved the response.

  • Now yes! Got it and thank you! :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.