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 112 113 114 115 116 117 118 119
|
private void initComponents()
{
jPanelMain = new JPanel();
jPanelHeader = new JPanel();
borderLayoutMain = new BorderLayout();
jPanelBottom = new JPanel();
jPanelCanvas = new JPanel();
// jScrollPane = new JScrollPane();
canvas = createCanvas();
jPanelRight = new JPanel();{
jLabel1 = new JLabel();
jButton1 = new JButton();
jButton2 = new JButton();
jButton2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
jButton2ActionPerformed(e);
}
});
jButton3 = new JButton();
jButton3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton3ActionPerformed(e);
}
});
jButton4 = new JButton();
container = new Container();
container = getContentPane();
container.add(jPanelMain);
jPanelMain.setLayout(borderLayoutMain);
jPanelMain.add(jPanelHeader,BorderLayout.NORTH);
jPanelHeader.setSize(-1,500);
jPanelHeader.add(jLabel1);
jLabel1.setText("Coucou");
jPanelMain.add(jPanelBottom);
BorderLayout bottomLayout = new BorderLayout();
jPanelBottom.setLayout(bottomLayout);
//jScrollPane = new JScrollPane(canvas);
//jScrollPane.setViewportView(canvas);
//jScrollPane.getViewport().setViewSize(new Dimension(200,200));
//jScrollPane.setSize(new Dimension(200,200));
//jPanelCanvas.setPreferredSize(new Dimension(500,500));
//jPanelCanvas.add(canvas);
//jScrollPane.setPreferredSize(new Dimension(600,800));
//jScrollPane.setBackground(new Color(60, 60, 60));
//jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
//jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
//jPanelBottom.add(canvas);
jPanelBottom.setPreferredSize(new Dimension(600,800));
//jScrollPane.setBounds(0, 0, 200, 200);
jPanelBottom.add(canvas,BorderLayout.WEST);
jPanelBottom.add(jPanelRight,BorderLayout.EAST);
jPanelRight.setLayout(new GridLayout(4,1));
jPanelRight.add(jButton1);
jPanelRight.add(jButton2);
jPanelRight.add(jButton3);
jPanelRight.add(jButton4);
jButton1.setText("Load from XML");
jButton2.setText("Save to XML");
jButton3.setText("Reset");
jButton4.setText("Options");
}
}
private WorkZone createCanvas()
{
WorkZone canvasTemp = new WorkZone();
//canvasTemp.setBackground(new Color(255,255,255));
canvasTemp.setBackground(new Color(200,200,200));
canvasTemp.setFocusable(true);
canvasTemp.setPreferredSize(new Dimension(5000, 5000));
Dimension dim =new Dimension(20,20);
new SimpleMouseListener(canvasTemp);
new MoveDrawableMouseListener(canvasTemp);
new NonOverlapMoveAdapter(canvasTemp);
return canvasTemp;
} |
Partager