Example usage for javax.swing JPanel setToolTipText

List of usage examples for javax.swing JPanel setToolTipText

Introduction

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

Prototype

@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.")
public void setToolTipText(String text) 

Source Link

Document

Registers the text to display in a tool tip.

Usage

From source file:com.juanhg.cicloc.cicloCApplet.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);

    lblPhase = new JLabel("Trabajo Ciclo:");
    lblPhase.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    JLabel lblPosicion = new JLabel("Trabajo:");
    lblPosicion.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblTrabajoValue = new JLabel();
    lblTrabajoValue.setText("0");
    lblTrabajoValue.setFont(new Font("Tahoma", Font.PLAIN, 14));
    hotImage = loadImage(hot);/*from   ww w .j  a  v  a 2 s. c  om*/

    coldImage = loadImage(cold);

    lblE = new JLabel("Rendimiento:");
    lblE.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblEValue = new JLabel();
    lblEValue.setText("0");
    lblEValue.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().addGap(22).addGroup(gl_panelOutputs
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(lblE, GroupLayout.PREFERRED_SIZE, 84, GroupLayout.PREFERRED_SIZE)
                            .addGap(26).addComponent(lblEValue, GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE))
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING)
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblPhase, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGap(26))
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 81,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(29)))
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(lblTrabajoValue, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblTrabajoCValue, GroupLayout.PREFERRED_SIZE, 103,
                                            GroupLayout.PREFERRED_SIZE))))
                    .addGap(109))
            .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(panelTitleOutputs,
                    GroupLayout.PREFERRED_SIZE, 262, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(82, Short.MAX_VALUE)));
    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(lblTrabajoCValue).addComponent(lblPhase))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblTrabajoValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblE, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(79)));
    panelOutputs.setLayout(gl_panelOutputs);

    panel_1 = new JPanel();
    panel_1.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.LEADING, false)
                            .addComponent(panelOutputs, 0, 0, Short.MAX_VALUE)
                            .addComponent(panelInputs, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(panel_6, 0, 0, Short.MAX_VALUE).addComponent(panel_1,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap(92, Short.MAX_VALUE)));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 213, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 146, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(panel_1,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addGap(17)));

    btnLaunchSimulation = new JButton("Iniciar");
    btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    btnLaunchSimulation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            btnLaunchSimulationEvent(event);
        }
    });

    btnCold = new JButton("");
    btnCold.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnHot.setEnabled(true);
            btnCold.setEnabled(false);
            isHot = false;
            lblE.setText("Eficiencia");

            lblModeValue.setText("Modo Frig");
            panelMode.setBackground(Color.BLUE);

        }
    });
    btnCold.setIcon(new ImageIcon(coldImage));
    btnCold.setEnabled(true);

    panelMode = new JPanel();
    panelMode.setBorder(new LineBorder(new Color(0, 0, 0)));
    panelMode.setBackground(Color.ORANGE);

    btnHot = new JButton("");
    btnHot.setIcon(new ImageIcon(hotImage));
    btnHot.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btnHot.setEnabled(false);
            btnCold.setEnabled(true);
            isHot = true;
            lblE.setText("Rendimiento");

            lblModeValue.setText("Modo Motor");
            panelMode.setBackground(Color.ORANGE);
        }
    });
    btnHot.setEnabled(false);
    GroupLayout gl_panel_6 = new GroupLayout(panel_6);
    gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_6
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_panel_6.createParallelGroup(Alignment.LEADING, false)
                    .addComponent(panelMode, Alignment.TRAILING, 0, 0, Short.MAX_VALUE)
                    .addComponent(btnHot, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE))
            .addGap(10)
            .addGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING, false)
                    .addComponent(btnCold, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE))
            .addContainerGap()));
    gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_6.createSequentialGroup().addGap(10)
                    .addGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
                            .addComponent(panelMode, 0, 0, Short.MAX_VALUE).addComponent(btnLaunchSimulation,
                                    GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING)
                            .addComponent(btnCold, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                            .addComponent(btnHot, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE))
                    .addContainerGap()));

    lblModeValue = new JLabel("Modo Motor");
    lblModeValue.setFont(new Font("Tahoma", Font.PLAIN, 17));
    GroupLayout gl_panelMode = new GroupLayout(panelMode);
    gl_panelMode.setHorizontalGroup(gl_panelMode.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelMode.createSequentialGroup().addContainerGap()
                    .addComponent(lblModeValue, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    gl_panelMode
            .setVerticalGroup(gl_panelMode.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelMode
                            .createSequentialGroup().addContainerGap().addComponent(lblModeValue,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGap(52)));
    panelMode.setLayout(gl_panelMode);
    panel_6.setLayout(gl_panel_6);

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

    JLabel LabelT1 = new JLabel("T1");
    LabelT1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelT2 = new JLabel("T2");
    labelT2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelVmin = new JLabel("Vm\u00EDn");
    labelVmin.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    lblT2Value = new JLabel("300");
    lblT2Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVminValue = new JLabel("2");
    lblVminValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblT1Value = new JLabel("400");
    lblT1Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderT1 = new JSlider();
    sliderT1.setMinimum(350);
    sliderT1.setMaximum(450);
    sliderT1.setMinorTickSpacing(1);
    sliderT1.setValue(400);
    sliderT1.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderT1Event();
        }
    });

    sliderT2 = new JSlider();
    sliderT2.setMinimum(270);
    sliderT2.setMaximum(330);
    sliderT2.setMinorTickSpacing(1);
    sliderT2.setValue(300);
    sliderT2.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderT2Event();
        }
    });

    sliderVMin = new JSlider();
    sliderVMin.setMaximum(4);
    sliderVMin.setMinimum(1);
    sliderVMin.setValue(2);
    sliderVMin.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderVminEvent();
        }
    });

    JLabel lblVmax = new JLabel("Vm\u00E1x");
    lblVmax.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVmaxValue = new JLabel("7");
    lblVmaxValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderVMax = new JSlider();
    sliderVMax.setMaximum(10);
    sliderVMax.setMinimum(6);
    sliderVMax.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderVmaxEvent();
        }
    });
    sliderVMax.setValue(7);
    sliderVMax.setMinorTickSpacing(1);

    JLabel labelN = new JLabel("N");
    labelN.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    sliderN = new JSlider();
    sliderN.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderNEvent();
        }
    });
    sliderN.setValue(10);
    sliderN.setMinorTickSpacing(1);

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelInputs.createSequentialGroup().addGap(19).addGroup(gl_panelInputs
                    .createParallelGroup(Alignment.LEADING, false)
                    .addComponent(labelN, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblVmax, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(labelVmin, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE)
                    .addComponent(labelT2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(LabelT1, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false)
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE, 42,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 56,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblVminValue, GroupLayout.PREFERRED_SIZE, 56,
                                                    GroupLayout.PREFERRED_SIZE))
                                    .addGap(18)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false)
                                            .addComponent(sliderT1, 0, 0, Short.MAX_VALUE)
                                            .addComponent(sliderT2, 0, 0, Short.MAX_VALUE)
                                            .addComponent(sliderVMin, GroupLayout.PREFERRED_SIZE, 88,
                                                    GroupLayout.PREFERRED_SIZE)))
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addComponent(lblVmaxValue, GroupLayout.PREFERRED_SIZE, 56,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(18).addComponent(sliderVMax, GroupLayout.PREFERRED_SIZE, 88,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 56,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(18)
                                    .addComponent(sliderN, GroupLayout.PREFERRED_SIZE, 88,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                    .addContainerGap())
            .addComponent(panelTitle, GroupLayout.DEFAULT_SIZE, 259, 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().addComponent(LabelT1).addGap(12)
                                    .addComponent(labelT2).addGap(17).addComponent(labelVmin).addGap(17)
                                    .addComponent(lblVmax, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(17).addComponent(labelN, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderT1, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderT2, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addGap(11)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblVminValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderVMin, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblVmaxValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderVMax, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
                                            .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderN, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
                    .addGap(8)));

    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.TRAILING)
            .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 286, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(panel_visualizar,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(93, Short.MAX_VALUE)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout
            .createSequentialGroup().addContainerGap()
            .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_visualizar, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE))
            .addContainerGap()));

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);

    panelPiston = new JPanelGrafica();
    panelPiston.setBackground(Color.WHITE);

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

    JPanel panel = new JPanel();
    panel.setBackground(Color.WHITE);
    GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar);
    gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING)
            .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 845, Short.MAX_VALUE)
            .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap()
                    .addComponent(panelPiston, GroupLayout.PREFERRED_SIZE, 355, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 183, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_5, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE).addContainerGap()));
    gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_visualizar.createSequentialGroup()
                    .addComponent(tabbedPane, GroupLayout.PREFERRED_SIZE, 289, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                            .addComponent(panelPiston, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                            .addComponent(panel_5, GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE))
                    .addContainerGap()));

    panelTermo = new JPanelGrafica();
    panelTermo.setBackground(Color.WHITE);
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelTermo,
            GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelTermo,
            GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE));
    panel.setLayout(gl_panel);

    panelPistonInterno = new JPanelGrafica();
    panelPistonInterno.setBackground(Color.WHITE);
    GroupLayout gl_panelPiston = new GroupLayout(panelPiston);
    gl_panelPiston.setHorizontalGroup(gl_panelPiston.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelPiston.createSequentialGroup()
                    .addComponent(panelPistonInterno, GroupLayout.PREFERRED_SIZE, 354,
                            GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    gl_panelPiston.setVerticalGroup(gl_panelPiston.createParallelGroup(Alignment.LEADING)
            .addComponent(panelPistonInterno, GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE));
    panelPiston.setLayout(gl_panelPiston);

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

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

    lblBulbValue = new JLabel("-  Horas");

    lblLEDValue = new JLabel("-  Horas");
    GroupLayout gl_panel_5 = new GroupLayout(panel_5);
    gl_panel_5.setHorizontalGroup(gl_panel_5.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_5.createSequentialGroup()
                    .addGroup(gl_panel_5.createParallelGroup(Alignment.LEADING, false)
                            .addComponent(panelLED, 0, 0, Short.MAX_VALUE)
                            .addComponent(panelBulb, GroupLayout.PREFERRED_SIZE, 132, Short.MAX_VALUE))
                    .addGap(18).addGroup(gl_panel_5.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblBulbValue).addComponent(lblLEDValue))
                    .addContainerGap(87, Short.MAX_VALUE)));
    gl_panel_5.setVerticalGroup(gl_panel_5.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_5.createSequentialGroup()
                    .addComponent(panelBulb, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(panelLED, GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE))
            .addGroup(gl_panel_5.createSequentialGroup().addGap(64).addComponent(lblBulbValue)
                    .addPreferredGap(ComponentPlacement.RELATED, 135, Short.MAX_VALUE).addComponent(lblLEDValue)
                    .addGap(64)));

    LEDOnImage = loadImage(LEDOn);
    LEDOffImage = loadImage(LEDOff);
    lblLED = new JLabel(new ImageIcon(LEDOffImage));
    lblLED.setBackground(Color.WHITE);

    GroupLayout gl_panelLED = new GroupLayout(panelLED);
    gl_panelLED.setHorizontalGroup(gl_panelLED.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelLED.createSequentialGroup()
                    .addComponent(lblLED, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(33, Short.MAX_VALUE)));
    gl_panelLED.setVerticalGroup(gl_panelLED.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING,
            gl_panelLED.createSequentialGroup().addContainerGap().addComponent(lblLED, GroupLayout.DEFAULT_SIZE,
                    126, Short.MAX_VALUE)));
    panelLED.setLayout(gl_panelLED);

    bulbOnImage = loadImage(bulbOn);
    bulbOffImage = loadImage(bulbOff);
    lblBulb = new JLabel(new ImageIcon(bulbOffImage));
    lblBulb.setBackground(Color.WHITE);

    GroupLayout gl_panelBulb = new GroupLayout(panelBulb);
    gl_panelBulb.setHorizontalGroup(gl_panelBulb.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelBulb.createSequentialGroup()
                    .addComponent(lblBulb, GroupLayout.PREFERRED_SIZE, 134, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(30, Short.MAX_VALUE)));
    gl_panelBulb.setVerticalGroup(gl_panelBulb.createParallelGroup(Alignment.LEADING).addComponent(lblBulb,
            GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE));
    panelBulb.setLayout(gl_panelBulb);
    panel_5.setLayout(gl_panel_5);

    JPanel panelXV = new JPanel();
    panelXV.setBackground(Color.WHITE);
    tabbedPane.addTab("Grficas V", null, panelXV, null);

    JPanel panel_2 = new JPanel();

    JPanel panel_3 = new JPanel();

    JPanel panel_4 = new JPanel();

    panelTV = new JPanelGrafica();
    GroupLayout gl_panel_4 = new GroupLayout(panel_4);
    gl_panel_4.setHorizontalGroup(
            gl_panel_4.createParallelGroup(Alignment.LEADING).addGap(0, 272, Short.MAX_VALUE)
                    .addComponent(panelTV, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE));
    gl_panel_4
            .setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE)
                    .addGroup(gl_panel_4.createSequentialGroup()
                            .addComponent(panelTV, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(306, Short.MAX_VALUE)));
    panel_4.setLayout(gl_panel_4);
    GroupLayout gl_panelXV = new GroupLayout(panelXV);
    gl_panelXV.setHorizontalGroup(gl_panelXV.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelXV.createSequentialGroup().addContainerGap()
                    .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 263, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 272, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(11, Short.MAX_VALUE)));
    gl_panelXV.setVerticalGroup(gl_panelXV.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelXV.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panelXV.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_panelXV.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(panel_3, Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                                    .addComponent(panel_2, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 241,
                                            Short.MAX_VALUE)))
                    .addContainerGap(317, Short.MAX_VALUE)));

    panelUV = new JPanelGrafica();
    GroupLayout gl_panel_3 = new GroupLayout(panel_3);
    gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addComponent(panelUV,
            GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE));
    gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_3.createSequentialGroup()
                    .addComponent(panelUV, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(306, Short.MAX_VALUE)));
    panel_3.setLayout(gl_panel_3);

    panelPV = new JPanelGrafica();
    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addComponent(panelPV,
            GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE));
    gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addComponent(panelPV,
            GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE));
    panel_2.setLayout(gl_panel_2);
    panelXV.setLayout(gl_panelXV);

    JPanel panelXT = new JPanel();
    panelXT.setBackground(Color.WHITE);
    tabbedPane.addTab("Grficas T", null, panelXT, null);

    JPanel panel_9 = new JPanel();

    panelPT = new JPanelGrafica();
    GroupLayout gl_panel_9 = new GroupLayout(panel_9);
    gl_panel_9.setHorizontalGroup(
            gl_panel_9.createParallelGroup(Alignment.LEADING).addGap(0, 263, Short.MAX_VALUE)
                    .addComponent(panelPT, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE));
    gl_panel_9
            .setVerticalGroup(gl_panel_9.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE)
                    .addComponent(panelPT, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE));
    panel_9.setLayout(gl_panel_9);

    JPanel panel_10 = new JPanel();

    panelST = new JPanelGrafica();
    GroupLayout gl_panel_10 = new GroupLayout(panel_10);
    gl_panel_10.setHorizontalGroup(
            gl_panel_10.createParallelGroup(Alignment.LEADING).addGap(0, 272, Short.MAX_VALUE)
                    .addComponent(panelST, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE));
    gl_panel_10
            .setVerticalGroup(gl_panel_10.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE)
                    .addGroup(gl_panel_10.createSequentialGroup()
                            .addComponent(panelST, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_10.setLayout(gl_panel_10);

    JPanel panel_11 = new JPanel();

    panelUT = new JPanelGrafica();
    GroupLayout gl_panel_11 = new GroupLayout(panel_11);
    gl_panel_11.setHorizontalGroup(
            gl_panel_11.createParallelGroup(Alignment.LEADING).addGap(0, 272, Short.MAX_VALUE)
                    .addComponent(panelUT, GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE));
    gl_panel_11
            .setVerticalGroup(gl_panel_11.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE)
                    .addGroup(gl_panel_11.createSequentialGroup()
                            .addComponent(panelUT, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_11.setLayout(gl_panel_11);
    GroupLayout gl_panelXT = new GroupLayout(panelXT);
    gl_panelXT.setHorizontalGroup(gl_panelXT.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelXT.createSequentialGroup().addContainerGap()
                    .addComponent(panel_9, GroupLayout.PREFERRED_SIZE, 263, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_11, GroupLayout.PREFERRED_SIZE, 272, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(11, Short.MAX_VALUE)));
    gl_panelXT.setVerticalGroup(gl_panelXT.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelXT.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panelXT.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel_11, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_panelXT.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(panel_10, Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                                    .addComponent(panel_9, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 241,
                                            Short.MAX_VALUE)))
                    .addContainerGap(317, Short.MAX_VALUE)));
    panelXT.setLayout(gl_panelXT);
    panel_visualizar.setLayout(gl_panel_visualizar);

    getContentPane().setLayout(groupLayout);
}

From source file:com.juanhg.pot.PotApplet.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);

    JLabel lblW = new JLabel("W:");
    lblW.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblWValue = new JLabel();
    lblWValue.setText("-");
    lblWValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblQ = new JLabel("Q:");
    lblQ.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblQValue = new JLabel();
    lblQValue.setText("-");
    lblQValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    lblTOValue = new JLabel();
    lblTOValue.setText("-");
    lblTOValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblU = new JLabel("U:");
    lblU.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

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

    lblVOValue = new JLabel();
    lblVOValue.setText("-");
    lblVOValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    lblUValue = new JLabel();
    lblUValue.setText("-");
    lblUValue.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, 352, Short.MAX_VALUE)
            .addGroup(gl_panelOutputs.createSequentialGroup().addGap(31).addGroup(gl_panelOutputs
                    .createParallelGroup(Alignment.TRAILING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(lblQ, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE)
                                    .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 43,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblWValue, GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                                    .addComponent(lblQValue, GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)))
                    .addGroup(Alignment.LEADING, gl_panelOutputs.createSequentialGroup()
                            .addComponent(lblT2, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblTOValue,
                                    GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)))
                    .addGap(18)//w  ww.j a  va  2s .  c  o  m
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelOutputs.createSequentialGroup()
                                    .addComponent(lblU, GroupLayout.PREFERRED_SIZE, 43,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(6).addComponent(lblUValue, GroupLayout.PREFERRED_SIZE, 90,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelOutputs.createSequentialGroup()
                                    .addComponent(lblP, GroupLayout.PREFERRED_SIZE, 43,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(6).addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 90,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelOutputs.createSequentialGroup()
                                    .addComponent(lblVO, GroupLayout.PREFERRED_SIZE, 43,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(6).addComponent(lblVOValue, GroupLayout.PREFERRED_SIZE, 90,
                                            GroupLayout.PREFERRED_SIZE)))
                    .addGap(25)));
    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.RELATED)
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING).addGroup(gl_panelOutputs
                            .createSequentialGroup()
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblU, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblUValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(6)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblP, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(6)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblVO, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblVOValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)))
                            .addGroup(gl_panelOutputs.createSequentialGroup().addGroup(gl_panelOutputs
                                    .createParallelGroup(Alignment.TRAILING)
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblQ,
                                                    GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblWValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblQValue,
                                                    GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)))
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblT2, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblTOValue, GroupLayout.PREFERRED_SIZE, 17,
                                                    GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap()));
    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.LEADING)
                    .addGroup(Alignment.TRAILING, gl_panel_control.createSequentialGroup().addContainerGap()
                            .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(panelInputs, Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                            346, Short.MAX_VALUE)
                                    .addComponent(panelOutputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE)
                                    .addComponent(panelLicense, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            346, Short.MAX_VALUE))
                            .addContainerGap()));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 81, 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(Alignment.TRAILING,
            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(69, Short.MAX_VALUE)));
    panel_6.setLayout(gl_panel_6);

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

    lblT = new JLabel("Temperatura");
    lblT.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    lblMo = new JLabel("Masa Inicial");
    lblMo.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

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

    lblMoValue = new JLabel("5");
    lblMoValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    sliderT = new JSlider();
    sliderT.setMinimum(280);
    sliderT.setMaximum(330);
    sliderT.setMinorTickSpacing(1);
    sliderT.setValue(300);
    sliderT.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderI1Event();
        }
    });

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

    sliderMo = new JSlider();
    sliderMo.setMinimum(1);
    sliderMo.setMaximum(1000);
    sliderMo.setValue(5);
    sliderMo.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI3Event();
        }
    });

    lblM = new JLabel("Masa Final");
    lblM.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblMValue = new JLabel("4");
    lblMValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    lblType = new JLabel("Combustible");
    lblType.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblTypeValue = new JLabel("Madera");
    lblTypeValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderType = new JSlider();
    sliderType.setMinimum(1);
    sliderType.setMaximum(4);
    sliderType.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI5Event();
        }
    });
    sliderType.setValue(1);
    sliderType.setMinorTickSpacing(1);

    lblMc = new JLabel("Masa Combustible");
    lblMc.setFont(new Font("Tahoma", Font.PLAIN, 14));

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

    sliderMc = new JSlider();
    sliderMc.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderI6Event();
        }
    });
    sliderMc.setMinimum(1);
    sliderMc.setValue(10);
    sliderMc.setMinorTickSpacing(1);
    sliderMc.setMaximum(50);

    btn1 = new JButton("1");
    btn1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btn1function();
        }
    });

    btn2 = new JButton("2");
    btn2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            btn1.setEnabled(true);
            btn2.setEnabled(false);
            btn3.setEnabled(true);

            lblT.setEnabled(true);
            lblTValue.setEnabled(true);
            sliderT.setEnabled(true);

            lblV.setEnabled(true);
            lblVValue.setEnabled(true);
            sliderV.setEnabled(true);

            lblMo.setEnabled(false);
            lblMoValue.setEnabled(false);
            sliderMo.setEnabled(false);

            lblM.setEnabled(false);
            lblMValue.setEnabled(false);
            sliderM.setEnabled(false);

            lblType.setEnabled(true);
            lblTypeValue.setEnabled(true);
            sliderType.setEnabled(true);

            lblMc.setEnabled(true);
            lblMcValue.setEnabled(true);
            sliderMc.setEnabled(true);

            model.setCurrentPhase(2);
            readInputs();
            updateFire();
            updateScrews();
            updatePot();

            updatePanels();
            repaint();
        }
    });

    btn3 = new JButton("3");
    btn3.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            btn1.setEnabled(true);
            btn2.setEnabled(true);
            btn3.setEnabled(false);

            lblT.setEnabled(true);
            lblTValue.setEnabled(true);
            sliderT.setEnabled(true);

            lblV.setEnabled(false);
            lblVValue.setEnabled(false);
            sliderV.setEnabled(false);

            lblMo.setEnabled(false);
            lblMoValue.setEnabled(false);
            sliderMo.setEnabled(false);

            lblM.setEnabled(true);
            lblMValue.setEnabled(true);
            sliderM.setEnabled(true);

            lblType.setEnabled(true);
            lblTypeValue.setEnabled(true);
            sliderType.setEnabled(true);

            lblMc.setEnabled(true);
            lblMcValue.setEnabled(true);
            sliderMc.setEnabled(true);

            model.setCurrentPhase(3);
            readInputs();
            updateFire();
            updateScrews();
            updatePot();

            updatePanels();
            repaint();
        }
    });

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
            .addComponent(panelTitle, GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE)
            .addGroup(gl_panelInputs.createSequentialGroup().addGap(25)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                            gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs
                                    .createParallelGroup(Alignment.TRAILING).addGroup(gl_panelInputs
                                            .createSequentialGroup()
                                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                                    .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 120,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblMo, GroupLayout.DEFAULT_SIZE, 141,
                                                            Short.MAX_VALUE)
                                                    .addComponent(lblM, GroupLayout.PREFERRED_SIZE, 120,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblType, GroupLayout.PREFERRED_SIZE, 120,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblMc, GroupLayout.PREFERRED_SIZE, 118,
                                                            GroupLayout.PREFERRED_SIZE))
                                            .addGap(18))
                                    .addComponent(lblT, GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 42,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 56,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblMoValue, GroupLayout.PREFERRED_SIZE, 56,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 56,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblTypeValue, GroupLayout.PREFERRED_SIZE, 70,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblMcValue, GroupLayout.PREFERRED_SIZE, 42,
                                                    GroupLayout.PREFERRED_SIZE))
                                    .addGap(4).addPreferredGap(ComponentPlacement.RELATED)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                            .addComponent(sliderMc, GroupLayout.PREFERRED_SIZE, 88,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderType, GroupLayout.PREFERRED_SIZE, 88,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderM, GroupLayout.PREFERRED_SIZE, 88,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sliderMo, GroupLayout.DEFAULT_SIZE, 109,
                                                    Short.MAX_VALUE)
                                            .addComponent(sliderV, 0, 0, Short.MAX_VALUE)
                                            .addComponent(sliderT, 0, 0, Short.MAX_VALUE)))
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 94,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 93,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(btn3,
                                            GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    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(lblT)
                                    .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)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE).addComponent(lblV)
                                    .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderV, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(11)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(lblMo)
                            .addComponent(lblMoValue, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderMo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblM, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderM, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblType, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblTypeValue, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblMcValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblMc, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderMc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addComponent(btn1, GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
                                    .addGap(12))
                            .addGroup(gl_panelInputs.createSequentialGroup()
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(btn2, GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
                                            .addComponent(btn3, GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE))
                                    .addContainerGap()))));

    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(UIManager.getColor("Button.background"));

    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 382, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 741, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(31, Short.MAX_VALUE)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
            .addGroup(groupLayout.createSequentialGroup()
                    .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
                            .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(
                                    panel_visualizar, GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE))
                            .addGroup(groupLayout.createSequentialGroup().addGap(12).addComponent(panel_control,
                                    GroupLayout.PREFERRED_SIZE, 568, Short.MAX_VALUE)))
                    .addContainerGap()));

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

    JPanel panel_1 = new JPanel();
    panel_1.setBounds(351, 0, 390, 568);
    panel_1.setBackground(Color.WHITE);
    panel_1.setBorder(new LineBorder(new Color(0, 0, 0)));

    JPanel panel33 = new JPanel();
    panel33.setBounds(1, 38, 388, 529);
    panel33.setBackground(Color.WHITE);

    JPanel panel_5 = new JPanel();
    panel_5.setBounds(1, 1, 388, 31);
    panel_5.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel lblGrficas = new JLabel("Gr\u00E1ficas");
    lblGrficas.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panel_5.add(lblGrficas);
    panel_visualizar.setLayout(null);

    JPanel panel32 = new JPanel();
    panel32.setBounds(1, 38, 343, 529);
    panel32.setBackground(Color.WHITE);

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

    JLabel lblSimulacion = new JLabel("Simulaci\u00F3n");
    lblSimulacion.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panel_4.add(lblSimulacion);
    panel_visualizar.add(panel);
    panel.setLayout(null);
    panel.add(panel_4);
    panel.add(panel32);

    panelPot = new JPanelGrafica();
    panelPot.setBackground(Color.WHITE);
    GroupLayout gl_panel32 = new GroupLayout(panel32);
    gl_panel32.setHorizontalGroup(gl_panel32.createParallelGroup(Alignment.LEADING).addComponent(panelPot,
            GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE));
    gl_panel32.setVerticalGroup(gl_panel32.createParallelGroup(Alignment.LEADING).addComponent(panelPot,
            GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE));
    panel32.setLayout(gl_panel32);
    panel_visualizar.add(panel_1);
    panel_1.setLayout(null);
    panel_1.add(panel33);

    panelGraficas = new JPanelGrafica();
    panelGraficas.setBackground(Color.WHITE);
    GroupLayout gl_panel33 = new GroupLayout(panel33);
    gl_panel33.setHorizontalGroup(gl_panel33.createParallelGroup(Alignment.LEADING).addComponent(panelGraficas,
            GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE));
    gl_panel33.setVerticalGroup(gl_panel33.createParallelGroup(Alignment.LEADING).addComponent(panelGraficas,
            GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE));
    panel33.setLayout(gl_panel33);
    panel_1.add(panel_5);

    getContentPane().setLayout(groupLayout);
}

