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

JavaFX Discussion :

avoir un jolie page d acceuille


Sujet :

JavaFX

  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Novembre 2010
    Messages
    89
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2010
    Messages : 89
    Par défaut avoir un jolie page d acceuille
    bonjour
    en fait je voudrai avoir un jolie page d acceuille ,tous ce que j arrive a faire c est de faire une page blanche avec des labels dedans en plus la taille de la page est trop petit
    je voudrai avoir un jolie page comment
    voila le code
    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
    package gogetter.vues;
    package class Demarrage extends CustomNode {
     
        public var controleInterne:IControleur;
             def level =ChoiceBox {
                layoutX: 80
                layoutY: 100
                width:20
                height:20
                layoutInfo: LayoutInfo { width: 110; height: 20 }
                items:["facile","moyen","difficile" };
     
        init {
            insert Label {
                font: Font { size: 24; embolden: true }
                text: "*****menu*****"
                layoutX: 5
                layoutY: 0
                width:200
                height:50
                layoutInfo: LayoutInfo { width: 290; height: 45 }
                hpos: HPos.CENTER
                textFill:Color.RED
            } into children;
     
             insert Label {
                font: Font { size: 15 }
                text: "  Niveau : "
                layoutX: 0
                layoutY: 100
                width:20
                height:60
                layoutInfo: LayoutInfo { width: 140; height: 20 }
                textFill:Color.GREEN
            } into children;
     
            insert level into children;
            level.select(0);
     
     
            insert Button {
                layoutX: 200
                layoutY: 100
                layoutInfo: LayoutInfo { width:50; height: 20 }
                text: "Start"
                action: valider
            } into children;
     
            layoutInfo = LayoutInfo { width: 300; height: 210 }
        }

    merci pour l aide

  2. #2
    Rédacteur/Modérateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Août 2005
    Messages
    6 897
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Nouvelle-Calédonie

    Informations professionnelles :
    Activité : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Août 2005
    Messages : 6 897
    Billets dans le blog
    54
    Par défaut
    Bienvenu au royaume des prises de tête intégrales.
    La solution que je te propose n'est pas parfaite mais elle semble s'afficher correctement (enfin, heu tant quand ne bidouille pas trop):

    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
    111
     
    package gogetter.vues;
     
    import javafx.scene.CustomNode;
    import javafx.scene.control.Button;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.control.Label;
    import javafx.scene.layout.Panel;
    import javafx.scene.layout.HBox;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.paint.Color;
    import javafx.geometry.VPos;
     
    def LEVELS: String[] = [
                ##[EASY_LEVEL_LABEL]"Facile",
                ##[MEDIUM_LEVEL_LABEL]"Moyen",
                ##[HARD_LEVEL_LABEL]"Difficile"
            ];
     
    public class Demarrage extends CustomNode {
     
        public-init var debug: Boolean = false;
        public var width: Number = 300 on replace {
                    requestLayout()
                }
        public var height: Number = 210 on replace {
                    requestLayout()
                }
        // public var controleInterne: IControleur;
        def levelChoice: ChoiceBox = ChoiceBox {
                    id: "levelChoice"
                    items: LEVELS
                }
        def titleLabel: Label = Label {
                    id: "titleLabel"
                    styleClass: "title-label"
                    text: ##[TITLE_LABEL]"*****menu*****"
                    layoutX: bind (width - titleLabel.layoutBounds.width) / 2;
                }
        def padding: Number = 6;
        def bottomHBox: HBox = HBox {
                    id: "bottomBox"
                    styleClass: "bottom-hbox"
                    width: bind width - 2 * padding
                    layoutX: bind padding
                    layoutY: bind height - bottomHBox.layoutBounds.height - padding;
                    nodeVPos: VPos.CENTER
                    content: [
                        Label {
                            id: "levelLabel"
                            styleClass: "level-label"
                            text: ##[LEVEL_LABEL]"Niveau :"
                        }
                        levelChoice,
                        Panel {
                            id: "filler"
                        }
                        Button {
                            id: "startButton"
                            style: "-fx-font-size: 200%"
                            text: ##[START_LABEL]"Start"
                            action: bind valider
                        }
                    ]
                }
        def rootPanel: Panel = Panel {
                    id: "rootPanel"
                    width: bind width
                    height: bind height
                    content: [
                        titleLabel,
                        bottomHBox,
                        Rectangle {
                            id: "titleBounds"
                            fill: null
                            stroke: Color.RED
                            x: bind titleLabel.boundsInParent.minX
                            y: bind titleLabel.boundsInParent.minY
                            width: bind titleLabel.boundsInParent.width
                            height: bind titleLabel.boundsInParent.height
                            visible: bind debug
                        }
                        Rectangle {
                            id: "bottomBounds"
                            fill: null
                            stroke: Color.BLUE
                            x: bind bottomHBox.boundsInParent.minX
                            y: bind bottomHBox.boundsInParent.minY
                            width: bind bottomHBox.boundsInParent.width
                            height: bind bottomHBox.boundsInParent.height
                            visible: bind debug
                        }
                        Label {
                            id: "screenBounds"
                            text: bind "{width} x {height}"
                            visible: bind debug
                        }
                    ]
                }
     
        init {
            children = rootPanel;
            levelChoice.select(0);
        }
     
        postinit {
            requestLayout();
        }
     
        var valider: function(): Void;
    }
    Code CSS : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    .scene {
        -fx-font: 12pt "Arial";
    }
    .title-label {
        -fx-font-size: 24pt;
        -fx-font-weight: bold;
        -fx-text-fill: red;
    }
    .level-label {
        -fx-font-size: 15pt;
        -fx-text-fill: green;
    }
    .bottom-hbox {
        -fx-spacing: 6;
    }

    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
     
    package gogetter.vues;
     
    import javafx.stage.Stage;
    import javafx.scene.Scene;
     
    var scene:Scene;
    Stage {
        title: "Application title"
        scene: scene = Scene {
            width: 300
            height: 210
            stylesheets: ["{__DIR__}resources/Demarrage.css"]
            content: Demarrage {
                width: bind scene.width
                height: bind scene.height
            }
        }
    }
    A noter que je te conseille FORTEMENT de passer par les CSS pour mettre certaines propriétés sur les objets ça évitera d'encombrer ton code avec des constantes que tu devras chercher dans tout le projet si jamais tu veux modifier quoi que ce soit au niveau de l'apparence. Évidement comme pour tout en JavaFX 1.x, le support CSS n'est pas non-plus parfait, a quelques bugs et bizarrement certaines propriétés ne fonctionnent pas sur certains contrôles.
    Merci de penser au tag quand une réponse a été apportée à votre question. Aucune réponse ne sera donnée à des messages privés portant sur des questions d'ordre technique. Les forums sont là pour que vous y postiez publiquement vos problèmes.

    suivez mon blog sur Développez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

Discussions similaires

  1. [Joomla!] Avoir dans toutes les pages les mêmes menus et la meme banniere que la page d'acceuil
    Par sitws dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 9
    Dernier message: 08/12/2011, 19h44
  2. Page d'acceuil avec photoshop-Image ready
    Par Lyn2004 dans le forum Webdesign & Ergonomie
    Réponses: 4
    Dernier message: 06/02/2005, 14h50
  3. page d'acceuil site ASP
    Par MASSAKA dans le forum ASP
    Réponses: 4
    Dernier message: 06/10/2004, 11h24
  4. parametrer page d'acceuil
    Par dehbi dans le forum Apache
    Réponses: 5
    Dernier message: 29/07/2004, 16h32
  5. [CR] Avoir seulement une page blanche qd la base est vide???
    Par littleChick dans le forum SAP Crystal Reports
    Réponses: 2
    Dernier message: 13/08/2002, 18h26

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