{filelink=877}
import java.net.URI;
import java.net.URISyntaxException;
public class ExempleIRI {
public static voi
|
Tag: class
Java: Pointer le JFileChooser sur le répertoire Courant
if(result==JFileChooser.CANCEL_OPTION)
return;
String BD=chooser.getSelectedFile().getAbsolutePath();
System.out.println(BD)
|
JPasswordField: Définir le symbole à utiliser pour masquer un mot de passe
final JPasswordField txtPassword = new JPasswordField("mon mot de passe", 20);
txtPassword.setEchoChar('*');
JButton btn=new JButton("Afficher le mot de passe");
|
Java: Souligner le texte de JLabel
public JLabelSouligne()
{
JPanel pnl=new JPanel();
JLabel label=new JLabel();
// Souligner le texte
label.setText(
|
Java: Affichage d’un LinkedList à l’aide d’une ListIterator
ListIterator iterator=linked_L.listIterator(0);
while(iterator.hasNext())
{
System.out.println (iterator.nextIndex()+"=>"+iterator.next());
}
|
Java: Obtenir l’index des éléments de ComboBox
JPanel mainPanel=new JPanel();
listMois=new JComboBox();
JButton btnIndex=new JButton("Cliquez ici");
btnIndex.addActionListe
|
Java: Générer des caractères aléatoires
package com.mesexemples;
import java.util.Random;
for(int x=0; x<=26; x++) {
Random random=new Random();
int val=65 + random.nextInt(123);
|
Java: Supprimer un élément de JComboBox
JPanel mainPanel=new JPanel();
myCmb=new JComboBox();
JButton btnSupprimer=new JButton("Supprimer");
btnSupprimer.addActionListener(new ActionListener()
|
Héritage avec vos propres exceptions
{filelink=4367}
public class TesterMonException {
public void a() throws MonException { //Utilisation de ma classe
|
Afficher la milliseconde dépuis 1970
{filelink=6323}
import java.util.Calendar;
public class Milliseconde
{
public static void main(String[] args)
{
|
Exemple de VarArgs: Calculer la somme d’un tableau
{filelink=4616}
public class ExempleVarArgs {
int sommeTableaux(int[]... tableauxDeInt)
{
int somme,
|