Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,62 @@ | ||
/** | ||
* Coop Network Tetris — A cooperative tetris over the Internet. | ||
* | ||
* Copyright Ⓒ 2012 Mattias Andrée, Peyman Eshtiagh, | ||
* Calle Lejdbrandt, Magnus Lundberg | ||
* | ||
* Project for prutt12 (DD2385), KTH. | ||
*/ | ||
package cnt.interfaces.gui; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
|
||
|
||
/** | ||
* Player list panel | ||
* | ||
* @author Peyman Eshtiagh | ||
* @author Mattias Andrée, <a href="mailto:maandree@kth.se">maandree@kth.se</a> | ||
*/ | ||
public class UserList extends JPanel | ||
{ | ||
/** | ||
* Constructor | ||
*/ | ||
public UserList() | ||
{ | ||
setLayout(new BorderLayout()); | ||
model = new DefaultListModel(); | ||
list = new JList(model); | ||
this.setLayout(new BorderLayout()); | ||
|
||
JScrollPane pane = new JScrollPane(list); | ||
model.addElement("Peyman"); | ||
model.addElement("Calle"); | ||
model.addElement("Magnus"); | ||
model.addElement("Mattias"); | ||
this.model = new DefaultListModel(); | ||
this.list = new JList(model); | ||
|
||
add(pane, BorderLayout.NORTH); | ||
final JScrollPane pane = new JScrollPane(this.list); | ||
this.model.addElement("<html><span style=\"color: rgb(0, 255, 0);\">Peyman</span></html>"); | ||
this.model.addElement("<html><span style=\"color: rgb(255, 255, 0);\">Calle</span></html>"); | ||
this.model.addElement("<html><span style=\"color: rgb(255, 0, 0);\">Magnus</span></html>"); | ||
this.model.addElement("<html><span style=\"color: rgb(0, 0, 255);\">Mattias</span></html>"); | ||
|
||
LookAndFeel.installBorder(pane, "BorderFactory.createEmptyBorder()"); | ||
|
||
this.add(pane, BorderLayout.CENTER); | ||
|
||
this.setBackground(Color.BLACK); | ||
pane.setBackground(Color.BLACK); | ||
list.setBackground(Color.BLACK); | ||
this.list.setBackground(Color.BLACK); | ||
} | ||
|
||
|
||
|
||
JList list; | ||
/** | ||
* The list component | ||
*/ | ||
private final JList list; | ||
|
||
DefaultListModel model; | ||
/** | ||
* The list's model | ||
*/ | ||
private final DefaultListModel model; | ||
|
||
} | ||
|