MCPcopy Create free account
hub / github.com/catabriga/graphwar / paintComponent

Method paintComponent

src/Graphwar/RoomBoard.java:79–130  ·  view source on GitHub ↗
(Graphics g)

Source from the content-addressed store, hash-verified

77 }
78
79 public void paintComponent(Graphics g)
80 {
81 resize();
82
83 g.setColor(Color.WHITE);
84
85 g.fillRect(0, 0, this.getWidth()-1, this.getHeight()-1);
86
87 g.setColor(Color.BLACK);
88
89 Graphics2D g2d = (Graphics2D)g;
90 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91 g2d.setFont(new Font("Sans", Font.BOLD, 14));
92
93 ListIterator<Room> itr = graphwar.getGlobalClient().getRooms().listIterator();
94 int i=0;
95 while(itr.hasNext())
96 {
97 Room room = itr.next();
98
99 if(roomFocused)
100 {
101 if(focusedRoomNum == i)
102 {
103 g2d.setColor(focusColor);
104 g2d.fillRect(0, entryHeight*i, width, entryHeight);
105 }
106 }
107
108 g2d.setColor(Color.BLACK);
109 g2d.drawString(" "+room.getName(), 0, entryHeight*(i+1)-4);
110
111 String mode = "y";
112
113 if(room.getGameMode()==1)
114 {
115 mode = "y'";
116 }
117 else if(room.getGameMode()==2)
118 {
119 mode = "y''";
120 }
121
122 g2d.drawString(mode, width-40, entryHeight*(i+1)-7);
123
124 g2d.drawString(room.getNumPlayers()+"/10", width-110, entryHeight*(i+1)-6);
125
126 g2d.drawRect(0, entryHeight*i, width, entryHeight);
127
128 i++;
129 }
130 }
131
132 public synchronized void mouseMoved(MouseEvent e)
133 {

Callers

nothing calls this directly

Calls 6

resizeMethod · 0.95
getNameMethod · 0.95
getGameModeMethod · 0.95
getNumPlayersMethod · 0.95
getRoomsMethod · 0.80
getGlobalClientMethod · 0.80

Tested by

no test coverage detected