Example usage for javax.swing JLayeredPane DRAG_LAYER

List of usage examples for javax.swing JLayeredPane DRAG_LAYER

Introduction

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

Prototype

Integer DRAG_LAYER

To view the source code for javax.swing JLayeredPane DRAG_LAYER.

Click Source Link

Document

Convenience object defining the Drag layer.

Usage

From source file:grafix.telas.JanelaGraficos.java

private void configurarJanela() {
    this.setBorder(BorderFactory.createEtchedBorder());
    this.setClosable(true);
    this.setIconifiable(false);
    this.setMaximizable(true);
    this.setResizable(true);
    this.setBounds(0, 0, 500, 500);
    this.setVisible(true);
    this.setTitle(getAcao().getCodAcao() + " - " + getAcao().getNomeAcao());
    this.setFrameIcon(new ImageIcon("resource/icones/grafix4.gif"));
    layersPane = new JLayeredPane();
    layersPane.setLayout(new OverlayLayout(layersPane));
    layersPane.add(getPanelGraficos(), JLayeredPane.FRAME_CONTENT_LAYER);
    layersPane.add(getPanelMolduras(), JLayeredPane.DRAG_LAYER);
    this.add(layersPane);
    this.addInternalFrameListener(new InternalFrameListener() {
        public void internalFrameActivated(InternalFrameEvent evt) {
            janelaAtivada();/*from   w  w w.  ja  v a  2  s  .co m*/
        }

        public void internalFrameClosed(InternalFrameEvent evt) {
            janelaFechada();
        }

        public void internalFrameClosing(InternalFrameEvent evt) {
        }

        public void internalFrameDeactivated(InternalFrameEvent evt) {
        }

        public void internalFrameDeiconified(InternalFrameEvent evt) {
        }

        public void internalFrameIconified(InternalFrameEvent evt) {
        }

        public void internalFrameOpened(InternalFrameEvent evt) {
        }
    });
}

