Example usage for javax.swing JPanel setBackground

List of usage examples for javax.swing JPanel setBackground

Introduction

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

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.")
public void setBackground(Color bg) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:com.juanhg.car.CarApplet.java

private void autogeneratedCode() {
    JPanel panel_control = new JPanel();
    panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null),
            new BevelBorder(BevelBorder.RAISED, null, null, null, null)));

    JPanel panelInputs = new JPanel();
    panelInputs.setToolTipText("");
    panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelOutputs = new JPanel();
    panelOutputs.setToolTipText("");
    panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelTitleOutputs = new JPanel();
    panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n");
    labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitleOutputs.add(labelOutputData);

    lblWc = new JLabel("Wc:");
    lblWc.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblWcValue = new JLabel();
    lblWcValue.setText("0");
    lblWcValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblNc = new JLabel("Ciclos:");
    lblNc.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblNcValue = new JLabel();
    lblNcValue.setText("0");
    lblNcValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO3 = new JLabel("Tmax:");
    lblO3.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblTmaxValue = new JLabel();
    lblTmaxValue.setText("0");
    lblTmaxValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblV = new JLabel("V:");
    lblV.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblP = new JLabel("P:");
    lblP.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblH = new JLabel("Eta:");
    lblH.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblEtaValue = new JLabel();
    lblEtaValue.setText("0");
    lblEtaValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblPValue = new JLabel();
    lblPValue.setText("0");
    lblPValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVValue = new JLabel();
    lblVValue.setText("0");
    lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblF = new JLabel("F:");
    lblF.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblFValue = new JLabel();
    lblFValue.setText("0");
    lblFValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblDist = new JLabel("Dist:");
    lblDist.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblXValue = new JLabel();
    lblXValue.setText("0");
    lblXValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs);
    gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelOutputs.createSequentialGroup().addGroup(gl_panelOutputs
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap().addGroup(gl_panelOutputs
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(lblNc, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(lblWc, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblP, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE)
                                    .addComponent(lblV, GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)))
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(lblWcValue, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
                                    .addComponent(lblNcValue, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblVValue, GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)
                                    .addComponent(lblPValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblDist, GroupLayout.PREFERRED_SIZE, 40,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblXValue,
                                                    GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE))
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblF, GroupLayout.PREFERRED_SIZE, 40,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblFValue,
                                                    GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE))
                                    .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblH)
                                            .addGap(18).addComponent(lblEtaValue, GroupLayout.DEFAULT_SIZE, 79,
                                                    Short.MAX_VALUE))
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 40,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addComponent(lblTmaxValue, GroupLayout.DEFAULT_SIZE, 76,
                                                    Short.MAX_VALUE))))
                    .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, 299,
                            GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
    gl_panelOutputs.setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelOutputs.createSequentialGroup()
                    .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGap(20)//from w w w  . j  a va  2  s. co m
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblWc)
                                    .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblNc,
                                            GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblWcValue)
                                    .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblNcValue,
                                            GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelOutputs.createSequentialGroup()
                                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(lblH, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblEtaValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblTmaxValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE))))
                    .addGap(11)
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblF, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblFValue, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(11)
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblDist, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblP, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addComponent(lblXValue, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(30, Short.MAX_VALUE)));
    panelOutputs.setLayout(gl_panelOutputs);

    JPanel panelLicense = new JPanel();
    panelLicense.setBorder(new LineBorder(new Color(0, 0, 0)));

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new LineBorder(new Color(0, 0, 0)));
    GroupLayout gl_panel_control = new GroupLayout(panel_control);
    gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control
                    .createParallelGroup(Alignment.TRAILING)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 300, GroupLayout.PREFERRED_SIZE)
                    .addComponent(panelInputs, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 300,
                            Short.MAX_VALUE)
                    .addComponent(panel_6, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
                    .addComponent(panelLicense, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 300,
                            Short.MAX_VALUE))
                    .addContainerGap()));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 211, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE).addGap(18)
                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 74, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addGap(24)));

    btnLaunchSimulation = new JButton("Iniciar");
    btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    btnLaunchSimulation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            btnLaunchSimulationEvent(event);
        }
    });
    GroupLayout gl_panel_6 = new GroupLayout(panel_6);
    gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_6.createSequentialGroup().addContainerGap()
                    .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_6
                    .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation,
                            GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(69, Short.MAX_VALUE)));
    panel_6.setLayout(gl_panel_6);

    JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE");
    panelLicense.add(lblNewLabel);

    JLabel lblVa = new JLabel("Va");
    lblVa.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblR = new JLabel("R");
    lblR.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblMg = new JLabel("mg");
    lblMg.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    lblRValue = new JLabel("8");
    lblRValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblMgValue = new JLabel("10");
    lblMgValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVaValue = new JLabel("6");
    lblVaValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderVa = new JSlider();
    sliderVa.setMinimum(5);
    sliderVa.setMaximum(8);
    sliderVa.setMinorTickSpacing(1);
    sliderVa.setValue(6);
    sliderVa.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderI1Event();
        }
    });

    sliderR = new JSlider();
    sliderR.setMinimum(7);
    sliderR.setMaximum(13);
    sliderR.setMinorTickSpacing(1);
    sliderR.setValue(8);
    sliderR.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI2Event();
        }
    });

    sliderMg = new JSlider();
    sliderMg.setMinimum(1);
    sliderMg.setMaximum(20);
    sliderMg.setValue(10);
    sliderMg.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI3Event();
        }
    });

    JLabel lblIVcar = new JLabel("Velocidad");
    lblIVcar.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVcarValue = new JLabel("120");
    lblVcarValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderVcar = new JSlider();
    sliderVcar.setMinimum(1);
    sliderVcar.setMaximum(160);
    sliderVcar.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderI4Event();
        }
    });
    sliderVcar.setValue(120);
    sliderVcar.setMinorTickSpacing(1);

    sliderQc = new JSlider();
    sliderQc.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderI5Event();
        }
    });
    sliderQc.setMaximum(1500);
    sliderQc.setMinimum(500);
    sliderQc.setValue(600);
    sliderQc.setMinorTickSpacing(100);

    lblQcValue = new JLabel("600");
    lblQcValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblQc = new JLabel("Qc");
    lblQc.setFont(new Font("Tahoma", Font.PLAIN, 14));

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panelInputs.createSequentialGroup().addGap(20).addGroup(gl_panelInputs
                    .createParallelGroup(Alignment.TRAILING)
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addComponent(lblQc, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                            .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 56,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(18)
                            .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED))
                    .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs
                                    .createParallelGroup(Alignment.TRAILING)
                                    .addComponent(lblMg, GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblVa, GroupLayout.PREFERRED_SIZE, 62,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblIVcar, Alignment.TRAILING,
                                                    GroupLayout.PREFERRED_SIZE, 67,
                                                    GroupLayout.PREFERRED_SIZE)))
                                    .addGap(18))
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addComponent(lblR, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
                                    .addGroup(gl_panelInputs.createSequentialGroup()
                                            .addComponent(lblVcarValue, GroupLayout.PREFERRED_SIZE, 56,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(18)
                                            .addComponent(sliderVcar, GroupLayout.PREFERRED_SIZE, 88,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED))
                                    .addGroup(gl_panelInputs.createSequentialGroup()
                                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                                    .addComponent(lblVaValue, GroupLayout.PREFERRED_SIZE, 42,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblRValue, GroupLayout.PREFERRED_SIZE, 56,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblMgValue, GroupLayout.PREFERRED_SIZE, 56,
                                                            GroupLayout.PREFERRED_SIZE))
                                            .addGap(18).addGroup(
                                                    gl_panelInputs.createParallelGroup(Alignment.LEADING, false)
                                                            .addComponent(sliderVa, 0, 0, Short.MAX_VALUE)
                                                            .addComponent(sliderR, 0, 0, Short.MAX_VALUE)
                                                            .addComponent(sliderMg, GroupLayout.PREFERRED_SIZE,
                                                                    88, GroupLayout.PREFERRED_SIZE))))))
                    .addGap(48))
            .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE));
    gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelInputs.createSequentialGroup()
                    .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblVaValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                    sliderVa, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(lblRValue, GroupLayout.PREFERRED_SIZE, 17,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblR))
                                            .addComponent(sliderR, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addGap(11)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(lblMgValue, GroupLayout.PREFERRED_SIZE, 17,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblMg))
                                            .addComponent(sliderMg, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                            .addComponent(lblVa))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblVcarValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblIVcar, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderVcar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblQc, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(3)));

    JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada");
    lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitle.add(lblDatosDeEntrada);
    panelInputs.setLayout(gl_panelInputs);
    panel_control.setLayout(gl_panel_control);

    JPanel panel_visualizar = new JPanel();
    panel_visualizar.setBackground(Color.WHITE);

    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 325, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 688, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(94, Short.MAX_VALUE)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
                            .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 568,
                                    Short.MAX_VALUE)
                            .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568,
                                    GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));

    JPanel panel = new JPanel();
    panel.setBackground(Color.WHITE);

    JPanel panel_1 = new JPanel();

    panelPlot = new JPanelGrafica();
    GroupLayout gl_panel_1 = new GroupLayout(panel_1);
    gl_panel_1.setHorizontalGroup(
            gl_panel_1.createParallelGroup(Alignment.LEADING).addGap(0, 263, Short.MAX_VALUE)
                    .addComponent(panelPlot, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE));
    gl_panel_1
            .setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE)
                    .addComponent(panelPlot, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE));
    panel_1.setLayout(gl_panel_1);

    JPanel panel_2 = new JPanel();

    panelMotor = new JPanelGrafica();
    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addComponent(panelMotor,
            Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE));
    gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_2.createSequentialGroup()
                    .addComponent(panelMotor, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_2.setLayout(gl_panel_2);
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap()
                    .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 258, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                            .addComponent(panel_2, 0, 0, Short.MAX_VALUE))
                    .addContainerGap()));
    panel.setLayout(gl_panel);

    JPanel panel_3 = new JPanel();
    panel_3.setBackground(Color.WHITE);

    JPanel panel_4 = new JPanel();

    panelCar = new JPanelGrafica();
    GroupLayout gl_panel_4 = new GroupLayout(panel_4);
    gl_panel_4.setHorizontalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING).addComponent(panelCar,
            GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE));
    gl_panel_4.setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_4.createSequentialGroup()
                    .addComponent(panelCar, GroupLayout.PREFERRED_SIZE, 252, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_4.setLayout(gl_panel_4);
    GroupLayout gl_panel_3 = new GroupLayout(panel_3);
    gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_3.createSequentialGroup().addContainerGap()
                    .addComponent(panel_4, GroupLayout.DEFAULT_SIZE, 648, Short.MAX_VALUE).addContainerGap()));
    gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_3.createSequentialGroup().addContainerGap()
                    .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 252, Short.MAX_VALUE)
                    .addContainerGap()));
    panel_3.setLayout(gl_panel_3);
    GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar);
    gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, gl_panel_visualizar.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel_visualizar.createParallelGroup(Alignment.TRAILING)
                            .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 668, GroupLayout.PREFERRED_SIZE)
                            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 668, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap()
                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE).addContainerGap()));

    panel_visualizar.setLayout(gl_panel_visualizar);

    getContentPane().setLayout(groupLayout);
}

