Example usage for javax.swing JSlider addChangeListener

List of usage examples for javax.swing JSlider addChangeListener

Introduction

In this page you can find the example usage for javax.swing JSlider addChangeListener.

Prototype

public void addChangeListener(ChangeListener l) 

Source Link

Document

Adds a ChangeListener to the slider.

Usage

From source file:ArcApp.java

public JSlider setSlider(int min, int max, int init, int mjrTkSp, int mnrTkSp) {
    JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, init);
    slider.setPaintTicks(true);/*www  . j a v a 2 s .  co m*/
    slider.setMajorTickSpacing(mjrTkSp);
    slider.setMinorTickSpacing(mnrTkSp);
    slider.setPaintLabels(true);
    slider.addChangeListener(new SliderListener());
    return slider;
}

From source file:biomine.bmvis2.pipeline.BestPathHiderOperation.java

public JComponent getSettingsComponent(final SettingsChangeCallback settingsChangeCallback,
        final VisualGraph graph) {
    long nodeCount = graph.getAllNodes().size();

    if (oldCount != 0) {
        long newTarget = (target * nodeCount) / oldCount;
        this.target = Math.max(newTarget, target);
    } else/*ww w . ja v a2  s.  com*/
        this.target = nodeCount;

    this.oldCount = nodeCount;

    JPanel ret = new JPanel();

    // if int overflows, we're fucked
    final JSlider sl = new JSlider(0, (int) nodeCount, (int) Math.min(target, nodeCount));
    sl.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            if (target == sl.getValue())
                return;
            target = sl.getValue();
            settingsChangeCallback.settingsChanged(false);
        }
    });

    ret.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    //c.gridwidth=2;

    ret.add(sl, c);
    c.gridy++;

    int choices = graph.getNodesOfInterest().size() + 1;

    Object[] items = new Object[choices];
    items[0] = "All PoIs";

    for (int i = 1; i < choices; i++) {
        items[i] = i + " nearest";
    }
    final JComboBox pathTypeBox = new JComboBox(items);
    pathTypeBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            int i = pathTypeBox.getSelectedIndex();
            grader.setPathK(i);
            settingsChangeCallback.settingsChanged(false);
        }
    });

    ret.add(new JLabel("hide by best path quality to:"), c);
    c.gridy++;
    ret.add(pathTypeBox, c);
    c.gridy++;

    System.out.println("new confpane nodeCount = " + nodeCount);

    final JCheckBox useMatchingColoring = new JCheckBox();
    ret.add(useMatchingColoring, c);

    useMatchingColoring.setAction(new AbstractAction("Use matching coloring") {
        public void actionPerformed(ActionEvent arg0) {
            matchColoring = useMatchingColoring.isSelected();
            settingsChangeCallback.settingsChanged(false);
        }
    });

    useMatchingColoring.setAlignmentX(JComponent.CENTER_ALIGNMENT);

    c.gridy++;

    final JCheckBox labelsBox = new JCheckBox();
    ret.add(labelsBox, c);

    labelsBox.setAction(new AbstractAction("Show goodness in node labels") {
        public void actionPerformed(ActionEvent arg0) {
            showLabel = labelsBox.isSelected();
            settingsChangeCallback.settingsChanged(false);
        }
    });

    return ret;
}

From source file:House.java

public JSlider setSlider(JPanel panel, int orientation, int minimumValue, int maximumValue, int initValue,
        int majorTickSpacing, int minorTickSpacing) {
    JSlider slider = new JSlider(orientation, minimumValue, maximumValue, initValue);
    slider.setPaintTicks(true);//from  w  w  w  . ja va  2  s.c  o m
    slider.setMajorTickSpacing(majorTickSpacing);
    slider.setMinorTickSpacing(minorTickSpacing);
    slider.setPaintLabels(true);
    slider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider tempSlider = (JSlider) e.getSource();

            if (tempSlider.equals(sliderTransX)) {
                transX = sliderTransX.getValue() - 150.0;
                canvas.repaint();
            } else if (tempSlider.equals(sliderTransY)) {
                transY = sliderTransY.getValue() - 150.0;
                canvas.repaint();
            } else if (tempSlider.equals(sliderRotateTheta)) {
                rotateTheta = sliderRotateTheta.getValue() * Math.PI / 180;
                canvas.repaint();
            } else if (tempSlider.equals(sliderRotateX)) {
                rotateX = sliderRotateX.getValue();
                canvas.repaint();
            } else if (tempSlider.equals(sliderRotateY)) {
                rotateY = sliderRotateY.getValue();
                canvas.repaint();
            } else if (tempSlider.equals(sliderScaleX)) {
                if (sliderScaleX.getValue() != 0.0) {
                    scaleX = sliderScaleX.getValue() / 100.0;
                    canvas.repaint();
                }
            } else if (tempSlider.equals(sliderScaleY)) {
                if (sliderScaleY.getValue() != 0.0) {
                    scaleY = sliderScaleY.getValue() / 100.0;
                    canvas.repaint();
                }
            }
        }
    });
    panel.add(slider);

    return slider;
}

