Example usage for javax.swing JPanel setBounds

List of usage examples for javax.swing JPanel setBounds

Introduction

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

Prototype

public void setBounds(int x, int y, int width, int height) 

Source Link

Document

Moves and resizes this component.

Usage

From source file:com.fratello.longevity.smooth.AppGUI.java

private void initialize() {
    LabelMaxSize = 0;/*  www.jav a  2  s.  com*/

    ActiveGUI = true;
    GUI_Start = false;
    GUI_Pause = true;
    GUI_Stop = false;
    ran_at_least_once = false;

    execute();

    initializeFields();

    frmFileSystemSearch = new JFrame();
    frmFileSystemSearch.setTitle("Smooth Longevity Fratello");
    frmFileSystemSearch.setBounds(100, 100, 450, 300);
    frmFileSystemSearch.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmFileSystemSearch.setResizable(false);

    UIManager.put("PopupMenu.border", BorderFactory.createLineBorder(Color.black, 1));

    JMenuBar menuBar = new JMenuBar();
    frmFileSystemSearch.setJMenuBar(menuBar);

    JMenu mnNewMenu = new JMenu("File");
    menuBar.add(mnNewMenu);

    JMenuItem mntmFirst = new JMenuItem("Open Directory");
    mntmFirst.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openFileChooserDir(mntmFirst);
        }
    });
    mnNewMenu.add(mntmFirst);

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            frmFileSystemSearch.dispose();
        }
    });
    mnNewMenu.add(mntmExit);

    JMenu mnHelp = new JMenu("Help");
    menuBar.add(mnHelp);

    JMenuItem mntmAbout = new JMenuItem("About");
    mnHelp.add(mntmAbout);

    JMenuItem mntmTutorials = new JMenuItem("Tutorials");
    mnHelp.add(mntmTutorials);

    JMenuItem mntmCheckForUpdates = new JMenuItem("Check for Updates");
    mnHelp.add(mntmCheckForUpdates);

    String ppallink = "https://www.paypal.com/cgi-bin/webscr" + "?cmd=" + "_donations" + "&business="
            + "8YUJNSN6KFV54" + "&lc=" + "US" + "&item_name="
            + "Personal%20funds%20for%20programming%20at%20university" + "&currency_code=" + "USD" + "&bn="
            + "PP%2dDonationsBF" + "%3abtn_donateCC_LG%2egif%3aNonHosted";

    JButton btnDonate = new JButton("Donate");
    btnDonate.setToolTipText("<html>Open default Internet browser <br>(Chrome, FireFox, etc.)</html>");
    btnDonate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    btnDonate.setBounds(159, 176, 90, 25);
    menuBar.add(btnDonate);

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

    // ---------------------------- JPanels ------------------------------
    JPanel panel = new JPanel();
    tabbedPane.addTab("Start Directory", null, panel, null);

    JPanel panel_1 = new JPanel();
    tabbedPane.addTab("Search Setup", null, panel_1, null);
    panel_1.setLayout(null);

    JPanel panel_2 = new JPanel();
    tabbedPane.addTab("Run Program", null, panel_2, null);
    panel_2.setLayout(null);

    JPanel panel_3 = new JPanel();
    tabbedPane.addTab("Information", null, panel_3, null);
    panel_3.setBounds(10, 11, 409, 154);
    GridBagLayout gbl_panel_3 = new GridBagLayout();
    gbl_panel_3.columnWidths = new int[] { 0, 0, 0 };
    gbl_panel_3.rowHeights = new int[] { 0, 0, 0 };
    gbl_panel_3.columnWeights = new double[] { 1.0, 1.0, 1.0 };
    gbl_panel_3.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    panel_3.setLayout(gbl_panel_3);

    // ------------- Dynamic Update - Swingworker Components -------------
    SentinelProgressBar = new JProgressBar();
    SentinelProgressBar.setMaximumSize(new Dimension(146, 14));
    SentinelProgressBar.setMaximum(1000);
    SentinelProgressBar.setBounds(74, 187, 146, 14);
    panel_2.add(SentinelProgressBar);

    SentinelProgressLabel = new JLabel();
    SentinelProgressLabel.setToolTipText("Time needed to finish the program in progress");
    SentinelProgressLabel.setBounds(333, 181, 86, 20);
    panel_2.add(SentinelProgressLabel);

    // -------------------------------------------------------------------
    // ------------------------ JPanel Components ------------------------
    JLabel lblCurrentDirectory = new JLabel("Current Directory");
    panel.add(lblCurrentDirectory);

    userSelectedDirectories = new JTextField();
    panel.add(userSelectedDirectories);
    userSelectedDirectories.setColumns(35);

    JButton btnBrowse = new JButton("Browse");
    btnBrowse.setToolTipText("Locate directory in system");
    btnBrowse.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openFileChooserDir(btnBrowse);
        }
    });
    panel.add(btnBrowse);

    JButton btnClear = new JButton("Clear");
    btnClear.setToolTipText("Deletes the current directory shown");
    btnClear.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            userSelectedDirectories.setText("");
            clearSourceDirectory();
        }
    });
    panel.add(btnClear);

    // -------------------------------------------------------------------
    // ----------------------- JPanel_1 Components -----------------------

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Extension :: [Check Box]
    chckbxExt = new JCheckBox("Extension");
    chckbxExt.setToolTipText("Check to ignore file extensions");
    chckbxExt.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Ext", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Ext", false);
        }
    });
    chckbxExt.setBounds(8, 15, 97, 23);
    panel_1.add(chckbxExt);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Hash :: [Check Box]
    chckbxHash = new JCheckBox("Hash");
    chckbxHash.setToolTipText("Check to compare by hashing files (FAST)");
    chckbxHash.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Hash", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Hash", false);
        }
    });
    chckbxHash.setBounds(8, 45, 97, 23);
    panel_1.add(chckbxHash);

    // Hash :: [Combo Box]
    comboBoxHash = new JComboBox<String>();
    comboBoxHash.setToolTipText(
            "<html>Hash algorithm to use in file hashing <br>(note - SHA-512 may not be <br>supported by your computer)</html>");
    comboBoxHash.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            @SuppressWarnings("unchecked")
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            String UIselect = (String) cb.getSelectedItem();
            cf.setHashString(UIselect);
        }
    });
    comboBoxHash
            .setModel(new DefaultComboBoxModel<String>(new String[] { "MD5", "SHA-1", "SHA-256", "SHA-512" }));
    comboBoxHash.setBounds(150, 44, 75, 25);
    panel_1.add(comboBoxHash);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Name :: [Check Box]
    chckbxName = new JCheckBox("Name");
    chckbxName.setToolTipText("Name tool-tip goes here");
    chckbxName.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Name", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Name", false);
        }
    });
    chckbxName.setBounds(8, 75, 97, 23);
    panel_1.add(chckbxName);

    // Name :: [Text Field]
    namePercentMatchTextField = new JFormattedTextField(new Double(0.0d));
    namePercentMatchTextField.setFormatterFactory(new DoubleDocListener(namePercentMatchTextField));
    namePercentMatchTextField.getDocument()
            .addDocumentListener(new DoubleDocListener(namePercentMatchTextField));
    namePercentMatchTextField.setToolTipText("Match file names by percentage [00.00-100.00]");
    namePercentMatchTextField.setBounds(150, 74, 110, 25);
    panel_1.add(namePercentMatchTextField);
    namePercentMatchTextField.setColumns(10);

    // Name :: [Combo Box]
    comboBoxNames = new JComboBox<String>();
    comboBoxNames.setToolTipText("Algorithm to compare names");
    comboBoxNames.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            @SuppressWarnings("unchecked")
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            String UIselect = (String) cb.getSelectedItem();
            cf.setMatchingAlgorithm(UIselect);
        }
    });
    comboBoxNames.setModel(new DefaultComboBoxModel<String>(new String[] { "Bitap", "Cosine",
            "DamerauLevenshtein", "DynamicTimeWarpingStandard1", "DynamicTimeWarpingStandard2", "Hamming",
            "Hirschberg", "JaccardIndex", "JaroWinkler", "Levenshtein", "NeedlemanWunsch", "SmithWaterman",
            "SorensenSimilarityIndex", "WagnerFischer" }));
    comboBoxNames.setBounds(265, 74, 150, 25);
    panel_1.add(comboBoxNames);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Size :: [Check Box]
    chckbxSize = new JCheckBox("Size");
    chckbxSize.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Size", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Size", false);
        }
    });
    chckbxSize.setBounds(8, 105, 97, 23);
    panel_1.add(chckbxSize);

    // Size :: [Text Field]
    sizePercentMatchTextField = new JFormattedTextField(new Double(0.0d));
    sizePercentMatchTextField.setFormatterFactory(new DoubleDocListener(sizePercentMatchTextField));
    sizePercentMatchTextField.getDocument()
            .addDocumentListener(new DoubleDocListener(sizePercentMatchTextField));
    sizePercentMatchTextField.setToolTipText("Match file sizes by percentage [00.00-100.00]");
    sizePercentMatchTextField.setBounds(150, 104, 110, 25);
    panel_1.add(sizePercentMatchTextField);
    sizePercentMatchTextField.setColumns(10);

    // Size :: [Combo Box]
    comboBoxSize = new JComboBox<String>();
    comboBoxSize.setToolTipText("Specify byte grouping");
    comboBoxSize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            @SuppressWarnings("unchecked")
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            String UIselect = (String) cb.getSelectedItem();
            cf.setMetricSize(UIselect);
        }
    });
    comboBoxSize.setModel(
            new DefaultComboBoxModel<String>(new String[] { "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE" }));
    comboBoxSize.setBounds(265, 104, 150, 25);
    panel_1.add(comboBoxSize);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Thorough :: [Check Box]
    chckbxThorough = new JCheckBox("Thorough");
    chckbxThorough.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Thorough", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Thorough", false);
        }
    });
    chckbxThorough.setToolTipText("Check byte by byte");
    chckbxThorough.setBounds(8, 135, 97, 23);
    panel_1.add(chckbxThorough);

    // Thorough :: [Text Field]
    thoroughPercentMatchTextField = new JFormattedTextField(new Double(0.0d));
    thoroughPercentMatchTextField.setFormatterFactory(new DoubleDocListener(thoroughPercentMatchTextField));
    thoroughPercentMatchTextField.getDocument()
            .addDocumentListener(new DoubleDocListener(thoroughPercentMatchTextField));
    thoroughPercentMatchTextField.setToolTipText("Match file sizes by percentage [00.00-100.00]");
    thoroughPercentMatchTextField.setBounds(150, 134, 110, 25);
    panel_1.add(thoroughPercentMatchTextField);
    thoroughPercentMatchTextField.setColumns(10);

    // Thorough :: [Check Box]
    chckbxExitFast = new JCheckBox("Exit Fast");
    chckbxExitFast.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setThoroughExitFirstByteMisMatch(true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setThoroughExitFirstByteMisMatch(false);
        }
    });
    chckbxExitFast.setToolTipText("<html>When the first byte comparison <br>is a mis-match then stop</html>");
    chckbxExitFast.setBounds(265, 138, 105, 16);
    panel_1.add(chckbxExitFast);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    JButton btnSaveSearchSettings = new JButton("Save Search Settings");
    btnSaveSearchSettings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            pollSearchSettings();
            cf.saveObject();
            // System.out.println(cf.toString()); // debug
        }
    });
    btnSaveSearchSettings.setBounds(292, 181, 140, 25);
    panel_1.add(btnSaveSearchSettings);

    JButton btnLoadSettings = new JButton("Load Settings");
    btnLoadSettings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (!cf.loadObject())
                cf.setDefaultSettings();
            cacheUpdateGUISettings();
        }
    });
    btnLoadSettings.setBounds(148, 181, 140, 25);
    panel_1.add(btnLoadSettings);

    JButton btnDefaultSettings = new JButton("Use Default Settings");
    btnDefaultSettings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            cf.setDefaultSettings();
            cacheUpdateGUISettings();
        }
    });
    btnDefaultSettings.setBounds(4, 181, 140, 25);
    panel_1.add(btnDefaultSettings);

    // -------------------------------------------------------------------
    // ----------------------- JPanel_2 Components -----------------------
    JLabel labelStatus = new JLabel("Progress");
    labelStatus.setBounds(10, 187, 54, 14);
    panel_2.add(labelStatus);

    JButton btnStart = new JButton("Start");
    btnStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            pollSearchSettings();
            if (!ran_at_least_once)
                ran_at_least_once = true;
            else {
                SentinelProgressBar.setValue(0);
                SentinelProgressLabel.setText("Waiting...");
            }
            try {
                if (multiSelection == null) {
                    JOptionPane.showMessageDialog(btnStart, "Please enter at least one directory.",
                            "Press OK to continue", JOptionPane.PLAIN_MESSAGE);
                    return;
                }
                setSourceDirectory(multiSelection);
                GUI_Start = true;
            } catch (Exception err) {
                err.printStackTrace();
            }
        }
    });
    btnStart.setBounds(40, 153, 89, 23);
    panel_2.add(btnStart);

    JButton btnStop = new JButton("Stop");
    btnStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            GUI_Stop = true;
        }
    });
    btnStop.setBounds(169, 153, 89, 23);
    panel_2.add(btnStop);

    JButton btnNewButton = new JButton("Pause");
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            GUI_Pause = true;
        }
    });
    btnNewButton.setBounds(298, 153, 89, 23);
    panel_2.add(btnNewButton);

    JCheckBox chckbxDeleteDuplicateFiles = new JCheckBox("Delete duplicate files");
    chckbxDeleteDuplicateFiles.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            deleteCopyResults = true;
        }
    });
    chckbxDeleteDuplicateFiles.setBounds(230, 10, 150, 16);
    panel_2.add(chckbxDeleteDuplicateFiles);

    JCheckBox chckbxLogDuplicateFiles = new JCheckBox("Save duplicates to file");
    chckbxLogDuplicateFiles.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            saveCopyResults = true;
        }
    });
    chckbxLogDuplicateFiles.setBounds(230, 36, 150, 16);
    panel_2.add(chckbxLogDuplicateFiles);

    // -------------------------------------------------------------------
    // ----------------------- JPanel_3 Components -----------------------

    JLabel lblAbout = new JLabel("About");
    GridBagConstraints gbc_lblAbout = new GridBagConstraints();
    gbc_lblAbout.insets = new Insets(0, 0, 5, 5);
    gbc_lblAbout.gridx = 0;
    gbc_lblAbout.gridy = 0;
    panel_3.add(lblAbout, gbc_lblAbout);

    JLabel lblTutorials = new JLabel("Tutorials");
    GridBagConstraints gbc_lblTutorials = new GridBagConstraints();
    gbc_lblTutorials.insets = new Insets(0, 0, 5, 5);
    gbc_lblTutorials.gridx = 1;
    gbc_lblTutorials.gridy = 0;
    panel_3.add(lblTutorials, gbc_lblTutorials);

    JLabel lblUpdates = new JLabel("Updates");
    GridBagConstraints gbc_lblUpdates = new GridBagConstraints();
    gbc_lblUpdates.insets = new Insets(0, 0, 5, 0);
    gbc_lblUpdates.gridx = 2;
    gbc_lblUpdates.gridy = 0;
    panel_3.add(lblUpdates, gbc_lblUpdates);

    JButton btnInformation = new JButton("Information");
    btnInformation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    GridBagConstraints gbc_btnInformation = new GridBagConstraints();
    gbc_btnInformation.insets = new Insets(0, 0, 0, 5);
    gbc_btnInformation.gridx = 0;
    gbc_btnInformation.gridy = 1;
    panel_3.add(btnInformation, gbc_btnInformation);

    JButton btnExamples = new JButton("Examples");
    btnExamples.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    GridBagConstraints gbc_btnExamples = new GridBagConstraints();
    gbc_btnExamples.insets = new Insets(0, 0, 0, 5);
    gbc_btnExamples.gridx = 1;
    gbc_btnExamples.gridy = 1;
    panel_3.add(btnExamples, gbc_btnExamples);

    JButton btnCheckNow = new JButton("Check Now");
    btnCheckNow.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    GridBagConstraints gbc_btnCheckNow = new GridBagConstraints();
    gbc_btnCheckNow.gridx = 2;
    gbc_btnCheckNow.gridy = 1;
    panel_3.add(btnCheckNow, gbc_btnCheckNow);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            type = WATER;

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

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

            type = MILK;

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

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

            type = ORANGE;

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

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

            type = LEMONADE;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    getContentPane().setLayout(groupLayout);
}