From source file:com.mirth.connect.connectors.file.FileReader.java

private void initLayout() {
    JPanel topPanel = new JPanel(
            new MigLayout("novisualpadding, hidemode 3, insets 0 13 0 0, gapy 6", "[right]12[left]"));
    topPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    topPanel.add(schemeLabel);/*from   w ww.j  a va 2s . com*/
    topPanel.add(schemeComboBox, "split 3");
    topPanel.add(testConnectionButton);
    topPanel.add(advancedSettingsButton, "h 22!, w 22!, wrap");

    topPanel.add(summaryLabel);
    topPanel.add(summaryField, "growx, wrap");

    topPanel.add(directoryLabel);
    topPanel.add(directoryField, "w 200!, wrap");

    topPanel.add(hostLabel);
    topPanel.add(hostField, "w 200!, split 3");
    topPanel.add(pathLabel, "gapleft 14");
    topPanel.add(pathField, "gapleft 14, w 200!, wrap");

    topPanel.add(filenameFilterLabel);
    topPanel.add(fileNameFilterField, "w 200!, split 2");
    topPanel.add(filenameFilterRegexCheckBox, "gapleft 8, wrap");

    topPanel.add(directoryRecursionLabel);
    topPanel.add(directoryRecursionYesRadio, "split 2");
    topPanel.add(directoryRecursionNoRadio, "wrap");

    topPanel.add(ignoreDotFilesLabel);
    topPanel.add(ignoreDotFilesYesRadio, "split 2");
    topPanel.add(ignoreDotFilesNoRadio, "wrap");

    topPanel.add(anonymousLabel);
    topPanel.add(anonymousYesRadio, "split 2");
    topPanel.add(anonymousNoRadio, "wrap");

    topPanel.add(usernameLabel);
    topPanel.add(usernameField, "w 125!, wrap");

    topPanel.add(passwordLabel);
    topPanel.add(passwordField, "w 125!, wrap");

    topPanel.add(timeoutLabel);
    topPanel.add(timeoutField, "w 75!, wrap");

    topPanel.add(secureModeLabel);
    topPanel.add(secureModeYesRadio, "split 2");
    topPanel.add(secureModeNoRadio, "wrap");

    topPanel.add(passiveModeLabel);
    topPanel.add(passiveModeYesRadio, "split 2");
    topPanel.add(passiveModeNoRadio, "wrap");

    topPanel.add(validateConnectionLabel);
    topPanel.add(validateConnectionYesRadio, "split 2");
    topPanel.add(validateConnectionNoRadio, "wrap");

    topPanel.add(afterProcessingActionLabel);
    topPanel.add(afterProcessingActionComboBox, "w 55!, wrap");
    add(topPanel, "wrap");

    JPanel splitPanel = new JPanel(
            new MigLayout("novisualpadding, hidemode 3, insets 0 18 0 0, gapy 6", "[right]12[left]"));
    splitPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    splitPanel.add(moveToDirectoryLabel);
    splitPanel.add(moveToDirectoryField, "w 250!, wrap");

    splitPanel.add(moveToFileNameLabel);
    splitPanel.add(moveToFileNameField, "w 250!, wrap");

    splitPanel.add(errorReadingActionLabel);
    splitPanel.add(errorReadingActionComboBox, "w 55!, wrap");

    splitPanel.add(errorResponseActionLabel);
    splitPanel.add(errorResponseActionComboBox, "w 140!, wrap");

    splitPanel.add(errorMoveToDirectoryLabel);
    splitPanel.add(errorMoveToDirectoryField, "w 250!, wrap");

    splitPanel.add(errorMoveToFileNameLabel);
    splitPanel.add(errorMoveToFileNameField, "w 250!, wrap");

    add(splitPanel, "split 2");
    add(variableListScrollPane, "aligny top, growy, wrap");

    JPanel bottomPanel = new JPanel(
            new MigLayout("novisualpadding, hidemode 3, insets 0 60 0 0, gapy 6", "[right]12[left]"));
    bottomPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    bottomPanel.add(checkFileAgeLabel);
    bottomPanel.add(checkFileAgeYesRadio, "split 2");
    bottomPanel.add(checkFileAgeNoRadio, "wrap");

    bottomPanel.add(checkFileAgeLabel);
    bottomPanel.add(checkFileAgeYesRadio, "split 2");
    bottomPanel.add(checkFileAgeNoRadio, "wrap");

    bottomPanel.add(fileAgeLabel);
    bottomPanel.add(fileAgeField, "w 75!, wrap");

    bottomPanel.add(fileSizeLabel);
    bottomPanel.add(fileSizeMinimumField, "w 75!, split 4");
    bottomPanel.add(fileSizeDashLabel);
    bottomPanel.add(fileSizeMaximumField, "w 75!");
    bottomPanel.add(ignoreFileSizeMaximumCheckBox, "wrap");

    bottomPanel.add(sortFilesByLabel);
    bottomPanel.add(sortByComboBox, "w 75!, wrap");

    bottomPanel.add(fileTypeLabel);
    bottomPanel.add(fileTypeBinary, "split 2");
    bottomPanel.add(fileTypeText, "wrap");

    bottomPanel.add(encodingLabel);
    bottomPanel.add(charsetEncodingComboBox, "w 125!");

    add(bottomPanel);
}

From source file:com.juanhg.icecubes.IceCubesApplet.java

