Example usage for javax.swing DefaultComboBoxModel DefaultComboBoxModel

List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel

Introduction

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

Prototype

public DefaultComboBoxModel(Vector<E> v) 

Source Link

Document

Constructs a DefaultComboBoxModel object initialized with a vector.

Usage

From source file:SuitaDetails.java

private void showLib() {
    JScrollPane jScrollPane1 = new JScrollPane();
    JList jList1 = new JList();
    JPanel libraries = new JPanel();
    jScrollPane1.setViewportView(jList1);
    GroupLayout layout = new GroupLayout(libraries);
    libraries.setLayout(layout);//  w  w  w.  j  a va  2  s. c  om
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1,
            GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE));

    try {
        Object[] s = (Object[]) RunnerRepository.getRPCClient().execute("getLibrariesList",
                new Object[] { RunnerRepository.user });
        String[] libs = new String[s.length];
        for (int i = 0; i < s.length; i++) {
            libs[i] = s[i].toString();
        }
        ArrayList<Integer> ind = new ArrayList<Integer>();
        jList1.setModel(new DefaultComboBoxModel(libs));
        for (String st : globallib) {
            for (int i = 0; i < libs.length; i++) {
                if (libs[i].equals(st)) {
                    ind.add(new Integer(i));
                }
            }
        }
        int[] indices = new int[ind.size()];
        for (int i = 0; i < ind.size(); i++) {
            indices[i] = ind.get(i);
        }
        jList1.setSelectedIndices(indices);

    } catch (Exception e) {
        System.out.println("There was an error on calling getLibrariesList on CE");
        e.printStackTrace();
    }
    int resp = (Integer) CustomDialog.showDialog(libraries, JOptionPane.PLAIN_MESSAGE,
            JOptionPane.OK_CANCEL_OPTION, RunnerRepository.window, "Libraries", null);
    if (resp == JOptionPane.OK_OPTION) {
        Object[] val = jList1.getSelectedValues();
        globallib = new String[val.length];
        for (int s = 0; s < val.length; s++) {
            globallib[s] = val[s].toString();
        }
    }

}

From source file:com.itemanalysis.jmetrik.swing.GraphOptionPanel.java