From source file:WeatherWizard.java

public void initComponents() {

    setLayout(new BorderLayout());

    JPanel p = new JPanel();
    p.add(new JLabel("Temperature:"));
    JSlider tempSlider = new JSlider(20, 100, 65);
    tempSlider.setMinorTickSpacing(5);//from w w w.  j  a  v  a  2 s . c o m
    tempSlider.setMajorTickSpacing(20);
    tempSlider.setPaintTicks(true);
    tempSlider.setPaintLabels(true);
    tempSlider.addChangeListener(this);
    p.add(tempSlider);
    add("North", p);

    painter = new WeatherPainter();
    painter.sun = loadImage("sun");
    painter.cloud = loadImage("cloud");
    painter.rain = loadImage("rain");
    painter.snow = loadImage("snow");
    painter.setTemperature(65);
    p.add("Center", painter);

}

From source file:biomine.bmvis2.pipeline.EdgeGoodnessHider.java

public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) {
    double maxEdge = 0;
    for (VisualEdge e : graph.getAllEdges()) {
        maxEdge = Math.max(maxEdge, e.getGoodness());
    }/* w ww . j a  va  2  s . c o m*/

    final int scale = 100;
    final JSlider limitSlider = new JSlider();
    limitSlider.setMinimum(0);
    limitSlider.setMaximum(scale);
    limitSlider.setValue((int) (limit * scale));
    final JTextField limitText = new JTextField();
    limitText.setEditable(false);
    limitText.setText("" + limit);

    limitSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            limit = limitSlider.getValue() / (double) scale;
            limitText.setText("" + limit);
            v.settingsChanged(false);
        }
    });

    JPanel ret = new JPanel();
    GridBagLayout bag = new GridBagLayout();
    ret.setLayout(bag);
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.fill = c.HORIZONTAL;
    ret.add(limitSlider, c);
    c.gridy++;
    ret.add(limitText, c);
    return ret;
}

From source file:org.csml.tommo.sugar.modules.heatmap.MixedHeatmapDialog.java

private JSlider createMixParameterSlider() {

    JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, (int) (mixOperation.getParameter() * 100.0));
    slider.setMajorTickSpacing(10);//from w  w w .j a va2  s. c o  m
    slider.setSnapToTicks(true);
    slider.setPaintTicks(true);
    //         slider.setPaintLabels(true);

    slider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {

            JSlider source = (JSlider) event.getSource();
            if (!source.getValueIsAdjusting()) {
                double param = (double) source.getValue() / (double) 100.0;
                updateMixParameter(param);
            }
        }
    });

    return slider;
}

From source file:jku.ss09.mir.lastfmecho.bo.visualization.MirArtistNetworkGraphVisualizer.java

public boolean init() {

    if (artistList.size() > similarityMatrix.length) {
        System.out.println(/*from   w  w  w .ja v a  2s  .  c  o  m*/
                "Error in MirArtistNetworkGraphVisualizer - The similaritymatrix is smaller than number of artists ");
        return false;
    }

    graph = getGraph(SIMILARITY_DEFAULT / 100.0);
    setVisualizationRenderer();

    // create a frome to hold the graph
    final JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JSlider slider = new JSlider(JSlider.HORIZONTAL, SIMILARITY_MIN, SIMILARITY_MAX, SIMILARITY_DEFAULT);
    slider.setMajorTickSpacing(10);
    slider.setPaintTicks(true);

    final JLabel sliderLabel = new JLabel("0.87");

    final MirArtistNetworkGraphVisualizer thisPointer = this;

    slider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            JSlider source = (JSlider) arg0.getSource();
            if (!source.getValueIsAdjusting()) {
                System.out.println(source.getValue() / 100.0);

                Graph testG = getGraph(source.getValue() / 100.0);
                sliderLabel.setText(Double.toString(source.getValue() / 100.0));
                thisPointer.vv.setGraphLayout(new FRLayout<Integer, Number>(testG));
                //thisPointer.setVisualizationRenderer();
                thisPointer.vv.validate();
                thisPointer.vv.repaint();

            }
        }

    });

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox());
    controls.add(new JLabel("Similarity Limit: "));
    controls.add(sliderLabel);
    controls.add(slider);
    content.add(controls, BorderLayout.SOUTH);

    frame.pack();
    frame.setVisible(true);

    return true;
}