From source file:game.Clue.ClueGameUI.java

private void CreateBoard() {

    //resize and center frame to fit all components of game(board,scorecard,buttons,etc)
    this.setSize(1030, 670);
    Dimension dimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    int x = (int) ((dimension.getWidth() - this.getWidth()) / 2);
    int y = (int) ((dimension.getHeight() - this.getHeight()) / 2);
    this.setLocation(x, y);

    NonCornerRoom NonCornerRoom_current;
    // Board gameBoard = new Board();
    ArrayList<String> RoomsAndHallways = new ArrayList<>(Arrays.asList("STUDY", "HALLWAY1", "HALL", "HALLWAY2",
            "LOUNGE", "HALLWAY3", "BLANK", "HALLWAY4", "BLANK", "HALLWAY5", "LIBRARY", "HALLWAY6",
            "BILLIARD ROOM", "HALLWAY7", "DINING ROOM", "HALLWAY8", "BLANK", "HALLWAY9", "BLANK", "HALLWAY10",
            "CONSERVATORY", "HALLWAY11", "BALL ROOM", "HALLWAY12", "KITCHEN"));
    ArrayList<String> RoomNames = new ArrayList<>(
            Arrays.asList("Hall", "Library", "BillardRoom", "BallRoom", "DiningRoom"));
    //RoomNames=["Hall","Library","BillardRoom","BallRoom","DiningRoom"];
    ArrayList<NonCornerRoom> NonCornerRooms = new ArrayList<>(Arrays.asList(new NonCornerRoom(""),
            new NonCornerRoom(""), new NonCornerRoom(""), new NonCornerRoom("")));
    for (int i = 0; i < 4; i++) {
        NonCornerRoom_current = NonCornerRooms.get(i);
        NonCornerRoom_current.setRoomName(RoomNames.get(i));
        System.out.println("jlayer=" + NonCornerRoom_current.getRoomName());

    }//from   w w  w .ja v a2  s  .co  m

    gameBoard = new JPanel();
    JPanel gameBoard_background = new JPanel();
    gameBoard_background.setLayout(new BorderLayout(1, 1));
    gameBoard_background.setPreferredSize(new Dimension(701, 590));
    gameBoard_background.setBounds(0, 0, 701, 590);
    jLayeredPane5.add(gameBoard, new Integer(1));
    gameBoard.setLayout(new GridLayout(5, 5));
    gameBoard.setOpaque(false);
    gameBoard.setPreferredSize(new Dimension(701, 590));
    gameBoard.setBounds(0, 0, 701, 590);
    Border roomBoarder = BorderFactory.createLineBorder(Color.white, 2);
    //draw rooms onto board
    for (int i = 0; i < 25; i++) {
        JPanel room_square = new JPanel(new BorderLayout());

        System.out.println(i);
        room_square.setName(RoomsAndHallways.get(i));

        System.out.println(RoomsAndHallways.get(i));
        gameBoard.add(room_square);

        int row = (i / 12) % 2;
        if (row == 0) {
            //room_square.setBackground(i % 2 == 0 ? Color.white : Color.gray);
            //room_square.setBorder(roomBoarder);
            room_square.setOpaque(false);

            //room_square.
            //room_square.add(new JLabel("Room# "+i));
        } else {
            //room_square.setBackground(i % 2 == 0 ? Color.gray : Color.white);
            //room_square.setBorder(roomBoarder);
            room_square.setOpaque(false);
            //room_square.add(new JLabel("Room# "+i));
        }

    }

    //add Players to board (use "for" statement later to reduce lines of code)
    ImageIcon player_icon = new ImageIcon(getClass().getResource("/resources/scarletphoto.png"),
            "MissScarlett");
    JPanel panel = (JPanel) gameBoard.getComponent(3); //MS SCARLET starting position
    player.setIcon(player_icon);
    player.setHorizontalAlignment(SwingConstants.CENTER);
    panel.add(player, SwingConstants.CENTER);

    ImageIcon player2_icon = new ImageIcon(getClass().getResource("/resources/mustardphoto.png"), "Mustard");
    JPanel panel2 = (JPanel) gameBoard.getComponent(9); //ColMustard starting position
    player2.setIcon(player2_icon);
    player2.setHorizontalAlignment(SwingConstants.CENTER);
    panel2.add(player2, SwingConstants.CENTER);
    //panel.add(player, SwingConstants.CENTER);

    ImageIcon player3_icon = new ImageIcon(getClass().getResource("/resources/plumphoto.png"), "ProfessorPlum");
    JPanel panel3 = (JPanel) gameBoard.getComponent(5); //Plum starting position
    player3.setIcon(player3_icon);
    player3.setHorizontalAlignment(SwingConstants.CENTER);
    panel3.add(player3, SwingConstants.CENTER);

    ImageIcon player4_icon = new ImageIcon(getClass().getResource("/resources/peacockphoto.png"), "MsPeacock");
    JPanel panel4 = (JPanel) gameBoard.getComponent(15); //Peacock starting position
    player4.setIcon(player4_icon);
    player4.setHorizontalAlignment(SwingConstants.CENTER);
    panel4.add(player4, SwingConstants.CENTER);

    ImageIcon player5_icon = new ImageIcon(getClass().getResource("/resources/greenphoto.png"), "Mr.Green");
    JPanel panel5 = (JPanel) gameBoard.getComponent(21); //MrGreen starting position
    player5.setIcon(player5_icon);
    player5.setHorizontalAlignment(SwingConstants.CENTER);
    panel5.add(player5, SwingConstants.CENTER);

    ImageIcon player6_icon = new ImageIcon(getClass().getResource("/resources/whitephoto.png"), "Ms.White");
    JPanel panel6 = (JPanel) gameBoard.getComponent(23); //MsWhite starting position
    player6.setIcon(player6_icon);
    player6.setHorizontalAlignment(SwingConstants.CENTER);
    panel6.add(player6, SwingConstants.CENTER);

    ImageIcon room_icon = new ImageIcon(getClass().getResource("/resources/newgamebackground-6.png"));
    JLabel room_icon_label = new JLabel();
    room_icon_label.setIcon(room_icon);

    gameBoard_background.add(room_icon_label);

    jLayeredPane5.add(gameBoard_background, new Integer(0));
    gameBoard_background.setVisible(true);
    room_icon_label.setVisible(true);
    //jLayeredPane5.add(room_icon_label,JLayeredPane.DRAG_LAYER);
    //jLayeredPane5.moveToFront(room_icon_label);

    //jPanel5.add(jLayeredPane1);
    //jPanel5.repaint();
    //jPanel5.setVisible(true);
    //System.out.println("JToggleButton2 Action Performed");
    packageGameState();

    //jPanel3.add(gameBoard, "card4");
}

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)/* ww w  .  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:beproject.MainGUI.java

void createTagCloud() throws SQLException {
    TreeMap tmp = getFrequentWords();
    Cloud cld = new Cloud();
    JPanel tmpPanel = new JPanel();
    FlowLayout t1 = new FlowLayout();
    tmpPanel.setPreferredSize(new Dimension(512, 512));
    tmpPanel.setLayout(t1);/* w  w  w  .  j  a  va 2s.c  om*/
    tmpPanel.setBounds(0, 0, 512, 512);
    //FlowLayout lm=(FlowLayout) tmpPanel.getLayout();
    for (int i = 0; i < 40 && !tmp.isEmpty(); i++) {
        Map.Entry mp = tmp.pollFirstEntry();
        Tag t = new Tag((String) mp.getKey(), (int) (mp.getValue()));
        cld.addTag(t);
    }
    Random rand = new Random();
    for (Tag tag : cld.tags()) {
        final JLabel label = new JLabel(tag.getName());
        label.setOpaque(false);
        label.setFont(label.getFont().deriveFont(rand.nextFloat() * 39));
        label.setForeground(new Color(rand.nextInt()));
        tmpPanel.add(label);
    }
    if (tagCloudPanel == null) {
        tagCloudPanel = new JScrollPane(tmpPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    } else {
        jPanel3.remove(tagCloudPanel);
        jPanel3.validate();
        tagCloudPanel = new JScrollPane(tmpPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    }
    //tagCloudPanel.setLayout(new ScrollPaneLayout());
    //tagCloudPanel.setAutoscrolls(true);
    tmpPanel.validate();
    tagCloudPanel.validate();
    jPanel3.add(tagCloudPanel, BorderLayout.CENTER);
    jPanel3.validate();

}

From source file:es.ubu.XRayDetector.interfaz.PanelAplicacion.java

/**
 * Gets the image panel./*w  ww .j a v  a2  s  .  co  m*/
 * 
 * @return the image panel.
 */
private JPanel getPanelImagen() {
    JPanel panelImagen = new JPanel();
    panelImagen.setBorder(new TitledBorder(null, "Visor", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelImagen.setBounds(282, 11, 750, 550);
    frmXraydetector.getContentPane().add(panelImagen);
    panelImagen.setLayout(new GridLayout(1, 0, 0, 0));
    return panelImagen;
}

From source file:es.ubu.XRayDetector.interfaz.PanelAplicacion.java

/**
 * Gets the control panel./*  w w w .jav a 2s. c o m*/
 * 
 * @return the control panel.
 */
private JPanel getPanelControl() {
    JPanel panelControl = new JPanel();
    panelControl
            .setBorder(new TitledBorder(null, "Control", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelControl.setBounds(10, 11, 262, 125);
    frmXraydetector.getContentPane().add(panelControl);
    panelControl.setLayout(new GridLayout(0, 1, 0, 4));
    return panelControl;
}

From source file:es.ubu.XRayDetector.interfaz.PanelAplicacion.java

/**
 * Gets the slider panel.//from   ww  w.j a v  a2 s .  c o m
 * 
 * @return the slider panel
 */
public JPanel getPanelSlider() {
    JPanel panelSlider = new JPanel();
    panelSlider.setBorder(
            new TitledBorder(null, "Nivel de tolerancia", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelSlider.setBounds(10, 218, 262, 73);
    frmXraydetector.getContentPane().add(panelSlider);
    panelSlider.setLayout(new GridLayout(1, 1, 0, 0));
    return panelSlider;
}

From source file:es.ubu.XRayDetector.interfaz.PanelAplicacion.java

/**
 * Gets the analyze results./*  w  w  w . j a v  a 2s  . c  om*/
 * 
 * @return The panel results.
 */
public JPanel getPanelAnalizarResultados() {
    JPanel panelAnalizarResultados = new JPanel();
    panelAnalizarResultados.setBorder(
            new TitledBorder(null, "Analizar resultados", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelAnalizarResultados.setBounds(10, 302, 262, 112);
    panelAnalizarResultados.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
    frmXraydetector.getContentPane().add(panelAnalizarResultados);
    return panelAnalizarResultados;
}

From source file:Clavis.Windows.WShedule.java

public synchronized void create() {
    initComponents();/*w w w .  j  a va  2  s.  c  om*/
    this.setModal(true);
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            close();
        }
    });
    this.setTitle(lingua.translate("Registos de emprstimo para o recurso") + ": "
            + lingua.translate(mat.getTypeOfMaterialName()).toLowerCase() + " "
            + lingua.translate(mat.getDescription()));
    KeyQuest.addtoPropertyListener(jPanelInicial, true);
    String dat = new TimeDate.Date().toString();
    String[] auxiliar = prefs.get("datainicio", dat).split("/");
    if (auxiliar[0].length() > 1) {
        if (auxiliar[0].charAt(0) == '0') {
            auxiliar[0] = auxiliar[0].replaceFirst("0", "");
        }
    }
    if (auxiliar[1].length() > 1) {
        if (auxiliar[1].charAt(0) == '0') {
            auxiliar[1] = auxiliar[1].replaceFirst("0", "");
        }
    }
    if (auxiliar[2].length() > 1) {
        if (auxiliar[2].charAt(0) == '0') {
            auxiliar[2] = auxiliar[2].replaceFirst("0", "");
        }
    }
    inicio = new TimeDate.Date(Integer.valueOf(auxiliar[0]), Integer.valueOf(auxiliar[1]),
            Integer.valueOf(auxiliar[2]));
    auxiliar = prefs.get("datafim", dat).split("/");
    if (auxiliar[0].length() > 1) {
        if (auxiliar[0].charAt(0) == '0') {
            auxiliar[0] = auxiliar[0].replaceFirst("0", "");
        }
    }
    if (auxiliar[1].length() > 1) {
        if (auxiliar[1].charAt(0) == '0') {
            auxiliar[1] = auxiliar[1].replaceFirst("0", "");
        }
    }
    if (auxiliar[2].length() > 1) {
        if (auxiliar[2].charAt(0) == '0') {
            auxiliar[2] = auxiliar[2].replaceFirst("0", "");
        }
    }
    fim = new TimeDate.Date(Integer.valueOf(auxiliar[0]), Integer.valueOf(auxiliar[1]),
            Integer.valueOf(auxiliar[2]));

    SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
    Date date;
    try {
        date = sdf.parse(fim.toString());
    } catch (ParseException ex) {
        date = new Date();

    }
    jXDatePickerFim.setDate(date);
    try {
        date = sdf.parse(inicio.toString());
    } catch (ParseException ex) {
        date = new Date();
    }
    jXDatePickerInicio.setDate(date);
    andamento = 0;
    if (DataBase.DataBase.testConnection(url)) {
        DataBase.DataBase db = new DataBase.DataBase(url);
        java.util.List<Keys.Request> requisicoes = Clavis.RequestList
                .simplifyRequests(db.getRequestsByMaterialByDateInterval(mat, inicio, fim));
        db.close();
        estado = lingua.translate("Todos");
        DefaultTableModel modelo = (DefaultTableModel) jTable1.getModel();
        if (requisicoes.size() > 0) {
            valores = new String[requisicoes.size()][4];
            lista = new java.util.ArrayList<>();
            requisicoes.stream().map((req) -> {
                if (mat.getMaterialTypeID() == 1) {
                    valores[andamento][0] = req.getPerson().getName();
                    valores[andamento][1] = req.getTimeBegin().toString(0) + " - "
                            + req.getTimeEnd().toString(0);
                    valores[andamento][2] = req.getBeginDate().toString();
                    String[] multipla = req.getActivity().split(":::");
                    if (multipla.length > 1) {
                        Components.PopUpMenu pop = new Components.PopUpMenu(multipla, lingua);
                        pop.create();
                        jTable1.addMouseListener(new MouseAdapter() {
                            int x = andamento;
                            int y = 3;

                            @Override
                            public void mousePressed(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    int row = jTable1.rowAtPoint(e.getPoint());
                                    int col = jTable1.columnAtPoint(e.getPoint());
                                    if ((row == x) && (col == y)) {
                                        pop.show(e.getComponent(), e.getX(), e.getY());
                                    }
                                }
                            }

                            @Override
                            public void mouseReleased(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    if (pop.isShowing()) {
                                        pop.setVisible(false);
                                    }
                                }
                            }
                        });
                        valores[andamento][3] = lingua.translate(multipla[0]) + "";
                    } else {
                        valores[andamento][3] = lingua.translate(req.getActivity());
                    }
                    if (valores[andamento][3].equals("")) {
                        valores[andamento][3] = lingua.translate("Sem descrio");
                    }
                    Object[] ob = { req.getPerson().getName(),
                            req.getTimeBegin().toString(0) + " - " + req.getTimeEnd().toString(0),
                            req.getBeginDate().toString(), valores[andamento][3], req.getSubject().getName() };
                    modelo.addRow(ob);
                } else {
                    valores[andamento][0] = req.getPerson().getName();
                    valores[andamento][1] = req.getBeginDate().toString();
                    valores[andamento][2] = req.getEndDate().toString();
                    String[] multipla = req.getActivity().split(":::");
                    if (multipla.length > 1) {
                        Components.PopUpMenu pop = new Components.PopUpMenu(multipla, lingua);
                        pop.create();
                        jTable1.addMouseListener(new MouseAdapter() {
                            int x = andamento;
                            int y = 3;

                            @Override
                            public void mousePressed(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    int row = jTable1.rowAtPoint(e.getPoint());
                                    int col = jTable1.columnAtPoint(e.getPoint());
                                    if ((row == x) && (col == y)) {
                                        pop.show(e.getComponent(), e.getX(), e.getY());
                                    }
                                }
                            }

                            @Override
                            public void mouseReleased(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    if (pop.isShowing()) {
                                        pop.setVisible(false);
                                    }
                                }
                            }
                        });
                        valores[andamento][3] = multipla[0];
                    } else {
                        valores[andamento][3] = lingua.translate(req.getActivity());
                    }
                    if (valores[andamento][3].equals("")) {
                        valores[andamento][3] = lingua.translate("Sem descrio");
                    }
                    Object[] ob = { req.getPerson().getName(), req.getBeginDate().toString(),
                            req.getEndDate().toString(), valores[andamento][3] };
                    modelo.addRow(ob);
                }
                return req;
            }).map((req) -> {
                lista.add(req);
                return req;
            }).forEach((_item) -> {
                andamento++;
            });
        }
    }
    jComboBoxEstado.setSelectedIndex(prefs.getInt("comboboxvalue", 0));
    String[] opcoes = { lingua.translate("Ver detalhes da requisio"),
            lingua.translate("Ver requisices com a mesma data"),
            lingua.translate("Ver requisices com o mesmo estado") };
    ActionListener[] eventos = new ActionListener[opcoes.length];
    eventos[0] = (ActionEvent r) -> {
        Border border = BorderFactory.createCompoundBorder(
                BorderFactory.createCompoundBorder(new org.jdesktop.swingx.border.DropShadowBorder(Color.BLACK,
                        3, 0.5f, 6, false, false, true, true), BorderFactory.createLineBorder(Color.BLACK, 1)),
                BorderFactory.createEmptyBorder(0, 10, 0, 10));
        int val = jTable1.getSelectedRow();
        Keys.Request req = lista.get(val);
        javax.swing.JPanel pan = new javax.swing.JPanel(null);
        pan.setPreferredSize(new Dimension(500, 300));
        pan.setBounds(0, 20, 500, 400);
        pan.setBackground(Components.MessagePane.BACKGROUND_COLOR);
        javax.swing.JLabel lrecurso1 = new javax.swing.JLabel(lingua.translate("Recurso") + ": ");
        lrecurso1.setBounds(10, 20, 120, 26);
        lrecurso1.setFocusable(true);
        lrecurso1.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso1);
        javax.swing.JLabel lrecurso11 = new javax.swing.JLabel(
                lingua.translate(req.getMaterial().getTypeOfMaterialName()) + " "
                        + lingua.translate(req.getMaterial().getDescription()));
        lrecurso11.setBounds(140, 20, 330, 26);
        lrecurso11.setBorder(border);
        pan.add(lrecurso11);
        javax.swing.JLabel lrecurso2 = new javax.swing.JLabel(lingua.translate("Utilizador") + ": ");
        lrecurso2.setBounds(10, 50, 120, 26);
        lrecurso2.setFocusable(true);
        lrecurso2.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso2);
        javax.swing.JLabel lrecurso22 = new javax.swing.JLabel(req.getPerson().getName());
        lrecurso22.setBounds(140, 50, 330, 26);
        lrecurso22.setBorder(border);
        pan.add(lrecurso22);
        javax.swing.JLabel lrecurso3 = new javax.swing.JLabel(lingua.translate("Data inicial") + ": ");
        lrecurso3.setBounds(10, 80, 120, 26);
        lrecurso3.setFocusable(true);
        lrecurso3.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso3);
        javax.swing.JLabel lrecurso33 = new javax.swing.JLabel(
                req.getBeginDate().toStringWithMonthWord(lingua));
        lrecurso33.setBounds(140, 80, 330, 26);
        lrecurso33.setBorder(border);
        pan.add(lrecurso33);
        javax.swing.JLabel lrecurso4 = new javax.swing.JLabel(lingua.translate("Data final") + ": ");
        lrecurso4.setBounds(10, 110, 120, 26);
        lrecurso4.setFocusable(true);
        lrecurso4.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso4);
        javax.swing.JLabel lrecurso44 = new javax.swing.JLabel(req.getEndDate().toStringWithMonthWord(lingua));
        lrecurso44.setBounds(140, 110, 330, 26);
        lrecurso44.setBorder(border);
        pan.add(lrecurso44);

        javax.swing.JLabel lrecurso5 = new javax.swing.JLabel(lingua.translate("Atividade") + ": ");
        lrecurso5.setBounds(10, 140, 120, 26);
        lrecurso5.setFocusable(true);
        lrecurso5.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso5);
        javax.swing.JLabel lrecurso55;
        if (req.getActivity().equals("")) {
            lrecurso55 = new javax.swing.JLabel(lingua.translate("Sem descrio"));
        } else {
            String[] saux = req.getActivity().split(":::");
            String atividade;
            boolean situacao = false;
            if (saux.length > 1) {
                situacao = true;
                atividade = saux[0];
            } else {
                atividade = req.getActivity();
            }
            if (req.getSubject().getId() > 0) {
                lrecurso55 = new javax.swing.JLabel(
                        lingua.translate(atividade) + ": " + req.getSubject().getName());
            } else {
                lrecurso55 = new javax.swing.JLabel(lingua.translate(atividade));
            }
            if (situacao) {
                Components.PopUpMenu pop = new Components.PopUpMenu(saux, lingua);
                pop.create();
                lrecurso55.addMouseListener(new MouseAdapter() {

                    @Override
                    public void mouseEntered(MouseEvent e) {
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    }

                    @Override
                    public void mouseExited(MouseEvent e) {
                        pop.setVisible(false);
                    }

                });
            }
        }
        lrecurso55.setBounds(140, 140, 330, 26);
        lrecurso55.setBorder(border);
        pan.add(lrecurso55);
        int distancia = 170;
        if (req.getBeginDate().isBigger(req.getEndDate()) == 0) {
            javax.swing.JLabel lrecurso6 = new javax.swing.JLabel(lingua.translate("Horrio") + ": ");
            lrecurso6.setBounds(10, distancia, 120, 26);
            lrecurso6.setFocusable(true);
            lrecurso6.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso6);
            javax.swing.JLabel lrecurso66 = new javax.swing.JLabel(
                    req.getTimeBegin().toString(0) + " - " + req.getTimeEnd().toString(0));
            lrecurso66.setBounds(140, distancia, 330, 26);
            lrecurso66.setBorder(border);
            pan.add(lrecurso66);
            distancia = 200;
        }
        if (req.getBeginDate().isBigger(req.getEndDate()) == 0) {
            javax.swing.JLabel lrecurso7 = new javax.swing.JLabel(lingua.translate("Dia da semana") + ": ");
            lrecurso7.setBounds(10, distancia, 120, 26);
            lrecurso7.setFocusable(true);
            lrecurso7.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso7);
            javax.swing.JLabel lrecurso77 = new javax.swing.JLabel(
                    lingua.translate(req.getWeekDay().perDayName()));
            lrecurso77.setBounds(140, distancia, 330, 26);
            lrecurso77.setBorder(border);
            pan.add(lrecurso77);
            if (distancia == 200) {
                distancia = 230;
            } else {
                distancia = 200;
            }
        }
        if (req.isTerminated() || req.isActive()) {
            javax.swing.JLabel lrecurso8 = new javax.swing.JLabel(lingua.translate("Levantamento") + ": ");
            lrecurso8.setBounds(10, distancia, 120, 26);
            lrecurso8.setFocusable(true);
            lrecurso8.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso8);
            javax.swing.JLabel lrecurso88;
            if ((req.getLiftDate() != null) && (req.getLiftTime() != null)) {
                lrecurso88 = new javax.swing.JLabel(req.getLiftDate().toString() + " " + lingua.translate("s")
                        + " " + req.getLiftTime().toString(0));
            } else {
                lrecurso88 = new javax.swing.JLabel(lingua.translate("sem dados para apresentar"));
            }
            lrecurso88.setBounds(140, distancia, 330, 26);
            lrecurso88.setBorder(border);
            pan.add(lrecurso88);
            switch (distancia) {
            case 200:
                distancia = 230;
                break;
            case 230:
                distancia = 260;
                break;
            default:
                distancia = 200;
                break;
            }
        }
        if (req.isTerminated()) {
            javax.swing.JLabel lrecurso9 = new javax.swing.JLabel(lingua.translate("Entrega") + ": ");
            lrecurso9.setBounds(10, distancia, 120, 26);
            lrecurso9.setFocusable(true);
            lrecurso9.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso9);
            javax.swing.JLabel lrecurso99;
            if ((req.getDeliveryDate() != null) && (req.getDeliveryTime() != null)) {
                lrecurso99 = new javax.swing.JLabel(req.getDeliveryDate().toString() + " "
                        + lingua.translate("s") + " " + req.getDeliveryTime().toString(0));
            } else {
                lrecurso99 = new javax.swing.JLabel(lingua.translate("sem dados para apresentar"));
            }
            lrecurso99.setBounds(140, distancia, 330, 26);
            lrecurso99.setBorder(border);
            pan.add(lrecurso99);
            switch (distancia) {
            case 200:
                distancia = 230;
                break;
            case 230:
                distancia = 260;
                break;
            case 260:
                distancia = 290;
                break;
            default:
                distancia = 200;
                break;
            }
        }
        Components.MessagePane mensagem = new Components.MessagePane(this, Components.MessagePane.INFORMACAO,
                Clavis.KeyQuest.getSystemColor(), lingua.translate(""), 500, 400, pan, "",
                new String[] { lingua.translate("Voltar") });
        mensagem.showMessage();
    };
    eventos[1] = (ActionEvent r) -> {
        String val = jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 2).toString();
        SimpleDateFormat sdf_auxiliar = new SimpleDateFormat("dd/MM/yyyy");
        Date data_auxiliar;
        try {
            data_auxiliar = sdf_auxiliar.parse(val);
            Calendar cal = Calendar.getInstance();
            cal.setTime(data_auxiliar);
            int dia = cal.get(Calendar.DAY_OF_MONTH);
            int mes = cal.get(Calendar.MONTH) + 1;
            int ano = cal.get(Calendar.YEAR);
            inicio = new TimeDate.Date(dia, mes, ano);
            fim = new TimeDate.Date(dia, mes, ano);
        } catch (ParseException ex) {
            data_auxiliar = new Date();
        }
        jXDatePickerFim.setDate(data_auxiliar);
        jXDatePickerInicio.setDate(data_auxiliar);
        refreshTable(jComboBoxEstado.getSelectedIndex());
    };
    eventos[2] = (ActionEvent r) -> {
        String val = jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 3).toString();
        for (int i = 0; i < jComboBoxEstado.getItemCount(); i++) {
            if (jComboBoxEstado.getItemAt(i).equals(val)) {
                jComboBoxEstado.setSelectedIndex(i);
            }
        }
    };
    KeyStroke[] strokes = new KeyStroke[opcoes.length];
    strokes[0] = KeyStroke.getKeyStroke(KeyEvent.VK_R, Event.CTRL_MASK);
    strokes[1] = KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK);
    strokes[2] = KeyStroke.getKeyStroke(KeyEvent.VK_E, Event.CTRL_MASK);
    Components.PopUpMenu pop = new Components.PopUpMenu(opcoes, eventos, strokes);
    pop.create();
    mouseaction = new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            java.awt.Point ponto = new java.awt.Point(e.getX(), e.getY());
            if (jTable1.rowAtPoint(ponto) > -1) {
                jTable1.setRowSelectionInterval(jTable1.rowAtPoint(ponto),
                        jTable1.rowAtPoint(new java.awt.Point(e.getX(), e.getY())));
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                if (jTable1.getSelectedRow() >= 0) {
                    java.awt.Point ponto = new java.awt.Point(e.getX(), e.getY());
                    if (jTable1.rowAtPoint(ponto) > -1) {
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    }
                }
            }
        }

    };
    jTable1.addMouseListener(mouseaction);
}