コード例 #1
0
  public void refresh() {
    Message message = new Message();
    try {
      message = this.trainingTeaBLService.showFrameStrategy();

    } catch (RemoteException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    if (message.getMesType().equals(MessageType.traTea_showStrategy_fail)) {
      // JOptionPane.showMessageDialog(this, "整体框架策略尚未发布!");
      jl1.setVisible(true);
      jb2.setEnabled(false);
      if (jsp1 != null) {
        jsp1.setVisible(false);
      }
    } else if (message.getMesType().equals(MessageType.traTea_showStrategy_success)) {
      jl1.setVisible(false);
      ArrayList<Dean> dean = message.getDeans();
      ArrayList<String> attriOfDean = message.getAttriOfDean();
      tm1 = new StrategyTableModel(dean, attriOfDean);
      if (jsp1 != null) {
        jt1.setModel(tm1);
        jsp1.setVisible(true);
      } else {
        jt1 = new JTable();
        jt1.setModel(tm1);

        jsp1 = new JScrollPane(jt1);
        strategy.add(jsp1);
      }

      if (dean.size() >= 15) {
        jb1.setEnabled(false);
      }

      jb2.setEnabled(true);

    } else {
      JOptionPane.showMessageDialog(this, "你的网络貌似有点问题!");
    }
  }
コード例 #2
0
ファイル: Chrome.java プロジェクト: Pjrat111/RSBot-1
 private void init() {
   setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
   addWindowListener(
       new WindowAdapter() {
         @Override
         public void windowClosing(final WindowEvent e) {
           cleanExit();
         }
       });
   addWindowStateListener(
       new WindowStateListener() {
         public void windowStateChanged(final WindowEvent arg0) {
           switch (arg0.getID()) {
             case WindowEvent.WINDOW_ICONIFIED:
               lessCpu(true);
               break;
             case WindowEvent.WINDOW_DEICONIFIED:
               lessCpu(false);
               break;
           }
         }
       });
   setIconImage(Configuration.getImage(Configuration.Paths.Resources.ICON));
   JPopupMenu.setDefaultLightWeightPopupEnabled(false);
   WindowUtil.setFrame(this);
   panel = new BotPanel();
   menuBar = new BotMenuBar(this);
   toolBar = new BotToolBar(this, menuBar);
   panel.setFocusTraversalKeys(0, new HashSet<AWTKeyStroke>());
   new BotKeyboardShortcuts(KeyboardFocusManager.getCurrentKeyboardFocusManager(), this, this);
   menuBar.setBot(null);
   setJMenuBar(menuBar);
   textScroll =
       new JScrollPane(
           TextAreaLogHandler.TEXT_AREA,
           ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
           ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
   textScroll.setBorder(null);
   textScroll.setPreferredSize(new Dimension(PANEL_WIDTH, 120));
   textScroll.setVisible(true);
   JScrollPane scrollableBotPanel = new JScrollPane(panel);
   add(toolBar, BorderLayout.NORTH);
   add(scrollableBotPanel, BorderLayout.CENTER);
   add(textScroll, BorderLayout.SOUTH);
 }
コード例 #3
0
  public static void main() {
    // Main
    frame = new JFrame("Java Playground");
    frame.setSize(640, 480);
    // Make sure the divider is properly resized
    frame.addComponentListener(
        new ComponentAdapter() {
          public void componentResized(ComponentEvent c) {
            splitter.setDividerLocation(.8);
          }
        });
    // Make sure the JVM is reset on close
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosed(WindowEvent w) {
            new FrameAction().kill();
          }
        });

    // Setting up the keybinding
    // Ctrl+k or Cmd+k -> compile
    bind(KeyEvent.VK_K);

    // Ctrl+e or Cmd+e -> console
    bind(KeyEvent.VK_E);

    // Save, New file, Open file, Print.
    // Currently UNUSED until I figure out how normal java files and playground files will
    // interface.
    bind(KeyEvent.VK_S);
    bind(KeyEvent.VK_N);
    bind(KeyEvent.VK_O);
    bind(KeyEvent.VK_P);

    // Binds the keys to the action defined in the FrameAction class.
    frame.getRootPane().getActionMap().put("console", new FrameAction());

    // The main panel for typing code in.
    text = new JTextPane();
    textScroll = new JScrollPane(text);
    textScroll.setBorder(null);
    textScroll.setPreferredSize(new Dimension(640, 480));

    // Document with syntax highlighting. Currently unfinished.
    doc = text.getStyledDocument();
    doc.addDocumentListener(
        new DocumentListener() {
          public void changedUpdate(DocumentEvent d) {}

          public void insertUpdate(DocumentEvent d) {}

          public void removeUpdate(DocumentEvent d) {}
        });

    ((AbstractDocument) doc).setDocumentFilter(new NewLineFilter());

    // The output log; a combination compiler warning/error/runtime error/output log.
    outputText = new JTextPane();
    outputScroll = new JScrollPane(outputText);
    outputScroll.setBorder(null);

    // "Constant" for the error font
    error = new SimpleAttributeSet();
    error.addAttribute(StyleConstants.CharacterConstants.Italic, Boolean.TRUE);
    error.addAttribute(StyleConstants.Foreground, Color.RED);

    // "Constant" for the warning message font
    warning = new SimpleAttributeSet();
    warning.addAttribute(StyleConstants.CharacterConstants.Italic, Boolean.TRUE);
    warning.addAttribute(StyleConstants.Foreground, Color.PINK);

    // "Constant" for the debugger error font
    progErr = new SimpleAttributeSet();
    progErr.addAttribute(StyleConstants.Foreground, Color.BLUE);

    // Print streams to redirect System.out and System.err.
    out = new TextOutputStream(outputText, null);
    err = new TextOutputStream(outputText, error);
    System.setOut(new PrintStream(out));
    System.setErr(new PrintStream(err));

    // Sets up the output log
    outputText.setEditable(false);
    outputScroll.setVisible(true);

    // File input/output setup
    chooser = new JFileChooser();

    // Setting up miscellaneous stuff
    compiler = ToolProvider.getSystemJavaCompiler();
    JVMrunning = false;
    redirectErr = null;
    redirectOut = null;
    redirectIn = null;

    // Sets up the splitter pane and opens the program up
    splitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT, textScroll, outputScroll);
    consoleDisplayed = false;
    splitter.remove(outputScroll); // Initially hides terminal until it is needed
    splitter.setOneTouchExpandable(true);
    frame.add(splitter);
    frame.setVisible(true);

    // Sets the divider to the proper one, for debugging
    // splitter.setDividerLocation(.8);
  }