From source file:external.jung.demo.RoadEditorDemo.java

/**
 * create an instance of a simple graph with popup controls to create a
 * graph./*from  ww  w  .  ja va2  s .c o  m*/
 *
 */
public RoadEditorDemo() {
    roadGraphHelper = new RoadGraphHelper();
    this.graph = roadGraphHelper.createRoadGraph();
    this.layout = new StaticLayout<Vertex3DInfo, Edge3DInfo>(graph, new Dimension(600, 600));
    this.roadGraphHelper.setLayout(layout);

    vv = new VisualizationViewer<Vertex3DInfo, Edge3DInfo>(layout);
    vv.setBackground(Color.white);

    vv.getRenderContext().setVertexLabelTransformer(
            MapTransformer.<Vertex3DInfo, String>getInstance(LazyMap.<Vertex3DInfo, String>decorate(
                    new HashMap<Vertex3DInfo, String>(), new ToStringLabeller<Vertex3DInfo>())));
    vv.getRenderContext().setEdgeLabelTransformer(
            MapTransformer.<Edge3DInfo, String>getInstance(LazyMap.<Edge3DInfo, String>decorate(
                    new HashMap<Edge3DInfo, String>(), new ToStringLabeller<Edge3DInfo>())));
    vv.setVertexToolTipTransformer(vv.getRenderContext().getVertexLabelTransformer());
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Vertex3DInfo, Edge3DInfo>());

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final EditingModalGraphMouse<Vertex3DInfo, Edge3DInfo> graphMouse = new EditingModalGraphMouse<Vertex3DInfo, Edge3DInfo>(
            vv.getRenderContext(), roadGraphHelper.vertexFactory, roadGraphHelper.edgeFactory);

    // the EditingGraphMouse will pass mouse event coordinates to the
    // vertexLocations function to set the locations of the vertices as
    // they are created
    //        graphMouse.setVertexLocations(vertexLocations);
    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    graphMouse.setMode(ModalGraphMouse.Mode.EDITING);

    final ScalingControl scaler = new CrossoverScalingControl();
    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JButton help = new JButton("Build");
    help.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //edgeAngle();
            roadGraphHelper.resetExtraDraw();
            roadGraphHelper.vertexIntersect();
            vv.repaint();

        }
    });

    AnnotationControls<Vertex3DInfo, Edge3DInfo> annotationControls = new AnnotationControls<Vertex3DInfo, Edge3DInfo>(
            graphMouse.getAnnotatingPlugin());
    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    JComboBox modeBox = graphMouse.getModeComboBox();
    controls.add(modeBox);
    controls.add(annotationControls.getAnnotationsToolBar());
    controls.add(help);

    JSlider slider2 = new JSlider();
    slider2.setBorder(BorderFactory.createTitledBorder("Size"));
    slider2.setMajorTickSpacing(20);
    slider2.setMinorTickSpacing(5);
    slider2.setPaintTicks(true);
    controls.add(slider2);
    slider2.addChangeListener(new SliderListener());

    JPanel checkBoxes = new JPanel();
    //checkBoxes.setLayout(new GridLayout(1, 5));
    layer1Check = new JCheckBox("Layer1");
    layer1Check.setSelected(true);

    layer2Check = new JCheckBox("Layer2");
    layer2Check.setSelected(true);

    layer3Check = new JCheckBox("Layer3");
    layer3Check.setSelected(true);

    layer4Check = new JCheckBox("Layer4");
    layer4Check.setSelected(true);
    layer5Check = new JCheckBox("Layer5");
    layer5Check.setSelected(true);
    checkBoxes.add(layer1Check);
    checkBoxes.add(layer2Check);
    checkBoxes.add(layer3Check);
    checkBoxes.add(layer4Check);
    checkBoxes.add(layer5Check);
    JPanel twoLine = new JPanel();
    twoLine.setLayout(new GridLayout(2, 1));
    content.add(twoLine, BorderLayout.SOUTH);
    twoLine.add(controls);
    twoLine.add(checkBoxes);
    // 
    vv.addPostRenderPaintable(new PaintRoad());
    vv.addPreRenderPaintable(new PaintRoadUnder());
    vv.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            //edgeAngle();
            roadGraphHelper.resetExtraDraw();
            roadGraphHelper.vertexIntersect();
            vv.repaint();

        }
    });

}