From source file:com.floreantpos.jasperreport.swing.JRViewerPanel.java

protected void createHyperlinks(List elements, int offsetX, int offsetY) {
    if (elements != null && elements.size() > 0) {
        for (Iterator it = elements.iterator(); it.hasNext();) {
            JRPrintElement element = (JRPrintElement) it.next();

            JRImageMapRenderer imageMap = null;
            if (element instanceof JRPrintImage) {
                JRRenderable renderer = ((JRPrintImage) element).getRenderer();
                if (renderer instanceof JRImageMapRenderer) {
                    imageMap = (JRImageMapRenderer) renderer;
                    if (!imageMap.hasImageAreaHyperlinks()) {
                        imageMap = null;
                    }/*from  w  w  w.ja va2s .co  m*/
                }
            }
            boolean hasImageMap = imageMap != null;

            JRPrintHyperlink hyperlink = null;
            if (element instanceof JRPrintHyperlink) {
                hyperlink = (JRPrintHyperlink) element;
            }
            boolean hasHyperlink = !hasImageMap && hyperlink != null
                    && hyperlink.getHyperlinkTypeValue() != HyperlinkTypeEnum.NONE;
            boolean hasTooltip = hyperlink != null && hyperlink.getHyperlinkTooltip() != null;

            if (hasHyperlink || hasImageMap || hasTooltip) {
                JPanel link;
                if (hasImageMap) {
                    Rectangle renderingArea = new Rectangle(0, 0, element.getWidth(), element.getHeight());
                    link = new ImageMapPanel(renderingArea, imageMap);
                } else //hasImageMap
                {
                    link = new JPanel();
                    if (hasHyperlink) {
                        link.addMouseListener(mouseListener);
                    }
                }

                if (hasHyperlink) {
                    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
                }

                link.setLocation((int) ((element.getX() + offsetX) * realZoom),
                        (int) ((element.getY() + offsetY) * realZoom));
                link.setSize((int) (element.getWidth() * realZoom), (int) (element.getHeight() * realZoom));
                link.setOpaque(false);

                String toolTip = getHyperlinkTooltip(hyperlink);
                if (toolTip == null && hasImageMap) {
                    toolTip = "";//not null to register the panel as having a tool tip
                }
                link.setToolTipText(toolTip);

                pnlLinks.add(link);
                linksMap.put(link, element);
            }

            if (element instanceof JRPrintFrame) {
                JRPrintFrame frame = (JRPrintFrame) element;
                int frameOffsetX = offsetX + frame.getX() + frame.getLineBox().getLeftPadding().intValue();
                int frameOffsetY = offsetY + frame.getY() + frame.getLineBox().getTopPadding().intValue();
                createHyperlinks(frame.getElements(), frameOffsetX, frameOffsetY);
            }
        }
    }
}

