| 12
 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
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 
 | /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gestion;
 
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import java.sql.*;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
 
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.border.*;
 
import java.text.SimpleDateFormat;
 
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
 
//import com.toedter.calendar.JCalendar;
import com.toedter.calendar.JDateChooser;
 
import java.util.Date;
import java.util.Calendar;
import java.util.Locale;
 
import java.io.File;
 
/**
 *
 * @author Christel Batele
 */
public class Pointsbas extends java.awt.Dialog
{
 
    private javax.swing.JLabel picture;
 
    private javax.swing.JComboBox cmbpict;
 
    public static Connection connection=null;
 
    private javax.swing.JTabbedPane onglets;
 
    private javax.swing.JLayeredPane jLayeredPane2;
 
 
        public Pointsbas(java.awt.Frame parent, boolean modal) 
        {
            super(parent, modal);
            initComponents();
            updateLabel(cmbpict.getSelectedItem().toString());
 
        }
 
        private void initComponents() 
        {
            jLayeredPane2 = new javax.swing.JLayeredPane();
 
            cmbpict = new javax.swing.JComboBox();
            //cmbpict.setSelectedIndex(3);
 
            setTitle("Enregistrement ...");
            setLocation(100, 100);
            setPreferredSize(new  Dimension(700, 320));
 
            addWindowListener(new java.awt.event.WindowAdapter() {
            @Override
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    closeDialog(evt);
                }
            });
 
			// Create the tab pages
				pagefiche();
 
            JTabbedPane onglets = new JTabbedPane();
            onglets.setPreferredSize(new java.awt.Dimension(1500, 300));
            add(onglets, java.awt.BorderLayout.WEST);
 
            onglets.addTab( "Fiche du Point Bas", jLayeredPane2 );
 
}
 
	public void pagefiche()
	{
			jLayeredPane2.setLayout( null );
            jLayeredPane2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 2, true));
 
            picture=new JLabel();
            picture.setFont(picture.getFont().deriveFont(Font.ITALIC));
            picture.setHorizontalAlignment(JLabel.CENTER);
 
            //updateLabel(petstrings[cmbpict.getSelectedIndex()]);
            picture.setBorder(new javax.swing.border.LineBorder
                        (new java.awt.Color(0, 0, 0), 2, true));
            //picture.setBorder(BorderFactory.createEmptyBorder(10,400,100,200));
 
            picture.setBounds(10, 275, 400, 200);
            jLayeredPane2.add(picture, javax.swing.JLayeredPane.DEFAULT_LAYER);
 
            cmbpict.setBounds(15, 250, 380, 20);
            jLayeredPane2.add(cmbpict, javax.swing.JLayeredPane.DEFAULT_LAYER);
//            
 
	}
//
 
 
    protected void updateLabel(String name)
        {
            ImageIcon icon = createImageIcon(name);
 
            //System.out.println(icon);
 
            picture.setIcon(icon);
            picture.setToolTipText("A drawing of a "+ name.toLowerCase());
 
            if(icon!= null)
            {
                picture.setText(null);
            }
            else
            {
                picture.setText("Image not found");
            }
            //}    
        }
 
        protected static ImageIcon createImageIcon(String path)
        {
            //String pa ="C:/kris5.JPG";
            java.net.URL imgURL = Pointsbas.class.getResource(path);
            //System.out.println(Pointsbas.class.getResource("c:/kris5.JPG"));
 
 
            if (imgURL != null)
            {
                return new ImageIcon(imgURL);                
                //return new ImageIcon("C:/kris.GIF");                
            }
            else
            {    
                System.err.println("Couldn't find file: " + path);
                return null;
            }    
        }
} | 
Partager