IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

[JLabel] Souligner le texte


Sujet :

AWT/Swing Java

  1. #1
    Membre averti Avatar de soad
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    520
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Février 2004
    Messages : 520
    Points : 439
    Points
    439
    Par défaut [JLabel] Souligner le texte
    Hello tout le monde...

    Je cherchais à souligner le contenu d'un JLabel mais apparemment on peut pas... je me trompe ?

    (Je ne veux pas d'html !)

  2. #2
    Membre émérite
    Avatar de xavlours
    Inscrit en
    Février 2004
    Messages
    1 832
    Détails du profil
    Informations forums :
    Inscription : Février 2004
    Messages : 1 832
    Points : 2 410
    Points
    2 410
    Par défaut
    Bonjour,
    Citation Envoyé par soad
    (Je ne veux pas d'html !)
    C'est bien dommage parce que c'est vraiment la solution la plus simple. Vu que la classe Font ne permet pas de souligner, il ne te reste plus qu'à surcharger paintComponent et dessiner une ligne au bon endroit, mais ça va être chaud.
    "Le bon ni le mauvais ne me feraient de peine si si si je savais que j'en aurais l'étrenne." B.V.
    Non au langage SMS ! Je ne répondrai pas aux questions techniques par MP.
    Eclipse : News, FAQ, Cours, Livres, Blogs.Et moi.

  3. #3
    Membre averti Avatar de soad
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    520
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Février 2004
    Messages : 520
    Points : 439
    Points
    439
    Par défaut
    Citation Envoyé par xavlours
    il ne te reste plus qu'à surcharger paintComponent et dessiner une ligne au bon endroit, mais ça va être chaud.
    Ouais ca va etre très chaud...
    Je crois que je vais utiliser JXHyperlink de swingx
    Merci

  4. #4
    Membre émérite
    Avatar de xavlours
    Inscrit en
    Février 2004
    Messages
    1 832
    Détails du profil
    Informations forums :
    Inscription : Février 2004
    Messages : 1 832
    Points : 2 410
    Points
    2 410
    Par défaut
    Citation Envoyé par soad
    (Je ne veux pas d'html !)
    Citation Envoyé par soad
    je vais utiliser JXHyperlink de swingx
    J'ai du mal à suivre, là ... Enfin le principal c'est que ça marche.
    "Le bon ni le mauvais ne me feraient de peine si si si je savais que j'en aurais l'étrenne." B.V.
    Non au langage SMS ! Je ne répondrai pas aux questions techniques par MP.
    Eclipse : News, FAQ, Cours, Livres, Blogs.Et moi.

  5. #5
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    fais en 3 minute (maximum)


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import java.awt.geom.Rectangle2D;
    import java.awt.FlowLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Font;
     
    /**
     * Created by IntelliJ IDEA.
     * User: bebe
     * Date: 06-sept.-2006
     * Time: 19:29:23
     * To change this template use File | Settings | File Templates.
     */
    public class UnderlinedLabel extends JLabel {
        private Color lineColor;
     
        public UnderlinedLabel(String text, Color lineColor) {
            super(text);
            this.lineColor = lineColor;
        }
     
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);    //To change body of overridden methods use File | Settings | File Templates.
     
            Rectangle2D textBounds = getFontMetrics(getFont()).getStringBounds(getText(), g);
            int y = (int) (getHeight() / 2 + textBounds.getHeight() / 2);
            int w = (int) (textBounds.getWidth());
     
            g.setColor(lineColor);
            g.drawLine(0, y, w, y);
        }
     
        public Color getLineColor() {
            return lineColor;
        }
     
        public void setLineColor(Color lineColor) {
            this.lineColor = lineColor;
        }
     
        /**
         * 
         * @param args
         */
        public static void main(String[] args) {
            JFrame myFrame = new JFrame("Underlined myLabel");
            myFrame.setLayout(new FlowLayout(FlowLayout.LEFT));
            UnderlinedLabel myLabel = new UnderlinedLabel("Hello World!", Color.RED);
            Font labelFont = myLabel.getFont();
            myLabel.setFont(new Font(labelFont.getFamily(), labelFont.getStyle(), labelFont.getSize() + 10));
            myFrame.add(myLabel);
            myFrame.pack();
            myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            myFrame.setLocationRelativeTo(null);
            myFrame.setVisible(true);
        }
    }

  6. #6
    Membre averti Avatar de soad
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    520
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Février 2004
    Messages : 520
    Points : 439
    Points
    439
    Par défaut
    Citation Envoyé par xavlours
    J'ai du mal à suivre, là ... Enfin le principal c'est que ça marche.
    Pkoi JXHyperlink utilise de l'html ?





    Citation Envoyé par bbclone
    fais en 3 minute (maximum)
    Sauf que si on centre le texte ca ne marche pas !!!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
     
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import java.awt.geom.Rectangle2D;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Font;
     
    /**
    * Created by IntelliJ IDEA.
    * User: bebe
    * Date: 06-sept.-2006
    * Time: 19:29:23
    * To change this template use File | Settings | File Templates.
    */
    public class UnderlinedLabel extends JLabel {
    	private Color lineColor;
     
    	public UnderlinedLabel(String text, Color lineColor) {
    		super(text, JLabel.CENTER);
    		this.lineColor = lineColor;
    	}
     
    	@Override
    	protected void paintComponent(Graphics g) {
     
    		super.paintComponent(g); //To change body of overridden methods use File | Settings | File Templates.
     
    		Rectangle2D textBounds = getFontMetrics(getFont()).getStringBounds(getText(), g);
    		int y = (int) (getHeight() / 2 + textBounds.getHeight() / 2);
    		int w = (int) (textBounds.getWidth());
     
    		g.setColor(lineColor);
    		g.drawLine(0, y, w, y);
    	}
     
     
    	public Color getLineColor() {
    		return lineColor;
    	}
     
    	public void setLineColor(Color lineColor) {
    	this.lineColor = lineColor;
    	}
     
    	/**
            * 
            * @param args
            */
    	public static void main(String[] args) {
    		JFrame myFrame = new JFrame("Underlined myLabel");
    		myFrame.setLayout(new BorderLayout());
    		UnderlinedLabel myLabel = new UnderlinedLabel("Hello World!", Color.RED);
    		Font labelFont = myLabel.getFont();
    		myLabel.setFont(new Font(labelFont.getFamily(), labelFont.getStyle(), labelFont.getSize() + 10));
    		myFrame.add(myLabel, BorderLayout.CENTER);
    		myFrame.pack();
    		myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		myFrame.setLocationRelativeTo(null);
    		myFrame.setVisible(true);
    	}
    }

  7. #7
    Membre averti Avatar de soad
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    520
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Février 2004
    Messages : 520
    Points : 439
    Points
    439
    Par défaut
    C'est bon j'ai corrigé !

    voilà pour ceux que ca intéresse :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
     
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import java.awt.geom.Rectangle2D;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Font;
     
    /**
    * Created by IntelliJ IDEA.
    * User: bebe
    * Date: 06-sept.-2006
    * Time: 19:29:23
    * To change this template use File | Settings | File Templates.
    */
    public class UnderlinedLabel extends JLabel {
    	private Color lineColor;
     
    	public UnderlinedLabel(String text, Color lineColor) {
    		super(text);
    		this.lineColor = lineColor;
    	}
     
    	@Override
    	protected void paintComponent(Graphics g) {
     
    		super.paintComponent(g); //To change body of overridden methods use File | Settings | File Templates.
     
    		Rectangle2D textBounds = getFontMetrics(getFont()).getStringBounds(getText(), g);
     
     
    		// Alignement verticale selon la position du texte
    		int y = (int) textBounds.getHeight();
    		if(getVerticalAlignment() == JLabel.BOTTOM) y = getHeight()-2;
    		else if(getVerticalAlignment() == JLabel.CENTER) y = (int) (getHeight() / 2 + textBounds.getHeight() / 2);
     
     
    		// Largueur du texte
    		int w = (int) (textBounds.getWidth());
     
     
    		// Alignement horizontale selon la position du texte
    		int x = 0;
    		if(getHorizontalAlignment() == JLabel.CENTER) x = getWidth()/2 - w/2;
    		else if(getHorizontalAlignment() == JLabel.RIGHT) x = getWidth() - w;
     
     
    		g.setColor(lineColor);
    		g.drawLine(x, y, x+w, y);
    	}
     
     
    	public Color getLineColor() {
    		return lineColor;
    	}
     
    	public void setLineColor(Color lineColor) {
    	this.lineColor = lineColor;
    	}
     
    	/**
            * 
            * @param args
            */
    	public static void main(String[] args) {
    		JFrame myFrame = new JFrame("Underlined myLabel");
    		myFrame.setLayout(new BorderLayout());
    		UnderlinedLabel myLabel = new UnderlinedLabel("Hello World!", Color.RED);
    		Font labelFont = myLabel.getFont();
    		myLabel.setFont(new Font(labelFont.getFamily(), labelFont.getStyle(), labelFont.getSize() + 10));
    		myFrame.add(myLabel, BorderLayout.CENTER);
    		myFrame.pack();
    		myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		myFrame.setLocationRelativeTo(null);
    		myFrame.setVisible(true);
    	}
    }
    Merci

  8. #8
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    l'alignment c'est pas le seul probleme.

    ca c'est un peu mieux ;-)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
     
    import javax.swing.plaf.basic.BasicLabelUI;
    import javax.swing.*;
    import java.awt.*;
     
    /**
     * Created by IntelliJ IDEA.
     * User: bebe
     * Date: 06-sept.-2006
     * Time: 21:28:17
     * To change this template use File | Settings | File Templates.
     */
    public class UnderlineLabelUI extends BasicLabelUI {
        static {
            labelUI = new UnderlineLabelUI(Color.BLACK);
        }
     
        private static Rectangle paintIconR = new Rectangle();
        private static Rectangle paintTextR = new Rectangle();
        private static Rectangle paintViewR = new Rectangle();
        private static Insets paintViewInsets = new Insets(0, 0, 0, 0);
        private Color linecolor;
     
        public UnderlineLabelUI(Color linecolor) {
            this.linecolor = linecolor;
        }
     
        public void paint(Graphics g, JComponent c) {
            JLabel label = (JLabel) c;
            String text = label.getText();
            Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
     
            if ((icon == null) && (text == null)) {
                return;
            }
     
            FontMetrics fm = g.getFontMetrics();
            paintViewInsets = c.getInsets(paintViewInsets);
     
            paintViewR.x = paintViewInsets.left;
            paintViewR.y = paintViewInsets.top;
     
            paintViewR.height = c.getHeight() - (paintViewInsets.top + paintViewInsets.bottom);
            paintViewR.width = c.getWidth() - (paintViewInsets.left + paintViewInsets.right);
     
            paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
            paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
     
            String clippedText = layoutCL(label, fm, text, icon, paintViewR, paintIconR, paintTextR);
     
            Graphics2D g2d = (Graphics2D) g;
            if (icon != null) {
                icon.paintIcon(c, g, paintIconR.x, paintIconR.y);
            }
     
            if (text != null) {
                int textX = paintTextR.x;
                int textY = paintTextR.y + fm.getMaxAscent();
     
                if (label.isEnabled()) {
                    paintEnabledText(label, g2d, clippedText, textX, textY - 1);
                    textY += fm.getMaxDescent() - 1;
                    g2d.setColor(linecolor);   // or label.getForeground ??
                    g2d.drawLine(textX, textY, textX + paintTextR.width, textY);
                } else {
                    paintDisabledText(label, g2d, clippedText, textX, textY - 1);
                    textY += fm.getMaxDescent() - 1;
                    g2d.setColor(linecolor.darker()); // or label.getForeground ??
                    g2d.drawLine(textX, textY, textX + paintTextR.width, textY);
                }
            }
        }
     
     
        /**
         * @param args
         */
        public static void main(String[] args) {
            JFrame myFrame = new JFrame("Underlined label using UI");
     
            myFrame.setLayout(new GridBagLayout());
     
            JLabel myLabels[] = {new JLabel("Hello World (alignment = center)!", SwingConstants.CENTER),
                    new JLabel("Hello World (alignment = left)!", SwingConstants.LEFT),
                    new JLabel("Hello World (alignment = right)!", SwingConstants.RIGHT),
                    new JLabel("Hello World (alignment = leading)!", SwingConstants.LEADING),
                    new JLabel("Hello World (alignment = trailing)!", SwingConstants.TRAILING)};
            Color[] colors = new Color[]{Color.BLACK, Color.BLUE, Color.RED, Color.MAGENTA, Color.PINK};
            Font labelFont = myLabels[0].getFont();
     
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(10, 5, 5, 5);
            gbc.gridx = 0;
            gbc.gridy = GridBagConstraints.RELATIVE;
            gbc.fill = GridBagConstraints.HORIZONTAL;
            for (int i = 0; i < 5; i++) {
                myLabels[i].setUI(new UnderlineLabelUI(colors[i]));
                myLabels[i].setFont(new Font(labelFont.getFamily(), labelFont.getStyle(), labelFont.getSize() + i * i));
                if ((i % 2) == 0) {
                    myLabels[i].setEnabled(false);
                }
                myFrame.add(myLabels[i], gbc);
            }
     
            myFrame.pack();
            myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            myFrame.setLocationRelativeTo(null);
            myFrame.setVisible(true);
        }
    }
    j'avai oublier les code dans le message avant. j'ai plus l'habitude

  9. #9
    Membre averti Avatar de soad
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    520
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Février 2004
    Messages : 520
    Points : 439
    Points
    439
    Par défaut
    Citation Envoyé par bbclone
    l'alignment c'est pas le seul probleme.

    ca c'est un peu mieux ;-)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
     
    import javax.swing.plaf.basic.BasicLabelUI;
    import javax.swing.*;
    import java.awt.*;
     
    /**
     * Created by IntelliJ IDEA.
     * User: bebe
     * Date: 06-sept.-2006
     * Time: 21:28:17
     * To change this template use File | Settings | File Templates.
     */
    public class UnderlineLabelUI extends BasicLabelUI {
        static {
            labelUI = new UnderlineLabelUI(Color.BLACK);
        }
     
        private static Rectangle paintIconR = new Rectangle();
        private static Rectangle paintTextR = new Rectangle();
        private static Rectangle paintViewR = new Rectangle();
        private static Insets paintViewInsets = new Insets(0, 0, 0, 0);
        private Color linecolor;
     
        public UnderlineLabelUI(Color linecolor) {
            this.linecolor = linecolor;
        }
     
        public void paint(Graphics g, JComponent c) {
            JLabel label = (JLabel) c;
            String text = label.getText();
            Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
     
            if ((icon == null) && (text == null)) {
                return;
            }
     
            FontMetrics fm = g.getFontMetrics();
            paintViewInsets = c.getInsets(paintViewInsets);
     
            paintViewR.x = paintViewInsets.left;
            paintViewR.y = paintViewInsets.top;
     
            paintViewR.height = c.getHeight() - (paintViewInsets.top + paintViewInsets.bottom);
            paintViewR.width = c.getWidth() - (paintViewInsets.left + paintViewInsets.right);
     
            paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
            paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
     
            String clippedText = layoutCL(label, fm, text, icon, paintViewR, paintIconR, paintTextR);
     
            Graphics2D g2d = (Graphics2D) g;
            if (icon != null) {
                icon.paintIcon(c, g, paintIconR.x, paintIconR.y);
            }
     
            if (text != null) {
                int textX = paintTextR.x;
                int textY = paintTextR.y + fm.getMaxAscent();
     
                if (label.isEnabled()) {
                    paintEnabledText(label, g2d, clippedText, textX, textY - 1);
                    textY += fm.getMaxDescent() - 1;
                    g2d.setColor(linecolor);   // or label.getForeground ??
                    g2d.drawLine(textX, textY, textX + paintTextR.width, textY);
                } else {
                    paintDisabledText(label, g2d, clippedText, textX, textY - 1);
                    textY += fm.getMaxDescent() - 1;
                    g2d.setColor(linecolor.darker()); // or label.getForeground ??
                    g2d.drawLine(textX, textY, textX + paintTextR.width, textY);
                }
            }
        }
     
     
        /**
         * @param args
         */
        public static void main(String[] args) {
            JFrame myFrame = new JFrame("Underlined label using UI");
     
            myFrame.setLayout(new GridBagLayout());
     
            JLabel myLabels[] = {new JLabel("Hello World (alignment = center)!", SwingConstants.CENTER),
                    new JLabel("Hello World (alignment = left)!", SwingConstants.LEFT),
                    new JLabel("Hello World (alignment = right)!", SwingConstants.RIGHT),
                    new JLabel("Hello World (alignment = leading)!", SwingConstants.LEADING),
                    new JLabel("Hello World (alignment = trailing)!", SwingConstants.TRAILING)};
            Color[] colors = new Color[]{Color.BLACK, Color.BLUE, Color.RED, Color.MAGENTA, Color.PINK};
            Font labelFont = myLabels[0].getFont();
     
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(10, 5, 5, 5);
            gbc.gridx = 0;
            gbc.gridy = GridBagConstraints.RELATIVE;
            gbc.fill = GridBagConstraints.HORIZONTAL;
            for (int i = 0; i < 5; i++) {
                myLabels[i].setUI(new UnderlineLabelUI(colors[i]));
                myLabels[i].setFont(new Font(labelFont.getFamily(), labelFont.getStyle(), labelFont.getSize() + i * i));
                if ((i % 2) == 0) {
                    myLabels[i].setEnabled(false);
                }
                myFrame.add(myLabels[i], gbc);
            }
     
            myFrame.pack();
            myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            myFrame.setLocationRelativeTo(null);
            myFrame.setVisible(true);
        }
    }
    j'avai oublier les code dans le message avant. j'ai plus l'habitude
    J'avais pas besoin d'image mais on sait jamais pour plus tard
    Merci...

  10. #10
    Membre éclairé
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Points : 704
    Points
    704
    Par défaut
    maintnant tu vois une solution c'etais pas tres chaud.
    si ?

  11. #11
    Membre averti Avatar de soad
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    520
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Février 2004
    Messages : 520
    Points : 439
    Points
    439
    Par défaut
    Citation Envoyé par bbclone
    maintnant tu vois une solution c'etais pas tres chaud.
    si ?
    Mouais... en java2d j'suis pas très bon !
    Mais c'est vrai, c'est tjs plus facile quand on a la réponse

Discussions similaires

  1. UN JLabel souligné
    Par maya dans le forum AWT/Swing
    Réponses: 2
    Dernier message: 22/11/2006, 20h55
  2. [Font]Souligner le texte
    Par Janitrix dans le forum AWT/Swing
    Réponses: 6
    Dernier message: 09/01/2006, 18h28
  3. [xslfo] souligne du texte
    Par khokho dans le forum XSL/XSLT/XPATH
    Réponses: 2
    Dernier message: 29/11/2005, 19h02
  4. [JLabel] Problème de texte tronqué
    Par mister3957 dans le forum Composants
    Réponses: 3
    Dernier message: 06/08/2005, 11h12
  5. [debutant][JLabel] Taille du texte
    Par GroRelou dans le forum Composants
    Réponses: 2
    Dernier message: 06/06/2005, 15h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo