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 "
"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

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$ cat lab2/src/a00720398/util/
package a00720398.util;

public class ColorSelector extends javax.swing.JPanel {

/** Creates new form ColorSelector */
public ColorSelector() {

/** 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,

red.setLabelText("red"); //pass "red " so that it matches up?



// 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




Relevant Pages

  • Re: This JComboBox does not resizes itself
    ... You may of course put your Item objects in the Vector instead of a String. ... public class ChangeItem extends JFrame { ... private class Combo extends JComboBox { ... > private static class Combo extends JComboBox { ...
  • Re: polymorphic method call from third class
    ... If B extends A you can invoke the method in class B with an A type or a B-type. ... If the test-methods have to be private, you could use B as an inner class of A, but then you'd need also a second method that invokes the private ones. ... public static void main{ ...
  • Thread Safety with SwingWorker
    ... I have a class that extends a jframe with some additional private ... It also has an inner class that extends SwingWorker and some ... I was wondering if it is safe to write to a (private) field from the ... SwingWorker finished method, while the listeners read the private field. ...
  • Re: [PHP] Object to array conversion oddity
    ... On 24 Sep 2006, at 01:09, Robert Cummings wrote: ... private $A; ... class B extends A { ... Synchromedia Limited: Creators of ...