Example #1
0
 /**
  * A change in the text fields.
  *
  * @param e the document event.
  */
 private void documentChanged(DocumentEvent e) {
   if (e.getDocument().equals(fileCountField.getDocument())) {
     // set file count only if its un integer
     try {
       int newFileCount = Integer.valueOf(fileCountField.getText());
       fileCountField.setForeground(Color.black);
       LoggingUtilsActivator.getPacketLoggingService()
           .getConfiguration()
           .setLogfileCount(newFileCount);
     } catch (Throwable t) {
       fileCountField.setForeground(Color.red);
     }
   } else if (e.getDocument().equals(fileSizeField.getDocument())) {
     // set file size only if its un integer
     try {
       int newFileSize = Integer.valueOf(fileSizeField.getText());
       fileSizeField.setForeground(Color.black);
       LoggingUtilsActivator.getPacketLoggingService()
           .getConfiguration()
           .setLimit(newFileSize * 1000);
     } catch (Throwable t) {
       fileSizeField.setForeground(Color.red);
     }
   }
 }
Example #2
0
  @Override
  protected void prepareComponent(
      JPanel component,
      HierarchicalTable<Property> table,
      Property property,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column,
      boolean forEditor) {
    super.prepareComponent(
        component, table, property, value, isSelected, hasFocus, row, column, forEditor);

    if (property.getButtonText() == null) {
      button.setVisible(false);
    } else {
      button.setVisible(true);
      button.setText(property.getButtonText());
      button.setToolTipText(property.getButtonTooltip());
    }

    if (isSelected && !forEditor) {
      textfield.setBackground(table.getSelectionBackground());
      textfield.setForeground(table.getSelectionForeground());
    } else {
      textfield.setBackground(table.getBackground());
      textfield.setForeground(table.getStyle().getValueCellFontColor());
    }
    panel.setBackground(textfield.getBackground());
    textfield.setFont(table.getStyle().getValueCellFont());
    textfield.setBorder(null);

    textfield.setText(FORMAT.format(value));
  }
 private void setJTextFieldColor(final JTextField tf, boolean isFloat) {
   if (!isFloat && (getIntValue(tf) > -1 || isVariableValue(tf))) {
     tf.setForeground(Color.black);
   } else if (isFloat && (getFloatValue(tf) > -1 || isVariableValue(tf))) {
     tf.setForeground(Color.black);
   } else {
     tf.setForeground(Color.red);
   }
 }
 @Override
 public void caretUpdate(CaretEvent e2) {
   try {
     det.setCustomSeed(Integer.parseInt(customSeedField.getText()));
     customSeedField.setForeground(Color.BLACK);
   } catch (NumberFormatException e) {
     customSeedField.setForeground(Color.RED);
   }
 }
 public void updatePageCounterField(int n) {
   if (pageCounterField == null) return;
   if (n == 0) {
     pageCounterField.setBackground(pageCounterFieldDefaultColor);
     pageCounterField.setForeground(Color.BLACK);
     pageCounterButton.setForeground(pageCounterButtonDefaultForeground);
   } else {
     pageCounterField.setBackground(pageCounterFieldColor);
     pageCounterField.setForeground(Color.WHITE);
     pageCounterButton.setForeground(pageCounterFieldColor);
   }
   pageCounterField.setText("" + n);
 }
  /**
   * Verify that the value is correct.
   *
   * @param input
   * @return true if the value is valid; false otherwise
   */
  private boolean verifyValueInput(JComponent input) {
    JTextField textField = (JTextField) input;
    String inputString = textField.getText();
    try {
      Double.parseDouble(inputString);
    } catch (NumberFormatException e) {
      textField.setForeground(Color.RED);
      return false;
    }

    textField.setForeground(Color.BLACK);
    return true;
  }