From source file:net.sf.jasperreports.swing.JRViewerPanel.java

protected void createHyperlinks(List<JRPrintElement> elements, int offsetX, int offsetY) {
    if (elements != null && elements.size() > 0) {
        for (Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();) {
            JRPrintElement element = it.next();

            AreaHyperlinksRenderable imageMap = null;
            if (element instanceof JRPrintImage) {
                Renderable renderer = ((JRPrintImage) element).getRenderer();
                if (renderer instanceof AreaHyperlinksRenderable) {
                    imageMap = (AreaHyperlinksRenderable) renderer;
                    if (!imageMap.hasImageAreaHyperlinks()) {
                        imageMap = null;
                    }/*from  ww  w .jav a2s .c o  m*/
                }
            }
            boolean hasImageMap = imageMap != null;

            JRPrintHyperlink hyperlink = null;
            if (element instanceof JRPrintHyperlink) {
                hyperlink = (JRPrintHyperlink) element;
            }
            boolean hasHyperlink = !hasImageMap && hyperlink != null
                    && hyperlink.getHyperlinkTypeValue() != HyperlinkTypeEnum.NONE;
            boolean hasTooltip = hyperlink != null && hyperlink.getHyperlinkTooltip() != null;

            if (hasHyperlink || hasImageMap || hasTooltip) {
                JPanel link;
                if (hasImageMap) {
                    Rectangle renderingArea = new Rectangle(0, 0, element.getWidth(), element.getHeight());
                    link = new ImageMapPanel(renderingArea, imageMap);
                } else //hasImageMap
                {
                    link = new JPanel();
                    if (hasHyperlink) {
                        link.addMouseListener(mouseListener);
                    }
                }

                if (hasHyperlink) {
                    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
                }

                link.setLocation((int) ((element.getX() + offsetX) * realZoom),
                        (int) ((element.getY() + offsetY) * realZoom));
                link.setSize((int) (element.getWidth() * realZoom), (int) (element.getHeight() * realZoom));
                link.setOpaque(false);

                String toolTip = getHyperlinkTooltip(hyperlink);
                if (toolTip == null && hasImageMap) {
                    toolTip = "";//not null to register the panel as having a tool tip
                }
                link.setToolTipText(toolTip);

                pnlLinks.add(link);
                linksMap.put(link, hyperlink);
            }

            if (element instanceof JRPrintFrame) {
                JRPrintFrame frame = (JRPrintFrame) element;
                int frameOffsetX = offsetX + frame.getX() + frame.getLineBox().getLeftPadding();
                int frameOffsetY = offsetY + frame.getY() + frame.getLineBox().getTopPadding();
                createHyperlinks(frame.getElements(), frameOffsetX, frameOffsetY);
            }
        }
    }
}

