/** * Renvoit le JPanel à afficher, avec en paramètre un booléen indiquant s'il s'agit du dernier * élément à afficher dans une liste d'enfants (auquel cas un bouton + peut être affiché) */ private JPanel getPanel(final boolean dernier) { panelEnfants = new JPanel(new GridBagLayout()); panelElement = new JPanel(new BorderLayout()); if (!attribut && affParent != null && affParent.enfantsMultiples(refNoeud)) { final JPanel panelBoutons = new JPanel(new BorderLayout()); if (dernier) { final JButton boutonPlus = new JButton("+"); boutonPlus.setAction( new AbstractAction("+") { public void actionPerformed(final ActionEvent e) { affParent.ajouterAffichageEnfant(AffichageFormulaire.this); } }); panelBoutons.add(boutonPlus, BorderLayout.WEST); } final JButton boutonMoins = new JButton("-"); boutonMoins.setAction( new AbstractAction("-") { public void actionPerformed(final ActionEvent e) { affParent.retirerAffichageEnfant(AffichageFormulaire.this); } }); panelBoutons.add(boutonMoins, BorderLayout.EAST); panelElement.add(panelBoutons, BorderLayout.EAST); panelElement.add(panelEnfants, BorderLayout.CENTER); } else panelElement.add(panelEnfants, BorderLayout.CENTER); if (affParent != null) { panelElement.add(getPanelTitre(), BorderLayout.NORTH); panelEnfants.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); panelElement.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); } majPanel(null); if (affParent == null) { panelEnfants.setFocusCycleRoot(true); panelElement = new JPanel(new BorderLayout()) { @Override public Dimension getMaximumSize() { if (System.getProperty("os.name") .startsWith("Mac OS")) { // curseur pas visible à droite sur la JVM d'Apple avec // getMaximumSize() final Dimension tps = doc.textPane.getSize(); final JaxeElement je = doc.getElementForNode(noeud); return (new Dimension(tps.width - 20 * (je.indentations() + 1) - 2, tps.height)); } return (super.getMaximumSize()); } }; panelElement.setOpaque(false); panelElement.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); panelEnfants.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(getTitre()), BorderFactory.createEmptyBorder(5, 5, 5, 5))); panelElement.add(panelEnfants, BorderLayout.CENTER); } return (panelElement); }
public void execute_TestCase2() throws Exception { setUndecorated(true); setRootPaneCheckingEnabled(false); setForeground(Color.BLACK); setBackground(Color.WHITE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 774, 353); setLocationRelativeTo(null); setVisible(true); contentPane = new JPanel(); contentPane.setFocusCycleRoot(true); contentPane.setDebugGraphicsOptions(DebugGraphics.NONE_OPTION); contentPane.setBounds(new Rectangle(100, 100, 130, 100)); contentPane.setBackground(Color.WHITE); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblEnterThePath = new JLabel("Select Path of Working Folder"); lblEnterThePath.setForeground(new Color(128, 128, 128)); lblEnterThePath.setFont(new Font("Tahoma", Font.BOLD, 11)); lblEnterThePath.setBackground(new Color(0, 0, 0)); lblEnterThePath.setBounds(63, 104, 187, 31); contentPane.add(lblEnterThePath); txtHello = new JTextField(); txtHello.setName(""); txtHello.setBounds(271, 104, 296, 31); txtHello.setEditable(false); contentPane.add(txtHello); txtHello.setColumns(10); JLabel lblSelectPathOf = new JLabel("Select Path of Configuration File"); lblSelectPathOf.setForeground(new Color(128, 128, 128)); lblSelectPathOf.setFont(new Font("Tahoma", Font.BOLD, 11)); lblSelectPathOf.setBounds(63, 149, 187, 28); contentPane.add(lblSelectPathOf); textField_1 = new JTextField(); textField_1.setBounds(271, 146, 296, 31); textField_1.setEditable(false); contentPane.add(textField_1); textField_1.setColumns(10); JLabel lblWelcomeToVitalhealth = new JLabel("Welcome to VitalHealth Test Automation Framework"); lblWelcomeToVitalhealth.setHorizontalTextPosition(SwingConstants.CENTER); lblWelcomeToVitalhealth.setForeground(new Color(128, 128, 128)); lblWelcomeToVitalhealth.setFont(new Font("Tahoma", Font.BOLD, 14)); lblWelcomeToVitalhealth.setHorizontalAlignment(SwingConstants.CENTER); lblWelcomeToVitalhealth.setBackground(Color.BLACK); lblWelcomeToVitalhealth.setBounds(191, 22, 465, 34); contentPane.add(lblWelcomeToVitalhealth); Button button = new Button("Browse"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { showOpenFileDialog(); } }); button.setForeground(Color.WHITE); button.setFont(new Font("Dialog", Font.BOLD, 12)); button.setBackground(new Color(51, 153, 255)); button.setBounds(573, 104, 113, 31); contentPane.add(button); Button button_1 = new Button("Browse"); button_1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { showOpenFileDialog1(); } }); button_1.setForeground(Color.WHITE); button_1.setFont(new Font("Dialog", Font.BOLD, 12)); button_1.setBackground(new Color(51, 153, 255)); button_1.setBounds(573, 146, 113, 31); contentPane.add(button_1); Button button_2 = new Button("RUN TEST"); button_2.setForeground(Color.WHITE); button_2.setFont(new Font("Dialog", Font.BOLD, 12)); button_2.setBackground(new Color(30, 144, 255)); button_2.setBounds(63, 205, 623, 34); contentPane.add(button_2); Button button_3 = new Button("DOWNLOAD SAMPLE EXCEL WEB"); button_3.setActionCommand("DOWNLOAD SAMPLE EXCEL WEB"); button_3.setForeground(new Color(128, 128, 128)); button_3.setFont(new Font("Dialog", Font.BOLD, 12)); button_3.setBackground(Color.WHITE); button_3.setBounds(564, 309, 200, 34); contentPane.add(button_3); Button button_4 = new Button("DOWNLOAD SAMPLE EXCEL MOBILE"); button_4.setForeground(new Color(128, 128, 128)); button_4.setFont(new Font("Dialog", Font.BOLD, 12)); button_4.setBackground(Color.WHITE); button_4.setActionCommand("DOWNLOAD SAMPLE EXCEL MOBILE"); button_4.setBounds(23, 309, 227, 34); contentPane.add(button_4); JLabel icon = new JLabel(""); Image img = new ImageIcon(this.getClass().getResource("/VitalHealth.png")).getImage(); icon.setIcon(new ImageIcon(img)); icon.setBounds(23, 11, 173, 71); contentPane.add(icon); // L1 l1 = new L1(); L2 l2 = new L2(); button_4.addActionListener(new L1(Constants.Download_ExcelWeb, Constants.Excel_NameMobile)); button_3.addActionListener(new L1(Constants.Download_ExcelWeb, Constants.Excel_NameWeb)); button_2.addActionListener(l2); }