Como inserir mais temas ao LookAndFeel?

Olá?
Queria saber como inserir mais temas ao LookAndFeel?
Quero inserir mais temas, modificando a barra de título, a barra de menus, a área de trabalho, etc.
Sabe me dizer como isso é possível?
O código abaixo muda os temas do Windows e Linux, quero mais exemplos específicos sobre temas.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class JavaTeste extends JFrame {
// ===========================
// The LookAndFeel
// ===========================
private UIManager.LookAndFeelInfo[] looks;
private JRadioButton[] escolha;
private ButtonGroup grupo;
// ===========================
// And LookAndFeel
// ===========================

      public JavaTeste() {

      super("Formulario");
      this.setSize(340,540);
      this.setLocation(50, 100);

      Container ct = this.getContentPane();
      ct.setLayout(null);

JLabel lb_1 = new JLabel("Nome:");
lb_1.setBounds(0,0,100,20);
ct.add(lb_1);

JTextField tf_1 = new JTextField("");
tf_1.setBounds(55,0,100,20);
ct.add(tf_1);

JLabel lb_2 = new JLabel("E-mail:");
lb_2.setBounds(0,21,100,20);
ct.add(lb_2);

JTextField tf_2 = new JTextField("");
tf_2.setBounds(55,21,100,20);
ct.add(tf_2);

JLabel lb_3 = new JLabel("Assunto:");
lb_3.setBounds(0,42,100,20);
ct.add(lb_3);

JTextField tf_3 = new JTextField("");
tf_3.setBounds(55,42,100,20);
ct.add(tf_3);

JButton bt_1 = new JButton("Enviar");
bt_1.setBounds(0,63,100,25);
ct.add(bt_1);

JButton bt_2 = new JButton("Limpar");
bt_2.setBounds(101,63,100,25);
ct.add(bt_2);

JLabel lb_4 = new JLabel("Mensagem");
lb_4.setBounds(0,89,100,20);
ct.add(lb_4);

JTextArea at_1 = new JTextArea("Digite seus comentários \n \n \n \n \n \n \n \n \n \n");
at_1.setLineWrap(true);
JScrollPane br_1 = new JScrollPane(at_1); 
br_1.setBounds(0,110,200,100);
ct.add(br_1);


String Lista[] = {"Estados", "Rio de Janeiro", "São Paulo", "Minas Gerais", "Espírito Santo", "Nenhuma das anteriores"};
JComboBox estado = new JComboBox(Lista);
estado.setBounds(0,211,150,25);
ct.add(estado);

JSlider cDeslizante = new JSlider(JSlider.HORIZONTAL);
cDeslizante.setMinimum(0);
cDeslizante.setMaximum(10);
cDeslizante.setValue(0);
cDeslizante.setMajorTickSpacing(2);
cDeslizante.setMinorTickSpacing(1);
cDeslizante.setPaintTicks(true);
cDeslizante.setPaintLabels(true);
cDeslizante.setSnapToTicks(true);
cDeslizante.setBounds(0,237,250,50);
ct.add(cDeslizante);

JPanel painel = new JPanel();
painel.setBorder(BorderFactory.createTitledBorder("LookAndFeel"));
painel.setBounds(0, 288, 250, 200);
ct.add(painel);

// ===========================
// The LookAndFeel
// ===========================
ItemSelecionado iselect = new ItemSelecionado();
looks = UIManager.getInstalledLookAndFeels(); 
escolha = new JRadioButton[  looks.length ];  
grupo = new ButtonGroup();  
for (int i = 0; i < looks.length; i++){  
escolha[i] = new JRadioButton( looks[i].getName() );  
escolha[i].addItemListener( iselect );  
grupo.add( escolha[i] );  
painel.add( escolha[i] );  
}
// ===========================
// And LookAndFeel
// ===========================

	  Image Icone = Toolkit.getDefaultToolkit().getImage("icon.gif"); 
      setIconImage(Icone);

      this.setVisible(true);



      this.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            System.exit(0);
      }});

   }
   public static void main(String[] args) {
      new JavaTeste();
   }
// ===========================
// The LookAndFeel
// ===========================
   private class ItemSelecionado implements ItemListener {  
           public void itemStateChanged( ItemEvent e) {  
             for (int i=0; i < escolha.length; i++){  
             	if (escolha[i].isSelected()) {  
               		atualiza(i);
			 	}
             }  
           }  
   } 
public void atualiza(int i){  
	try {  
		UIManager.setLookAndFeel(looks[i].getClassName());  
		SwingUtilities.updateComponentTreeUI(this);  
	}catch(Exception e) {  
		e.printStackTrace();  
	}  
}
// ===========================
// And LookAndFeel
// ===========================
}

De longe, os melhores são os FlatLaf. Swing é uma tecnologia meio “morta”, mas eu gosto.

https://www.formdev.com/flatlaf/

1 curtida