Skip to content

Commit be10da9

Browse files
committed
Tweaks
1 parent 2880ceb commit be10da9

File tree

4 files changed

+150
-155
lines changed

4 files changed

+150
-155
lines changed

src/org/cyberpwn/react/AboutReact.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package org.cyberpwn.react;
22

3+
import java.awt.Font;
34
import java.awt.Window.Type;
45

6+
import javax.swing.ImageIcon;
57
import javax.swing.JFrame;
8+
import javax.swing.JLabel;
9+
import javax.swing.SpringLayout;
610

711
public class AboutReact
812
{
@@ -17,9 +21,29 @@ public AboutReact()
1721
private void initialize()
1822
{
1923
frame = new JFrame();
20-
frame.setType(Type.POPUP);
24+
frame.setType(Type.UTILITY);
2125
frame.setResizable(false);
22-
frame.setBounds(100, 100, 432, 465);
26+
frame.setBounds(100, 100, 548, 533);
2327
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
28+
SpringLayout springLayout = new SpringLayout();
29+
frame.getContentPane().setLayout(springLayout);
30+
31+
JLabel lblReactClient = new JLabel("React Client");
32+
springLayout.putConstraint(SpringLayout.NORTH, lblReactClient, 263, SpringLayout.NORTH, frame.getContentPane());
33+
springLayout.putConstraint(SpringLayout.WEST, lblReactClient, 172, SpringLayout.WEST, frame.getContentPane());
34+
lblReactClient.setFont(new Font("Segoe UI Light", Font.PLAIN, 40));
35+
frame.getContentPane().add(lblReactClient);
36+
37+
JLabel lblDevelopedByCyberpwn = new JLabel("Developed by Cyberpwn");
38+
springLayout.putConstraint(SpringLayout.NORTH, lblDevelopedByCyberpwn, 6, SpringLayout.SOUTH, lblReactClient);
39+
springLayout.putConstraint(SpringLayout.WEST, lblDevelopedByCyberpwn, 178, SpringLayout.WEST, frame.getContentPane());
40+
springLayout.putConstraint(SpringLayout.SOUTH, lblDevelopedByCyberpwn, -156, SpringLayout.SOUTH, frame.getContentPane());
41+
lblDevelopedByCyberpwn.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
42+
frame.getContentPane().add(lblDevelopedByCyberpwn);
43+
44+
JLabel lblNewLabel = new JLabel(new ImageIcon(ReactClient.class.getResource("/org/cyberpwn/react/ui/server-low.png")));
45+
springLayout.putConstraint(SpringLayout.WEST, lblNewLabel, 143, SpringLayout.WEST, frame.getContentPane());
46+
springLayout.putConstraint(SpringLayout.SOUTH, lblNewLabel, -6, SpringLayout.NORTH, lblReactClient);
47+
frame.getContentPane().add(lblNewLabel);
2448
}
2549
}

src/org/cyberpwn/react/ReactClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public ReactClient()
6767

6868
this.network = new Network();
6969
initialize();
70-
ns = new NetworkScheduler(network.getServers(), 500);
70+
ns = new NetworkScheduler(network.getServers(), 50);
7171
ns.start();
7272
}
7373

src/org/cyberpwn/react/ServerTab.java

Lines changed: 79 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,25 @@ public class ServerTab
3838
private JLabel lblOnline;
3939
private JLabel lblmsPing;
4040

41-
private JPanel TPS;
42-
private Grapher GTPS;
41+
private Grapher TPS;
4342
private GList<Double> DTPS;
4443

