getting a JSlider to expand
red, green and blue are instance of LabelSliderText, which extends
JPanel. How can I get the three "rows", beans, to line up vertically?
I suppose I could pass in:
"red "
"green"
"blue "
so that the spacing matches up? It's "ok" to pass strings? Hmm, maybe
it would make more sense to pass a Color instance...but maybe that's
overkill.
Also, I can't figure out how to make the JSlider expand horizontally when
the JFrame is enlarged. The surrounding JPane, "green " for instance,
does seem to expand.
thufir@arrakis:~/bcit3621$
thufir@arrakis:~/bcit3621$ cat lab2/src/a00720398/util/ColorSelector.java
package a00720398.util;
public class ColorSelector extends javax.swing.JPanel {
/** Creates new form ColorSelector */
public ColorSelector() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
red = new a00720398.util.LabelSliderText();
green = new a00720398.util.LabelSliderText();
blue = new a00720398.util.LabelSliderText();
setLayout(new javax.swing.BoxLayout(this,
javax.swing.BoxLayout.Y_AXIS));
red.setLabelText("red"); //pass "red " so that it matches up?
add(red);
green.setLabelText("green");
add(green);
blue.setLabelText("blue");
add(blue);
}//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private a00720398.util.LabelSliderText blue;
private a00720398.util.LabelSliderText green;
private a00720398.util.LabelSliderText red;
// End of variables declaration//GEN-END:variables
}
thufir@arrakis:~/bcit3621$
thanks,
Thufir