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
|
import javax.swing.* ;
import java.awt.*;
public class Dialog extends JDialog{
private JPanel pnlRecoFV ;
private JLabel recoFVInstrumentLbl ;
private JLabel recommendationLbl ;
private JComboBox recommendationBox ;
private JLabel fairValueLbl ;
private JComboBox fairValueBox ;
private JTextField fairValueText ;
private JPanel pnlInstrument ;
private JPanel pnlReco ;
private JPanel pnlFV ;
private JButton addButton ;
private JButton cancelButton ;
private JPanel pnlButtonsRecoFV ;
//********** Constructeur ****************
public Dialog() {
super();
pnlRecoFV = new JPanel() ;
recoFVInstrumentLbl = new JLabel() ;
recommendationLbl = new JLabel() ;
recommendationBox = new JComboBox() ;
fairValueLbl = new JLabel() ;
fairValueBox = new JComboBox() ;
fairValueText = new JTextField() ;
pnlInstrument = new JPanel() ;
pnlReco = new JPanel() ;
pnlFV = new JPanel() ;
addButton = new JButton("Add") ;
cancelButton = new JButton("Cancel") ;
pnlButtonsRecoFV = new JPanel() ;
pnlRecoFV.setLayout(new BoxLayout(pnlRecoFV, BoxLayout.Y_AXIS));
pnlInstrument.setLayout(new BoxLayout(pnlInstrument, BoxLayout.X_AXIS));
pnlReco.setLayout(new BoxLayout(pnlReco, BoxLayout.X_AXIS));
pnlFV.setLayout(new BoxLayout(pnlFV, BoxLayout.X_AXIS));
pnlButtonsRecoFV.setLayout(new BoxLayout(pnlButtonsRecoFV, BoxLayout.X_AXIS));
recoFVInstrumentLbl.setText("Instrument: ");
recommendationLbl.setText("Recommendation :");
fairValueLbl.setText("Fair value: ");
recommendationBox.setPreferredSize(new Dimension(100, 80));
fairValueBox.setPreferredSize(new Dimension(100, 80));
pnlInstrument.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
pnlInstrument.add(recoFVInstrumentLbl);
pnlReco.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
pnlReco.add(recommendationLbl);
pnlReco.add(recommendationBox);
pnlFV.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
pnlButtonsRecoFV.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
pnlFV.add(fairValueLbl);
pnlFV.add(fairValueBox);
pnlFV.add(fairValueText);
pnlButtonsRecoFV.add(addButton);
pnlButtonsRecoFV.add(cancelButton);
pnlRecoFV.add(pnlInstrument);
pnlRecoFV.add(pnlReco);
pnlRecoFV.add(pnlFV);
pnlRecoFV.add(pnlButtonsRecoFV);
this.add(pnlRecoFV);
this.setVisible(true);
pack() ;
}
//********************* main *********************
public static void main(String[] argv) {
Dialog dialog = new Dialog() ;
}
}//class |
Partager