Example #7
0
 private void filterValidStateChanged(LogView4JEvent event) {
   Boolean isValid = (Boolean) event.get(LogView4JEventKey.FILTER_VALID);
   if (Boolean.TRUE.equals(isValid)) {
     quickFilterTextField.setToolTipText("Quick filter");
     quickFilterTextField.setBackground(Color.WHITE);
     quickFilterTextField.setForeground(Color.BLACK);
   } else {
     String error = (String) event.get(LogView4JEventKey.ERROR_MESSAGE);
     quickFilterTextField.setToolTipText("Quick filter : " + error);
     quickFilterTextField.setBackground(INVALID_COLOR);
     quickFilterTextField.setForeground(Color.WHITE);
   }
 }
 /** Update Display with Connection info */
 public void setDisplay() {
   m_text.setText(getDisplay());
   if (m_value == null) return;
   //  Text
   if (m_value.isAppsServerOK(false) || m_value.isDatabaseOK()) {
     m_text.setForeground(AdempierePLAF.getTextColor_OK());
     setBackground(false);
     if (!m_value.isAppsServerOK(false))
       m_server.setBackground(AdempierePLAF.getFieldBackground_Error());
     if (!m_value.isDatabaseOK()) m_db.setBackground(AdempierePLAF.getFieldBackground_Error());
   } else {
     m_text.setForeground(AdempierePLAF.getTextColor_Issue());
     setBackground(true);
   }
 } //  setDisplay