From source file:it.isislab.dmason.tools.batch.BatchWizard.java

/**
 * Create the frame./* w  w w  .  ja  va2s.  co m*/
 */
public BatchWizard() {
    setPreferredSize(new Dimension(800, 600));
    setTitle("Batch wizard");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 849, 620);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new GridLayout(1, 0, 0, 0));

    JPanel panel = new JPanel();
    panel.setToolTipText("");
    contentPane.add(panel);

    panel_1 = new JPanel();
    panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Param Option",
            TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(
            new TitledBorder(null, "Params List", TitledBorder.LEADING, TitledBorder.TOP, null, null));

    JPanel panel_3 = new JPanel();

    JPanel panel_4 = new JPanel();
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel
            .createSequentialGroup().addContainerGap()
            .addComponent(
                    panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
                    .addGroup(gl_panel.createSequentialGroup()
                            .addComponent(panel_4, GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE).addGap(20))
                    .addGroup(gl_panel.createSequentialGroup()
                            .addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE).addGap(4))))
            .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 823, Short.MAX_VALUE));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel
            .createSequentialGroup()
            .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
                    .addGroup(gl_panel.createSequentialGroup()
                            .addComponent(panel_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addGap(25)
                            .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE))
                    .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addContainerGap()));

    final JButton btnSave = new JButton("Save");
    btnSave.setEnabled(false);
    btnSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {

            File saveFile = SaveFileChooser();
            createXML(saveFile.getAbsoluteFile().getPath());
        }
    });

    lblTotTests = new JLabel(totTestsMessage);
    GroupLayout gl_panel_4 = new GroupLayout(panel_4);
    gl_panel_4.setHorizontalGroup(gl_panel_4.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_4.createSequentialGroup().addGap(21).addComponent(lblTotTests)
                    .addPreferredGap(ComponentPlacement.RELATED, 515, Short.MAX_VALUE).addComponent(btnSave)
                    .addGap(21)));
    gl_panel_4.setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_4.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel_4.createParallelGroup(Alignment.BASELINE).addComponent(btnSave)
                            .addComponent(lblTotTests))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_4.setLayout(gl_panel_4);

    top = new DefaultMutableTreeNode("Parameters");

    JScrollPane scrollPaneTree = new JScrollPane();

    JLabel lblNumberOfWorkers = new JLabel("Number of Workers:");

    textFieldNumberOfWorkers = new JTextField();
    textFieldNumberOfWorkers.setText("1");
    textFieldNumberOfWorkers.setColumns(10);
    textFieldNumberOfWorkers.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            if (textFieldNumberOfWorkers.isVisible()) {
                boolean checkNumberOfWorkers = true;

                while (checkNumberOfWorkers) {

                    String dist = textFieldNumberOfWorkers.getText();
                    boolean validateDist = dist.matches("(\\d)+");
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldNumberOfWorkers.setText(newDist);
                    }

                    else {
                        checkNumberOfWorkers = false;
                    }
                }
            }
        }
    });

    checkBoxLoadBalancing = new JCheckBox("Load Balancing", false);
    checkBoxLoadBalancing.setEnabled(true);

    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_2
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
                    .addComponent(scrollPaneTree, GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
                    .addGroup(gl_panel_2.createSequentialGroup().addComponent(lblNumberOfWorkers)
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addComponent(textFieldNumberOfWorkers, GroupLayout.PREFERRED_SIZE, 46,
                                    GroupLayout.PREFERRED_SIZE))
                    .addComponent(checkBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 114,
                            GroupLayout.PREFERRED_SIZE))
            .addContainerGap()));
    gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_2
            .createSequentialGroup().addContainerGap()
            .addComponent(scrollPaneTree, GroupLayout.PREFERRED_SIZE, 271, GroupLayout.PREFERRED_SIZE)
            .addGap(33)
            .addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE).addComponent(lblNumberOfWorkers)
                    .addComponent(textFieldNumberOfWorkers, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addComponent(checkBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
            .addContainerGap(56, Short.MAX_VALUE)));

    final JTree treeParams = new JTree(top);
    scrollPaneTree.setViewportView(treeParams);
    treeParams.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent selected) {
            // DefaultMutableTreeNode parent =
            // selected.getPath().getParentPath()

            DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeParams.getLastSelectedPathComponent();
            if (node.getParent() != null) {
                if (node.getParent() == simParams || node.getParent().equals(generalParams)) {

                    selectedParam = (Param) node.getUserObject();
                    if (node.getParent() == simParams) {
                        selectedParamIndex = simParams.getIndex(node);
                        paramType = "simParam";
                    }

                    else {
                        selectedParamIndex = generalParams.getIndex(node);
                        paramType = "generalParam";
                    }
                    if (selectedParam instanceof ParamFixed) {
                        ParamFixed pf = (ParamFixed) selectedParam;
                        lblParamType.setText(pf.getName() + ": " + pf.getType());
                        if (suggestion.get(pf.getName()) != null) {
                            lblDomain.setText("Domain: " + suggestion.get(pf.getName()).getDomain());
                            lblSuggested.setText(
                                    "Suggested Value: " + suggestion.get(pf.getName()).getSuggestedValue());
                        }

                        textFieldRuns.setText("" + pf.getRuns());
                        textFieldValue.setText(pf.getValue());
                        rdbtnFixed.doClick();

                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);

                    }

                    if (selectedParam instanceof ParamRange) {
                        ParamRange pf = (ParamRange) selectedParam;
                        lblParamType.setText(pf.getName() + ": " + pf.getType());
                        if (suggestion.get(pf.getName()) != null) {
                            lblDomain.setText("Domain: " + suggestion.get(pf.getName()).getDomain());
                            lblSuggested.setText(
                                    "Suggested Value: " + suggestion.get(pf.getName()).getSuggestedValue());
                        }
                        textFieldRuns.setText("" + pf.getRuns());
                        textFieldStartValue.setText(pf.getStart());
                        textFieldEndValue.setText(pf.getEnd());
                        textFieldIncrement.setText(pf.getIncrement());
                        rdbtnRange.doClick();

                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);
                    }

                    if (selectedParam instanceof ParamList) {
                        ParamList pl = (ParamList) selectedParam;
                        if (suggestion.get(pl.getName()) != null) {
                            lblDomain.setText("Domain: " + suggestion.get(pl.getName()).getDomain());
                            lblSuggested.setText(
                                    "Suggested Value: " + suggestion.get(pl.getName()).getSuggestedValue());
                        }
                        lblParamType.setText(pl.getName() + ": " + pl.getType());
                        textFieldRuns.setText("" + pl.getRuns());
                        StringBuilder b = new StringBuilder();
                        boolean isFirst = true;
                        for (String element : pl.getValues()) {
                            if (isFirst) {
                                b.append(element);
                                isFirst = false;
                            } else
                                b.append("," + element);
                        }
                        textFieldList.setText(b.toString());
                        rdbtnByvalues.doClick();

                        setListControlvisibility(true);
                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);
                    }
                    if (selectedParam instanceof ParamDistribution) {
                        DistributionType distType = DistributionType.none;
                        if (selectedParam instanceof ParamDistributionUniform) {
                            ParamDistributionUniform pu = (ParamDistributionUniform) selectedParam;
                            lblParamType.setText(pu.getName() + ": " + pu.getType());
                            if (suggestion.get(pu.getName()) != null) {
                                lblDomain.setText("Domain: " + suggestion.get(pu.getName()).getDomain());
                                lblSuggested.setText(
                                        "Suggested Value: " + suggestion.get(pu.getName()).getSuggestedValue());
                            }

                            textFieldRuns.setText("" + pu.getRuns());
                            textFieldA.setText(pu.getA());
                            textFieldB.setText(pu.getB());
                            textFieldNumberOfValues.setText("" + pu.getNumberOfValues());
                            distType = DistributionType.uniform;
                        }
                        if (selectedParam instanceof ParamDistributionExponential) {
                            ParamDistributionExponential pe = (ParamDistributionExponential) selectedParam;
                            lblParamType.setText(pe.getName() + ": " + pe.getType());
                            if (suggestion.get(pe.getName()) != null) {

                                lblDomain.setText("Domain: " + suggestion.get(pe.getName()).getDomain());
                                lblSuggested.setText(
                                        "Suggested Value: " + suggestion.get(pe.getName()).getSuggestedValue());
                            }

                            textFieldRuns.setText("" + pe.getRuns());
                            textFieldA.setText(pe.getLambda());
                            textFieldNumberOfValues.setText("" + pe.getNumberOfValues());
                            distType = DistributionType.exponential;
                        }
                        if (selectedParam instanceof ParamDistributionNormal) {
                            ParamDistributionNormal pn = (ParamDistributionNormal) selectedParam;
                            lblParamType.setText(pn.getName() + ": " + pn.getType());
                            if (suggestion.get(pn.getName()) != null) {
                                lblDomain.setText("Domain: " + suggestion.get(pn.getName()).getDomain());
                                lblSuggested.setText(
                                        "Suggested Value: " + suggestion.get(pn.getName()).getSuggestedValue());
                            }

                            textFieldRuns.setText("" + pn.getRuns());
                            textFieldA.setText(pn.getMean());
                            textFieldB.setText(pn.getStdDev());
                            textFieldNumberOfValues.setText("" + pn.getNumberOfValues());
                            distType = DistributionType.normal;

                        }

                        rdbtnByDistribution.doClick();
                        setDistributionControlVisibility(distType);
                        setDistributionComboBoxVisibility(true);
                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);
                    }
                }
            }
        }
    });

    panel_2.setLayout(gl_panel_2);

    JLabel lblSelectSimulationJar = new JLabel("Select simulation jar:");

    textFieldSimJarPath = new JTextField();
    textFieldSimJarPath.setColumns(10);

    btnLoadParams = new JButton("Load Params");
    btnLoadParams.setEnabled(false);
    btnLoadParams.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ArrayList<Param> params = loadParams();
            if (params != null) {
                top.removeAllChildren();
                createNodes(top, params);
                treeParams.expandPath(new TreePath(top.getPath()));
                treeParams.expandPath(new TreePath(simParams.getPath()));
                treeParams.expandPath(new TreePath(generalParams.getPath()));
            }

            lblTotTests.setText(totTestsMessage + " " + getTotTests());
            btnSave.setEnabled(true);
        }
    });

    JButton bntChooseSimulation = new JButton();
    bntChooseSimulation.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            simulationFile = showFileChooser();
            if (simulationFile != null) {
                textFieldSimJarPath.setText(simulationFile.getAbsolutePath());
                btnLoadParams.setEnabled(true);

                isThin = isThinSimulation(simulationFile);
                checkBoxLoadBalancing.setEnabled(!isThin);

            }
        }

    });
    bntChooseSimulation.setIcon(
            new ImageIcon(BatchWizard.class.getResource("/it.isislab.dmason/resource/image/openFolder.png")));
    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(lblSelectSimulationJar)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(textFieldSimJarPath, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addComponent(bntChooseSimulation, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
            .addGap(26).addComponent(btnLoadParams).addContainerGap(172, Short.MAX_VALUE)));
    gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3
                    .createParallelGroup(Alignment.BASELINE).addComponent(lblSelectSimulationJar)
                    .addComponent(textFieldSimJarPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(bntChooseSimulation, GroupLayout.PREFERRED_SIZE, 25,
                            GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnLoadParams))
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_3.setLayout(gl_panel_3);

    lblParamType = new JLabel("Param : type");
    lblParamType.setFont(new Font("Tahoma", Font.BOLD, 11));

    JLabel lblRuns = new JLabel("Runs:");
    textFieldRuns = new JTextField();
    textFieldRuns.setColumns(10);
    textFieldRuns.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            if (textFieldRuns.isVisible()) {
                boolean checkRuns = true;

                while (checkRuns) {

                    String dist = textFieldRuns.getText();
                    boolean validateDist = dist.matches("(\\d)+");
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldRuns.setText(newDist);
                    }

                    else {
                        checkRuns = false;
                    }
                }
            }
        }
    });
    JLabel lblParameterSpace = new JLabel("Parameter Space");
    lblParameterSpace.setFont(new Font("Tahoma", Font.BOLD, 11));

    lblValue = new JLabel("Value:");

    textFieldValue = new JTextField();
    textFieldValue.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldValue.isVisible()) {
                boolean checkValue = true;

                while (checkValue) {

                    String dist = textFieldValue.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldValue.setText(newDist);
                    }

                    else {
                        checkValue = false;
                    }
                }
            }
        }
    });
    textFieldValue.setColumns(10);
    /*textFieldValue.addKeyListener(new KeyListener() {
            
       @Override
       public void keyTyped(KeyEvent arg0) {}
            
       @Override
       public void keyReleased(KeyEvent arg0) {
    checkError();
            
            
       }
            
       @Override
       public void keyPressed(KeyEvent arg0) {}
    });
    */
    lblStartValue = new JLabel("Start value:");

    textFieldStartValue = new JTextField();
    textFieldStartValue.setText("1");
    textFieldStartValue.setColumns(10);
    textFieldStartValue.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldStartValue.isVisible()) {
                boolean checkStartValue = true;

                while (checkStartValue) {

                    String dist = textFieldStartValue.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldStartValue.setText(newDist);
                    }

                    else {
                        checkStartValue = false;
                    }
                }
            }
        }
    });

    lblEndValue = new JLabel("End value:");

    textFieldEndValue = new JTextField();
    textFieldEndValue.setText("1");
    textFieldEndValue.setColumns(10);
    textFieldEndValue.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldEndValue.isVisible()) {
                boolean checkEndValue = true;

                while (checkEndValue) {

                    String dist = textFieldEndValue.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldEndValue.setText(newDist);
                    }

                    else {
                        checkEndValue = false;
                    }
                }
            }
        }
    });

    lblIncrement = new JLabel("Increment:");

    textFieldIncrement = new JTextField();
    textFieldIncrement.setText("1");
    textFieldIncrement.setColumns(10);
    textFieldIncrement.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldIncrement.isVisible()) {

                boolean checkIncrement = true;

                while (checkIncrement) {

                    String dist = textFieldIncrement.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldIncrement.setText(newDist);
                    }

                    else {
                        checkIncrement = false;
                    }
                }
            }
        }
    });

    rdbtnFixed = new JRadioButton("Fixed");
    rdbtnFixed.setSelected(true);
    rdbtnFixed.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {

            setListControlvisibility(false);
            setDistributionComboBoxVisibility(false);
            setRangeControlVisibility(false);
            setFixedControlVisibility(true);
            setDistributionControlVisibility(DistributionType.none);
        }

    });

    rdbtnRange = new JRadioButton("Range");
    rdbtnRange.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setRangeControlVisibility(true);
            setFixedControlVisibility(false);
            setListControlvisibility(false);
            setDistributionComboBoxVisibility(false);
            setDistributionControlVisibility(DistributionType.none);
        }
    });

    rdbtnByvalues = new JRadioButton("By Values");
    rdbtnByvalues.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setRangeControlVisibility(false);
            setFixedControlVisibility(false);
            setListControlvisibility(true);
            setDistributionComboBoxVisibility(false);
            setDistributionControlVisibility(DistributionType.none);
        }
    });
    rdbtnByDistribution = new JRadioButton("By Distribution");
    rdbtnByDistribution.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setRangeControlVisibility(false);
            setFixedControlVisibility(false);
            setListControlvisibility(false);
            setDistributionComboBoxVisibility(true);
            setDistributionControlVisibility(DistributionType.none);
        }
    });
    // Group the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(rdbtnFixed);
    group.add(rdbtnRange);
    group.add(rdbtnByvalues);
    group.add(rdbtnByDistribution);

    setRangeControlVisibility(false);
    setFixedControlVisibility(false);

    lblMessage = new JLabel(message);

    btnModify = new JButton("Modify");
    btnModify.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            if (rdbtnFixed.isSelected()) {
                ParamFixed param = new ParamFixed(selectedParam.getName(), selectedParam.getType(),
                        Integer.parseInt(textFieldRuns.getText()), textFieldValue.getText());
                DefaultMutableTreeNode p = new DefaultMutableTreeNode(param);

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }

                treeParams.updateUI();

                /*
                 * ((ParamFixed)
                 * selectedParam).setValue(textFieldValue.getText());
                 * selectedParam
                 * .setRuns(Integer.parseInt(textFieldRuns.getText()));
                 * treeParams.repaint();
                 */
            }
            if (rdbtnRange.isSelected()) {
                ParamRange param = new ParamRange(selectedParam.getName(), selectedParam.getType(),
                        Integer.parseInt(textFieldRuns.getText()), textFieldStartValue.getText(),
                        textFieldEndValue.getText(), textFieldIncrement.getText());
                DefaultMutableTreeNode p = new DefaultMutableTreeNode(param);

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }
                treeParams.updateUI();
                // treeParams.repaint();

            }
            if (rdbtnByvalues.isSelected()) {
                StringTokenizer st = new StringTokenizer(textFieldList.getText(), ",");
                ArrayList<String> values = new ArrayList<String>();
                while (st.hasMoreTokens())
                    values.add(st.nextToken());

                ParamList param = new ParamList(selectedParam.getName(), selectedParam.getType(),
                        Integer.parseInt(textFieldRuns.getText()), values);
                DefaultMutableTreeNode p = new DefaultMutableTreeNode(param);

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }
                treeParams.updateUI();
                // treeParams.repaint();

            }
            if (rdbtnByDistribution.isSelected()) {
                DefaultMutableTreeNode p;
                switch (selectedDistribution) {
                case uniform:

                    p = new DefaultMutableTreeNode(
                            new ParamDistributionUniform(selectedParam.getName(), selectedParam.getType(),
                                    Integer.parseInt(textFieldRuns.getText()), textFieldA.getText(),
                                    textFieldB.getText(), Integer.parseInt(textFieldNumberOfValues.getText())));
                    break;
                case exponential:

                    p = new DefaultMutableTreeNode(new ParamDistributionExponential(selectedParam.getName(),
                            selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()),
                            textFieldA.getText(), Integer.parseInt(textFieldNumberOfValues.getText())));
                    break;

                case normal:

                    p = new DefaultMutableTreeNode(
                            new ParamDistributionNormal(selectedParam.getName(), selectedParam.getType(),
                                    Integer.parseInt(textFieldRuns.getText()), textFieldA.getText(),
                                    textFieldA.getText(), Integer.parseInt(textFieldNumberOfValues.getText())));
                    break;
                default:
                    p = new DefaultMutableTreeNode();
                    break;
                }

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }
                treeParams.updateUI();
                // treeParams.repaint();

            }
            lblMessage.setVisible(true);
            setModifyControlEnable(false);
            setDistributionControlVisibility(DistributionType.none);
            setDistributionComboBoxVisibility(false);
            setListControlvisibility(false);

            int tot = getTotTests();
            if (tot >= testAlertThreshold)
                lblTotTests.setForeground(Color.RED);
            else
                lblTotTests.setForeground(Color.BLACK);

            lblTotTests.setText(totTestsMessage + " " + tot);

        }
    });

    btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            lblMessage.setVisible(true);
            setModifyControlEnable(false);

        }
    });

    lblCommaSeparatedList = new JLabel("List:");
    lblCommaSeparatedList.setVisible(false);

    textFieldList = new JTextField();
    textFieldList.setVisible(false);
    textFieldList.setToolTipText("Comma separated");
    textFieldList.setColumns(10);
    textFieldList.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            /*if(textFieldList.isVisible())
            {
            boolean checkList=true;
                    
            while(checkList){
                    
               String dist=textFieldList.getText();
               boolean validateDist=dist.matches("(\\d)+|((\\d)+\\.(\\d)+)(,(\\d)+|((\\d)+\\.(\\d)+))*");
               if(!validateDist){   
                  String   newDist=  JOptionPane.showInputDialog(null,"Insert comma separate number list","Number Format Error", 0);
                  textFieldList.setText(newDist);
               }
                    
               else{
                  checkList=false;
               }
            }
            }*/
        }
    });

    lblDistribution = new JLabel("Distribution");
    lblDistribution.setVisible(false);

    lblA = new JLabel("a:");
    lblA.setVisible(false);

    textFieldA = new JTextField();
    textFieldA.setText("1");
    textFieldA.setVisible(false);
    textFieldA.setColumns(10);
    textFieldA.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";

            if (textFieldA.isVisible()) {
                boolean checkA = true;

                while (checkA) {

                    String dist = textFieldA.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldA.setText(newDist);
                    }

                    else {
                        checkA = false;
                    }
                }
            }
        }
    });

    lblB = new JLabel("b:");
    lblB.setVisible(false);

    textFieldB = new JTextField();
    textFieldB.setText("1");
    textFieldB.setVisible(false);
    textFieldB.setColumns(10);
    textFieldB.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {

            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldB.isVisible()) {
                boolean checkB = true;

                while (checkB) {

                    String dist = textFieldB.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldB.setText(newDist);
                    }

                    else {
                        checkB = false;
                    }
                }
            }
        }
    });
    jComboBoxDistribution = new JComboBox();
    jComboBoxDistribution.setVisible(false);
    jComboBoxDistribution.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            // Prevent executing listener's actions two times
            if (e.getStateChange() != ItemEvent.SELECTED)
                return;
            selectedDistribution = ((DistributionType) jComboBoxDistribution.getSelectedItem());

            setDistributionControlVisibility(DistributionType.none);
            setDistributionControlVisibility(selectedDistribution);

        }
    });

    lblOfValues = new JLabel("# of values:");
    lblOfValues.setVisible(false);

    textFieldNumberOfValues = new JTextField();
    textFieldNumberOfValues.setText("1");
    textFieldNumberOfValues.setVisible(false);
    textFieldNumberOfValues.setColumns(10);
    textFieldNumberOfValues.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            if (textFieldNumberOfValues.isVisible()) {
                boolean checkNumberOfValues = true;

                while (checkNumberOfValues) {

                    String dist = textFieldNumberOfValues.getText();
                    boolean validateDist = dist.matches("(\\d)+");
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldNumberOfValues.setText(newDist);
                    }

                    else {
                        checkNumberOfValues = false;
                    }
                }
            }
        }
    });

    lblSuggested = new JLabel("Suggested Value:");

    lblDomain = new JLabel("Domain:");

    GroupLayout gl_panel_1 = new GroupLayout(panel_1);
    gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel_1
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel_1
                    .createSequentialGroup()
                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addComponent(lblParamType)
                            .addComponent(lblMessage).addComponent(lblSuggested))
                    .addContainerGap(77, Short.MAX_VALUE))
                    .addGroup(gl_panel_1.createSequentialGroup().addComponent(btnModify)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnCancel)
                            .addContainerGap())
                    .addGroup(gl_panel_1.createSequentialGroup().addGroup(gl_panel_1
                            .createParallelGroup(Alignment.LEADING).addComponent(lblParameterSpace)
                            .addGroup(gl_panel_1.createSequentialGroup()
                                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                            .addComponent(rdbtnFixed).addComponent(rdbtnRange))
                                    .addGap(31)
                                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                            .addComponent(rdbtnByDistribution).addComponent(rdbtnByvalues)))
                            .addGroup(gl_panel_1.createSequentialGroup().addGroup(gl_panel_1
                                    .createParallelGroup(Alignment.TRAILING)
                                    .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblValue)
                                            .addPreferredGap(ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
                                            .addComponent(textFieldValue, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(Alignment.LEADING,
                                            gl_panel_1.createSequentialGroup().addComponent(lblStartValue)
                                                    .addPreferredGap(ComponentPlacement.RELATED, 46,
                                                            Short.MAX_VALUE)
                                                    .addComponent(textFieldStartValue,
                                                            GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_panel_1.createSequentialGroup()
                                            .addComponent(lblCommaSeparatedList)
                                            .addPreferredGap(ComponentPlacement.RELATED, 69, Short.MAX_VALUE)
                                            .addComponent(textFieldList, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_panel_1.createSequentialGroup()
                                            .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                                    .addComponent(lblEndValue).addComponent(lblIncrement)
                                                    .addComponent(lblDistribution))
                                            .addGap(45)
                                            .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING)
                                                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                                            .addGroup(gl_panel_1
                                                                    .createParallelGroup(Alignment.LEADING,
                                                                            false)
                                                                    .addComponent(jComboBoxDistribution, 0,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            Short.MAX_VALUE)
                                                                    .addComponent(textFieldA,
                                                                            GroupLayout.PREFERRED_SIZE,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            GroupLayout.PREFERRED_SIZE)
                                                                    .addComponent(textFieldB,
                                                                            GroupLayout.PREFERRED_SIZE,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            GroupLayout.PREFERRED_SIZE)
                                                                    .addComponent(textFieldNumberOfValues,
                                                                            GroupLayout.PREFERRED_SIZE,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            GroupLayout.PREFERRED_SIZE))
                                                            .addComponent(textFieldIncrement, 89, 89, 89))
                                                    .addComponent(textFieldEndValue, GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE))))
                                    .addPreferredGap(ComponentPlacement.RELATED, 8, GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblA).addPreferredGap(
                                    ComponentPlacement.RELATED, 173, GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblB).addPreferredGap(
                                    ComponentPlacement.RELATED, 173, GroupLayout.PREFERRED_SIZE))
                            .addComponent(lblOfValues)
                            .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblRuns)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(textFieldRuns, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED, 65,
                                            GroupLayout.PREFERRED_SIZE)))
                            .addGap(35))
                    .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblDomain).addContainerGap(186,
                            Short.MAX_VALUE)))));
    gl_panel_1.setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_1
            .createSequentialGroup().addGap(4).addComponent(lblMessage).addGap(18).addComponent(lblParamType)
            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblSuggested)
            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblDomain).addGap(7)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblRuns).addComponent(
                    textFieldRuns, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                    GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblParameterSpace)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(rdbtnFixed)
                    .addComponent(rdbtnByvalues))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(rdbtnRange)
                    .addComponent(rdbtnByDistribution))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textFieldValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblValue))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textFieldList, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCommaSeparatedList))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblStartValue)
                    .addComponent(textFieldStartValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblEndValue).addComponent(
                    textFieldEndValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                    GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textFieldIncrement, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblIncrement))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jComboBoxDistribution, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDistribution))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1
                    .createParallelGroup(Alignment.BASELINE).addComponent(lblA).addComponent(textFieldA,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1
                    .createParallelGroup(Alignment.BASELINE).addComponent(lblB).addComponent(textFieldB,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblOfValues).addComponent(
                    textFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                    GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED, 18, Short.MAX_VALUE).addGroup(gl_panel_1
                    .createParallelGroup(Alignment.BASELINE).addComponent(btnModify).addComponent(btnCancel))));
    panel_1.setLayout(gl_panel_1);
    panel.setLayout(gl_panel);

    setModifyControlEnable(false);
    loadDistribution();
}

