/** * This method initializes jButtonLogout * * @return javax.swing.JButton */ private JButton getJButtonLogout() { if (jButtonLogout == null) { jButtonLogout = new JButton(); jButtonLogout.setText("Log Out"); jButtonLogout.setFont(new Font("Arial", Font.BOLD, 12)); jButtonLogout.setSelected(false); jButtonLogout.setMnemonic(KeyEvent.VK_UNDEFINED); jButtonLogout.setComponentOrientation(ComponentOrientation.UNKNOWN); jButtonLogout.setBounds(new Rectangle(8, 30, 80, 40)); jButtonLogout.setForeground(Color.white); jButtonLogout.setFont(new Font("Arial", Font.BOLD, 12)); jButtonLogout.setBackground(new Color(91, 155, 213)); jButtonLogout.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { int option = JOptionPane.showConfirmDialog( myFrame, "Do You want to exit?", "Confirmation", JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { JPanel panel = new LobbyLoginPanel(myFrame); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); } } }); } return jButtonLogout; }
/** * Helper method makes simple scrollable panel full of possible responses. * * @param c Character accused * @param w Weapon accused * @param r Room accused * @return scroll panel of buttons */ private JScrollPane cardsPanel(Character c, Weapon w, Room r) { JPanel panel = new JPanel(new FlowLayout()); // perhaps boxlayout along x JScrollPane pane = new JScrollPane( panel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); for (Card crd : player.getCards()) { if (crd.toString().equals(c.getName()) || crd.toString().equals(w.getName()) || crd.toString().equals(r.toString())) { refutable = true; JButton l = new JButton(new ImageIcon(crd.getCardImg())); final Card refW = crd; l.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { refutedWith = refW; } }); l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); l.setBorder(new EmptyBorder(10, 10, 10, 10)); panel.add(l); } } return pane; }