Example #9
0
 private void updateTotals() {
   boolean used = processAssignmentList.size() > 0;
   machineLabel.setEnabled(used);
   for (MrResource resource : resourceList) {
     JTextField resourceField = resourceFieldMap.get(resource);
     long maximumCapacity;
     long safetyCapacity;
     if (machine != null) {
       MrMachineCapacity machineCapacity = machine.getMachineCapacity(resource);
       maximumCapacity = machineCapacity.getMaximumCapacity();
       safetyCapacity = machineCapacity.getSafetyCapacity();
     } else {
       maximumCapacity = 0L;
       safetyCapacity = 0L;
     }
     long usedTotal = 0L;
     for (MrProcessAssignment processAssignment : processAssignmentList) {
       usedTotal += processAssignment.getProcess().getProcessRequirement(resource).getUsage();
     }
     resourceField.setText(usedTotal + " / " + maximumCapacity);
     resourceField.setForeground(
         usedTotal > maximumCapacity
             ? TangoColorFactory.SCARLET_3
             : (usedTotal > safetyCapacity ? TangoColorFactory.ORANGE_3 : Color.BLACK));
     resourceField.setEnabled(used);
   }
   numberOfProcessesLabel.setText(processAssignmentList.size() + " processes ");
   numberOfProcessesLabel.setEnabled(used);
 }
  public ConexionServidorCMD() {
    super("Cliente"); // Establece titulo al Frame

    campoTexto = new JTextField(); // crea el campo para texto
    campoTexto.setEditable(false); // No permite que sea editable el campo de texto
    add(campoTexto, BorderLayout.NORTH); // Coloca el campo de texto en la parte superior

    areaTexto = new JTextArea(); // Crear displayArea
    areaTexto.setEditable(false);
    add(new JScrollPane(areaTexto), BorderLayout.CENTER);
    areaTexto.setBackground(Color.orange); // Pone de color cyan al displayArea
    areaTexto.setForeground(Color.BLACK); // pinta azul la letra en el displayArea
    campoTexto.setForeground(Color.BLACK); // pinta toja la letra del mensaje a enviar

    // Crea menu Archivo y submenu Salir, ademas agrega el submenu al menu
    JMenu menuArchivo = new JMenu("Archivo");
    JMenuItem salir = new JMenuItem("Salir");
    menuArchivo.add(salir); // Agrega el submenu Salir al menu menuArchivo

    JMenuBar barra = new JMenuBar(); // Crea la barra de menus
    setJMenuBar(barra); // Agrega barra de menus a la aplicacion
    barra.add(menuArchivo); // agrega menuArchivo a la barra de menus

    // Accion que se realiza cuando se presiona el submenu Salir
    salir.addActionListener(
        new ActionListener() { // clase interna anonima
          public void actionPerformed(ActionEvent e) {
            System.exit(0); // Sale de la aplicacion
          }
        });

    setSize(300, 320); // Establecer tamano a ventana
    setVisible(true); // Pone visible la ventana
  }
  public SurrenderUI() {
    setType(Type.UTILITY);

    ExitB = new JButton("Exit");
    ExitB.setFont(new Font("Tahoma", Font.BOLD, 12));
    ExitB.setBackground(new Color(255, 215, 0));
    ExitB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
            new HSmain();
          }
        });
    ExitB.setBounds(461, 427, 296, 60);

    setTitle("Surrendering a Pet");
    Container pane = getContentPane();
    getContentPane().setLayout(null);
    pane.add(ExitB);

    txtSurrender = new JTextField();
    txtSurrender.setEditable(false);
    txtSurrender.setForeground(new Color(0, 0, 0));
    txtSurrender.setBackground(new Color(255, 215, 0));
    txtSurrender.setBounds(10, 11, 764, 50);
    txtSurrender.setHorizontalAlignment(SwingConstants.CENTER);
    txtSurrender.setFont(new Font("Lucida Handwriting", Font.BOLD, 18));
    txtSurrender.setText("Surrendering a Pet");
    getContentPane().add(txtSurrender);
    txtSurrender.setColumns(10);

    BackB = new JButton("Back");
    BackB.setFont(new Font("Tahoma", Font.BOLD, 12));
    BackB.setBackground(new Color(255, 215, 0));
    BackB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new AnimalServiceUI();
            dispose();
          }
        });
    BackB.setBounds(26, 427, 320, 60);
    getContentPane().add(BackB);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(0, 72, 764, 329);
    getContentPane().add(scrollPane);

    JTextPane txtSurrenderInfo = new JTextPane();
    scrollPane.setViewportView(txtSurrenderInfo);
    txtSurrenderInfo.setForeground(new Color(0, 0, 0));
    txtSurrenderInfo.setEditable(false);
    txtSurrenderInfo.setFont(new Font("Times New Roman", Font.BOLD, 15));
    txtSurrenderInfo.setText(
        "\tThe Humane Society of Lamar cannot accept every animal brought to our shelter immediately. \r\nWe respect the difficult decision of owners to relinquish their pets, and the hard choices of those \r\ngood citizens who are trying to help a stray. We accept the surrender of pets as space allows. \r\nWe maintain a waiting list for all animals needing to be admitted to the shelter.\r\nAnimals are surrendered to our facility by appointment.\r\nWe admit at least 12 animals per week. We accept more animals as adoptions and space allow.\r\nNote that we cannot accept aggressive, sick or pregnant animals.\r\nPlease call 409-225-7981, and one of our adoption specialists will speak to you.\r\nAt times our waiting list will have up to 100 animals waiting for admission and it can take several weeks \r\nbefore we can admit your pet.\r\nPlease understand that our primary goal is to place as many animals in forever homes as possible, \r\ntherefore we must give every pet admitted to the shelter enough time to find a loving home. \r\nWe cannot guarantee placement of every animal admitted to the shelter.\r\n\t\r\n\tAdmission of any animal into the Humane Society of Lamar  is based on the animal\u2019s health, \r\nbehavior, and adoptability. When you bring your pets, please have:\r\n\r\n    *Any veterinary records\r\n    *Your pet\u2019s medications\r\n    *Special food or treats that your pet needs\r\n    *Your pet\u2019s bed, toys, leash and other belongings from home\r\n\r\nA staff member will evaluate the temperament of your pet. Once your pet has been screened, \r\nand the Humane Society of Lamar decides to accept your pet, we ask a donation to our shelter to be made. \r\nThis is not required, but will greatly help us care for your pet.");

    setSize(800, 553);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
  private static void configControls(
      String optionName,
      int value,
      boolean highlight,
      JLabel sizeLabel,
      JTextField sizeField,
      JLabel unitsLabel,
      JLabel currentValueLabel) {
    sizeLabel.setText(optionName);

    String formatted =
        value == -1
            ? DiagnosticBundle.message("diagnostic.out.of.memory.currentValue.unknown")
            : String.valueOf(value);
    sizeField.setText(formatted);
    currentValueLabel.setText(
        DiagnosticBundle.message("diagnostic.out.of.memory.currentValue", formatted));

    if (highlight) {
      sizeLabel.setForeground(Color.RED);
      sizeField.setForeground(Color.RED);
      unitsLabel.setForeground(Color.RED);
      currentValueLabel.setForeground(Color.RED);
    }
  }