From source file:com.openbravo.pos.util.JRViewer411.java

protected void createHyperlinks(List<JRPrintElement> elements, int offsetX, int offsetY) {
    if (elements != null && elements.size() > 0) {
        for (Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();) {
            JRPrintElement element = it.next();

            JRImageMapRenderer imageMap = null;
            if (element instanceof JRPrintImage) {
                JRRenderable renderer = ((JRPrintImage) element).getRenderer();
                if (renderer instanceof JRImageMapRenderer) {
                    imageMap = (JRImageMapRenderer) renderer;
                    if (!imageMap.hasImageAreaHyperlinks()) {
                        imageMap = null;
                    }/*from   w  ww. j  a  va 2 s  . co m*/
                }
            }
            boolean hasImageMap = imageMap != null;

            JRPrintHyperlink hyperlink = null;
            if (element instanceof JRPrintHyperlink) {
                hyperlink = (JRPrintHyperlink) element;
            }
            boolean hasHyperlink = !hasImageMap && hyperlink != null
                    && hyperlink.getHyperlinkTypeValue() != HyperlinkTypeEnum.NONE;
            boolean hasTooltip = hyperlink != null && hyperlink.getHyperlinkTooltip() != null;

            if (hasHyperlink || hasImageMap || hasTooltip) {
                JPanel link;
                if (hasImageMap) {
                    Rectangle renderingArea = new Rectangle(0, 0, element.getWidth(), element.getHeight());
                    link = new ImageMapPanel(renderingArea, imageMap);
                } else //hasImageMap
                {
                    link = new JPanel();
                    if (hasHyperlink) {
                        link.addMouseListener(mouseListener);
                    }
                }

                if (hasHyperlink) {
                    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
                }

                link.setLocation((int) ((element.getX() + offsetX) * realZoom),
                        (int) ((element.getY() + offsetY) * realZoom));
                link.setSize((int) (element.getWidth() * realZoom), (int) (element.getHeight() * realZoom));
                link.setOpaque(false);

                String toolTip = getHyperlinkTooltip(hyperlink);
                if (toolTip == null && hasImageMap) {
                    toolTip = "";//not null to register the panel as having a tool tip
                }
                link.setToolTipText(toolTip);

                pnlLinks.add(link);
                linksMap.put(link, hyperlink);
            }

            if (element instanceof JRPrintFrame) {
                JRPrintFrame frame = (JRPrintFrame) element;
                int frameOffsetX = offsetX + frame.getX() + frame.getLineBox().getLeftPadding().intValue();
                int frameOffsetY = offsetY + frame.getY() + frame.getLineBox().getTopPadding().intValue();
                createHyperlinks(frame.getElements(), frameOffsetX, frameOffsetY);
            }
        }
    }
}