44+
private Grapher MEM;
45+
private GList<Double> DMEM;
46+
47+
private Grapher GC;
48+
private GList<Double> DGC;
49+
50+
private Grapher MAH;
51+
private GList<Double> DMAH;
52+
4553
public ServerTab(JFrame frame, NetworkedServer server, JXTabbedPane tabbedPane)
4654
{
4755
this.ns = server;
4856
this.DTPS = new GList<Double>().qadd(20.0);
57+
this.DMEM = new GList<Double>().qadd(128.0);
58+
this.DGC = new GList<Double>().qadd(1.0);
59+
this.DMAH = new GList<Double>().qadd(9.0);
4960

5061
JPanel panel = new JPanel();
5162
tabbedPane.addTab(ns.getName(), new ImageIcon(ReactClient.class.getResource("/org/cyberpwn/react/ui/server-mini.png")), panel, null);
@@ -137,12 +148,10 @@ public void mouseReleased(MouseEvent e)
137148
lblTps.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
138149
panel_7.add(lblTps, "cell 1 0");
139150

140-
TPS = new JPanel();
151+
TPS = new Grapher(20, Color.CYAN, new GList<Double>().qadd(1.0));
141152
TPS.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
142153
TPS.setBackground(Color.DARK_GRAY);
143154
panel_7.add(TPS, "cell 0 1 2 2,grow");
144-
GTPS = new Grapher(TPS.getWidth(), TPS.getHeight(), 20, Color.CYAN, new GList<Double>().qadd(1.0));
145-
TPS.add(GTPS);
146155

147156
JPanel panel_13 = new JPanel();
148157
tabbedPane_2.addTab("Memory", null, panel_13, null);
@@ -162,10 +171,10 @@ public void mouseReleased(MouseEvent e)
162171
lblMbUsed.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
163172
panel_14.add(lblMbUsed, "cell 1 0");
164173

165-
JPanel panel_9 = new JPanel();
166-
panel_9.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
167-
panel_9.setBackground(Color.DARK_GRAY);
168-
panel_14.add(panel_9, "cell 0 1 2 1,grow");
174+
MEM = new Grapher(400, Color.CYAN, new GList<Double>().qadd(1.0));
175+
MEM.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
176+
MEM.setBackground(Color.DARK_GRAY);
177+
panel_14.add(MEM, "cell 0 1 2 1,grow");
169178

170179
JPanel panel_16 = new JPanel();
171180
panel_16.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
@@ -181,10 +190,10 @@ public void mouseReleased(MouseEvent e)
181190
lblGcminute.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
182191
panel_16.add(lblGcminute, "cell 1 0");
183192

184-
JPanel panel_11 = new JPanel();
185-
panel_11.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
186-
panel_11.setBackground(Color.DARK_GRAY);
187-
panel_16.add(panel_11, "cell 0 1 2 1,grow");
193+
GC = new Grapher(1200, Color.CYAN, new GList<Double>().qadd(1.0));
194+
GC.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
195+
GC.setBackground(Color.DARK_GRAY);
196+
panel_16.add(GC, "cell 0 1 2 1,grow");
188197

189198
JPanel panel_15 = new JPanel();
190199
panel_15.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
@@ -200,10 +209,10 @@ public void mouseReleased(MouseEvent e)
200209
lblMahs.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
201210
panel_15.add(lblMahs, "cell 1 0");
202211

203-
JPanel panel_17 = new JPanel();
204-
panel_17.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
205-
panel_17.setBackground(Color.DARK_GRAY);
206-
panel_15.add(panel_17, "cell 0 1 2 1,grow");
212+
MAH = new Grapher(1, Color.CYAN, new GList<Double>().qadd(1.0));
213+
MAH.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
214+
MAH.setBackground(Color.DARK_GRAY);
215+
panel_15.add(MAH, "cell 0 1 2 1,grow");
207216

208217
JPanel panel_4 = new JPanel();
209218
tabbedPane_1.addTab("Actions", null, panel_4, null);
@@ -251,43 +260,73 @@ public void mouseReleased(MouseEvent e)
251260
lblNewLabel_1.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
252261
panel_18.add(lblNewLabel_1, "cell 0 1");
253262
}
254-
263+
255264
public void push(GMap<String, Double> sample)
256265
{
257-
lblUsingSpigot.setText("Using " + ns.getVersionBukkit());
266+
lblUsingSpigot.setText("Using " + ns.getVersion());
258267
lblTps.setText(F.f(sample.get("tps"), 2) + " TPS (" + F.pc(sample.get("stability"), 0) + " Stable)");
259268
lblGcminute.setText(F.f(sample.get("spms")) + " GC/Minute");
260269
lblMahs.setText(F.f(sample.get("mah/s")) + " MAH/s");
261270
lblMbUsed.setText(F.mem(sample.get("mem").longValue()) + " Used");
262271
lblOnline.setText(F.f(sample.get("plr")) + " Players Online");
263272
lblmsPing.setText(F.f(sample.get("plg")) + " Loaded Plugins");
264273

274+
if(MAH.getMax() < sample.get("mah/s"))
275+
{
276+
MAH.setMax(sample.get("mah/s").intValue());
277+
}
278+
265279
DTPS.add(sample.get("tps"));
266280

267-
if(DTPS.size() > 64)
281+
if(DTPS.size() > TPS.getWidth())
268282
{
269-
DTPS.remove(0);
283+
while(DTPS.size() > TPS.getWidth())
284+
{
285+
DTPS.remove(0);
286+
}
270287
}
271288

272-
GTPS.setWidth(TPS.getWidth());
273-
GTPS.setHeight(TPS.getHeight());
274-
GTPS.setData(DTPS);
275-
GTPS.repaint();
289+
TPS.setData(DTPS);
276290
TPS.repaint();
291+
292+
DMEM.add(sample.get("mem"));
293+
294+
if(DMEM.size() > MEM.getWidth())
295+
{
296+
while(DMEM.size() > MEM.getWidth())
297+
{
298+
DMEM.remove(0);
299+
}
300+
}
301+
302+
MEM.setMax(sample.get("memory-max").intValue());
303+
MEM.setData(DMEM);
304+
MEM.repaint();
305+
306+
DGC.add(sample.get("spms"));
307+
308+
if(DGC.size() > GC.getWidth())
309+
{
310+
while(DGC.size() > GC.getWidth())
311+
{
312+
DGC.remove(0);
313+
}
314+
}
315+
316+
GC.setData(DGC);
317+
GC.repaint();
318+
319+
DMAH.add(sample.get("mah/s"));
320+
321+
if(DMAH.size() > MAH.getWidth())
322+
{
323+
while(DMAH.size() > MAH.getWidth())
324+
{
325+
DMAH.remove(0);
326+
}
327+
}
328+
329+
MAH.setData(DMAH);
330+
MAH.repaint();
277331
}
278-
279-
/*
280-
>> liq/s : 0.0
281-
>> tnt/s : 0.0
282-
>> drops : 31.0
283-
>> hist : 1.0
284-
>> chk/s : 10.6
285-
>> rct : 501220.2773345846
286-
>> red/s : 0.0
287-
>> chunks : 0.0
288-
>> mb/p : 29.857142857142858
289-
>> ents : 190.0
290-
>> cgen/s : 2.0
291-
>> chunkmem : 0.0
292-
*/
293332
}

0 commit comments

Comments
 (0)