From source file:EdgeLabelDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the label positioning features/*  www  .  ja  va  2 s.c  o m*/
 * 
 */
@SuppressWarnings("serial")
public EdgeLabelDemo() {

    // create a simple graph for the demo
    graph = new SparseMultigraph<Integer, Number>();
    Integer[] v = createVertices(3);
    createEdges(v);

    Layout<Integer, Number> layout = new CircleLayout<Integer, Number>(graph);
    vv = new VisualizationViewer<Integer, Number>(layout, new Dimension(600, 400));
    vv.setBackground(Color.white);

    vertexLabelRenderer = vv.getRenderContext().getVertexLabelRenderer();
    edgeLabelRenderer = vv.getRenderContext().getEdgeLabelRenderer();

    Transformer<Number, String> stringer = new Transformer<Number, String>() {
        public String transform(Number e) {
            return "Edge:" + graph.getEndpoints(e).toString();
        }
    };
    vv.getRenderContext().setEdgeLabelTransformer(stringer);
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan));
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.red, Color.yellow));
    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>());

    // create a frome to hold the graph
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    Container content = getContentPane();
    content.add(panel);

    final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(graphMouse);

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    ButtonGroup radio = new ButtonGroup();
    JRadioButton lineButton = new JRadioButton("Line");
    lineButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, Number>());
                vv.repaint();
            }
        }
    });

    JRadioButton quadButton = new JRadioButton("QuadCurve");
    quadButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Integer, Number>());
                vv.repaint();
            }
        }
    });

    JRadioButton cubicButton = new JRadioButton("CubicCurve");
    cubicButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<Integer, Number>());
                vv.repaint();
            }
        }
    });
    radio.add(lineButton);
    radio.add(quadButton);
    radio.add(cubicButton);

    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    JCheckBox rotate = new JCheckBox("<html><center>EdgeType<p>Parallel</center></html>");
    rotate.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            AbstractButton b = (AbstractButton) e.getSource();
            edgeLabelRenderer.setRotateEdgeLabels(b.isSelected());
            vv.repaint();
        }
    });
    rotate.setSelected(true);
    MutableDirectionalEdgeValue mv = new MutableDirectionalEdgeValue(.5, .7);
    vv.getRenderContext().setEdgeLabelClosenessTransformer(mv);
    JSlider directedSlider = new JSlider(mv.getDirectedModel()) {
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width /= 2;
            return d;
        }
    };
    JSlider undirectedSlider = new JSlider(mv.getUndirectedModel()) {
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width /= 2;
            return d;
        }
    };

    JSlider edgeOffsetSlider = new JSlider(0, 50) {
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width /= 2;
            return d;
        }
    };
    edgeOffsetSlider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            JSlider s = (JSlider) e.getSource();
            AbstractEdgeShapeTransformer<Integer, Number> aesf = (AbstractEdgeShapeTransformer<Integer, Number>) vv
                    .getRenderContext().getEdgeShapeTransformer();
            aesf.setControlOffsetIncrement(s.getValue());
            vv.repaint();
        }

    });

    Box controls = Box.createHorizontalBox();

    JPanel zoomPanel = new JPanel(new GridLayout(0, 1));
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Scale"));
    zoomPanel.add(plus);
    zoomPanel.add(minus);

    JPanel edgePanel = new JPanel(new GridLayout(0, 1));
    edgePanel.setBorder(BorderFactory.createTitledBorder("EdgeType Type"));
    edgePanel.add(lineButton);
    edgePanel.add(quadButton);
    edgePanel.add(cubicButton);

    JPanel rotatePanel = new JPanel();
    rotatePanel.setBorder(BorderFactory.createTitledBorder("Alignment"));
    rotatePanel.add(rotate);

    JPanel labelPanel = new JPanel(new BorderLayout());
    JPanel sliderPanel = new JPanel(new GridLayout(3, 1));
    JPanel sliderLabelPanel = new JPanel(new GridLayout(3, 1));
    JPanel offsetPanel = new JPanel(new BorderLayout());
    offsetPanel.setBorder(BorderFactory.createTitledBorder("Offset"));
    sliderPanel.add(directedSlider);
    sliderPanel.add(undirectedSlider);
    sliderPanel.add(edgeOffsetSlider);
    sliderLabelPanel.add(new JLabel("Directed", JLabel.RIGHT));
    sliderLabelPanel.add(new JLabel("Undirected", JLabel.RIGHT));
    sliderLabelPanel.add(new JLabel("Edges", JLabel.RIGHT));
    offsetPanel.add(sliderLabelPanel, BorderLayout.WEST);
    offsetPanel.add(sliderPanel);
    labelPanel.add(offsetPanel);
    labelPanel.add(rotatePanel, BorderLayout.WEST);

    JPanel modePanel = new JPanel(new GridLayout(2, 1));
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modePanel.add(graphMouse.getModeComboBox());

    controls.add(zoomPanel);
    controls.add(edgePanel);
    controls.add(labelPanel);
    controls.add(modePanel);
    content.add(controls, BorderLayout.SOUTH);
    quadButton.setSelected(true);
}