From source file:neg.JRViewer.java

protected void createHyperlinks(List elements, int offsetX, int offsetY) {
    if (elements != null && elements.size() > 0) {
        for (Iterator it = elements.iterator(); it.hasNext();) {
            JRPrintElement element = (JRPrintElement) it.next();

            JRImageMapRenderer imageMap = null;
            if (element instanceof JRPrintImage) {
                JRRenderable renderer = ((JRPrintImage) element).getRenderer();
                if (renderer instanceof JRImageMapRenderer) {
                    imageMap = (JRImageMapRenderer) renderer;
                    if (!imageMap.hasImageAreaHyperlinks()) {
                        imageMap = null;
                    }/* ww w . jav  a  2 s .  c  om*/
                }
            }
            boolean hasImageMap = imageMap != null;

            JRPrintHyperlink hyperlink = null;
            if (element instanceof JRPrintHyperlink) {
                hyperlink = (JRPrintHyperlink) element;
            }
            boolean hasHyperlink = !hasImageMap && hyperlink != null
                    && hyperlink.getHyperlinkType() != JRHyperlink.HYPERLINK_TYPE_NONE;
            boolean hasTooltip = hyperlink != null && hyperlink.getHyperlinkTooltip() != null;

            if (hasHyperlink || hasImageMap || hasTooltip) {
                JPanel link;
                if (hasImageMap) {
                    Rectangle renderingArea = new Rectangle(0, 0, element.getWidth(), element.getHeight());
                    link = new ImageMapPanel(renderingArea, imageMap);
                } else //hasImageMap
                {
                    link = new JPanel();
                    if (hasHyperlink) {
                        link.addMouseListener(mouseListener);
                    }
                }

                if (hasHyperlink) {
                    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
                }

                link.setLocation((int) ((element.getX() + offsetX) * realZoom),
                        (int) ((element.getY() + offsetY) * realZoom));
                link.setSize((int) (element.getWidth() * realZoom), (int) (element.getHeight() * realZoom));
                link.setOpaque(false);

                String toolTip = getHyperlinkTooltip(hyperlink);
                if (toolTip == null && hasImageMap) {
                    toolTip = "";//not null to register the panel as having a tool tip
                }
                link.setToolTipText(toolTip);

                pnlLinks.add(link);
                linksMap.put(link, element);
            }

            if (element instanceof JRPrintFrame) {
                JRPrintFrame frame = (JRPrintFrame) element;
                int frameOffsetX = offsetX + frame.getX() + frame.getLineBox().getLeftPadding().intValue();
                int frameOffsetY = offsetY + frame.getY() + frame.getLineBox().getTopPadding().intValue();
                createHyperlinks(frame.getElements(), frameOffsetX, frameOffsetY);
            }
        }
    }
}