private void initComponents() {

    orientationButtonGroup = new ButtonGroup();
    colorPanel = new JPanel();
    color1Label = new JLabel();
    colorLabel2 = new JLabel();
    colorButton1 = new JButton();
    colorButton2 = new JButton();
    colorLabel3 = new JLabel();
    colorButton3 = new JButton();
    colorLabel4 = new JLabel();
    colorButton4 = new JButton();
    colorLabel5 = new JLabel();
    colorButton5 = new JButton();
    colorLabel6 = new JLabel();
    colorButton6 = new JButton();
    colorLabel7 = new JLabel();
    colorButton7 = new JButton();
    colorLabel8 = new JLabel();
    colorButton8 = new JButton();
    colorLabel9 = new JLabel();
    colorButton9 = new JButton();
    lineStylePanel = new JPanel();
    lineLabel1 = new JLabel();
    lineStyleComboBox1 = new JComboBox();
    lineLabel2 = new JLabel();
    lineStyleComboBox2 = new JComboBox();
    lineLabel3 = new JLabel();
    lineStyleComboBox3 = new JComboBox();
    lineLabel4 = new JLabel();
    lineStyleComboBox4 = new JComboBox();
    lineLabel5 = new JLabel();
    lineStyleComboBox5 = new JComboBox();
    lineLabel6 = new JLabel();
    lineStyleComboBox6 = new JComboBox();
    lineLabel7 = new JLabel();
    lineStyleComboBox7 = new JComboBox();
    lineLabel8 = new JLabel();
    lineStyleComboBox8 = new JComboBox();
    lineLabel9 = new JLabel();
    lineStyleComboBox9 = new JComboBox();
    lineWidthLabel = new JLabel();
    lineWidthTextField = new JTextField();
    displayPanel = new JPanel();
    legendPositionComboBox = new JComboBox();
    legendCheckbox = new JCheckBox();
    markersCheckbox = new JCheckBox();
    horizontalRadioButton = new JRadioButton();
    verticalRadioButton = new JRadioButton();
    sizePanel = new JPanel();
    widthLabel = new JLabel();
    widthTextField = new JTextField();
    heightLabel = new JLabel();
    heightTextField = new JTextField();
    resetButton = new JButton();

    //        setBorder(BorderFactory.createTitledBorder(""));

    colorPanel.setBorder(BorderFactory.createTitledBorder("Color Sequence"));

    color1Label.setText("Color 1");

    colorLabel2.setText("Color 2");

    colorButton1.setText("Choose Color");
    colorButton1.setMaximumSize(new Dimension(116, 25));
    colorButton1.setMinimumSize(new Dimension(116, 25));
    colorButton1.setPreferredSize(new Dimension(116, 25));
    colorButton1.setBackground(color[0]);
    colorButton1.addActionListener(new ActionListener() {
        @Override/*from   w ww. j  av a 2  s.com*/
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 1", color[0]);
            if (newColor != null) {
                colorButton1.setBackground(newColor);
                color[0] = newColor;
            }
        }
    });

    colorButton2.setText("Choose Color");
    colorButton2.setMaximumSize(new Dimension(116, 25));
    colorButton2.setMinimumSize(new Dimension(116, 25));
    colorButton2.setPreferredSize(new Dimension(116, 25));
    colorButton2.setBackground(color[1]);
    colorButton2.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 2", color[1]);
            if (newColor != null) {
                colorButton2.setBackground(newColor);
                color[1] = newColor;
            }
        }
    });

    colorLabel3.setText("Color 3");

    colorButton3.setText("Choose Color");
    colorButton3.setMaximumSize(new Dimension(116, 25));
    colorButton3.setMinimumSize(new Dimension(116, 25));
    colorButton3.setPreferredSize(new Dimension(116, 25));
    colorButton3.setBackground(color[2]);
    colorButton3.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 3", color[2]);
            if (newColor != null) {
                colorButton3.setBackground(newColor);
                color[2] = newColor;
            }
        }
    });

    colorLabel4.setText("Color 4");

    colorButton4.setText("Choose Color");
    colorButton4.setMaximumSize(new Dimension(116, 25));
    colorButton4.setMinimumSize(new Dimension(116, 25));
    colorButton4.setPreferredSize(new Dimension(116, 25));
    colorButton4.setBackground(color[3]);
    colorButton4.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 4", color[3]);
            if (newColor != null) {
                colorButton4.setBackground(newColor);
                color[3] = newColor;
            }
        }
    });

    colorLabel5.setText("Color 5");

    colorButton5.setText("Choose Color");
    colorButton5.setMaximumSize(new Dimension(116, 25));
    colorButton5.setMinimumSize(new Dimension(116, 25));
    colorButton5.setPreferredSize(new Dimension(116, 25));
    colorButton5.setBackground(color[4]);
    colorButton5.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 5", color[4]);
            if (newColor != null) {
                colorButton5.setBackground(newColor);
                color[4] = newColor;
            }
        }
    });

    colorLabel6.setText("Color 6");

    colorButton6.setText("Choose Color");
    colorButton6.setMaximumSize(new Dimension(116, 25));
    colorButton6.setMinimumSize(new Dimension(116, 25));
    colorButton6.setPreferredSize(new Dimension(116, 25));
    colorButton6.setBackground(color[5]);
    colorButton6.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 6", color[5]);
            if (newColor != null) {
                colorButton6.setBackground(newColor);
                color[5] = newColor;
            }
        }
    });

    colorLabel7.setText("Color 7");

    colorButton7.setText("Choose Color");
    colorButton7.setMaximumSize(new Dimension(116, 25));
    colorButton7.setMinimumSize(new Dimension(116, 25));
    colorButton7.setPreferredSize(new Dimension(116, 25));
    colorButton7.setBackground(color[6]);
    colorButton7.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 7", color[6]);
            if (newColor != null) {
                colorButton7.setBackground(newColor);
                color[6] = newColor;
            }
        }
    });

    colorLabel8.setText("Color 8");

    colorButton8.setText("Choose Color");
    colorButton8.setMaximumSize(new Dimension(116, 25));
    colorButton8.setMinimumSize(new Dimension(116, 25));
    colorButton8.setPreferredSize(new Dimension(116, 25));
    colorButton8.setBackground(color[7]);
    colorButton8.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 8", color[7]);
            if (newColor != null) {
                colorButton8.setBackground(newColor);
                color[7] = newColor;
            }
        }
    });

    colorLabel9.setText("Color 9");

    colorButton9.setText("Choose Color");
    colorButton9.setMaximumSize(new Dimension(116, 25));
    colorButton9.setMinimumSize(new Dimension(116, 25));
    colorButton9.setPreferredSize(new Dimension(116, 25));
    colorButton9.setBackground(color[8]);
    colorButton9.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 9", color[8]);
            if (newColor != null) {
                colorButton9.setBackground(newColor);
                color[8] = newColor;
            }
        }
    });

    GroupLayout colorPanelLayout = new GroupLayout(colorPanel);
    colorPanel.setLayout(colorPanelLayout);
    colorPanelLayout.setHorizontalGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(colorPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(color1Label)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton1, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel2)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton2, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel3)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton3, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel4)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton4, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel5)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton5, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel6)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton6, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel7)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton7, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel8)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton8, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel9)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(colorButton9, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addContainerGap()));
    colorPanelLayout.setVerticalGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(colorPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(color1Label).addComponent(colorButton1, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel2).addComponent(colorButton2, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel3).addComponent(colorButton3, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel4).addComponent(colorButton4, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel5).addComponent(colorButton5, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel6).addComponent(colorButton6, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel7).addComponent(colorButton7, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel8).addComponent(colorButton8, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(colorLabel9).addComponent(colorButton9, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    lineStylePanel.setBorder(BorderFactory.createTitledBorder("Line Styles"));

    lineLabel1.setText("Line 1");

    lineStyleComboBox1.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox1.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox1.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[0]));
    lineStyleComboBox1.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox1.setPreferredSize(new Dimension(150, 25));

    lineLabel2.setText("Line 2");

    lineStyleComboBox2.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox2.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox2.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[1]));
    lineStyleComboBox2.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox2.setPreferredSize(new Dimension(150, 25));

    lineLabel3.setText("Line 3");

    lineStyleComboBox3.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox3.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox3.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[2]));
    lineStyleComboBox3.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox3.setPreferredSize(new Dimension(150, 25));

    lineLabel4.setText("Line 4");

    lineStyleComboBox4.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox4.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox4.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[3]));
    lineStyleComboBox4.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox4.setPreferredSize(new Dimension(150, 25));

    lineLabel5.setText("Line 5");

    lineStyleComboBox5.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox5.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox5.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[4]));
    lineStyleComboBox5.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox5.setPreferredSize(new Dimension(150, 25));

    lineLabel6.setText("Line 6");

    lineStyleComboBox6.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox6.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox6.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[5]));
    lineStyleComboBox6.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox6.setPreferredSize(new Dimension(150, 25));

    lineLabel7.setText("Line 7");

    lineStyleComboBox7.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox7.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox7.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[6]));
    lineStyleComboBox7.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox7.setPreferredSize(new Dimension(150, 25));

    lineLabel8.setText("Line 8");

    lineStyleComboBox8.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox8.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox8.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[7]));
    lineStyleComboBox8.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox8.setPreferredSize(new Dimension(150, 25));

    lineLabel9.setText("Line 9");

    lineStyleComboBox9.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME));
    lineStyleComboBox9.setRenderer(new LineStyleComboBoxRenderer());
    lineStyleComboBox9.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[8]));
    lineStyleComboBox9.setMinimumSize(new Dimension(150, 25));
    lineStyleComboBox9.setPreferredSize(new Dimension(150, 25));

    GroupLayout lineStylePanelLayout = new GroupLayout(lineStylePanel);
    lineStylePanel.setLayout(lineStylePanelLayout);
    lineStylePanelLayout.setHorizontalGroup(lineStylePanelLayout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(lineStylePanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel1)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox1, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel2)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox2, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel3)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox3, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel4)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox4, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel5)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox5, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel6)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox6, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel7)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox7, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel8)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox8, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel9)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(lineStyleComboBox9, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    lineStylePanelLayout
            .setVerticalGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(lineStylePanelLayout.createSequentialGroup().addContainerGap()
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel1).addComponent(lineStyleComboBox1,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel2).addComponent(lineStyleComboBox2,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel3).addComponent(lineStyleComboBox3,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel4).addComponent(lineStyleComboBox4,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel5).addComponent(lineStyleComboBox5,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel6).addComponent(lineStyleComboBox6,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel7).addComponent(lineStyleComboBox7,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel8).addComponent(lineStyleComboBox8,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(lineLabel9).addComponent(lineStyleComboBox9,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    displayPanel.setBorder(BorderFactory.createTitledBorder("Display Options"));

    legendPositionComboBox
            .setModel(new DefaultComboBoxModel(new String[] { "Bottom", "Left", "Top", "Right" }));
    legendPositionComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String s = legendPositionComboBox.getSelectedItem().toString();
            if ("Bottom".equals(s)) {
                prefs.setLegendPosition(RectangleEdge.BOTTOM);
            } else if ("Left".equals(s)) {
                prefs.setLegendPosition(RectangleEdge.LEFT);
            } else if ("Top".equals(s)) {
                prefs.setLegendPosition(RectangleEdge.TOP);
            } else {
                prefs.setLegendPosition(RectangleEdge.RIGHT);
            }

        }
    });

    legendCheckbox.setSelected(true);
    legendCheckbox.setText("Legend");
    legendCheckbox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (legendCheckbox.isSelected()) {
                prefs.setShowLegend(true);
            } else {
                prefs.setShowLegend(false);
            }
        }
    });

    markersCheckbox.setText("Point markers");
    markersCheckbox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (markersCheckbox.isSelected()) {
                prefs.setShowMarkers(true);
            } else {
                prefs.setShowMarkers(false);
            }
        }
    });

    orientationButtonGroup.add(horizontalRadioButton);
    horizontalRadioButton.setText("Horizontal orientation");
    horizontalRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (horizontalRadioButton.isSelected()) {
                prefs.setChartOrientation(PlotOrientation.HORIZONTAL);
            }
        }
    });

    orientationButtonGroup.add(verticalRadioButton);
    verticalRadioButton.setSelected(true);
    verticalRadioButton.setText("Vertical orientation");
    verticalRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (verticalRadioButton.isSelected()) {
                prefs.setChartOrientation(PlotOrientation.VERTICAL);
            }
        }
    });

    GroupLayout displayPanelLayout = new GroupLayout(displayPanel);
    displayPanel.setLayout(displayPanelLayout);
    displayPanelLayout.setHorizontalGroup(displayPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(displayPanelLayout.createSequentialGroup().addContainerGap().addGroup(displayPanelLayout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(displayPanelLayout.createSequentialGroup().addGroup(displayPanelLayout
                            .createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(markersCheckbox)
                            .addGroup(displayPanelLayout.createSequentialGroup().addComponent(legendCheckbox)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(legendPositionComboBox, 0, 89, Short.MAX_VALUE)))
                            .addGap(26, 26, 26))
                    .addGroup(displayPanelLayout.createSequentialGroup().addComponent(horizontalRadioButton)
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(displayPanelLayout.createSequentialGroup().addComponent(verticalRadioButton)
                            .addGap(0, 0, Short.MAX_VALUE)))));
    displayPanelLayout.setVerticalGroup(displayPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(displayPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(displayPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(legendCheckbox).addComponent(legendPositionComboBox,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(markersCheckbox)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(horizontalRadioButton)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(verticalRadioButton)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    sizePanel.setBorder(BorderFactory.createTitledBorder("Chart Size"));

    widthLabel.setText("Width");

    widthTextField.setText("450");
    widthTextField.setMaximumSize(new Dimension(100, 25));
    widthTextField.setMinimumSize(new Dimension(100, 25));
    widthTextField.setPreferredSize(new Dimension(100, 25));
    widthTextField.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(FocusEvent e) {
            //do nothing
        }

        @Override
        public void focusLost(FocusEvent e) {
            String s = widthTextField.getText();
            try {
                int w = Integer.parseInt(s);
                prefs.setChartWidth(w);
            } catch (NumberFormatException ex) {
                widthTextField.setText("450");
            }
        }
    });

    heightLabel.setText("Height");

    heightTextField.setText("400");
    heightTextField.setMaximumSize(new Dimension(100, 25));
    heightTextField.setMinimumSize(new Dimension(100, 25));
    heightTextField.setPreferredSize(new Dimension(100, 25));
    heightTextField.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(FocusEvent e) {
            //do nothing
        }

        @Override
        public void focusLost(FocusEvent e) {
            try {
                String s = heightTextField.getText();
                int h = Integer.parseInt(s);
                prefs.setChartHeight(h);
            } catch (NumberFormatException ex) {
                heightTextField.setText("400");
            }
        }
    });

    lineWidthLabel.setText("Line width");

    lineWidthTextField.setText("1.0");
    lineWidthTextField.setMaximumSize(new Dimension(100, 25));
    lineWidthTextField.setMinimumSize(new Dimension(100, 25));
    lineWidthTextField.setPreferredSize(new Dimension(100, 25));
    lineWidthTextField.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(FocusEvent e) {
            //do nothing
        }

        @Override
        public void focusLost(FocusEvent e) {
            try {

                String s = lineWidthTextField.getText();
                float lw = Float.parseFloat(s);
                prefs.setChartLineWidth(lw);
            } catch (NumberFormatException ex) {
                lineWidthTextField.setText("1.0");
            }
        }
    });

    GroupLayout sizePanelLayout = new GroupLayout(sizePanel);
    sizePanel.setLayout(sizePanelLayout);
    sizePanelLayout.setHorizontalGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(sizePanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addComponent(widthLabel).addComponent(heightLabel).addComponent(lineWidthLabel))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.CENTER)
                            .addComponent(widthTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(heightTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(lineWidthTextField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    sizePanelLayout.setVerticalGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(sizePanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(widthLabel).addComponent(widthTextField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(heightLabel).addComponent(heightTextField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(lineWidthLabel).addComponent(lineWidthTextField,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    resetButton.setText("Reset to Default Chart Options");
    resetButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            resetPanel();
        }
    });

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
                    .createSequentialGroup()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                            .addComponent(displayPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(colorPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(lineStylePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(sizePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)))
                    .addComponent(resetButton))
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(colorPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(lineStylePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(sizePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(displayPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(resetButton)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
}

From source file:com.microsoft.intellij.forms.CreateWebSiteForm.java

private void fillResourceGroups(String valToSet) {
    try {/*  w  w w . java 2 s.  co m*/
        if (subscription != null) {
            final List<String> groupList = AzureManagerImpl.getManager(project)
                    .getResourceGroupNames(subscription.getId());
            DefaultComboBoxModel model = new DefaultComboBoxModel(groupList.toArray());
            model.insertElementAt(createResGrpLabel, 0);
            model.setSelectedItem(null);
            groupComboBox.setModel(model);
            if (!groupList.isEmpty()) {
                if (valToSet != null && !valToSet.isEmpty()) {
                    groupComboBox.setSelectedItem(valToSet);
                } else {
                    groupComboBox.setSelectedIndex(1);
                }
                // prepare list of App Service plans for selected subscription
                if (fillPlansAcrossSub != null && !fillPlansAcrossSub.isFinished()) {
                    fillPlansAcrossSub.cancel();
                }
                IDEHelper.ProjectDescriptor projectDescriptor = new IDEHelper.ProjectDescriptor(
                        project.getName(), project.getBasePath() == null ? "" : project.getBasePath());
                fillPlansAcrossSub = DefaultLoader.getIdeHelper().runInBackground(projectDescriptor,
                        "Loading service plans...", null, new CancellableTask() {
                            @Override
                            public void onCancel() {
                            }

                            @Override
                            public void onSuccess() {
                            }

                            @Override
                            public void onError(@NotNull Throwable throwable) {
                            }

                            @Override
                            public synchronized void run(final CancellationHandle cancellationHandle)
                                    throws Throwable {
                                plansAcrossSub = new ArrayList<String>();
                                for (String groupName : groupList) {
                                    List<WebHostingPlanCache> plans = AzureManagerImpl.getManager(project)
                                            .getWebHostingPlans(subscription.getId(), groupName);
                                    for (WebHostingPlanCache plan : plans) {
                                        plansAcrossSub.add(plan.getName());
                                    }
                                }
                            }
                        });
            }
        }
    } catch (AzureCmdException e) {
        String msg = "An error occurred while loading the resource groups." + "\n"
                + String.format(message("webappExpMsg"), e.getMessage());
        PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, e);
    }
}

From source file:ca.sfu.federation.viewer.propertysheet.PointPropertySheet.java

private void setValues() {
    // target/*from w  w  w .  j  ava  2s  .  c o m*/
    this.target = (Point) Application.getContext().getViewState(ApplicationContext.VIEWER_SELECTION);
    // set field values
    this.lblINamedObject.setText(this.target.getName());
    this.jtfClass.setText(this.target.getClass().toString());
    this.jtfName.setText(this.target.getName());
    this.jtfCanonicalName.setText(this.target.getCanonicalName());
    this.jtfParentContext.setText(this.target.getContext().getName());
    try {
        BeanProxy proxy = new BeanProxy(this.target);
        Double x = (Double) proxy.get("x");
        Double y = (Double) proxy.get("y");
        Double z = (Double) proxy.get("z");
        this.jtfX.setText(String.valueOf(x));
        this.jtfY.setText(String.valueOf(y));
        this.jtfZ.setText(String.valueOf(z));
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "{0}", stack);
    }

    List<Method> methods = this.target.getUpdateMethods();
    ArrayList<String> methodNameList = new ArrayList<String>();
    Iterator<Method> it = methods.iterator();
    while (it.hasNext()) {
        Method method = it.next();
        methodNameList.add(method.getName());
    }
    DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel(methodNameList.toArray());
    jcbUpdateMethod.setModel(comboBoxModel);
    String selected = this.target.getUpdateMethodName();
    jcbUpdateMethod.setSelectedItem(selected);

    // build the input panel
    this.buildUpdateMethodInputsPanel();

    // listen for changes on the target
    if (this.target instanceof Observable) {
        Observable o = (Observable) this.target;
        o.addObserver(this);
    }
}

From source file:com.mirth.connect.connectors.doc.DocumentWriter.java

private void updatePageSizeComboBox() {
    if (pageSizeUpdating) {
        return;/*from   ww  w  . j a  v  a2  s . co m*/
    }
    pageSizeUpdating = true;

    try {
        double width = Double.parseDouble(pageSizeWidthField.getText());
        double height = Double.parseDouble(pageSizeHeightField.getText());
        Unit unit = (Unit) pageSizeUnitComboBox.getSelectedItem();

        PageSize matchingPageSize = null;
        for (PageSize pageSize : PageSize.values()) {
            if (pageSize != PageSize.CUSTOM && pageSize.getWidth(unit) == width
                    && pageSize.getHeight(unit) == height) {
                matchingPageSize = pageSize;
                break;
            }
        }

        if (matchingPageSize != null) {
            pageSizeComboBox.setModel(new DefaultComboBoxModel<PageSize>(
                    ArrayUtils.subarray(PageSize.values(), 0, PageSize.values().length - 1)));
            pageSizeComboBox.setSelectedItem(matchingPageSize);
            pageSizeUpdating = false;
            return;
        }
    } catch (Exception e) {
    }

    pageSizeComboBox.setModel(new DefaultComboBoxModel<PageSize>(PageSize.values()));
    pageSizeComboBox.setSelectedItem(PageSize.CUSTOM);
    pageSizeUpdating = false;
}

From source file:com.cch.aj.entryrecorder.frame.SettingsJFrame.java

private void UpdateTabProduct(int id) {
    //product//from  w  w  w . j av a  2  s  .  c om
    Product currentProduct = new Product();

    int selectedIndex = FillProductComboBox(this.cbProduct, id, this.settingMouldId);
    if (selectedIndex >= 0) {
        currentProduct = ((ComboBoxItem<Product>) this.cbProduct.getSelectedItem()).getItem();
        this.settingProduct = currentProduct;
        this.UpdateProductUI(currentProduct);

    } else {
        this.cbProduct.setModel(new DefaultComboBoxModel(new ComboBoxItem[] {}));
        this.UpdateProductUI(new Product());
    }

    if (this.cbProduct.getSelectedItem() == null
            || ((ComboBoxItem<Product>) this.cbProduct.getSelectedItem()).getId() == 0) {
        this.pnlProductEdit.setVisible(false);
        this.btnProductDelete.setVisible(false);
        this.btnProductDuplicate.setVisible(false);
        this.btnProductSave.setVisible(false);
        this.btnProductUndo.setVisible(false);
    } else {
        this.pnlProductEdit.setVisible(true);
        this.btnProductDelete.setVisible(true);
        this.btnProductDuplicate.setVisible(true);
        this.btnProductSave.setVisible(true);
        this.btnProductUndo.setVisible(true);
    }

}

From source file:ca.sfu.federation.viewer.propertysheet.LinePropertySheet.java

private void setValues() {
    // target// w  w  w  . jav a2  s.co m
    this.target = (Line) Application.getContext().getViewState(ApplicationContext.VIEWER_SELECTION);
    // set field values
    this.lblINamedObject.setText(this.target.getName());
    this.jtfClass.setText(this.target.getClass().toString());
    this.jtfName.setText(this.target.getName());
    // this.jtfDescription.setText(this.target.getDescription());
    this.jtfCanonicalName.setText(this.target.getCanonicalName());
    this.jtfParentContext.setText(this.target.getContext().getName());
    try {
        BeanProxy proxy = new BeanProxy(this.target);
        IPoint startPoint = (IPoint) proxy.get("startPoint");
        IPoint midPoint = (IPoint) proxy.get("startPoint");
        IPoint endPoint = (IPoint) proxy.get("startPoint");
        Double length = (Double) proxy.get("length");
        this.jtfStartPoint.setText(String.valueOf(startPoint));
        this.jtfMidPoint.setText(String.valueOf(midPoint));
        this.jtfEndPoint.setText(String.valueOf(endPoint));
        this.jtfLength.setText(String.valueOf(length));
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "{0}", stack);
    }
    ArrayList<String> methodNameList = new ArrayList<String>();
    List<Method> methods = this.target.getUpdateMethods();
    Iterator<Method> it = methods.iterator();
    while (it.hasNext()) {
        Method method = it.next();
        String name = method.getName();
        methodNameList.add(name);
    }
    DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel(methodNameList.toArray());
    jcbUpdateMethod.setModel(comboBoxModel);
    String selected = this.target.getUpdateMethodName();
    jcbUpdateMethod.setSelectedItem(selected);

    // build the input panel
    this.buildUpdateMethodInputsPanel();

    // listen for changes on the target
    if (this.target instanceof Observable) {
        Observable o = (Observable) this.target;
        o.addObserver(this);
    }
}

From source file:AST.DesignPatternDetection.java

private void initComponents() {

    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Murat Oruc
    btPathFinder = new JButton();
    label1 = new JLabel();
    tfPath = new JTextField();
    label2 = new JLabel();
    cbSelectionDP = new JComboBox<>();
    btRun = new JButton();
    label3 = new JLabel();
    tfProjectName = new JTextField();
    label4 = new JLabel();
    tfThreshold = new JTextField();
    chbOverlap = new JCheckBox();
    btRunSgiso = new JButton();
    scrollPane1 = new JScrollPane();
    taInfo = new JTextArea();
    label5 = new JLabel();
    tfProgramPath = new JTextField();
    btProgramPath = new JButton();
    button1 = new JButton();
    button2 = new JButton();
    chbInnerClass = new JCheckBox();

    //======== this ========
    setTitle("DesPaD (Design Pattern Detector)");
    setIconImage(((ImageIcon) UIManager.getIcon("FileView.computerIcon")).getImage());
    addWindowListener(new WindowAdapter() {
        @Override//from  w  ww.j  av  a  2s.c  o m
        public void windowClosing(WindowEvent e) {
            thisWindowClosing(e);
        }
    });
    Container contentPane = getContentPane();

    //---- btPathFinder ----
    btPathFinder.setText("...");
    btPathFinder.setFont(btPathFinder.getFont().deriveFont(btPathFinder.getFont().getSize() + 1f));
    btPathFinder.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            btPathFinderActionPerformed(e);
        }
    });

    //---- label1 ----
    label1.setText("Source Code Directory Path");

    //---- tfPath ----
    tfPath.setText("...");
    tfPath.setEditable(false);
    tfPath.setForeground(Color.blue);
    tfPath.setFont(tfPath.getFont().deriveFont(tfPath.getFont().getStyle() | Font.BOLD));

    //---- label2 ----
    label2.setText("Select Design Pattern");

    //---- cbSelectionDP ----
    cbSelectionDP.setModel(new DefaultComboBoxModel<>(
            new String[] { "FACTORY_METHOD", "PROTOTYPE", "ABSTRACT_FACTORY", "BUILDER", "SINGLETON",
                    "COMPOSITE", "FACADE", "DECORATOR", "DECORATOR2", "BRIDGE", "FLYWEIGHT", "ADAPTER", "PROXY",
                    "MEDIATOR", "STATE", "OBSERVER", "TEMPLATE_METHOD", "TEMPLATE_METHOD2", "COMMAND",
                    "CHAIN_OF_RESPONSIBILITY", "INTERPRETER", "MEMENTO", "ITERATOR", "STRATEGY", "VISITOR" }));

    //---- btRun ----
    btRun.setText("1. Build Model Graph");
    btRun.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                btRunActionPerformed(e);
            } catch (IOException | InterruptedException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });

    //---- label3 ----
    label3.setText("Project Name");

    //---- label4 ----
    label4.setText("Threshold");

    //---- tfThreshold ----
    tfThreshold.setText("0.0");

    //---- chbOverlap ----
    chbOverlap.setText("Overlap");

    //---- btRunSgiso ----
    btRunSgiso.setText("2. Run Subdue-Sgiso Algorithm");
    btRunSgiso.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                btRunSgisoActionPerformed(e);
            } catch (IOException | InterruptedException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });

    //======== scrollPane1 ========
    {
        scrollPane1.setViewportView(taInfo);
    }

    //---- label5 ----
    label5.setText("Program Directory Path");

    //---- tfProgramPath ----
    tfProgramPath.setEditable(false);
    tfProgramPath.setForeground(Color.blue);
    tfProgramPath.setFont(tfProgramPath.getFont().deriveFont(tfProgramPath.getFont().getStyle() | Font.BOLD));

    //---- btProgramPath ----
    btProgramPath.setText("...");
    btProgramPath.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            btProgramPathActionPerformed(e);
        }
    });

    //---- button1 ----
    button1.setText("3. Exclude overlap outputs");
    button1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                button1ActionPerformed(e);
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });

    //---- button2 ----
    button2.setText("4. Graph Representations");
    button2.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                button2ActionPerformed(e);
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });

    //---- chbInnerClass ----
    chbInnerClass.setText("Include Inner Classes");
    chbInnerClass.setSelected(true);

    GroupLayout contentPaneLayout = new GroupLayout(contentPane);
    contentPane.setLayout(contentPaneLayout);
    contentPaneLayout.setHorizontalGroup(
            contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout.createSequentialGroup()
                    .addContainerGap().addGroup(contentPaneLayout
                            .createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING,
                                    contentPaneLayout.createSequentialGroup().addComponent(label1).addGap(21,
                                            433, Short.MAX_VALUE))
                            .addGroup(contentPaneLayout
                                    .createSequentialGroup().addGroup(contentPaneLayout.createParallelGroup()
                                            .addComponent(label4).addGroup(contentPaneLayout
                                                    .createSequentialGroup().addGroup(contentPaneLayout
                                                            .createParallelGroup(GroupLayout.Alignment.TRAILING,
                                                                    false)
                                                            .addComponent(
                                                                    button1, GroupLayout.Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE, 260,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(tfThreshold,
                                                                    GroupLayout.Alignment.LEADING)
                                                            .addComponent(cbSelectionDP,
                                                                    GroupLayout.Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE, 260,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(label2, GroupLayout.Alignment.LEADING)
                                                            .addComponent(
                                                                    btRun, GroupLayout.Alignment.LEADING,
                                                                    GroupLayout.DEFAULT_SIZE, 260,
                                                                    Short.MAX_VALUE))
                                                    .addGap(30, 30, 30)
                                                    .addGroup(contentPaneLayout
                                                            .createParallelGroup(GroupLayout.Alignment.LEADING,
                                                                    false)
                                                            .addComponent(label3)
                                                            .addComponent(tfProjectName,
                                                                    GroupLayout.DEFAULT_SIZE, 260,
                                                                    Short.MAX_VALUE)
                                                            .addGroup(contentPaneLayout.createSequentialGroup()
                                                                    .addComponent(chbOverlap)
                                                                    .addPreferredGap(
                                                                            LayoutStyle.ComponentPlacement.RELATED,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            Short.MAX_VALUE)
                                                                    .addComponent(chbInnerClass))
                                                            .addComponent(btRunSgiso, GroupLayout.DEFAULT_SIZE,
                                                                    260, Short.MAX_VALUE)
                                                            .addComponent(
                                                                    button2, GroupLayout.DEFAULT_SIZE, 260,
                                                                    Short.MAX_VALUE))))
                                    .addGap(0, 56, Short.MAX_VALUE))
                            .addGroup(GroupLayout.Alignment.TRAILING,
                                    contentPaneLayout.createSequentialGroup().addGroup(contentPaneLayout
                                            .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                            .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 594,
                                                    Short.MAX_VALUE)
                                            .addGroup(contentPaneLayout.createSequentialGroup()
                                                    .addGroup(contentPaneLayout.createParallelGroup()
                                                            .addGroup(contentPaneLayout.createSequentialGroup()
                                                                    .addComponent(label5)
                                                                    .addGap(0, 418, Short.MAX_VALUE))
                                                            .addComponent(tfProgramPath,
                                                                    GroupLayout.DEFAULT_SIZE, 564,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(
                                                                    tfPath, GroupLayout.Alignment.TRAILING,
                                                                    GroupLayout.DEFAULT_SIZE, 564,
                                                                    Short.MAX_VALUE))
                                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                                    .addGroup(contentPaneLayout
                                                            .createParallelGroup(GroupLayout.Alignment.LEADING,
                                                                    false)
                                                            .addComponent(btPathFinder,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(btProgramPath,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE))))
                                            .addContainerGap()))));
    contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout
            .createSequentialGroup().addGap(29, 29, 29).addComponent(label1).addGap(5, 5, 5)
            .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(tfPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(btPathFinder, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE))
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(label5)
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(tfProgramPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(btProgramPath))
            .addGap(18, 18, 18)
            .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(label2)
                    .addComponent(label3))
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(cbSelectionDP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfProjectName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addGap(18, 18, 18).addComponent(label4).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(tfThreshold, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(chbOverlap).addComponent(chbInnerClass))
            .addGap(18, 18, 18)
            .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(btRun, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE)
                    .addComponent(btRunSgiso, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE))
            .addGap(18, 18, 18)
            .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                    .addComponent(button2, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
                    .addComponent(button1, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE))
            .addGap(18, 18, 18).addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)
            .addContainerGap()));
    setSize(630, 625);
    setLocationRelativeTo(null);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.intuit.tank.tools.debugger.AgentDebuggerFrame.java

