Beispiel #1
0
 public static void setEstilo(String pEstilo) {
   Estilo estilo = Estilo.valueOf(pEstilo);
   switch (estilo) {
     case DEFAULT:
       COLOR_BLOQUE_PRINCIPAL = Color.RED;
       COLOR_CELDA = Color.BLACK;
       COLOR_NOMBRE_VARIABLE = Color.BLACK;
       COLOR_NOMBRE_LLAMADA = Color.BLUE;
       COLOR_LIENZO = Color.WHITE;
       break;
     case VERDENEGRO:
       COLOR_BLOQUE_PRINCIPAL = Color.GREEN.brighter();
       COLOR_CELDA = Color.GREEN.brighter();
       COLOR_NOMBRE_VARIABLE = Color.GREEN.brighter();
       COLOR_NOMBRE_LLAMADA = Color.GREEN.brighter();
       COLOR_LIENZO = Color.BLACK;
       break;
     case OPUESTO:
       COLOR_BLOQUE_PRINCIPAL = Color.RED;
       COLOR_CELDA = Color.WHITE;
       COLOR_NOMBRE_VARIABLE = Color.WHITE;
       COLOR_NOMBRE_LLAMADA = Color.BLUE;
       COLOR_LIENZO = Color.BLACK;
       break;
   }
 }
Beispiel #2
0
  private void paintElementsProgressBar(Graphics g) {
    int leftPadding = 20;
    int topPadding = 56;
    int splashWidth = getSplashScreen().getSize().width;
    int width = Math.min(10 * counter, splashWidth - (leftPadding * 2 + 2));

    g.setColor(Color.GREEN.darker());
    g.fillRect(leftPadding, topPadding, width, 3);
    g.setColor(Color.GREEN.brighter());
    g.fillRect(leftPadding, topPadding, width, 1);
  }
  private static void paintInvariant(
      Graphics g, Invariant i, int size, int ulcx, int ulcy, int width, int height) {
    boolean b = i.check();
    double w = width * (3 / 4.0) / size;

    if (i instanceof RegionInvariant) {
      RegionInvariant ri = (RegionInvariant) i;
      int A = ri.getA();
      int B = ri.getB();

      if (b) {
        g.setColor(Color.GREEN.brighter());
      } else {
        g.setColor(Color.RED.brighter());
      }

      // g.drawRect( 100 + (int)(A*w), 100, (int)((B-A+1)*w), 400 );
      g.drawRect(
          (int) (ulcx + width / 8.0 + A * w),
          (int) (ulcy + height / 6.0),
          (int) ((B - A + 1) * w),
          (int) (height * 2 / 3.0));
    }
  }
 @Override
 public void focusGained(FocusEvent e) {
   // TODO parameter or component
   JTextComponent.class.cast(e.getSource()).setBackground(Color.GREEN.brighter().brighter());
 }
 @Override
 public Color getColor() {
   return Color.GREEN.brighter();
 }
  /**
   * @param isLotsOfFastOutput use 'true' if you expect millions of lines of quickly produced
   *     output, ex. CLI -> "locate /"
   * @param dialogTitle non-HTML
   * @param cliable the port command thread to .start()
   * @param resultCodeListenable permits intelligence regarding failed port CLI commands, can be
   *     'null'
   */
  private JDialog_ProcessStream(
      final boolean isLotsOfFastOutput,
      final String dialogTitle,
      final Cliable cliable,
      final OneArgumentListenable<Integer> resultCodeListenable) {
    super(
        TheUiHolder.INSTANCE.getMainFrame() // stay on top
        ,
        dialogTitle,
        ModalityType.APPLICATION_MODAL);

    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // required
    this.setUndecorated(_IS_UI_IMMOBILE);
    this.setResizable(_IS_UI_IMMOBILE == false);
    ((JPanel) this.getContentPane())
        .setBorder(BorderFactory.createEmptyBorder(10, 10, 5, 10)); // T L B R

    final Window parent = this.getOwner();
    this.setLocation(parent.getX(), parent.getY());
    this.setSize(parent.getWidth(), parent.getHeight());

    final JList jList = new JList();
    jList.setFont(new Font(Font.MONOSPACED, Font.BOLD, 12));
    jList.setForeground(Color.GREEN.brighter());
    jList.setBackground(Color.BLACK);
    jList.setLayoutOrientation(JList.VERTICAL);
    jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jList.setVisibleRowCount(-1); // all

    final AbstractButton ab_Cancel = FocusedButtonFactory.create("Cancel", "");
    ab_Cancel.setEnabled(false);

    final JProgressBar jProgress = new JProgressBar();
    jProgress.setIndeterminate(true);

    // console
    final Listener listener =
        (isLotsOfFastOutput == true)
            ? new LateListening(this, jList, jProgress, ab_Cancel, resultCodeListenable)
            : new LiveListening(this, jList, jProgress, ab_Cancel, resultCodeListenable);

    //        try
    //        {   // try-catch to keep AWT thread alive for proper UI recovery

    final Thread runningThread = cliable.provideExecutingCommandLineInterfaceThread(listener);
    if (runningThread != null) {
      final JPanel southPanel = new JPanel(new GridLayout(1, 0));
      southPanel.add(jProgress);
      southPanel.add(ab_Cancel);

      final JScrollPane jsp =
          JScrollPaneFactory_.create(jList, EScrollPolicy.VERT_AS_NEEDED__HORIZ_NONE);

      // assemble rest of gui in this AWT thread
      this.add(Box.createHorizontalStrut(800), BorderLayout.NORTH);
      this.add(Box.createVerticalStrut(600), BorderLayout.EAST);
      this.add(jsp, BorderLayout.CENTER);
      this.add(southPanel, BorderLayout.SOUTH);

      // not working correctly to Cancel cli
      //        ab.addActionListener( new ActionListener() // anonymous class
      //                {   @Override public void actionPerformed( ActionEvent e )
      //                    {   thread.interrupt();
      //                        try
      //                        {   // Cancel
      //                            thread.join( 2000 );
      //                        }
      //                        catch( InterruptedException ex )
      //                        {}
      //                    }
      //                } );
    } else { // no Ports binary to run
      this.dispose();
    }

    //        }
    //        catch( Exception ex )
    //        {
    //            ex.printStackTrace();
    //        }
  }