Example #13
0
  public RFIDGUI() {

    setLayout(new FlowLayout());
    // label = new JTextField(ThreadTwoTestTwo.randomQuestionStatement);
    Question.setFont(new Font("Serif", Font.BOLD, 18));
    // Points.setFont(new Font("Serif", Font.BOLD, 50));
    // Question.setBounds(300, 250, 900, 300);
    // Points.setBounds(1200, 600, 300, 200);

    // Points.setHorizontalAlignment(JTextField.RIGHT);
    // Points.set
    Question.setForeground(Color.blue);
    // Points.setForeground(Color.red);
    add(Question);
    // Question.validate();
    // add(Points, BorderLayout.SOUTH);
    // Points.validate();
    // Question.setLocation(0, 0);
    // Points.setLocation(1600,900);

    /*while(count<70){
    //secondDoneYet = false;
    while (!secondDoneYet) {
    	//label = new JTextField(ThreadTwoTestTwo.randomQuestionStatement);
    	label.repaint();
    	secondDoneYet = true;
    	count++;

    	/*
    	 * while(ThreadTwoTestTwo.amountOfQuestions <=60){
    	 * label.repaint(); }
    	 */
  }
Example #14
0
    @Override
    public void actionPerformed(ActionEvent e) {
      // TODO Auto-generated method stub

      Object source = e.getSource();
      if (source == ok) {
        response = APPLY_OPTION;
        this.setVisible(false);
      } else if (source == cancel) {
        response = CANCEL_OPTION;
        this.setVisible(false);
      } else if (source == sizeCombo) {
        // get the number from the source
        JComboBox number = (JComboBox) source;
        String numberItem = (String) number.getSelectedItem();
        Font temp = example.getFont();
        // then set the font
        int newSize = Integer.parseInt(numberItem);
        example.setFont(new Font(temp.getFamily(), temp.getStyle(), newSize));
      } else if (source == fontCombo) {
        JComboBox font = (JComboBox) source;
        String s = (String) font.getSelectedItem();
        Font tmp = example.getFont();
        example.setFont(new Font(s, tmp.getStyle(), tmp.getSize()));
      } else if (source == foreground) {
        Color tmp = JColorChooser.showDialog(this, "Choose text color", example.getForeground());
        MenuBar.shapeLBG.setBackground(tmp);
        if (tmp != null) example.setForeground(tmp);
      }
    }
  @Override
  public void actionPerformed(ActionEvent e) {
    // TODO Auto-generated method stub
    Object source = e.getSource();

    if (source == ok) {
      userResponse = APPLY_OPTION;
      this.setVisible(false);
    } else if (source == cancel) {
      userResponse = CANCEL_OPTION;
      this.setVisible(false);
    } else if (source == fontCombo) {
      @SuppressWarnings("unchecked")
      JComboBox<String> cb = (JComboBox<String>) source;
      String s = (String) cb.getSelectedItem();
      Font tmp = example.getFont();
      example.setFont(new Font(s, tmp.getStyle(), tmp.getSize()));
    } else if (source == sizeCombo) {
      @SuppressWarnings("unchecked")
      JComboBox<String> cb = (JComboBox<String>) source;
      String s = (String) cb.getSelectedItem();
      int newSize = Integer.parseInt(s);
      Font tmp = example.getFont();
      example.setFont(new Font(tmp.getFamily(), tmp.getStyle(), newSize));
    } else if (source == foreground) {
      Color tmp = JColorChooser.showDialog(this, "Choose text color", example.getForeground());
      if (tmp != null) example.setForeground(tmp);
    }
  }
  /**
   * Verify that the value is correct.
   *
   * @param input
   * @return true if the value is valid; false otherwise
   */
  private boolean verifyWidthInput(JComponent input) {
    JTextField textField = (JTextField) input;
    String inputString = textField.getText();
    try {
      float width = Float.parseFloat(inputString);
      if (width <= 0.0) {
        textField.setForeground(Color.RED);
        return false;
      }
    } catch (NumberFormatException e) {
      textField.setForeground(Color.RED);
      return false;
    }

    textField.setForeground(Color.BLACK);
    return true;
  }