private void autogeneratedCode() {
    JPanel panel_control = new JPanel();
    panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null),
            new BevelBorder(BevelBorder.RAISED, null, null, null, null)));

    JPanel panelInputs = new JPanel();
    panelInputs.setToolTipText("");
    panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelOutputs = new JPanel();
    panelOutputs.setToolTipText("");
    panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelTitleOutputs = new JPanel();
    panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n");
    labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitleOutputs.add(labelOutputData);

    lblO1 = new JLabel("T:");
    lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO1Value = new JLabel();
    lblO1Value.setText("0");
    lblO1Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblO2 = new JLabel("t:");
    lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO2Value = new JLabel();
    lblO2Value.setText("0");
    lblO2Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblV = new JLabel("V:");
    lblV.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVValue = new JLabel();
    lblVValue.setText("0");
    lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs);
    gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
            .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
            .addGroup(gl_panelOutputs.createSequentialGroup()
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING)
                            .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22)
                                    .addComponent(lblO1, GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)
                                    .addPreferredGap(ComponentPlacement.RELATED))
                            .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap()
                                    .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 57,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(37)))
                    .addGroup(//from  w ww. j  a  va  2s .  com
                            gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblO1Value, GroupLayout.DEFAULT_SIZE, 52,
                                                    Short.MAX_VALUE)
                                            .addGap(3))
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 55,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED)))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    gl_panelOutputs
            .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblO1).addComponent(lblO1Value)
                                    .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(40)));
    panelOutputs.setLayout(gl_panelOutputs);

    JPanel panelLicense = new JPanel();
    panelLicense.setBorder(new LineBorder(new Color(0, 0, 0)));

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new LineBorder(new Color(0, 0, 0)));
    GroupLayout gl_panel_control = new GroupLayout(panel_control);
    gl_panel_control
            .setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
                    .addGroup(Alignment.LEADING, gl_panel_control.createSequentialGroup().addContainerGap()
                            .addGroup(gl_panel_control.createParallelGroup(Alignment.LEADING)
                                    .addComponent(panelOutputs, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE)
                                    .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346,
                                            Short.MAX_VALUE)
                                    .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE))
                            .addContainerGap()));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    btnLaunchSimulation = new JButton("Iniciar");
    btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    btnLaunchSimulation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            btnLaunchSimulationEvent(event);
        }
    });
    GroupLayout gl_panel_6 = new GroupLayout(panel_6);
    gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_6.createSequentialGroup().addContainerGap()
                    .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_6
                    .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation,
                            GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(78, Short.MAX_VALUE)));
    panel_6.setLayout(gl_panel_6);

    JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE");
    panelLicense.add(lblNewLabel);

    JLabel LabelI1 = new JLabel("Volumen");
    LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI2 = new JLabel("T");
    labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI3 = new JLabel("t");
    labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    lblTValue = new JLabel("15");
    lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lbltValue = new JLabel("-15");
    lbltValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVolValue = new JLabel("20");
    lblVolValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderVol = new JSlider();
    sliderVol.setMinimum(1);
    sliderVol.setMaximum(30);
    sliderVol.setMinorTickSpacing(1);
    sliderVol.setValue(20);
    sliderVol.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderI1Event();
        }
    });

    sliderT = new JSlider();
    sliderT.setMinimum(5);
    sliderT.setMaximum(30);
    sliderT.setMinorTickSpacing(1);
    sliderT.setValue(15);
    sliderT.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI2Event();
        }
    });

    slidert = new JSlider();
    slidert.setMinimum(5);
    slidert.setMaximum(30);
    slidert.setValue(15);
    slidert.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI3Event();
        }
    });

    JLabel lblI4 = new JLabel("N\u00BA de Cubitos");
    lblI4.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblNValue = new JLabel("1");
    lblNValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderN = new JSlider();
    sliderN.setMinimum(1);
    sliderN.setMaximum(4);
    sliderN.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderI4Event();
        }
    });
    sliderN.setValue(1);
    sliderN.setMinorTickSpacing(1);

    waterImage = loadImage(water);
    btnWater = new JButton(new ImageIcon(waterImage));
    btnWater.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btnWater.setEnabled(false);
            btnMilk.setEnabled(true);
            btnOrange.setEnabled(true);
            btnlemonade.setEnabled(true);

            type = WATER;

            fluidColor = new Color(100, 180, 255, 70);
            updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue()));
            repaint();
        }
    });

    milkImage = loadImage(milk);
    btnMilk = new JButton(new ImageIcon(milkImage));
    btnMilk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btnWater.setEnabled(true);
            btnMilk.setEnabled(false);
            btnOrange.setEnabled(true);
            btnlemonade.setEnabled(true);

            type = MILK;

            fluidColor = new Color(255, 255, 255, 255);
            updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue()));
            repaint();
        }
    });

    orangeImage = loadImage(orange);
    btnOrange = new JButton(new ImageIcon(orangeImage));
    btnOrange.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnWater.setEnabled(true);
            btnMilk.setEnabled(true);
            btnOrange.setEnabled(false);
            btnlemonade.setEnabled(true);

            type = ORANGE;

            fluidColor = new Color(225, 150, 0, 220);
            updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue()));
            repaint();
        }
    });

    lemonadeImage = loadImage(lemonade);
    btnlemonade = new JButton(new ImageIcon(lemonadeImage));
    btnlemonade.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnWater.setEnabled(true);
            btnMilk.setEnabled(true);
            btnOrange.setEnabled(true);
            btnlemonade.setEnabled(false);

            type = LEMONADE;

            fluidColor = new Color(225, 225, 0, 150);
            updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue()));
            repaint();
        }
    });

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
            .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
            .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap(23, Short.MAX_VALUE)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING).addGroup(gl_panelInputs
                            .createSequentialGroup()
                            .addComponent(btnWater, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(btnOrange, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(btnlemonade, GroupLayout.PREFERRED_SIZE, 70,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(8))
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs
                                            .createParallelGroup(Alignment.TRAILING, false)
                                            .addComponent(labelI3, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(LabelI1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(labelI2, Alignment.LEADING,
                                                    GroupLayout.PREFERRED_SIZE, 120,
                                                    GroupLayout.PREFERRED_SIZE))
                                            .addGap(18)
                                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                                    .addComponent(lblVolValue, GroupLayout.PREFERRED_SIZE, 42,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 56,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lbltValue, GroupLayout.PREFERRED_SIZE, 56,
                                                            GroupLayout.PREFERRED_SIZE))
                                            .addGap(18).addGroup(
                                                    gl_panelInputs.createParallelGroup(Alignment.LEADING, false)
                                                            .addComponent(sliderVol, 0, 0, Short.MAX_VALUE)
                                                            .addComponent(sliderT, 0, 0, Short.MAX_VALUE)
                                                            .addComponent(slidert, GroupLayout.PREFERRED_SIZE,
                                                                    88, GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(gl_panelInputs.createSequentialGroup()
                                            .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 120,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(18)
                                            .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 56,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(18).addComponent(sliderN, GroupLayout.PREFERRED_SIZE, 88,
                                                    GroupLayout.PREFERRED_SIZE))))
                    .addGap(15)));
    gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelInputs.createSequentialGroup()
                    .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(LabelI1).addComponent(lblVolValue, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderVol, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(labelI2).addComponent(lblTValue, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderT, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(11)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3)
                            .addComponent(lbltValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(slidert, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderN, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(7)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false)
                            .addComponent(btnWater, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(btnMilk, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)
                            .addComponent(btnOrange, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)
                            .addComponent(btnlemonade, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
                    .addGap(11)));

    JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada");
    lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitle.add(lblDatosDeEntrada);
    panelInputs.setLayout(gl_panelInputs);
    panel_control.setLayout(gl_panel_control);

    JPanel panel_visualizar = new JPanel();
    panel_visualizar.setBackground(Color.WHITE);

    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(
            Alignment.TRAILING,
            groupLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 694, GroupLayout.PREFERRED_SIZE)
                    .addGap(156)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING,
            groupLayout.createSequentialGroup().addGap(12)
                    .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
                            .addComponent(panel_visualizar, Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                            .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 494,
                                    Short.MAX_VALUE))
                    .addContainerGap(84, Short.MAX_VALUE)));

    JPanel panel = new JPanel();
    panel.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel.setBounds(0, 0, 368, 494);
    panel.setBackground(Color.WHITE);

    JPanel panel_1 = new JPanel();
    panel_1.setBounds(1, 1, 366, 31);
    panel_1.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel lblSimulacin = new JLabel("Simulaci\u00F3n");
    lblSimulacin.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panel_1.add(lblSimulacin);

    JPanel panel_3 = new JPanel();
    panel_3.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_3.setBackground(Color.WHITE);
    panel_3.setBounds(368, 0, 326, 494);
    panel_visualizar.setLayout(null);
    panel_visualizar.add(panel);
    panel.setLayout(null);
    panel.add(panel_1);

    panel_7 = new JPanelGrafica();
    panel_7.setBackground(Color.WHITE);
    panel_7.setBounds(1, 31, 366, 463);
    panel.add(panel_7);

    panelGlass = new JPanelGrafica();
    panelGlass.setBackground(Color.WHITE);
    GroupLayout gl_panel_7 = new GroupLayout(panel_7);
    gl_panel_7.setHorizontalGroup(gl_panel_7.createParallelGroup(Alignment.LEADING).addComponent(panelGlass,
            GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE));
    gl_panel_7.setVerticalGroup(gl_panel_7.createParallelGroup(Alignment.LEADING).addComponent(panelGlass,
            GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE));
    panel_7.setLayout(gl_panel_7);
    panel_visualizar.add(panel_3);
    panel_3.setLayout(null);

    JPanel panel_4 = new JPanel();
    panel_4.setBounds(1, 1, 324, 31);
    panel_4.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel lblGrficaDeEvolucin = new JLabel("Gr\u00E1fica de Evoluci\u00F3n (T frente a Q)");
    lblGrficaDeEvolucin.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panel_4.add(lblGrficaDeEvolucin);
    panel_3.add(panel_4);

    JPanel panel7 = new JPanel();
    panel7.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel7.setBackground(Color.WHITE);
    panel7.setBounds(1, 31, 324, 463);
    panel_3.add(panel7);
    panel7.setLayout(null);

    panelChart = new JPanelGrafica();
    panelChart.setBorder(new LineBorder(new Color(0, 0, 0)));
    panelChart.setBackground(Color.WHITE);
    panelChart.setBounds(0, 0, 324, 462);
    panel7.add(panelChart);

    getContentPane().setLayout(groupLayout);
}

From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java