From source file:cn.pholance.datamanager.common.components.JRViewer.java

protected void createHyperlinks(List<JRPrintElement> elements, int offsetX, int offsetY) {
    if (elements != null && elements.size() > 0) {
        for (Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();) {
            JRPrintElement element = it.next();

            ImageMapRenderable imageMap = null;
            if (element instanceof JRPrintImage) {
                Renderable renderer = ((JRPrintImage) element).getRenderable();
                if (renderer instanceof ImageMapRenderable) {
                    imageMap = (ImageMapRenderable) renderer;
                    if (!imageMap.hasImageAreaHyperlinks()) {
                        imageMap = null;
                    }//from w  w  w.  j a  v a 2  s.  c  o m
                }
            }
            boolean hasImageMap = imageMap != null;

            JRPrintHyperlink hyperlink = null;
            if (element instanceof JRPrintHyperlink) {
                hyperlink = (JRPrintHyperlink) element;
            }
            boolean hasHyperlink = !hasImageMap && hyperlink != null
                    && hyperlink.getHyperlinkTypeValue() != HyperlinkTypeEnum.NONE;
            boolean hasTooltip = hyperlink != null && hyperlink.getHyperlinkTooltip() != null;

            if (hasHyperlink || hasImageMap || hasTooltip) {
                JPanel link;
                if (hasImageMap) {
                    Rectangle renderingArea = new Rectangle(0, 0, element.getWidth(), element.getHeight());
                    link = new ImageMapPanel(renderingArea, imageMap);
                } else //hasImageMap
                {
                    link = new JPanel();
                    if (hasHyperlink) {
                        link.addMouseListener(mouseListener);
                    }
                }

                if (hasHyperlink) {
                    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
                }

                link.setLocation((int) ((element.getX() + offsetX) * realZoom),
                        (int) ((element.getY() + offsetY) * realZoom));
                link.setSize((int) (element.getWidth() * realZoom), (int) (element.getHeight() * realZoom));
                link.setOpaque(false);

                String toolTip = getHyperlinkTooltip(hyperlink);
                if (toolTip == null && hasImageMap) {
                    toolTip = "";//not null to register the panel as having a tool tip
                }
                link.setToolTipText(toolTip);

                pnlLinks.add(link);
                linksMap.put(link, hyperlink);
            }

            if (element instanceof JRPrintFrame) {
                JRPrintFrame frame = (JRPrintFrame) element;
                int frameOffsetX = offsetX + frame.getX() + frame.getLineBox().getLeftPadding().intValue();
                int frameOffsetY = offsetY + frame.getY() + frame.getLineBox().getTopPadding().intValue();
                createHyperlinks(frame.getElements(), frameOffsetX, frameOffsetY);
            }
        }
    }
}