Example #17
0
  // methods
  public void updateMessage() {
    messageField.setText(message);
    messageField.setFont(messageFont);
    messageField.setForeground(foreground);
    messageField.setBackground(background);
    // tt = messageField.getText();

  }
Example #18
0
  public static JTextField getTextField(int size) {
    JTextField component = new JTextField(size);
    component.setBackground(BACKGROUND_COLOR_TXTA);
    component.setForeground(TEXT_COLOR_TXTA);

    component.setFont(FONT_TYPE_TXTA);

    return component;
  }
Example #19
0
  loginframe() {
    Container c = getContentPane();
    c.setLayout(null);
    Color co1 = new Color(252, 251, 251);
    Color co2 = new Color(153, 153, 153);
    Color co3 = new Color(0, 0, 0);
    Font fo1 = new Font("Curlz MT", Font.BOLD, 35);
    Font fo2 = new Font("Tahoma", Font.BOLD, 14);
    Font fo3 = new Font("Tahoma", Font.PLAIN, 12);

    l1 = new JLabel("LOGIN");
    l1.setFont(fo1);
    c.add(l1);
    l1.setBounds(130, 30, 200, 30);
    l1.setForeground(co1);

    l2 = new JLabel("Username");
    c.add(l2);
    l2.setBounds(130, 100, 100, 30);
    l2.setForeground(co1);
    l2.setFont(fo2);

    l3 = new JLabel("Password");
    c.add(l3);
    l3.setBounds(130, 150, 100, 30);
    l3.setForeground(co1);
    l3.setFont(fo2);

    t1 = new JTextField();
    t1.setBounds(250, 100, 120, 25);
    c.add(t1);
    t1.setBackground(co2);
    t1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    t1.setForeground(co3);
    t1.setFont(fo3);

    p1 = new JPasswordField();
    p1.setBounds(250, 150, 120, 25);
    c.add(p1);
    p1.setBackground(co2);
    p1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

    b1 = new JButton("Login");
    b1.setBounds(140, 220, 70, 30);
    b1.addActionListener(this);
    c.add(b1);

    b2 = new JButton("Exit");
    b2.setBounds(270, 220, 70, 30);
    b2.addActionListener(this);
    c.add(b2);

    l4 = new JLabel("");
    c.add(l4);
    l4.setBounds(0, 0, 464, 409);
    l4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/loginpackage/locked2_1.jpg")));
  }
Example #20
0
    @Override
    public void installUI(JComponent c) {
      super.installUI(c);

      jtf = (JTextField) c;

      JTextField editor = jtf;

      UIDefaults uidefaults = XToolkit.getUIDefaults();

      String prefix = getPropertyPrefix();
      Font f = editor.getFont();
      if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
      }

      Color bg = editor.getBackground();
      if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
      }

      Color fg = editor.getForeground();
      if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
      }

      Color color = editor.getCaretColor();
      if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
      }

      Color s = editor.getSelectionColor();
      if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
      }

      Color sfg = editor.getSelectedTextColor();
      if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
      }

      Color dfg = editor.getDisabledTextColor();
      if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
      }

      Border b = editor.getBorder();
      if ((b == null) || (b instanceof UIResource)) {
        editor.setBorder(uidefaults.getBorder(prefix + ".border"));
      }

      Insets margin = editor.getMargin();
      if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
      }
    }
