Revision 11004 trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/graphic/BoxesPanel.java

View differences:

BoxesPanel.java
18 18
 */
19 19
package org.gvsig.gui.beans.graphic;
20 20

  
21
import java.awt.BorderLayout;
21 22
import java.awt.FlowLayout;
22 23

  
23 24
import javax.swing.JPanel;
......
31 32

  
32 33
public class BoxesPanel extends JPanel {
33 34
	private static final long serialVersionUID = -4117483555280497312L;
34
	private int 				width = 300, height = 30;
35 35
	private JPanel pLeft = null;
36 36
	private JPanel pRight = null;
37 37
	private TextIncreaserContainer controlLeft = null;
38 38
	private TextIncreaserContainer controlRight = null;
39
	public BoxesPanel(int width, int height) {
39
	public BoxesPanel() {
40 40
		super();
41
		this.width = width;
42
		this.height = height;
43 41
		initialize(); 
44 42
	}
45 43

  
......
48 46
	 * 
49 47
	 */
50 48
	private void initialize() {
51
        FlowLayout flowLayout = new FlowLayout();
52
        flowLayout.setHgap(0);
53
        flowLayout.setVgap(0);
54
        this.setLayout(flowLayout);
55
        this.setSize(new java.awt.Dimension(width, height));
56
        this.setPreferredSize(new java.awt.Dimension(width, height));
57
        this.add(getPLeft(), null);
58
        this.add(getPRight(), null);
59
			
49
		this.setLayout(new BorderLayout());
50
		this.add(getPLeft(), BorderLayout.WEST);
51
		this.add(getPRight(), BorderLayout.EAST);
60 52
	}
61 53

  
62 54
	/**
......
73 65
			pLeft = new JPanel();
74 66
			pLeft.setLayout(flowLayout1);
75 67
			pLeft.add(getControlLeft(), null);
76
			pLeft.setSize(new java.awt.Dimension(width >> 1, height));
77
	        pLeft.setPreferredSize(new java.awt.Dimension(width >> 1, height));
68
			pLeft.setPreferredSize(new java.awt.Dimension(100, 30));
78 69
		}
79 70
		return pLeft;
80 71
	}
......
93 84
			pRight = new JPanel();
94 85
			pRight.setLayout(flowLayout2);
95 86
			pRight.add(getControlRight(), null);
96
			pRight.setSize(new java.awt.Dimension(width >> 1, height));
97
			pRight.setPreferredSize(new java.awt.Dimension(width >> 1, height));
87
			pRight.setPreferredSize(new java.awt.Dimension(100, 30));
98 88
		}
99 89
		return pRight;
100 90
	}
......
122 112
		}
123 113
		return controlRight;
124 114
	}
125
	
126
	/**
127
	 * Asigna el tama?o del componente
128
	 * @param w Nuevo ancho del componente padre
129
	 * @param h Nuevo alto del componente padre
130
	 */
131
	public void setComponentSize(int w, int h){
132
		this.width = w;
133
		this.height = h;
134
		setSize(w, h);
135
		setPreferredSize(new java.awt.Dimension(w, h));
136
		getPRight().setSize(w >> 1, h);
137
		getPRight().setPreferredSize(new java.awt.Dimension(w >> 1, h));
138
		getPLeft().setSize(w >> 1, h);
139
		getPLeft().setPreferredSize(new java.awt.Dimension(w >> 1, h));
140
		
141
	}
142
	
115

  
143 116
	//****************************************************
144 117
	//M?TODOS DEL CONTROL
145 118
	
......
154 127
		v[1] = getControlLeft().getValue();
155 128
		return v;
156 129
	}
157
}
130
}

Also available in: Unified diff