Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package eu.darkbot.wakatoa.tasks.ggspinner;
- import com.github.manolo8.darkbot.config.tree.ConfigField;
- import com.github.manolo8.darkbot.gui.tree.OptionEditor;
- import net.miginfocom.swing.MigLayout;
- import javax.swing.*;
- import java.awt.*;
- import java.util.Map;
- public class JStatsComponent extends JPanel implements OptionEditor {
- public JStatsComponent(SpinnerConfiguration config){
- super(new MigLayout("ins 0, wrap 2, fillx", "[grow]10px[grow]"));
- setOpaque(false);
- setPreferredSize(new Dimension(450, 440));
- JLabel statusField = new JLabel();
- statusField.setText("Status: Bot initialized... waiting for user action...");
- add(statusField, "span 2, gaptop 5px");
- config.STATUS_UPDATE.add(info -> SwingUtilities.invokeLater(() -> statusField.setText("Status: " + info)));
- int counter = 0;
- for (Map.Entry<String, Integer> entry : config.STATS_INFO.entrySet()) {
- JLabel lbl = new JLabel(entry.getKey() + ": " + entry.getValue());
- config.STATS_INFO_UPDATE.get(entry.getKey()).add(info -> SwingUtilities.invokeLater(() -> lbl.setText(entry.getKey() + ": " + entry.getValue())));
- counter++;
- if(counter < 4){
- add(lbl, "span 2");
- }
- else if(counter == 4){
- add(lbl, "gaptop 10px");
- }
- else{
- add(lbl);
- }
- }
- GateInfoTable gateInfoTable = new GateInfoTable(config);
- add(gateInfoTable.getComponent(), "span 2, gaptop 10px");
- }
- @Override
- public JComponent getComponent() {
- return this;
- }
- @Override
- public void edit(ConfigField configField) {
- }
- @Override
- public String toString(){
- return "Display not available in no-editor-mode";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement