Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Exemple d’utilisation de ‘look and feel’ de Java


{filelink=906}

 
import java.awt.Dimension;
 
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.UIManager;
 
public class LookAndFeelWindows {
 
	public LookAndFeelWindows()
	{
		JLabel label = new JLabel("Cliquez sur ce Site");
		    JTextField champ = new JTextField("www.mesexemples.com");
		    JList list = new JList(new String[] { "Janvier", "January", "Januar" });
		    JScrollPane panelList = new JScrollPane(list);
		    panelList.setPreferredSize(new Dimension(250, 100));
 
		    JScrollPane panelJTree = new JScrollPane(new JTree());
		    panelJTree.setPreferredSize(new Dimension(250, 100));
		    JButton button = new JButton("Click me");
 
		    JPanel panelPrincipal = new JPanel();
		    panelPrincipal.add(label);
		    panelPrincipal.add(champ);
		    panelPrincipal.add(panelList);
		    panelPrincipal.add(panelJTree);
		    panelPrincipal.add(button);
 
		    JFrame frame = new JFrame();
		    frame.setTitle("Utilisation de theme en java");
		    frame.setPreferredSize(new Dimension(280, 300));
		    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		    frame.setContentPane(panelPrincipal);
		    frame.pack();
    		frame.setVisible(true);
	}
 
  public static void main(String[] args) {
    try
    {
		//Utiliser le thème de Microsoft windows
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
      new LookAndFeelWindows();
    } catch (Exception e) {
      e.printStackTrace();
    }
 
  }
}

A Voir sur le même Sujet:

  • look and feel exemple
  • java exemple jscrollpane
  • java afficher les look and feel disponibles
  • imprimer le contenu de jscrollpane en java
  • telecharger des themes java swing
  • look and feel java gratuit
  • Jlist personnaliser
  • telecharger look and feel java gratuit
  • exemple de look and feel en java a telecharger
  • java introduire un thème au swing