From source file:net.pms.encoders.VLCVideo.java

@Override
public JComponent config() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec("right:pref, 3dlu, pref:grow, 7dlu, right:pref, 3dlu, pref:grow",
            orientation);//from w  w  w .  ja  va2s  . c  o  m
    FormLayout layout = new FormLayout(colSpec, "");
    // Here goes my 3rd try to learn JGoodies Form
    layout.setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } });
    DefaultFormBuilder mainPanel = new DefaultFormBuilder(layout);

    mainPanel.appendSeparator(Messages.getString("VlcTrans.1"));
    mainPanel.append(experimentalCodecs = new JCheckBox(Messages.getString("VlcTrans.3"),
            configuration.isVlcExperimentalCodecs()), 3);
    experimentalCodecs.setContentAreaFilled(false);
    experimentalCodecs.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setVlcExperimentalCodecs(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mainPanel.append(audioSyncEnabled = new JCheckBox(Messages.getString("VlcTrans.4"),
            configuration.isVlcAudioSyncEnabled()), 3);
    audioSyncEnabled.setContentAreaFilled(false);
    audioSyncEnabled.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setVlcAudioSyncEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mainPanel.nextLine();

    // Developer stuff. Theoretically is temporary 
    mainPanel.appendSeparator(Messages.getString("VlcTrans.10"));

    // Add scale as a subpanel because it has an awkward layout
    mainPanel.append(Messages.getString("VlcTrans.11"));
    FormLayout scaleLayout = new FormLayout("pref,3dlu,pref", "");
    DefaultFormBuilder scalePanel = new DefaultFormBuilder(scaleLayout);
    double startingScale = Double.valueOf(configuration.getVlcScale());
    scalePanel.append(scale = new JTextField(String.valueOf(startingScale)));
    final JSlider scaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 10, (int) (startingScale * 10));
    scalePanel.append(scaleSlider);
    scaleSlider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent ce) {
            String value = String.valueOf((double) scaleSlider.getValue() / 10);
            scale.setText(value);
            configuration.setVlcScale(value);
        }
    });
    scale.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            String typed = scale.getText();
            if (!typed.matches("\\d\\.\\d")) {
                return;
            }
            double value = Double.parseDouble(typed);
            scaleSlider.setValue((int) (value * 10));
            configuration.setVlcScale(String.valueOf(value));
        }
    });
    mainPanel.append(scalePanel.getPanel(), 3);

    // Audio sample rate
    FormLayout sampleRateLayout = new FormLayout(
            "right:pref, 3dlu, right:pref, 3dlu, right:pref, 3dlu, left:pref", "");
    DefaultFormBuilder sampleRatePanel = new DefaultFormBuilder(sampleRateLayout);
    sampleRateOverride = new JCheckBox(Messages.getString("VlcTrans.17"),
            configuration.getVlcSampleRateOverride());
    sampleRatePanel.append(Messages.getString("VlcTrans.18"), sampleRateOverride);
    sampleRate = new JTextField(configuration.getVlcSampleRate(), 8);
    sampleRate.setEnabled(configuration.getVlcSampleRateOverride());
    sampleRate.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setVlcSampleRate(sampleRate.getText());
        }
    });
    sampleRatePanel.append(Messages.getString("VlcTrans.19"), sampleRate);
    sampleRateOverride.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean checked = e.getStateChange() == ItemEvent.SELECTED;
            configuration.setVlcSampleRateOverride(checked);
            sampleRate.setEnabled(checked);
        }
    });

    mainPanel.nextLine();
    mainPanel.append(sampleRatePanel.getPanel(), 7);

    // Extra options
    mainPanel.nextLine();
    mainPanel.append(Messages.getString("VlcTrans.20"), extraParams = new JTextField(), 5);

    return mainPanel.getPanel();
}