private JPanel createCompositePanel(final JPanel b, final JComponent c, final String name) {
    final JPanel compositeBox = new JPanel(new VerticalLayout(5));
    int r = b.getBackground().getRed() - 20;
    if (r < 1) {
        r = 0;//from  w  ww.jav  a  2  s.  c  om
    }
    if (r > 254) {
        r = 255;
    }
    int g = b.getBackground().getGreen() - 20;
    if (g < 1) {
        g = 0;
    }
    if (g > 254) {
        g = 255;
    }
    int bl = b.getBackground().getBlue() - 20;
    if (bl < 1) {
        bl = 0;
    }
    if (bl > 254) {
        bl = 255;
    }

    compositeBox.setBackground(new Color(r, g, bl));
    final JPanel title = new JPanel(new BorderLayout());
    title.setBackground(new Color(r, g, bl));
    /*
     * ImageIcon icon = new ImageIcon( Toolkit .getDefaultToolkit()
     * .getImage( (getClass()
     * .getResource("/com/isencia/passerelle/hmi/resources/composite.gif"
     * )))); JLabel lab = new JLabel(icon);
     * 
     * title.add(lab, BorderLayout.LINE_START);
     */
    final JLabel lab2 = new JLabel(name);
    final Font f = lab2.getFont();
    lab2.setFont(new Font(f.getName(), f.getStyle(), f.getSize() + 6));
    lab2.setForeground(new Color(49, 106, 196));
    title.add(lab2);
    compositeBox.add(title);
    final Border loweredbevel = BorderFactory.createLoweredBevelBorder();
    final TitledBorder border = BorderFactory.createTitledBorder(loweredbevel);

    compositeBox.setBorder(border);
    compositeBox.setName(name);
    c.setBackground(new Color(r, g, bl));
    compositeBox.add(c);
    return compositeBox;
}

From source file:com.xilinx.kintex7.MainScreen.java

private JPanel testAndStats() {
    JPanel tstats = new JPanel();
    tstats.setLayout(new BoxLayout(tstats, BoxLayout.Y_AXIS));

    JPanel ledPanel = new JPanel(new BorderLayout());

    JPanel iledPanel = new JPanel();
    iledPanel.setLayout(new BoxLayout(iledPanel, BoxLayout.X_AXIS));

    led_ddr3 = new JLabel("DDR3", new ImageIcon(led1), JLabel.CENTER);
    led_phy0 = new JLabel("10G PHY-0", new ImageIcon(led1), JLabel.CENTER);
    led_phy1 = new JLabel("10G PHY-1", new ImageIcon(led1), JLabel.CENTER);

    JPanel le1 = new JPanel(new BorderLayout());
    le1.add(led_ddr3, BorderLayout.CENTER);

    JPanel le2 = new JPanel(new BorderLayout());
    le2.add(led_phy0, BorderLayout.CENTER);

    JPanel le3 = new JPanel(new BorderLayout());
    le3.add(led_phy1, BorderLayout.CENTER);

    iledPanel.add(le1);/*from  w  w  w.j a  v  a 2s  . c  om*/
    iledPanel.add(le2);
    iledPanel.add(le3);

    ledPanel.add(iledPanel, BorderLayout.CENTER);
    tstats.add(ledPanel);

    JPanel tstats1 = new JPanel();
    tstats1.setLayout(new BoxLayout(tstats1, BoxLayout.Y_AXIS));

    tstats1.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    tstats1.add(testPanelItems());

    JPanel dmaInner = new JPanel(new BorderLayout());

    JPanel dmaPanel = new JPanel(new BorderLayout());

    dmaPanel.setBackground(new Color(130, 170, 180));
    table1 = new MyTableModel(dummy_data, dmaColumnNames0);
    dmaStats1 = new JTable(table1);
    try {
        dmaStats1.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader = dmaStats1.getTableHeader();
    dmaHeader.setForeground(new Color(92, 25, 25));

    dmaPanel.add(dmaHeader, BorderLayout.PAGE_START);
    dmaPanel.add(dmaStats1, BorderLayout.CENTER);
    dmaInner.add(dmaPanel, BorderLayout.CENTER);
    tstats1.add(dmaInner);
    tstats.add(tstats1);

    JPanel trnPanel = new JPanel(new GridLayout(1, 1));
    trnPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Statistics"),
            BorderFactory.createRaisedBevelBorder()));
    JPanel trn1 = new JPanel(new FlowLayout());
    trn1.add(new JLabel("Transmit (writes in Gbps): "));
    trnLTX = new JTextField("0.0", 5);
    trnLTX.setEditable(false);
    trn1.add(trnLTX);
    trn1.add(new JLabel("Receive (reads in Gbps): "));
    trnLRX = new JTextField("0.0", 5);
    trnLRX.setEditable(false);
    trn1.add(trnLRX);
    trnPanel.add(trn1);
    tstats.add(trnPanel);

    JPanel tstats2 = new JPanel();
    tstats2.setLayout(new BoxLayout(tstats2, BoxLayout.Y_AXIS));
    tstats2.add(testPanelItems1());

    tstats2.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),
            BorderFactory.createRaisedBevelBorder()));

    JPanel dmaPanel1 = new JPanel(new BorderLayout());

    table2 = new MyTableModel(dummy_data, dmaColumnNames1);
    dmaStats2 = new JTable(table2);
    try {
        dmaStats2.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
    } catch (Exception e) {
    }
    JTableHeader dmaHeader1 = dmaStats2.getTableHeader();
    dmaHeader1.setForeground(new Color(92, 25, 25));

    dmaPanel1.add(dmaHeader1, BorderLayout.PAGE_START);
    dmaPanel1.add(dmaStats2, BorderLayout.CENTER);
    tstats2.add(dmaPanel1);
    tstats.add(tstats2);

    JPanel tstats3 = new JPanel(new BorderLayout());
    tstats3.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Message Log"),
            BorderFactory.createRaisedBevelBorder()));
    textArea = new CustomTextPane();

    final JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    // keep scrollbar at end showing latest messages
    scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
        BoundedRangeModel brm = scrollPane.getVerticalScrollBar().getModel();
        boolean wasAtBottom = true;

        @Override
        public void adjustmentValueChanged(AdjustmentEvent ae) {
            if (!brm.getValueIsAdjusting()) {
                if (wasAtBottom)
                    brm.setValue(brm.getMaximum());
            } else
                wasAtBottom = ((brm.getValue() + brm.getExtent()) == brm.getMaximum());
        }
    });

    textArea.setEditable(false);
    tstats3.add(scrollPane, BorderLayout.CENTER);
    tstats.add(tstats3);
    return tstats;
}

From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java

/**
 * Creates the center panel./*from w  w w  .j  a  v a2s  . com*/
 *
 * @return the created center panel
 */
private Container createCenter() {
    JPanel centerPanel = new JPanel(new GridBagLayout());

    centerPanel.setBackground(Color.WHITE);
    centerPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3));

    GridBagConstraints constraints = new GridBagConstraints();

    initSmsLabel(centerPanel);
    initTextArea(centerPanel);

    smsCharCountLabel = new JLabel(String.valueOf(smsCharCount));
    smsCharCountLabel.setForeground(Color.GRAY);
    smsCharCountLabel.setVisible(false);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 0;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    constraints.insets = new Insets(0, 2, 0, 2);
    constraints.gridheight = 1;
    constraints.gridwidth = 1;
    centerPanel.add(smsCharCountLabel, constraints);

    smsNumberLabel = new JLabel(String.valueOf(smsNumberCount)) {
        @Override
        public void paintComponent(Graphics g) {
            AntialiasingManager.activateAntialiasing(g);
            g.setColor(getBackground());
            g.fillOval(0, 0, getWidth(), getHeight());

            super.paintComponent(g);
        }
    };
    smsNumberLabel.setHorizontalAlignment(JLabel.CENTER);
    smsNumberLabel.setPreferredSize(new Dimension(18, 18));
    smsNumberLabel.setMinimumSize(new Dimension(18, 18));
    smsNumberLabel.setForeground(Color.WHITE);
    smsNumberLabel.setBackground(Color.GRAY);
    smsNumberLabel.setVisible(false);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 0;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    constraints.insets = new Insets(0, 2, 0, 2);
    constraints.gridheight = 1;
    constraints.gridwidth = 1;
    centerPanel.add(smsNumberLabel, constraints);

    return centerPanel;
}

From source file:com.rapidminer.gui.viewer.metadata.AttributeStatisticsPanel.java