From source file:game.Clue.ClueGameUI.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from  w ww. java 2  s.c  om
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonGroup2 = new javax.swing.ButtonGroup();
    jPanel3 = new javax.swing.JPanel();
    LoginPanel = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jTextField2 = new javax.swing.JTextField();
    jToggleButton3 = new javax.swing.JToggleButton();
    jLabel12 = new javax.swing.JLabel();
    jProgressBar1 = new javax.swing.JProgressBar();
    CharacterSelectionPanel = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    jToggleButton4 = new javax.swing.JToggleButton();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    jLabel9 = new javax.swing.JLabel();
    jRadioButton1 = new javax.swing.JRadioButton();
    jRadioButton2 = new javax.swing.JRadioButton();
    jRadioButton3 = new javax.swing.JRadioButton();
    jRadioButton4 = new javax.swing.JRadioButton();
    jRadioButton5 = new javax.swing.JRadioButton();
    jRadioButton6 = new javax.swing.JRadioButton();
    jPanel2 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jScrollPane3 = new javax.swing.JScrollPane();
    jTable3 = new javax.swing.JTable();
    jLabel10 = new javax.swing.JLabel();
    jScrollPane2 = new javax.swing.JScrollPane();
    jTable2 = new javax.swing.JTable();
    jPanel5 = new javax.swing.JPanel();
    jLayeredPane5 = new javax.swing.JLayeredPane();
    jButton2 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jButton5 = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jLabel15 = new javax.swing.JLabel();
    jLabel16 = new javax.swing.JLabel();
    jToggleButton2 = new javax.swing.JToggleButton();
    jButton6 = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jTextField1 = new javax.swing.JTextField();
    jToggleButton1 = new javax.swing.JToggleButton();
    jLabel11 = new javax.swing.JLabel();
    jTextField3 = new javax.swing.JTextField();
    jLabel13 = new javax.swing.JLabel();
    jLabel14 = new javax.swing.JLabel();
    jTextField4 = new javax.swing.JTextField();
    jScrollPane4 = new javax.swing.JScrollPane();
    jTextArea1 = new javax.swing.JTextArea();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Clueless");
    setBackground(new java.awt.Color(0, 0, 0));
    setMaximumSize(new java.awt.Dimension(2147483647, 400));
    setResizable(false);

    jPanel3.setMaximumSize(new java.awt.Dimension(2147483647, 400));
    jPanel3.setLayout(new java.awt.CardLayout());

    LoginPanel.setBackground(new java.awt.Color(51, 51, 51));
    LoginPanel.setForeground(new java.awt.Color(255, 153, 153));
    LoginPanel.setMaximumSize(new java.awt.Dimension(32767, 400));
    LoginPanel.setPreferredSize(new java.awt.Dimension(729, 670));
    LoginPanel.setLayout(null);

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(255, 255, 255));
    jLabel1.setText("Name:");
    LoginPanel.add(jLabel1);
    jLabel1.setBounds(20, 580, 35, 14);

    jTextField2.setMaximumSize(new java.awt.Dimension(6, 20));
    jTextField2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField2ActionPerformed(evt);
        }
    });
    LoginPanel.add(jTextField2);
    jTextField2.setBounds(90, 570, 110, 30);

    jToggleButton3.setText("Start/Join a game");
    jToggleButton3.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton3ItemStateChanged(evt);
        }
    });
    jToggleButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton3ActionPerformed(evt);
        }
    });
    LoginPanel.add(jToggleButton3);
    jToggleButton3.setBounds(40, 610, 130, 23);

    jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/logo-login3.jpg"))); // NOI18N
    jLabel12.setText("jLabel12");
    jLabel12.setMaximumSize(new java.awt.Dimension(729, 670));
    jLabel12.setMinimumSize(new java.awt.Dimension(729, 670));
    jLabel12.setPreferredSize(new java.awt.Dimension(729, 670));
    LoginPanel.add(jLabel12);
    jLabel12.setBounds(0, 0, 729, 670);
    LoginPanel.add(jProgressBar1);
    jProgressBar1.setBounds(40, 640, 146, 14);

    jPanel3.add(LoginPanel, "card4");

    CharacterSelectionPanel.setBackground(new java.awt.Color(102, 153, 255));
    CharacterSelectionPanel.setMaximumSize(new java.awt.Dimension(32767, 400));
    CharacterSelectionPanel.setPreferredSize(new java.awt.Dimension(729, 670));

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel3.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ColonelMustard.png"))); // NOI18N
    jLabel3.setPreferredSize(new java.awt.Dimension(175, 233));

    buttonGroup2.add(jToggleButton4);
    jToggleButton4.setText("Next");
    jToggleButton4.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton4ItemStateChanged(evt);
        }
    });
    jToggleButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton4ActionPerformed(evt);
        }
    });

    jLabel4.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel4.setText("Character Selection");
    jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel5.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MissScarlett.png"))); // NOI18N
    jLabel5.setToolTipText("");
    jLabel5.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel6.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrGreen.png"))); // NOI18N
    jLabel6.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel7.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrsPeacock.png"))); // NOI18N
    jLabel7.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel8.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/MrsWhite.png"))); // NOI18N
    jLabel8.setPreferredSize(new java.awt.Dimension(175, 233));

    jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jLabel9.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ProfessorPlum.png"))); // NOI18N
    jLabel9.setPreferredSize(new java.awt.Dimension(175, 233));

    buttonGroup2.add(jRadioButton1);

    buttonGroup2.add(jRadioButton2);

    buttonGroup2.add(jRadioButton3);
    jRadioButton3.setToolTipText("");

    buttonGroup2.add(jRadioButton4);

    buttonGroup2.add(jRadioButton5);

    buttonGroup2.add(jRadioButton6);

    javax.swing.GroupLayout CharacterSelectionPanelLayout = new javax.swing.GroupLayout(
            CharacterSelectionPanel);
    CharacterSelectionPanel.setLayout(CharacterSelectionPanelLayout);
    CharacterSelectionPanelLayout.setHorizontalGroup(CharacterSelectionPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CharacterSelectionPanelLayout
                    .createSequentialGroup().addGap(47, 47, 47)
                    .addGroup(CharacterSelectionPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 156,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(31, 31, 31).addComponent(jLabel5,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                    .addGroup(CharacterSelectionPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 158,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(85, 85, 85))
            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup().addGap(131, 131, 131)
                    .addComponent(jRadioButton1).addGap(170, 170, 170).addComponent(jRadioButton2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jRadioButton3).addGap(162, 162, 162))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CharacterSelectionPanelLayout
                    .createSequentialGroup().addGap(131, 131, 131).addComponent(jRadioButton4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jRadioButton5).addGap(169, 169, 169).addComponent(jRadioButton6)
                    .addGap(171, 171, 171))
            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                    .addGroup(CharacterSelectionPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addGap(158, 158, 158).addComponent(jLabel4))
                            .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                    .addGap(329, 329, 329).addComponent(jToggleButton4)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    CharacterSelectionPanelLayout.setVerticalGroup(
            CharacterSelectionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(32, 32, 32)
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                            .addGap(5, 5, 5).addComponent(jRadioButton1))
                                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                            .addGap(7, 7, 7).addComponent(jRadioButton2))
                                    .addGroup(CharacterSelectionPanelLayout.createSequentialGroup()
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jRadioButton3)))
                            .addGap(18, 18, 18)
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 233,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(CharacterSelectionPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jRadioButton6).addComponent(jRadioButton5)
                                    .addComponent(jRadioButton4))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jToggleButton4).addContainerGap(25, Short.MAX_VALUE)));

    jPanel3.add(CharacterSelectionPanel, "card5");

    jPanel2.setBackground(new java.awt.Color(204, 204, 204));
    jPanel2.setMaximumSize(new java.awt.Dimension(720, 400));
    jPanel2.setPreferredSize(new java.awt.Dimension(729, 670));

    jPanel4.setBackground(new java.awt.Color(204, 102, 0));

    jTable1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { "Mrs.White", null }, { "Mr. Plum", null }, { "Miss Scarlet", null },
                    { "Mr. Green", null }, { "Mrs.Peacock", null }, { "Col. Mustard", null } },
            new String[] { "SUSPECTS", "" }) {
        boolean[] canEdit = new boolean[] { false, true };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    jScrollPane1.setViewportView(jTable1);

    jTable3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jTable3.setModel(
            new javax.swing.table.DefaultTableModel(
                    new Object[][] { { "Hall", null }, { "Lounge", null }, { "Library", null },
                            { "Kitchen", null }, { "Dining Room", null }, { "Billiard Room", null },
                            { "Study", null }, { "Ballroom", null }, { "Conservatory", null } },
                    new String[] { "ROOMS", "P1" }));
    jScrollPane3.setViewportView(jTable3);

    jLabel10.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
    jLabel10.setText("Scorecard");

    jTable2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { "CandleStick", null }, { "Knife", null }, { "LeadPipe", null },
                    { "Revolver", null }, { "Rope", null }, { "Wrench", null } },
            new String[] { "WEAPONS", "" }) {
        boolean[] canEdit = new boolean[] { false, true };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    jScrollPane2.setViewportView(jTable2);

    jPanel5.setBackground(new java.awt.Color(51, 51, 51));

    javax.swing.GroupLayout jLayeredPane5Layout = new javax.swing.GroupLayout(jLayeredPane5);
    jLayeredPane5.setLayout(jLayeredPane5Layout);
    jLayeredPane5Layout.setHorizontalGroup(jLayeredPane5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 701, Short.MAX_VALUE));
    jLayeredPane5Layout.setVerticalGroup(jLayeredPane5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));

    javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jLayeredPane5, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel5Layout
                    .createSequentialGroup().addGap(22, 22, 22).addComponent(jLayeredPane5).addContainerGap()));

    jLayeredPane5.addMouseListener(this);
    jLayeredPane5.addMouseMotionListener(this);
    jLayeredPane5.add(player, JLayeredPane.DRAG_LAYER);

    jButton2.setText("Make Accusation");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });

    jButton4.setText("(unused) jButton4");
    jButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton4ActionPerformed(evt);
        }
    });

    jButton5.setText("Make A Suggestion");
    jButton5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton5ActionPerformed(evt);
        }
    });

    jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cards/Ballroom.PNG"))); // NOI18N
    jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jLabel2MouseClicked(evt);
        }
    });

    jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cards/Candlestick.PNG"))); // NOI18N
    jLabel15.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jLabel15MouseClicked(evt);
        }
    });

    jLabel16.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/characterImages/ColonelMustard.png"))); // NOI18N
    jLabel16.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jLabel16MouseClicked(evt);
        }
    });

    jToggleButton2.setText("jToggleButton2");
    jToggleButton2.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton2ItemStateChanged(evt);
        }
    });
    jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton2ActionPerformed(evt);
        }
    });

    jButton6.setText("Move");
    jButton6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton6ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(jPanel4Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout
                                    .createSequentialGroup().addGap(25, 25, 25)
                                    .addGroup(jPanel4Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(jButton2)
                                            .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jToggleButton2).addComponent(jButton4)
                                            .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 130,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel4Layout.createSequentialGroup().addGap(21, 21, 21).addComponent(jLabel10)))
                    .addGap(11, 11, 11)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15).addComponent(jLabel2).addComponent(jLabel16))
                    .addContainerGap(3138, Short.MAX_VALUE)));
    jPanel4Layout
            .setVerticalGroup(jPanel4Layout
                    .createParallelGroup(
                            javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup().addGap(23, 23, 23).addComponent(jLabel10)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 131,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 133,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(37, 37, 37).addComponent(jToggleButton2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton4)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jButton5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButton6).addGap(3, 3, 3))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel4Layout.createSequentialGroup().addGap(59, 59, 59).addComponent(jLabel2)
                                    .addGap(58, 58, 58).addComponent(jLabel15).addGap(18, 18, 18)
                                    .addComponent(jLabel16)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)));
    jPanel2Layout
            .setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel2Layout.createSequentialGroup().addContainerGap()
                                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addContainerGap()));

    jPanel3.add(jPanel2, "card3");

    jPanel1.setMaximumSize(new java.awt.Dimension(32767, 400));
    jPanel1.setPreferredSize(new java.awt.Dimension(729, 670));

    jButton1.setText("Connect to Server");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    jButton3.setText("Send Message to Server");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
        }
    });

    jToggleButton1.setText("Go To Gameboard");
    jToggleButton1.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jToggleButton1ItemStateChanged(evt);
        }
    });
    jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jToggleButton1ActionPerformed(evt);
        }
    });

    jLabel11.setText("Technical Page for Server Communication..Wont be used in Game");

    jTextField3.setText("192.168.1.8");

    jLabel13.setText("IP address:");

    jLabel14.setText("Port:");

    jTextField4.setText("8888");

    jTextArea1.setColumns(20);
    jTextArea1.setRows(5);
    jScrollPane4.setViewportView(jTextArea1);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addGap(180, 180, 180).addGroup(jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jToggleButton1).addComponent(jLabel11)
                            .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jButton1)
                                    .addGap(42, 42, 42)
                                    .addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel13).addComponent(jLabel14))
                                    .addGap(18, 18, 18)
                                    .addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    102, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    58, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel1Layout.createSequentialGroup().addGap(50, 50, 50).addComponent(
                                    jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 255,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel1Layout.createSequentialGroup().addGap(247, 247, 247)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jButton3).addComponent(jTextField1,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 139,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap(211, Short.MAX_VALUE)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addGap(25, 25, 25).addComponent(jLabel11)
                    .addGap(101, 101, 101)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton1)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(8, 8, 8).addComponent(jToggleButton1).addGap(41, 41, 41)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 154,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jButton3).addContainerGap(190, Short.MAX_VALUE)));

    jPanel3.add(jPanel1, "card2");

    getContentPane().add(jPanel3, java.awt.BorderLayout.PAGE_END);

    pack();
}