Example #21
0
 private void addErrorMessagePlaceholder() {
   errorMessage = new JTextField();
   errorMessage.setForeground(COLOR_DANGER);
   errorMessage.setBounds(BOUNDS_LOGIN_ERROR_MESSAGE);
   errorMessage.setFont(ClientUI.FONT_NORMAL);
   errorMessage.setHorizontalAlignment(JTextField.CENTER);
   errorMessage.setBorder(BorderFactory.createEmptyBorder());
   errorMessage.setEditable(false);
   contentPanel.add(errorMessage);
 }
 /**
  * Creates a {@link JTextField} customized for use in this UI widget.
  *
  * @return a {@link JTextField}
  */
 protected JTextField createTextField() {
   JTextField tf = UIHelper.createTextField();
   Insets insets = tf.getBorder().getBorderInsets(tf);
   tf.setBorder(
       BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom));
   tf.setForeground(Color.BLACK);
   tf.setBackground(Color.WHITE);
   tf.setEditable(false);
   return tf;
 }
  private void updateUserValue(boolean highlightError) {
    if (editorComponent != null) {
      JTextField valueTextField = editorComponent.getTextField();
      if (valueTextField.isEditable()) {
        try {
          Object value = getEditorValue();
          editorComponent.getUserValueHolder().updateUserValue(value, false);
          valueTextField.setForeground(UIUtil.getTextFieldForeground());
        } catch (ParseException e1) {
          if (highlightError) {
            valueTextField.setForeground(Color.RED);
          }

          // DBDataType dataType = cell.getColumnInfo().getDataType();
          // MessageUtil.showErrorDialog("Can not convert " + valueTextField.getText() + " to " +
          // dataType.getName());
        }
      }
    }
  }
Example #24
0
 public void setColor(final Color color) {
   final Color oldColor = colorTextField.getBackground();
   colorTextField.setBackground(color);
   final double l =
       color.getRed() / 255.0 * 0.299
           + color.getGreen() / 255.0 * 0.587
           + color.getBlue() / 255.0 * 0.114;
   colorTextField.setForeground(l > 0.5 ? Color.BLACK : Color.WHITE);
   colorTextField.setText("#" + Integer.toHexString(color.getRGB()).toUpperCase());
   firePropertyChange("color", oldColor, color);
 }
  /** Affichage en mode GUI. */
  public void drawGUI() {
    panel.removeAll();
    // panel.updateUI();

    JLabel label = new JLabel("Choix pseudo joueurs");
    label.setFont(new Font("Serif", Font.BOLD, 22));
    panel.add(label);

    JLabel j1 = new JLabel("Joueur 1");
    j1.setFont(new Font("Serif", Font.PLAIN, 16));
    panel.add(j1);

    pseudoJ1 = new JTextField();
    pseudoJ1.setFont(new Font("Serif", Font.PLAIN, 16));
    pseudoJ1.setPreferredSize(new Dimension(150, 30));
    pseudoJ1.setForeground(Color.BLACK);

    panel.add(pseudoJ1);

    // Si on ne joue pas contre une IA, on demande au joueur 2 son pseudo aussi
    if (this.jeu.getTypeJeu() != Jeu.TYPE_JOUEUR_VS_IA) {
      JLabel j2 = new JLabel("Joueur 2");
      j2.setFont(new Font("Serif", Font.PLAIN, 16));
      panel.add(j2);

      pseudoJ2 = new JTextField();
      pseudoJ2.setFont(new Font("Serif", Font.PLAIN, 16));
      pseudoJ2.setPreferredSize(new Dimension(150, 30));
      pseudoJ2.setForeground(Color.BLACK);

      panel.add(pseudoJ2);
    }

    boutonOK = new JButton("Ok");
    boutonOK.addActionListener(this);
    panel.add(boutonOK);

    window.setContentPane(panel);
    window.pack();
    window.setVisible(true);
  }
