2-APL UPC project.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

bbfizp 9a582182 d5f8b497

+40 -3
+40 -3
code/2apl_platform/environments/cardtable/Table.java
··· 2 2 3 3 import java.awt.*; 4 4 import javax.swing.*; 5 - import java.util.*; 6 5 7 6 8 7 ··· 30 29 31 30 32 31 TablePane = new JLayeredPane(); 33 - TablePane.setBackground(Color.green); 32 + 33 + 34 + 35 + Point origin = new Point(50, 20); 36 + Color[] layerColors = { Color.yellow, Color.magenta, 37 + Color.cyan, Color.red, 38 + Color.green }; 39 + //This is the offset for computing the origin for the next label. 40 + int offset = 35; 41 + 42 + //Add several overlapping, colored labels to the layered pane 43 + //using absolute positioning/sizing. 44 + for (int i = 0; i < 5; i++) { 45 + JLabel label = createColoredLabel("card", 46 + layerColors[i], origin); 47 + TablePane.add(label, new Integer(i)); 48 + origin.x += offset; 49 + origin.y += offset; 50 + } 51 + 52 + 53 + 54 + 34 55 35 56 36 57 Info = new JTextArea(5,00); ··· 50 71 VerticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 51 72 TablePane,GameInfo); 52 73 53 - 74 + VerticalSplitPane.setPreferredSize(new Dimension(360,600)); 54 75 55 76 //AddPlayersGUI(); 56 77 addComponentsToPane(CardDisplayPane); ··· 63 84 //Provide a preferred size for the split pane. 64 85 HorizontalSplitPlane.setPreferredSize(new Dimension(800,600)); 65 86 } 87 + 88 + 89 + private JLabel createColoredLabel(String text, 90 + Color color, 91 + Point origin) { 92 + JLabel label = new JLabel(text); 93 + label.setVerticalAlignment(JLabel.TOP); 94 + label.setHorizontalAlignment(JLabel.CENTER); 95 + label.setOpaque(true); 96 + label.setBackground(color); 97 + label.setForeground(Color.black); 98 + label.setBorder(BorderFactory.createLineBorder(Color.black)); 99 + label.setBounds(origin.x, origin.y, 140, 140); 100 + return label; 101 + } 102 + 66 103 67 104 68 105 public static void addComponentsToPane(Container pane) {