/**
 * @param currentWorkload/*from  ww w.  j  a v a  2 s.  co  m*/
 *            the currentWorkload to set
 */
public void setCurrentWorkload(HDWorkload currentWorkload) {
    setCurrentTestPlan(null);
    this.currentWorkload = currentWorkload;
    if (currentWorkload != null) {
        DefaultComboBoxModel model = new DefaultComboBoxModel(
                currentWorkload.getPlans().toArray(new HDTestPlan[currentWorkload.getPlans().size()]));
        if (currentWorkload.getPlans().size() > 0) {
            setCurrentTestPlan(currentWorkload.getPlans().get(0));
            model.setSelectedItem(currentTestPlan);
        }
        testPlanChooser.setModel(model);
    } else {
        setCurrentTestPlan(null);
        testPlanChooser.setModel(new DefaultComboBoxModel());
    }
}

From source file:cl.uai.webcursos.emarking.desktop.OptionsDialog.java

/**
 * Create the dialog./*from   www  . ja  v a 2  s. co  m*/
 */
public OptionsDialog(Moodle _moodle) {
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            cancelled = true;
        }
    });
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setIconImage(Toolkit.getDefaultToolkit().getImage(OptionsDialog.class
            .getResource("/cl/uai/webcursos/emarking/desktop/resources/glyphicons_439_wrench.png")));
    setTitle(EmarkingDesktop.lang.getString("emarkingoptions"));
    setModal(true);
    setBounds(100, 100, 707, 444);
    this.moodle = _moodle;
    this.moodle.loadProperties();
    getContentPane().setLayout(new BorderLayout());
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            okButton = new JButton(EmarkingDesktop.lang.getString("ok"));
            okButton.setEnabled(false);
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    try {
                        UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
                        if (!validator.isValid(moodleurl.getText())) {
                            throw new Exception(EmarkingDesktop.lang.getString("invalidmoodleurl") + " "
                                    + moodleurl.getText());
                        }
                        File f = new File(filename.getText());
                        if (!f.exists() || f.isDirectory()
                                || (!f.getPath().endsWith(".pdf") && !f.getPath().endsWith(".zip"))) {
                            throw new Exception(EmarkingDesktop.lang.getString("invalidpdffile") + " "
                                    + filename.getText());
                        }
                        if (omrtemplate.getText().trim().length() > 0) {
                            File omrf = new File(omrtemplate.getText());
                            if (!omrf.exists() || omrf.isDirectory() || (!omrf.getPath().endsWith(".xtmpl"))) {
                                throw new Exception(EmarkingDesktop.lang.getString("invalidomrfile") + " "
                                        + omrtemplate.getText());
                            }
                        }
                        moodle.setLastfile(filename.getText());
                        moodle.getQrExtractor().setDoubleside(chckbxDoubleSide.isSelected());
                        moodle.setMaxthreads(Integer.parseInt(getMaxThreads().getSelectedItem().toString()));
                        moodle.setResolution(Integer.parseInt(getResolution().getSelectedItem().toString()));
                        moodle.setMaxzipsize(getMaxZipSize().getSelectedItem().toString());
                        moodle.setOMRTemplate(omrtemplate.getText());
                        moodle.setThreshold(Integer.parseInt(spinnerOMRthreshold.getValue().toString()));
                        moodle.setDensity(Integer.parseInt(spinnerOMRdensity.getValue().toString()));
                        moodle.setShapeSize(Integer.parseInt(spinnerOMRshapeSize.getValue().toString()));
                        moodle.setAnonymousPercentage(
                                Integer.parseInt(spinnerAnonymousPercentage.getValue().toString()));
                        moodle.setAnonymousPercentageCustomPage(
                                Integer.parseInt(spinnerAnonymousPercentageCustomPage.getValue().toString()));
                        moodle.setFakeStudents(chckbxMarkersTraining.isSelected());
                        moodle.saveProperties();
                        cancelled = false;
                        setVisible(false);
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        JOptionPane.showMessageDialog(panel,
                                EmarkingDesktop.lang.getString("invaliddatainform"));
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton(EmarkingDesktop.lang.getString("cancel"));
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    cancelled = true;
                    setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    panel = new JPanel();
    tabbedPane.addTab(EmarkingDesktop.lang.getString("general"), null, panel, null);
    panel.setLayout(null);

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_2.setBounds(10, 11, 665, 131);
    panel.add(panel_2);
    panel_2.setLayout(null);

    JLabel lblPassword = new JLabel(EmarkingDesktop.lang.getString("password"));
    lblPassword.setBounds(10, 99, 109, 14);
    panel_2.add(lblPassword);
    lblPassword.setHorizontalAlignment(SwingConstants.RIGHT);

    password = new JPasswordField();
    password.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testConnection();
        }
    });
    password.setBounds(129, 96, 329, 20);
    panel_2.add(password);
    this.password.setText(this.moodle.getPassword());

    btnTestConnection = new JButton(EmarkingDesktop.lang.getString("connect"));
    btnTestConnection.setEnabled(false);
    btnTestConnection.setBounds(468, 93, 172, 27);
    panel_2.add(btnTestConnection);

    username = new JTextField();
    username.setBounds(129, 65, 329, 20);
    panel_2.add(username);
    username.setColumns(10);
    this.username.setText(this.moodle.getUsername());

    moodleurl = new JTextField();
    moodleurl.setBounds(129, 34, 329, 20);
    panel_2.add(moodleurl);
    moodleurl.setColumns(10);
    moodleurl.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            warn();
        }

        private void warn() {
            UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
            if (!validator.isValid(moodleurl.getText()) || !moodleurl.getText().endsWith("/")) {
                moodleurl.setForeground(Color.RED);
                btnTestConnection.setEnabled(false);
            } else {
                moodleurl.setForeground(Color.BLACK);
                btnTestConnection.setEnabled(true);
            }
        }
    });

    // Initializing values from moodle configuration
    this.moodleurl.setText(this.moodle.getUrl());

    JLabel lblMoodleUrl = new JLabel(EmarkingDesktop.lang.getString("moodleurl"));
    lblMoodleUrl.setBounds(10, 37, 109, 14);
    panel_2.add(lblMoodleUrl);
    lblMoodleUrl.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblUsername = new JLabel(EmarkingDesktop.lang.getString("username"));
    lblUsername.setBounds(10, 68, 109, 14);
    panel_2.add(lblUsername);
    lblUsername.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblMoodleSettings = new JLabel(EmarkingDesktop.lang.getString("moodlesettings"));
    lblMoodleSettings.setBounds(10, 11, 230, 14);
    panel_2.add(lblMoodleSettings);
    btnTestConnection.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testConnection();
        }
    });

    JPanel panel_3 = new JPanel();
    panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_3.setBounds(10, 159, 666, 174);
    panel.add(panel_3);
    panel_3.setLayout(null);

    JLabel lblPdfFile = new JLabel(EmarkingDesktop.lang.getString("pdffile"));
    lblPdfFile.setBounds(0, 39, 119, 14);
    panel_3.add(lblPdfFile);
    lblPdfFile.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblScanned = new JLabel(EmarkingDesktop.lang.getString("scanned"));
    lblScanned.setBounds(0, 64, 119, 14);
    panel_3.add(lblScanned);
    lblScanned.setHorizontalAlignment(SwingConstants.RIGHT);

    chckbxDoubleSide = new JCheckBox(EmarkingDesktop.lang.getString("doubleside"));
    chckbxDoubleSide.setEnabled(false);
    chckbxDoubleSide.setBounds(125, 60, 333, 23);
    panel_3.add(chckbxDoubleSide);
    chckbxDoubleSide.setToolTipText(EmarkingDesktop.lang.getString("doublesidetooltip"));
    this.chckbxDoubleSide.setSelected(this.moodle.getQrExtractor().isDoubleside());

    filename = new JTextField();
    filename.setEnabled(false);
    filename.setBounds(129, 36, 329, 20);
    panel_3.add(filename);
    filename.setColumns(10);
    filename.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            warn();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            warn();
        }

        private void warn() {
            validateFileForProcessing(!btnTestConnection.isEnabled());
        }
    });
    this.filename.setText(this.moodle.getLastfile());

    btnOpenPdfFile = new JButton(EmarkingDesktop.lang.getString("openfile"));
    btnOpenPdfFile.setEnabled(false);
    btnOpenPdfFile.setBounds(468, 33, 172, 27);
    panel_3.add(btnOpenPdfFile);

    JLabel lblPdfFileSettings = new JLabel(EmarkingDesktop.lang.getString("filesettings"));
    lblPdfFileSettings.setBounds(10, 11, 230, 14);
    panel_3.add(lblPdfFileSettings);

    JLabel lblOMRtemplate = new JLabel(EmarkingDesktop.lang.getString("omrfile"));
    lblOMRtemplate.setHorizontalAlignment(SwingConstants.RIGHT);
    lblOMRtemplate.setBounds(0, 142, 119, 14);
    panel_3.add(lblOMRtemplate);

    omrtemplate = new JTextField();
    omrtemplate.setEnabled(false);
    omrtemplate.setText((String) null);
    omrtemplate.setColumns(10);
    omrtemplate.setBounds(129, 139, 329, 20);
    panel_3.add(omrtemplate);
    omrtemplate.setText(this.moodle.getOMRTemplate());

    btnOpenOMRTemplate = new JButton(EmarkingDesktop.lang.getString("openomrfile"));
    btnOpenOMRTemplate.setEnabled(false);
    btnOpenOMRTemplate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser chooser = new JFileChooser();
            chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle"));
            chooser.setDialogType(JFileChooser.OPEN_DIALOG);
            chooser.setFileFilter(new FileFilter() {
                @Override
                public String getDescription() {
                    return "*.xtmpl";
                }

                @Override
                public boolean accept(File arg0) {
                    if (arg0.getName().endsWith(".xtmpl") || arg0.isDirectory())
                        return true;
                    return false;
                }
            });
            int retval = chooser.showOpenDialog(panel);
            if (retval == JFileChooser.APPROVE_OPTION) {
                omrtemplate.setText(chooser.getSelectedFile().getAbsolutePath());
            } else {
                return;
            }
        }
    });
    btnOpenOMRTemplate.setBounds(468, 136, 172, 27);
    panel_3.add(btnOpenOMRTemplate);

    lblMarkersTraining = new JLabel((String) EmarkingDesktop.lang.getString("markerstraining"));
    lblMarkersTraining.setHorizontalAlignment(SwingConstants.RIGHT);
    lblMarkersTraining.setBounds(0, 89, 119, 14);
    panel_3.add(lblMarkersTraining);

    chckbxMarkersTraining = new JCheckBox(EmarkingDesktop.lang.getString("markerstrainingfakestudents"));
    chckbxMarkersTraining.setBounds(125, 87, 333, 23);
    panel_3.add(chckbxMarkersTraining);
    btnOpenPdfFile.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            okButton.setEnabled(false);
            JFileChooser chooser = new JFileChooser();
            chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle"));
            chooser.setDialogType(JFileChooser.OPEN_DIALOG);
            chooser.setFileFilter(new FileFilter() {
                @Override
                public String getDescription() {
                    return "*.pdf, *.zip";
                }

                @Override
                public boolean accept(File arg0) {
                    if (arg0.getName().endsWith(".zip") || arg0.getName().endsWith(".pdf")
                            || arg0.isDirectory())
                        return true;
                    return false;
                }
            });
            int retval = chooser.showOpenDialog(panel);
            if (retval == JFileChooser.APPROVE_OPTION) {
                filename.setText(chooser.getSelectedFile().getAbsolutePath());
                okButton.setEnabled(true);
            } else {
                return;
            }
        }
    });

    JPanel panel_1 = new JPanel();
    tabbedPane.addTab(EmarkingDesktop.lang.getString("advanced"), null, panel_1, null);
    panel_1.setLayout(null);

    JPanel panel_4 = new JPanel();
    panel_4.setLayout(null);
    panel_4.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_4.setBounds(10, 11, 665, 131);
    panel_1.add(panel_4);

    JLabel lblAdvancedOptions = new JLabel(EmarkingDesktop.lang.getString("advancedoptions"));
    lblAdvancedOptions.setBounds(10, 11, 233, 14);
    panel_4.add(lblAdvancedOptions);

    JLabel lblThreads = new JLabel(EmarkingDesktop.lang.getString("maxthreads"));
    lblThreads.setBounds(10, 38, 130, 14);
    panel_4.add(lblThreads);
    lblThreads.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel lblSomething = new JLabel(EmarkingDesktop.lang.getString("separatezipfiles"));
    lblSomething.setBounds(10, 73, 130, 14);
    panel_4.add(lblSomething);
    lblSomething.setHorizontalAlignment(SwingConstants.RIGHT);

    JLabel label = new JLabel(EmarkingDesktop.lang.getString("resolution"));
    label.setBounds(10, 105, 130, 14);
    panel_4.add(label);
    label.setHorizontalAlignment(SwingConstants.RIGHT);

    resolution = new JComboBox<Integer>();
    resolution.setBounds(150, 99, 169, 27);
    panel_4.add(resolution);
    resolution.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 75, 100, 150, 300, 400, 500, 600 }));
    resolution.setSelectedIndex(2);
    this.resolution.setSelectedItem(this.moodle.getQrExtractor().getResolution());

    maxZipSize = new JComboBox<String>();
    maxZipSize.setBounds(150, 67, 169, 27);
    panel_4.add(maxZipSize);
    maxZipSize.setModel(new DefaultComboBoxModel<String>(new String[] { "<dynamic>", "2Mb", "4Mb", "8Mb",
            "16Mb", "32Mb", "64Mb", "128Mb", "256Mb", "512Mb", "1024Mb" }));
    maxZipSize.setSelectedIndex(6);
    this.maxZipSize.setSelectedItem(this.moodle.getMaxZipSizeString());

    maxThreads = new JComboBox<Integer>();
    maxThreads.setBounds(150, 32, 169, 27);
    panel_4.add(maxThreads);
    maxThreads.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 2, 4, 8, 16 }));
    maxThreads.setSelectedIndex(1);
    this.maxThreads.setSelectedItem(this.moodle.getQrExtractor().getMaxThreads());

    JPanel panel_5 = new JPanel();
    panel_5.setLayout(null);
    panel_5.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
    panel_5.setBounds(10, 153, 665, 131);
    panel_1.add(panel_5);

    JLabel lblOMRoptions = new JLabel(EmarkingDesktop.lang.getString("omroptions"));
    lblOMRoptions.setBounds(10, 11, 233, 14);
    panel_5.add(lblOMRoptions);

    JLabel lblOMRthreshold = new JLabel(EmarkingDesktop.lang.getString("omrthreshold"));
    lblOMRthreshold.setHorizontalAlignment(SwingConstants.RIGHT);
    lblOMRthreshold.setBounds(10, 32, 130, 14);
    panel_5.add(lblOMRthreshold);

    JLabel lblShapeSize = new JLabel(EmarkingDesktop.lang.getString("omrshapesize"));
    lblShapeSize.setHorizontalAlignment(SwingConstants.RIGHT);
    lblShapeSize.setBounds(10, 99, 130, 14);
    panel_5.add(lblShapeSize);

    JLabel lblDensity = new JLabel(EmarkingDesktop.lang.getString("omrdensity"));
    lblDensity.setHorizontalAlignment(SwingConstants.RIGHT);
    lblDensity.setBounds(10, 70, 130, 14);
    panel_5.add(lblDensity);

    spinnerOMRthreshold = new JSpinner();
    spinnerOMRthreshold.setBounds(150, 32, 169, 20);
    panel_5.add(spinnerOMRthreshold);
    spinnerOMRthreshold.setValue(this.moodle.getOMRthreshold());

    spinnerOMRdensity = new JSpinner();
    spinnerOMRdensity.setBounds(150, 67, 169, 20);
    panel_5.add(spinnerOMRdensity);
    spinnerOMRdensity.setValue(this.moodle.getOMRdensity());

    spinnerOMRshapeSize = new JSpinner();
    spinnerOMRshapeSize.setBounds(150, 99, 169, 20);
    panel_5.add(spinnerOMRshapeSize);
    spinnerOMRshapeSize.setValue(this.moodle.getOMRshapeSize());

    JLabel lblAnonymousPercentage = new JLabel(
            "<html>" + EmarkingDesktop.lang.getString("anonymouspercentage") + "</html>");
    lblAnonymousPercentage.setHorizontalAlignment(SwingConstants.RIGHT);
    lblAnonymousPercentage.setBounds(329, 32, 130, 27);
    panel_5.add(lblAnonymousPercentage);

    spinnerAnonymousPercentage = new JSpinner();
    spinnerAnonymousPercentage.setBounds(469, 32, 169, 20);
    panel_5.add(spinnerAnonymousPercentage);
    spinnerAnonymousPercentage.setValue(this.moodle.getAnonymousPercentage());

    JLabel lblAnonymousPercentageCustomPage = new JLabel(
            "<html>" + EmarkingDesktop.lang.getString("anonymouspercentagecustompage") + "</html>");
    lblAnonymousPercentageCustomPage.setHorizontalAlignment(SwingConstants.RIGHT);
    lblAnonymousPercentageCustomPage.setBounds(329, 70, 130, 27);
    panel_5.add(lblAnonymousPercentageCustomPage);

    spinnerAnonymousPercentageCustomPage = new JSpinner();
    spinnerAnonymousPercentageCustomPage.setBounds(469, 70, 169, 20);
    panel_5.add(spinnerAnonymousPercentageCustomPage);
    spinnerAnonymousPercentageCustomPage.setValue(this.moodle.getAnonymousPercentageCustomPage());

    JLabel lblCustomPage = new JLabel(
            "<html>" + EmarkingDesktop.lang.getString("anonymouscustompage") + "</html>");
    lblCustomPage.setHorizontalAlignment(SwingConstants.RIGHT);
    lblCustomPage.setBounds(329, 99, 130, 27);
    panel_5.add(lblCustomPage);

    spinnerCustomPage = new JSpinner();
    spinnerCustomPage.setBounds(469, 99, 169, 20);
    panel_5.add(spinnerCustomPage);
    spinnerCustomPage.setValue(this.moodle.getAnonymousCustomPage());
}