Example #26
0
  public void addString(String msg) {
    JTextField txtF = new JTextField();
    txtF.setText(msg);
    txtF.setVisible(true);
    txtF.setBounds(new Rectangle(10, mYPos, X_WINDOW_SIZE * 5, Y_HEIGHT));
    txtF.setBackground(mMainColor);
    txtF.setBorder(BorderFactory.createEmptyBorder());
    txtF.setForeground(Color.WHITE);
    mJMain.add(txtF);

    mYPos += Y_STEP;
  }
  public ConsoleWindow() {
    if (gui) {
      window = new JFrame("Package Tracking Console");
      window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      window.setSize((int) (screenSize.getWidth() / 4), (int) (screenSize.getHeight() / 1.5));
      window.setLocationRelativeTo(null);
      window.getContentPane().setLayout(new BorderLayout());

      menuBar = new JMenuBar();
      menuBar.add("test", new JLabel("Testing"));
      window.setJMenuBar(menuBar);

      StyleContext sc = new StyleContext();
      document = new DefaultStyledDocument(sc);

      // Styles

      send = sc.addStyle("(Send)", null);
      send.addAttribute(StyleConstants.Foreground, Color.CYAN);

      info = sc.addStyle("(Info)", null);
      info.addAttribute(StyleConstants.Foreground, Color.WHITE);

      warning = sc.addStyle("(Warning)", null);
      warning.addAttribute(StyleConstants.Foreground, Color.YELLOW);

      error = sc.addStyle("(Error)", null);
      error.addAttribute(StyleConstants.Foreground, Color.RED);
      error.addAttribute(StyleConstants.Bold, new Boolean(true));

      textArea = new JTextPane(document);
      textArea.setBackground(new Color(50, 50, 50));
      textArea.setEditable(true);
      textArea.setBorder(null);
      textArea.setForeground(Color.WHITE);

      scrollPane = new JScrollPane(textArea);
      new SmartScroller(scrollPane);

      window.getContentPane().add(scrollPane);

      input = new JTextField();
      input.setBackground(new Color(50, 50, 50));
      input.setForeground(Color.WHITE);
      input.setCaretColor(Color.WHITE);
      input.addActionListener(new test());
      window.getContentPane().add(input, BorderLayout.SOUTH);

      window.setVisible(true);
      info.addAttribute(StyleConstants.Foreground, Color.BLUE);
    }
  }
Example #28
0
 public JTextField createTextField() {
   JTextField field = new JTextField();
   field.setBackground(fieldBg);
   field.setForeground(fieldtextColor);
   field.setCaretColor(fieldtextColor);
   if (fieldBorder != null)
     field.setBorder(
         BorderFactory.createCompoundBorder(
             BorderFactory.createLineBorder(fieldBorder, 1),
             BorderFactory.createEmptyBorder(0, 3, 0, 3)));
   return field;
 }
  private void updateValidity() {
    boolean isDirectoryValid = isDestinationDirectoryValid();

    saveToFileField.setForeground(
        isDirectoryValid ? UIManager.getColor("TextField.foreground") : Color.RED); // NOI18N

    boolean isValid = saveToProjectRadio.isSelected() || isDirectoryValid;

    if (isValid != areSettingsValid()) {
      fireValidityChanged(isValid);
    }
  }
Example #30
0
  // ----------------------------------------------------------------------------
  private JPanel createTextField() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(new TitledBorder(new EtchedBorder(), "Text"));
    text_field_ = new JTextField("Preview Font");
    text_field_.setBackground(Color.white);
    text_field_.setForeground(Color.black);
    text_field_.setOpaque(true);
    text_field_.setBorder(new LineBorder(Color.black));
    text_field_.setPreferredSize(new Dimension(120, 40));
    panel.add(text_field_, BorderLayout.CENTER);

    return panel;
  }