/**
 * Initializes the GUI./*from  w w  w. j  a v a2s .c om*/
 *
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void initGUI() {
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    // add attribute name
    panelAttName = new JPanel();
    panelAttName.setLayout(new BoxLayout(panelAttName, BoxLayout.PAGE_AXIS));
    panelAttName.setOpaque(false);
    // this border is to visualize that the name column can be enlarged/shrinked
    panelAttName.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.LIGHT_GRAY));

    labelAttHeader = new JLabel(LABEL_DOTS);
    labelAttHeader.setFont(labelAttHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelAttHeader.setForeground(Color.GRAY);
    panelAttName.add(labelAttHeader);

    labelAttName = new JLabel(LABEL_DOTS);
    labelAttName.setFont(labelAttName.getFont().deriveFont(Font.BOLD, FONT_SIZE_LABEL_VALUE));
    labelAttName.setMinimumSize(DIMENSION_LABEL_ATTRIBUTE);
    labelAttName.setPreferredSize(DIMENSION_LABEL_ATTRIBUTE);
    panelAttName.add(labelAttName);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new Insets(3, 20, 3, 10);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 0.0;
    gbc.weighty = 1.0;
    gbc.gridheight = 2;
    add(panelAttName, gbc);

    // create value type name and bring it to a nice to read format (aka uppercase first letter
    // and replace '_' with ' '
    gbc.gridx += 1;
    gbc.insets = new Insets(5, 15, 5, 10);
    labelAttType = new JLabel(LABEL_DOTS);
    labelAttType.setMinimumSize(DIMENSION_LABEL_TYPE);
    labelAttType.setPreferredSize(DIMENSION_LABEL_TYPE);
    add(labelAttType, gbc);

    // missings panel
    JPanel panelStatsMissing = new JPanel();
    panelStatsMissing.setLayout(new BoxLayout(panelStatsMissing, BoxLayout.PAGE_AXIS));
    panelStatsMissing.setOpaque(false);

    labelStatsMissing = new JLabel(LABEL_DOTS);
    labelStatsMissing.setMinimumSize(DIMENSION_LABEL_MISSINGS);
    labelStatsMissing.setPreferredSize(DIMENSION_LABEL_MISSINGS);
    panelStatsMissing.add(labelStatsMissing);

    gbc.gridx += 1;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0.0;
    add(panelStatsMissing, gbc);

    // chart panel(s) (only visible when enlarged)
    JPanel chartPanel = new JPanel(new BorderLayout());
    chartPanel.setBackground(COLOR_TRANSPARENT);
    chartPanel.setOpaque(false);
    listOfChartPanels.add(chartPanel);
    updateVisibilityOfChartPanels();

    gbc.fill = GridBagConstraints.NONE;
    gbc.weighty = 0.0;
    gbc.insets = new Insets(0, 10, 0, 10);
    for (JPanel panel : listOfChartPanels) {
        gbc.gridx += 1;
        add(panel, gbc);
    }

    // (hidden) construction panel
    String constructionLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.construction.label");
    panelStatsConstruction = new JPanel();
    panelStatsConstruction.setLayout(new BoxLayout(panelStatsConstruction, BoxLayout.PAGE_AXIS));
    panelStatsConstruction.setOpaque(false);
    panelStatsConstruction.setVisible(false);

    JLabel labelConstructionHeader = new JLabel(constructionLabel);
    labelConstructionHeader.setFont(labelConstructionHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelConstructionHeader.setForeground(Color.GRAY);
    panelStatsConstruction.add(labelConstructionHeader);

    labelStatsConstruction = new JLabel(LABEL_DOTS);
    labelStatsConstruction.setFont(labelStatsConstruction.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    labelStatsConstruction.setMinimumSize(DIMENSION_LABEL_CONSTRUCTION);
    labelStatsConstruction.setPreferredSize(DIMENSION_LABEL_CONSTRUCTION);
    panelStatsConstruction.add(labelStatsConstruction);

    gbc.gridx += 1;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0.0;
    add(panelStatsConstruction, gbc);

    // statistics panel, contains different statistics panels for numerical/nominal/date_time on
    // a card layout
    // needed to switch between for model swapping
    cardStatsPanel = new JPanel();
    cardStatsPanel.setOpaque(false);
    cardLayout = new CardLayout();
    cardStatsPanel.setLayout(cardLayout);

    // numerical version
    JPanel statsNumPanel = new JPanel();
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints gbcStatPanel = new GridBagConstraints();
    statsNumPanel.setLayout(layout);
    statsNumPanel.setOpaque(false);

    String avgLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.avg.label");
    String devianceLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.variance.label");
    String minLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.min.label");
    String maxLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.max.label");

    // min value panel
    JPanel panelStatsMin = new JPanel();
    panelStatsMin.setLayout(new BoxLayout(panelStatsMin, BoxLayout.PAGE_AXIS));
    panelStatsMin.setOpaque(false);

    JLabel labelMinHeader = new JLabel(minLabel);
    labelMinHeader.setFont(labelMinHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelMinHeader.setForeground(Color.GRAY);
    panelStatsMin.add(labelMinHeader);

    labelStatsMin = new JLabel(LABEL_DOTS);
    labelStatsMin.setFont(labelStatsMin.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsMin.add(labelStatsMin);

    // max value panel
    JPanel panelStatsMax = new JPanel();
    panelStatsMax.setLayout(new BoxLayout(panelStatsMax, BoxLayout.PAGE_AXIS));
    panelStatsMax.setOpaque(false);

    JLabel labelMaxHeader = new JLabel(maxLabel);
    labelMaxHeader.setFont(labelMaxHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelMaxHeader.setForeground(Color.GRAY);
    panelStatsMax.add(labelMaxHeader);

    labelStatsMax = new JLabel(LABEL_DOTS);
    labelStatsMax.setFont(labelStatsMax.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsMax.add(labelStatsMax);

    // average value panel
    JPanel panelStatsAvg = new JPanel();
    panelStatsAvg.setLayout(new BoxLayout(panelStatsAvg, BoxLayout.PAGE_AXIS));
    panelStatsAvg.setOpaque(false);

    JLabel labelAvgHeader = new JLabel(avgLabel);
    labelAvgHeader.setFont(labelAvgHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelAvgHeader.setForeground(Color.GRAY);
    panelStatsAvg.add(labelAvgHeader);

    labelStatsAvg = new JLabel(LABEL_DOTS);
    labelStatsAvg.setFont(labelStatsAvg.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsAvg.add(labelStatsAvg);

    // deviance value panel
    JPanel panelStatsDeviance = new JPanel();
    panelStatsDeviance.setLayout(new BoxLayout(panelStatsDeviance, BoxLayout.PAGE_AXIS));
    panelStatsDeviance.setOpaque(false);

    JLabel labelDevianceHeader = new JLabel(devianceLabel);
    labelDevianceHeader.setFont(labelDevianceHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelDevianceHeader.setForeground(Color.GRAY);
    panelStatsDeviance.add(labelDevianceHeader);

    labelStatsDeviation = new JLabel(LABEL_DOTS);
    labelStatsDeviation.setFont(labelStatsDeviation.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsDeviance.add(labelStatsDeviation);

    // add sub panels to stats panel
    gbcStatPanel.gridx = 0;
    gbcStatPanel.weightx = 0.0;
    gbcStatPanel.fill = GridBagConstraints.NONE;
    gbcStatPanel.insets = new Insets(0, 0, 0, 4);
    panelStatsMin.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE);
    statsNumPanel.add(panelStatsMin, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    panelStatsMax.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE);
    statsNumPanel.add(panelStatsMax, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    panelStatsAvg.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE);
    statsNumPanel.add(panelStatsAvg, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    panelStatsDeviance.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE);
    statsNumPanel.add(panelStatsDeviance, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    gbcStatPanel.weightx = 1.0;
    gbcStatPanel.fill = GridBagConstraints.HORIZONTAL;
    statsNumPanel.add(new JLabel(), gbcStatPanel);
    cardStatsPanel.add(statsNumPanel, CARD_NUMERICAL);

    // nominal version
    JPanel statsNomPanel = new JPanel();
    statsNomPanel.setLayout(layout);
    statsNomPanel.setOpaque(false);
    String leastLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.least.label");
    String mostLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.most.label");
    String valuesLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.values.label");

    // least panel
    JPanel panelStatsLeast = new JPanel();
    panelStatsLeast.setLayout(new BoxLayout(panelStatsLeast, BoxLayout.PAGE_AXIS));
    panelStatsLeast.setOpaque(false);

    JLabel labelLeastHeader = new JLabel(leastLabel);
    labelLeastHeader.setFont(labelLeastHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelLeastHeader.setForeground(Color.GRAY);
    labelLeastHeader.setAlignmentX(Component.LEFT_ALIGNMENT);
    panelStatsLeast.add(labelLeastHeader);

    labelStatsLeast = new JLabel(LABEL_DOTS);
    labelStatsLeast.setFont(labelStatsLeast.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsLeast.add(labelStatsLeast);

    // most panel
    JPanel panelStatsMost = new JPanel();
    panelStatsMost.setLayout(new BoxLayout(panelStatsMost, BoxLayout.PAGE_AXIS));
    panelStatsMost.setOpaque(false);

    JLabel labelMostHeader = new JLabel(mostLabel);
    labelMostHeader.setFont(labelMostHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelMostHeader.setForeground(Color.GRAY);
    labelMostHeader.setAlignmentX(Component.LEFT_ALIGNMENT);
    panelStatsMost.add(labelMostHeader);

    labelStatsMost = new JLabel(LABEL_DOTS);
    labelStatsMost.setFont(labelStatsMost.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsMost.add(labelStatsMost);

    // values panel
    JPanel panelStatsValues = new JPanel();
    panelStatsValues.setLayout(new BoxLayout(panelStatsValues, BoxLayout.PAGE_AXIS));
    panelStatsValues.setOpaque(false);

    JLabel labelValuesHeader = new JLabel(valuesLabel);
    labelValuesHeader.setFont(labelValuesHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelValuesHeader.setForeground(Color.GRAY);
    labelValuesHeader.setAlignmentX(Component.LEFT_ALIGNMENT);
    panelStatsValues.add(labelValuesHeader);

    labelStatsValues = new JLabel(LABEL_DOTS);
    labelStatsValues.setFont(labelStatsValues.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsValues.add(labelStatsValues);

    detailsButton = new JButton(new ShowNomValueAction(this));
    detailsButton.setVisible(false);
    detailsButton.setOpaque(false);
    detailsButton.setContentAreaFilled(false);
    detailsButton.setBorderPainted(false);
    detailsButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
    detailsButton.setHorizontalAlignment(SwingConstants.LEFT);
    detailsButton.setHorizontalTextPosition(SwingConstants.LEFT);
    detailsButton.setIcon(null);
    Font font = detailsButton.getFont();
    Map attributes = font.getAttributes();
    attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
    detailsButton.setFont(font.deriveFont(attributes));
    panelStatsValues.add(detailsButton);

    // add sub panel to stats panel
    gbcStatPanel.gridx = 0;
    gbcStatPanel.weightx = 0.0;
    gbcStatPanel.fill = GridBagConstraints.NONE;
    gbcStatPanel.insets = new Insets(0, 0, 0, 6);
    panelStatsLeast.setPreferredSize(DIMENSION_PANEL_NOMINAL_PREF_SIZE);
    statsNomPanel.add(panelStatsLeast, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    panelStatsMost.setPreferredSize(DIMENSION_PANEL_NOMINAL_PREF_SIZE);
    statsNomPanel.add(panelStatsMost, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    statsNomPanel.add(panelStatsValues, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    gbcStatPanel.weightx = 1.0;
    gbcStatPanel.fill = GridBagConstraints.HORIZONTAL;
    statsNomPanel.add(new JLabel(), gbcStatPanel);
    cardStatsPanel.add(statsNomPanel, CARD_NOMINAL);

    // date_time version
    JPanel statsDateTimePanel = new JPanel();
    statsDateTimePanel.setLayout(layout);
    statsDateTimePanel.setOpaque(false);

    String durationLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.duration.label");
    String fromLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.from.label");
    String untilLabel = I18N.getMessage(I18N.getGUIBundle(),
            "gui.label.attribute_statistics.statistics.until.label");

    // min value panel
    JPanel panelStatsFrom = new JPanel();
    panelStatsFrom.setLayout(new BoxLayout(panelStatsFrom, BoxLayout.PAGE_AXIS));
    panelStatsFrom.setOpaque(false);

    JLabel labelFromHeader = new JLabel(fromLabel);
    labelFromHeader.setFont(labelFromHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelFromHeader.setForeground(Color.GRAY);
    panelStatsFrom.add(labelFromHeader);

    labelStatsFrom = new JLabel(LABEL_DOTS);
    labelStatsFrom.setFont(labelStatsFrom.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsFrom.add(labelStatsFrom);

    // until value panel
    JPanel panelStatsUntil = new JPanel();
    panelStatsUntil.setLayout(new BoxLayout(panelStatsUntil, BoxLayout.PAGE_AXIS));
    panelStatsUntil.setOpaque(false);

    JLabel labelUntilHeader = new JLabel(untilLabel);
    labelUntilHeader.setFont(labelUntilHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelUntilHeader.setForeground(Color.GRAY);
    panelStatsUntil.add(labelUntilHeader);

    labelStatsUntil = new JLabel(LABEL_DOTS);
    labelStatsUntil.setFont(labelStatsUntil.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsUntil.add(labelStatsUntil);

    // duration value panel
    JPanel panelStatsDuration = new JPanel();
    panelStatsDuration.setLayout(new BoxLayout(panelStatsDuration, BoxLayout.PAGE_AXIS));
    panelStatsDuration.setOpaque(false);

    JLabel labelDurationHeader = new JLabel(durationLabel);
    labelDurationHeader.setFont(labelDurationHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER));
    labelDurationHeader.setForeground(Color.GRAY);
    panelStatsDuration.add(labelDurationHeader);

    labelStatsDuration = new JLabel(LABEL_DOTS);
    labelStatsDuration.setFont(labelStatsDuration.getFont().deriveFont(FONT_SIZE_LABEL_VALUE));
    panelStatsDuration.add(labelStatsDuration);

    // add sub panels to stats panel
    gbcStatPanel.gridx = 0;
    gbcStatPanel.weightx = 0.0;
    gbcStatPanel.fill = GridBagConstraints.NONE;
    gbcStatPanel.insets = new Insets(0, 0, 0, 6);
    panelStatsFrom.setPreferredSize(DIMENSION_PANEL_DATE_PREF_SIZE);
    statsDateTimePanel.add(panelStatsFrom, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    panelStatsUntil.setPreferredSize(DIMENSION_PANEL_DATE_PREF_SIZE);
    statsDateTimePanel.add(panelStatsUntil, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    panelStatsDuration.setPreferredSize(DIMENSION_PANEL_DATE_PREF_SIZE);
    statsDateTimePanel.add(panelStatsDuration, gbcStatPanel);
    gbcStatPanel.gridx += 1;
    gbcStatPanel.weightx = 1.0;
    gbcStatPanel.fill = GridBagConstraints.HORIZONTAL;
    statsDateTimePanel.add(new JLabel(), gbcStatPanel);
    cardStatsPanel.add(statsDateTimePanel, CARD_DATE_TIME);

    // add stats panel to main gui
    gbc.gridx += 1;
    gbc.insets = new Insets(5, 10, 5, 10);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.anchor = GridBagConstraints.WEST;
    add(cardStatsPanel, gbc);

    // needed so we can draw our own background
    setOpaque(false);

    // handle mouse events for hover effect and enlarging/shrinking
    addMouseListener(enlargeAndHoverAndPopupMouseAdapter);

    // change cursor to indicate this component can be clicked
    setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}

From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java

/**
 * Initialize GUI components.//from  ww  w .  j  ava  2s.  co m
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initGUI() {

    App.init();

    // setBounds(100, 100, 972, 439);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setIconImage(Builder.getApplicationIcon());
    setTitle("Sample Size Analysis");
    getContentPane().setLayout(new MigLayout("", "[1136px,grow,fill]", "[30px][405px,grow]"));

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    getContentPane().add(toolBar, "cell 0 0,growx,aligny top");

    JToolBarButton btnOpen = new JToolBarButton(actionBrowse);
    btnOpen.setIcon(Builder.getImageIcon("fileopen.png"));
    toolBar.add(btnOpen);

    JToolBarButton btnSave = new JToolBarButton(actionSaveTable);
    btnSave.setIcon(Builder.getImageIcon("save.png"));
    toolBar.add(btnSave);

    JToolBarButton btnExportPDF = new JToolBarButton(actionExportPDF);
    btnExportPDF.setIcon(Builder.getImageIcon("pdf.png"));
    toolBar.add(btnExportPDF);

    JToolBarButton btnExportPNG = new JToolBarButton(actionExportPNG);
    btnExportPNG.setIcon(Builder.getImageIcon("formatpng.png"));
    toolBar.add(btnExportPNG);

    toolBar.addSeparator();

    JToolBarButton btnRun = new JToolBarButton(actionRun);
    btnRun.setIcon(Builder.getImageIcon("run.png"));
    toolBar.add(btnRun);

    JPanel panelMain = new JPanel();
    getContentPane().add(panelMain, "cell 0 1,grow");
    panelMain.setLayout(new BorderLayout(0, 0));

    JSplitPane splitPaneMain = new JSplitPane();
    splitPaneMain.setOneTouchExpandable(true);
    panelMain.add(splitPaneMain);

    JPanel panelParameters = new JPanel();
    splitPaneMain.setLeftComponent(panelParameters);
    panelParameters.setLayout(new MigLayout("", "[grow,right]", "[][][][193.00,grow,fill][]"));

    JPanel panelInput = new JPanel();
    panelInput.setBorder(new TitledBorder(null, "Input", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelInput, "cell 0 0,grow");
    panelInput.setLayout(new MigLayout("", "[100px:100px:180px,right][grow,fill][]", "[]"));

    JLabel lblInputFile = new JLabel("Input file:");
    panelInput.add(lblInputFile, "cell 0 0");

    txtInputFile = new JTextField();
    panelInput.add(txtInputFile, "cell 1 0,growx");
    txtInputFile.setActionCommand("NewFileTyped");
    txtInputFile.addActionListener(this);
    txtInputFile.setColumns(10);

    JButton btnBrowse = new JButton("");
    panelInput.add(btnBrowse, "cell 2 0");
    btnBrowse.setAction(actionBrowse);
    btnBrowse.setText("");
    btnBrowse.setIcon(Builder.getImageIcon("fileopen16.png"));
    btnBrowse.setPreferredSize(new Dimension(25, 25));
    btnBrowse.setMaximumSize(new Dimension(25, 25));
    btnBrowse.putClientProperty("JButton.buttonType", "segmentedTextured");
    btnBrowse.putClientProperty("JButton.segmentPosition", "middle");

    JPanel panelAnalysisOptions = new JPanel();
    panelAnalysisOptions.setBorder(new TitledBorder(null, "Analysis and filtering options",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelAnalysisOptions, "cell 0 1,grow");
    panelAnalysisOptions.setLayout(new MigLayout("", "[100px:100px:180px,right][grow][][]", "[][][][][]"));

    JLabel lblEventTypes = new JLabel("Event type:");
    panelAnalysisOptions.add(lblEventTypes, "cell 0 0");

    cboEventType = new JComboBox();
    panelAnalysisOptions.add(cboEventType, "cell 1 0 3 1");
    cboEventType.setModel(new DefaultComboBoxModel(EventTypeToProcess.values()));
    new EventTypeWrapper(cboEventType, PrefKey.EVENT_TYPE_TO_PROCESS, EventTypeToProcess.FIRE_EVENT);

    chkCommonYears = new JCheckBox("<html>Only analyze years all series have in common");
    chkCommonYears.setEnabled(false);
    new CheckBoxWrapper(chkCommonYears, PrefKey.SSIZ_CHK_COMMON_YEARS, false);
    panelAnalysisOptions.add(chkCommonYears, "cell 1 1 3 1");

    chkExcludeSeriesWithNoEvents = new JCheckBox("<html>Exclude series/segments with no events");
    chkExcludeSeriesWithNoEvents.setEnabled(false);
    new CheckBoxWrapper(chkExcludeSeriesWithNoEvents, PrefKey.SSIZ_CHK_EXCLUDE_SERIES_WITH_NO_EVENTS, false);
    panelAnalysisOptions.add(chkExcludeSeriesWithNoEvents, "cell 1 2 3 1");

    JLabel lblThresholdType = new JLabel("Threshold:");
    panelAnalysisOptions.add(lblThresholdType, "cell 0 3");

    cboThresholdType = new JComboBox();
    panelAnalysisOptions.add(cboThresholdType, "cell 1 3");
    cboThresholdType.setModel(new DefaultComboBoxModel(FireFilterType.values()));
    new FireFilterTypeWrapper(cboThresholdType, PrefKey.COMPOSITE_FILTER_TYPE_WITH_ALL_TREES,
            FireFilterType.NUMBER_OF_EVENTS);

    JLabel label = new JLabel(">=");
    panelAnalysisOptions.add(label, "flowx,cell 2 3");

    spnThresholdValueGT = new JSpinner();
    panelAnalysisOptions.add(spnThresholdValueGT, "cell 3 3");
    spnThresholdValueGT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    new SpinnerWrapper(spnThresholdValueGT, PrefKey.COMPOSITE_FILTER_VALUE, 1);

    chkEnableLessThan = new JCheckBox("");
    chkEnableLessThan.setActionCommand("LessThanThresholdStatus");
    chkEnableLessThan.addActionListener(this);
    panelAnalysisOptions.add(chkEnableLessThan, "flowx,cell 1 4,alignx right");

    lblLessThan = new JLabel("<=");
    lblLessThan.setEnabled(false);
    panelAnalysisOptions.add(lblLessThan, "cell 2 4");

    spnThresholdValueLT = new JSpinner();
    spnThresholdValueLT.setEnabled(false);
    spnThresholdValueLT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    panelAnalysisOptions.add(spnThresholdValueLT, "cell 3 4");

    lblAnd = new JLabel("and");
    panelAnalysisOptions.add(lblAnd, "cell 1 4");

    JPanel panelSimulations = new JPanel();
    panelSimulations.setBorder(
            new TitledBorder(null, "Simulations", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelSimulations, "cell 0 2,grow");
    panelSimulations.setLayout(new MigLayout("", "[100px:100px:180px,right][fill]", "[][][]"));

    JLabel lblSimulations = new JLabel("Simulations:");
    panelSimulations.add(lblSimulations, "cell 0 0");

    spnSimulations = new JSpinner();
    panelSimulations.add(spnSimulations, "cell 1 0");
    spnSimulations.setModel(new SpinnerNumberModel(new Integer(1000), new Integer(1), null, new Integer(1)));
    new SpinnerWrapper(spnSimulations, PrefKey.SSIZ_SIMULATION_COUNT, 1000);

    JLabel lblSeedNumber = new JLabel("Seed number:");
    panelSimulations.add(lblSeedNumber, "cell 0 1");

    spnSeed = new JSpinner();
    panelSimulations.add(spnSeed, "cell 1 1");
    spnSeed.setModel(new SpinnerNumberModel(new Integer(30188), null, null, new Integer(1)));
    new SpinnerWrapper(spnSeed, PrefKey.SSIZ_SEED_NUMBER, 30188);

    JLabel lblResampling = new JLabel("Resampling:");
    panelSimulations.add(lblResampling, "cell 0 2");

    cboResampling = new JComboBox();
    panelSimulations.add(cboResampling, "cell 1 2");
    cboResampling
            .setModel(new DefaultComboBoxModel(new String[] { "With replacement", "Without replacement" }));
    new ResamplingTypeWrapper(cboResampling, PrefKey.SSIZ_RESAMPLING_TYPE, ResamplingType.WITH_REPLACEMENT);

    segmentationPanel = new SegmentationPanel();
    segmentationPanel.chkSegmentation.setText("Process subset or segments of dataset?");
    segmentationPanel.chkSegmentation.setEnabled(false);
    panelParameters.add(segmentationPanel, "cell 0 3,growx");

    JPanel panel_3 = new JPanel();
    panelParameters.add(panel_3, "cell 0 4,grow");
    panel_3.setLayout(new MigLayout("", "[left][grow][right]", "[]"));

    JButton btnReset = new JButton("Reset");
    btnReset.setActionCommand("Reset");
    btnReset.addActionListener(this);
    panel_3.add(btnReset, "cell 0 0,grow");

    JButton btnRunAnalysis = new JButton("Run Analysis");
    btnRunAnalysis.setAction(actionRun);
    panel_3.add(btnRunAnalysis, "cell 2 0,grow");

    JPanel panelResults = new JPanel();
    splitPaneMain.setRightComponent(panelResults);
    panelResults.setLayout(new BorderLayout(0, 0));

    splitPaneResults = new JSplitPane();
    splitPaneResults.setResizeWeight(0.5);
    splitPaneResults.setOneTouchExpandable(true);
    splitPaneResults.setDividerLocation(0.5d);
    panelResults.add(splitPaneResults, BorderLayout.CENTER);
    splitPaneResults.setOrientation(JSplitPane.VERTICAL_SPLIT);

    JPanel panelResultsTop = new JPanel();
    splitPaneResults.setLeftComponent(panelResultsTop);
    panelResultsTop.setLayout(new BorderLayout(0, 0));

    JPanel panelChartOptions = new JPanel();
    panelChartOptions.setBackground(Color.WHITE);
    panelResultsTop.add(panelChartOptions, BorderLayout.SOUTH);
    panelChartOptions.setLayout(new MigLayout("", "[][][][][][grow][grow]", "[15px,center]"));

    JLabel lblNewLabel = new JLabel("Plot:");
    panelChartOptions.add(lblNewLabel, "cell 0 0,alignx trailing,aligny center");

    cboChartMetric = new JComboBox();
    cboChartMetric.setEnabled(false);
    cboChartMetric.setModel(new DefaultComboBoxModel(MiddleMetric.values()));
    panelChartOptions.add(cboChartMetric, "cell 1 0,growx");
    cboChartMetric.setBackground(Color.WHITE);

    JLabel lblOfSegment = new JLabel("of segment:");
    panelChartOptions.add(lblOfSegment, "cell 2 0,alignx trailing");

    cboSegment = new JComboBox();
    cboSegment.setBackground(Color.WHITE);
    cboSegment.setActionCommand("UpdateChart");
    cboSegment.addActionListener(this);

    panelChartOptions.add(cboSegment, "cell 3 0,growx");
    cboChartMetric.setActionCommand("UpdateChart");

    JLabel lblWithAsymptoteType = new JLabel("with asymptote type:");
    panelChartOptions.add(lblWithAsymptoteType, "cell 4 0,alignx trailing");

    JComboBox comboBox = new JComboBox();
    comboBox.setEnabled(false);
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "none", "Weibull", "Michaelis-Menten",
            "Modified Michaelis-Menten", "Logistic", "Modified exponential" }));
    comboBox.setBackground(Color.WHITE);
    panelChartOptions.add(comboBox, "cell 5 0,growx");
    cboChartMetric.addActionListener(this);

    panelChart = new JPanel();
    panelChart.setMinimumSize(new Dimension(200, 200));
    panelResultsTop.add(panelChart, BorderLayout.CENTER);
    panelChart.setLayout(new BorderLayout(0, 0));
    panelChart.setBackground(Color.WHITE);

    JTabbedPane panelResultsBottom = new JTabbedPane(JTabbedPane.BOTTOM);
    splitPaneResults.setRightComponent(panelResultsBottom);

    simulationsTable = new SSIZResultsTable();
    simulationsTable.setEnabled(false);
    simulationsTable.addMouseListener(new TablePopClickListener());
    simulationsTable.setVisibleRowCount(10);

    adapter = new JTableSpreadsheetByRowAdapter(simulationsTable);

    scrollPaneSimulations = new JScrollPane();
    panelResultsBottom.addTab("Simulations", null, scrollPaneSimulations, null);
    scrollPaneSimulations.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneSimulations.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneSimulations.setViewportView(simulationsTable);

    JPanel panelAsymptote = new JPanel();

    asymptoteTable = new AsymptoteTable();
    asymptoteTable.setEnabled(false);
    // asymptoteTable.addMouseListener(new TablePopClickListener());
    asymptoteTable.setVisibleRowCount(10);

    scrollPaneAsymptote = new JScrollPane();

    scrollPaneAsymptote.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneAsymptote.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneAsymptote.setViewportView(asymptoteTable);
    panelAsymptote.setLayout(new BorderLayout());
    panelAsymptote.add(scrollPaneAsymptote, BorderLayout.CENTER);
    panelResultsBottom.addTab("Asymptote", null, panelAsymptote, null);

    // Disable asymptote tab until it is implemented
    panelResultsBottom.setEnabledAt(1, false);

    panelProgressBar = new JPanel();
    panelProgressBar.setLayout(new BorderLayout());

    btnCancelAnalysis = new JButton("Cancel");
    btnCancelAnalysis.setIcon(Builder.getImageIcon("delete.png"));
    btnCancelAnalysis.setVisible(false);
    btnCancelAnalysis.setActionCommand("CancelAnalysis");
    btnCancelAnalysis.addActionListener(this);

    progressBar = new JProgressBar();
    panelProgressBar.add(progressBar, BorderLayout.CENTER);
    panelProgressBar.add(btnCancelAnalysis, BorderLayout.EAST);
    progressBar.setStringPainted(true);

    fileDialogWasUsed = false;
    mouseListenersActive = false;

    this.setGUIForFHFileReader();
    this.setGUIForThresholdStatus();

    pack();
    this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    setVisible(true);
}

From source file:geovista.network.gui.NodeLinkView.java

protected void addControls(final JPanel jp) {

    // Satellite//w w w.  j a  v a 2  s.com
    // JComboBox modeBox = graphMouse.getModeComboBox();
    // modeBox.addItemListener(((DefaultModalGraphMouse)satellite.getGraphMouse()).getModeListener());

    // Control Panel
    jp.setBackground(Color.WHITE);
    jp.setLayout(new BorderLayout());
    jp.add(vv, BorderLayout.CENTER);
    JPanel control_panel = new JPanel(new GridLayout(5, 1));
    jp.add(control_panel, BorderLayout.EAST);

    // File_Layout Panel
    Class[] combos = getCombos();
    final JComboBox jcb = new JComboBox(combos);
    jcb.setRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            String valueString = value.toString();
            valueString = valueString.substring(valueString.lastIndexOf('.') + 1);
            return super.getListCellRendererComponent(list, valueString, index, isSelected, cellHasFocus);
        }
    });

    jcb.addActionListener(new LayoutChooser(jcb, vv));
    jcb.setSelectedItem(FRLayout.class);
    final Box file_layout_panel = Box.createVerticalBox();
    file_layout_panel.setBorder(BorderFactory.createTitledBorder("File_Layout"));
    final JComboBox graph_chooser = new JComboBox(g_names);
    graph_chooser.addActionListener(new GraphChooser(jcb));
    JPanel layoutPanel = new JPanel();
    jcb.setAlignmentX(Component.CENTER_ALIGNMENT);
    layoutPanel.add(jcb);
    graph_chooser.setAlignmentX(Component.CENTER_ALIGNMENT);
    layoutPanel.add(graph_chooser);
    file_layout_panel.add(layoutPanel);

    // Basic Operation Panel

    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 reset = new JButton("reset");
    reset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Layout<Integer, Number> layout = vv.getGraphLayout();
            layout.initialize();
            Relaxer relaxer = vv.getModel().getRelaxer();
            if (relaxer != null) {
                relaxer.stop();
                relaxer.prerelax();
                relaxer.relax();
            }
        }
    });

    // Tranform and picking part
    final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(graphMouse);
    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(((DefaultModalGraphMouse<Integer, Number>) vv.getGraphMouse()).getModeListener());

    JButton collapse = new JButton("Collapse");
    JButton expand = new JButton("Expand");

    final Box basic_panel = Box.createVerticalBox();
    basic_panel.setBorder(BorderFactory.createTitledBorder("Basic_Operation"));
    JPanel zoomPanel = new JPanel();
    // plus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(plus);
    // minus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(minus);
    // modeBox.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(modeBox);
    // reset.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(reset);
    // collapse.setAlignmentY(Component.CENTER_ALIGNMENT);
    zoomPanel.add(collapse);
    // expand.setAlignmentY(Component.CENTER_ALIGNMENT);
    zoomPanel.add(expand);

    basic_panel.add(zoomPanel);

    // Vertex Part
    String[] vertexScoreType = { "VertexScore", "Degree", "BarycenterScorer", "BetweennessCentrality",
            "ClosenessCentrality", "DistanceCentralityScorer", "EigenvectorCentrality" };
    final JComboBox vertexScoreList = new JComboBox(vertexScoreType);
    vertexScoreList.setSelectedIndex(0);

    vertexScoreList.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            // Renderer.VertexLabel.Position position =
            // (Renderer.VertexLabel.Position)e.getItem();
            // vv.getRenderer().getVertexLabelRenderer().setPosition(position);
            if (vertexScoreList.getSelectedIndex() == 0) {

                // vertexScores = new VertexScoreTransformer<Integer,
                // Double>(voltage_scores);
                // vv.getRenderContext().setVertexShapeTransformer(new
                // ConstantTransformer(null));
                // vssa.setScaling(false);
                vv.getRenderContext().setVertexLabelTransformer(nonvertexLabel);
                vv.repaint();
            }

            if (vertexScoreList.getSelectedIndex() == 1) {
                // vertexScores = new VertexScoreTransformer<Integer,
                // Double>(degreeScorer);
                /*
                 * vssa = new
                 * VertexShapeSizeAspect<Integer,Number>((Graph<Integer
                 * ,Number>)g, transformerDegree);
                 * vv.getRenderContext().setVertexShapeTransformer(vssa);
                 * vssa.setScaling(true);
                 */

                vv.getRenderContext().setVertexLabelTransformer(vertexLabelDegree);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 2) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerBarycenter);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelBarycenter);
                vv.repaint();
            }

            if (vertexScoreList.getSelectedIndex() == 3) {

                // betweennessCentrality= new BetweennessCentrality(g);
                // voltages = new VertexScoreTransformer<Integer,
                // Double>(betweennessCentrality);
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerBetweenness);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelBetweenness);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 4) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerCloseness);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelCloseness);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 5) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerDistanceCentrality);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelDistanceCentrality);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 6) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerEigenvector);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelEigenvector);
                vv.repaint();
            }

        }
    });
    // cb.setSelectedItem(Renderer.VertexLabel.Position.SE);

    /*
     * v_shape = new JCheckBox("shape by degree");
     * v_shape.addActionListener(this); v_size = new
     * JCheckBox("size by vertexScores"); v_size.addActionListener(this);
     * v_size.setSelected(true); v_aspect = new
     * JCheckBox("stretch by degree ratio");
     * v_aspect.addActionListener(this);
     */
    v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE);
    v_small.addActionListener(this);
    e_labels = new JCheckBox("show edge labels");
    e_labels.addActionListener(this);

    // Vertex Panel
    final Box vertex_panel = Box.createVerticalBox();
    vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices"));
    // vertex_panel.add(v_stroke);
    vertex_panel.add(vertexScoreList);
    // vertex_panel.add(v_degree_labels);
    /*
     * vertex_panel.add(v_shape); vertex_panel.add(v_size);
     * vertex_panel.add(v_aspect);
     */
    vertex_panel.add(v_small);

    // Edge Part
    final Box edge_panel = Box.createVerticalBox();
    edge_panel.setBorder(BorderFactory.createTitledBorder("Edges"));
    edge_panel.add(e_labels);

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");
    // Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(g.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    // Cluster Part
    final Box cluster_panel = Box.createVerticalBox();
    cluster_panel.setBorder(BorderFactory.createTitledBorder("Cluster"));
    cluster_panel.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    cluster_panel.setBorder(sliderBorder);
    cluster_panel.add(Box.createVerticalGlue());
    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                cluster_panel.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });
    cluster_panel.add(groupVertices);

    control_panel.add(file_layout_panel);
    control_panel.add(vertex_panel);
    control_panel.add(edge_panel);
    control_panel.add(cluster_panel);
    control_panel.add(basic_panel);
}

From source file:org.biojava.bio.view.MotifAnalyzer.java

public void displayCharts(String fileName) throws IOException {
    JFrame chartsFrame = new JFrame("Charts Analysis");
    chartsFrame.setSize(700, 600);//from w  w w. ja  v a 2 s .c om
    JTabbedPane tabs = new JTabbedPane();
    chartsFrame.add(tabs);

    JPanel image1 = new JPanel(new BorderLayout());
    image1.add(new JLabel(new ImageIcon(ImageIO.read(new File(fileName)))));
    image1.setBackground(Color.white);
    tabs.addTab("Chart ", image1);

    chartsFrame.setVisible(true);

}