From source file:game.Clue.ClueGameUI.java

public void mousePressed(MouseEvent e) {
    //player=null;
    Component j = e.getComponent();
    //System.out.println("Click component is : \n"+j.toString()+"\n "+(e.getSource().toString());
    Component c = gameBoard.findComponentAt(e.getX(), e.getY());
    if (c instanceof JPanel) {
        System.out.println("No character chosen");
        return;/*www .  j  a v  a 2s. c o m*/
    }

    Point parentLocation = c.getParent().getLocation();
    xAdjustment = parentLocation.x - e.getX();
    yAdjustment = parentLocation.y - e.getY();
    player = (JLabel) c;
    previous_room_x = parentLocation.x + xAdjustment;
    previous_room_y = parentLocation.y + yAdjustment;
    player.setLocation(e.getX() + xAdjustment, e.getY() + yAdjustment);
    player.setSize(player.getWidth(), player.getHeight());
    jLayeredPane5.add(player, JLayeredPane.DRAG_LAYER);

}

From source file:org.ut.biolab.medsavant.client.filter.FilterEffectivenessPanel.java

public FilterEffectivenessPanel(Color foregroundColor) {

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;//from ww w. j  a  va  2 s. c om
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;

    this.setPreferredSize(new Dimension(280, 80));
    this.setMaximumSize(new Dimension(280, 80));

    setLayout(new GridBagLayout());

    waitPanel = new WaitPanel("Applying Filters");
    waitPanel.setVisible(false);
    add(waitPanel, gbc, JLayeredPane.DRAG_LAYER);

    panel = ViewUtil.getClearPanel();
    panel.setLayout(new BorderLayout());
    panel.setBorder(ViewUtil.getMediumBorder());
    //panel.setPreferredSize(waitPanel.getPreferredSize());
    add(panel, gbc, JLayeredPane.DEFAULT_LAYER);

    labelVariantsRemaining = ViewUtil.getDetailTitleLabel("");
    labelVariantsRemaining.setForeground(foregroundColor);

    JPanel infoPanel = ViewUtil.getClearPanel();
    ViewUtil.applyVerticalBoxLayout(infoPanel);

    final JLabel a = new JLabel("");
    a.setForeground(foregroundColor);
    ViewUtil.makeSmall(a);
    infoPanel.add(ViewUtil.centerHorizontally(a));

    Listener<FilterEvent> fe = new Listener<FilterEvent>() {
        @Override
        public void handleEvent(FilterEvent event) {
            try {

                if (MedSavantClient.VariantManager.willApproximateCountsForConditions(
                        LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(),
                        ReferenceController.getInstance().getCurrentReferenceID(),
                        FilterController.getInstance().getAllFilterConditions())) {
                    a.setText("approximately");
                } else {
                    a.setText("");
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    };

    fe.handleEvent(null);
    FilterController.getInstance().addListener(fe);

    infoPanel.add(ViewUtil.centerHorizontally(labelVariantsRemaining));

    JLabel l = new JLabel("of all variants pass search conditions");
    l.setForeground(foregroundColor);
    ViewUtil.makeSmall(l);
    infoPanel.add(ViewUtil.centerHorizontally(l));
    infoPanel.setBorder(ViewUtil.getMediumTopHeavyBorder());

    panel.add(infoPanel, BorderLayout.NORTH);

    initListeners();

}

From source file:org.ut.biolab.medsavant.client.filter.FilterEffectivenessPanel.java

public synchronized void showWaitCard() {
    waitCounter++;
    waitPanel.setVisible(true);
    setLayer(waitPanel, JLayeredPane.DRAG_LAYER);
    waitPanel.repaint();
}