From source file:shuffle.fwk.service.roster.EditRosterService.java

private Component makeUpperPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;//from   w  ww. j  av a 2  s .  com
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel typePanel = new JPanel();
    typePanel.add(new JLabel(getString(KEY_TYPE)));
    typeChooser = new TypeChooser(true);
    typePanel.add(typeChooser);
    typePanel.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    typeChooser.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    ret.add(typePanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel levelPanel = new JPanel();
    levelPanel.add(new JLabel(getString(KEY_LEVEL)));
    SpinnerNumberModel snm = new SpinnerNumberModel(0, 0, Species.MAX_LEVEL, 1);
    levelSpinner = new JSpinner(snm);
    levelPanel.add(levelSpinner);
    levelPanel.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    levelSpinner.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    JButton applyAllButton = new JButton(getString(KEY_SET_FOR_ALL));
    applyAllButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            applyLevelToAll();
        }
    });
    applyAllButton.setToolTipText(getString(KEY_SET_FOR_ALL_TOOLTIP));
    levelPanel.add(applyAllButton);
    ret.add(levelPanel, c);

    c.gridx += 1;
    c.weightx = 1.0;
    JPanel stringPanel = new JPanel(new GridBagLayout());
    GridBagConstraints sc = new GridBagConstraints();
    sc.fill = GridBagConstraints.HORIZONTAL;
    sc.gridx = 1;
    stringPanel.add(new JLabel(getString(KEY_NAME)), sc);
    textField = new JTextField();
    sc.gridx += 1;
    sc.weightx = 1.0;
    sc.insets = new Insets(0, 5, 0, 5);
    stringPanel.add(textField, sc);
    stringPanel.setToolTipText(getString(KEY_NAME_TOOLTIP));
    textField.setToolTipText(getString(KEY_NAME_TOOLTIP));
    ret.add(stringPanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    megaFilter = new JCheckBox(getString(KEY_MEGA_FILTER));
    megaFilter.setToolTipText(getString(KEY_MEGA_FILTER_TOOLTIP));
    ret.add(megaFilter, c);

    c.gridx += 1;
    c.weightx = 0.0;
    effectFilter = new EffectChooser(false, EffectChooser.DefaultEntry.NO_FILTER);
    effectFilter.setToolTipText(getString(KEY_EFFECT_FILTER_TOOLTIP));
    ret.add(effectFilter, c);

    getMinUpperPanel = new Supplier<Dimension>() {

        @Override
        public Dimension get() {
            Dimension ret = new Dimension(10 + 50, 0);
            for (Component c : new Component[] { typePanel, levelPanel, stringPanel, megaFilter,
                    effectFilter }) {
                Dimension temp = c.getPreferredSize();
                int width = temp.width + ret.width;
                int height = Math.max(temp.height, ret.height);
                ret.setSize(width, height);
            }
            return ret;
        }
    };

    return ret;
}

From source file:shuffle.fwk.service.roster.EditRosterService.java

private Component makeBottomPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.insets = new Insets(0, 10, 0, 10);
    c.weightx = 1.0;/*from  w  ww. ja v a  2 s.co m*/
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx++;
    selectedDisplayLabel = new JLabel(getString(KEY_NONE_SELECTED));
    selectedDisplayLabel.setToolTipText(getString(KEY_SELECTED_TOOLTIP));
    ;
    ret.add(selectedDisplayLabel, c);
    c.insets = new Insets(0, 0, 0, 0);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 1.0;
    c.gridx++;
    teamFilter = new JCheckBox(getString(KEY_TEAM));
    JPanel teamFilterPanel = new JPanel(new BorderLayout());
    teamFilterPanel.add(teamFilter, BorderLayout.WEST);
    teamFilter.setToolTipText(getString(KEY_TEAM_TOOLTIP));
    ret.add(teamFilterPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    activeEffect = new EffectChooser(false, EffectChooser.DefaultEntry.SPECIES);
    JPanel activeEffectPanel = new JPanel(new BorderLayout());
    activeEffectPanel.add(activeEffect, BorderLayout.WEST);
    activeEffect.setToolTipText(getString(KEY_ACTIVE_EFFECT));
    ret.add(activeEffectPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JPanel skillPanel = new JPanel(new BorderLayout());
    ImageIcon skillBoosterIcon = getUser().getImageManager().getImageFor(KEY_SKILL_BOOSTER);
    JLabel skillBoosterLabel = new JLabel(skillBoosterIcon);
    skillPanel.add(skillBoosterLabel, BorderLayout.EAST);
    skillLevels = new JComboBox<Integer>();
    skillLevels.setEnabled(false);
    skillLevels.addItem(1);
    skillPanel.add(skillLevels, BorderLayout.WEST);
    skillPanel.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP));
    skillLevels.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP));
    ret.add(skillPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JPanel speedupPanel = new JPanel(new BorderLayout());
    ImageIcon candyIcon = getUser().getImageManager().getImageFor(KEY_CANDY_ICON);
    JLabel candyLabel = new JLabel(candyIcon);
    speedupPanel.add(candyLabel, BorderLayout.EAST);
    speedups = new JComboBox<Integer>();
    speedups.setEnabled(false);
    speedups.addItem(0);
    speedupPanel.add(speedups, BorderLayout.WEST);
    speedupPanel.setToolTipText(getString(KEY_CANDY_TOOLTIP));
    speedups.setToolTipText(getString(KEY_CANDY_TOOLTIP));
    ret.add(speedupPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JButton okButton = new JButton(getString(KEY_OK));
    okButton.setToolTipText(getString(KEY_OK_TOOLTIP));
    ret.add(okButton, c);
    setDefaultButton(okButton);

    c.anchor = GridBagConstraints.CENTER;
    c.weightx = 0.0;
    c.gridx++;
    JButton applyButton = new JButton(getString(KEY_APPLY));
    applyButton.setToolTipText(getString(KEY_APPLY_TOOLTIP));
    ret.add(applyButton, c);

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx++;
    JButton cancelButton = new JButton(new DisposeAction(getString(KEY_CANCEL), this));
    cancelButton.setToolTipText(getString(KEY_CANCEL_TOOLTIP));
    ret.add(cancelButton, c);

    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onOK();
        }
    });
    applyButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onApply();
        }
    });
    addSpeedupsListener();
    return ret;
}