コード例 #4
0
  /** Initialize the common user interface components. */
  private void initUI() {
    /* initialize fields */
    {
      pFileSeqPanels = new TreeMap<FileSeq, JFileSeqPanel>();
    }

    /* initialize the popup menus */
    {
      initBasicMenus(true, false);
      updateMenuToolTips();
    }

    /* initialize the panel components */
    {
      setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

      /* header */
      {
        pApplyToolTipText = "Replace the working area files with the selected checked-in files.";
        pUnApplyToolTipText = "There are no unsaved changes to Apply at this time.";

        JPanel panel = initHeader(true);
        add(panel);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      /* full node name */
      {
        LinkedList<Component> extra = new LinkedList<Component>();
        extra.add(Box.createRigidArea(new Dimension(4, 0)));
        {
          JButton btn = new JButton();
          pSeqLayoutButton = btn;
          btn.setName(pIsListLayout ? "ListLayoutButton" : "TabbedLayoutButton");

          Dimension size = new Dimension(19, 19);
          btn.setMinimumSize(size);
          btn.setMaximumSize(size);
          btn.setPreferredSize(size);

          btn.setActionCommand("seq-layout-changed");
          btn.addActionListener(this);

          extra.add(btn);
        }

        initNameField(this, extra);

        pNodeNameField.setFocusable(true);
        pNodeNameField.addKeyListener(this);
        pNodeNameField.addMouseListener(this);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      {
        JTabbedPane tab = new JTabbedPane();
        pFileSeqsTab = tab;
        tab.setVisible(!pIsListLayout);
        add(tab);
      }

      {
        Box vbox = new Box(BoxLayout.Y_AXIS);
        pFileSeqsBox = vbox;

        {
          JScrollPane scroll = UIFactory.createVertScrollPane(vbox);
          pFileSeqsScroll = scroll;
          scroll.setVisible(!pIsListLayout);

          add(scroll);
        }
      }

      Dimension size = new Dimension(sSize + 22, 120);
      setMinimumSize(size);
      setPreferredSize(size);

      setFocusable(true);
      addKeyListener(this);
      addMouseListener(this);
    }

    updateNodeStatus(null, null, null);
  }