예제 #1
0
 private void updateTerminal() {
   final DefaultStyledDocument doc = new DefaultStyledDocument();
   for (Field f : s3270.getScreen().getFields()) {
     final Style s = getStyle(f);
     final String text = f.getText().replace('\u0000', ' ');
     if ((f instanceof InputField) && text.startsWith(" ")) {
       appendText(doc, " ", styleBlack);
       appendText(doc, text.substring(1), s);
     } else {
       appendText(doc, text, s);
     }
   }
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           try {
             boolean sizeChanged = updateTextPane3270Size();
             if (sizeChanged) {
               updateTabbedPaneSize();
               frame.pack();
             }
             textPane3270.setDocument(doc);
           } catch (RuntimeException e) {
             // do nothing
           }
         }
       });
 }
예제 #2
0
  private Style getStyle(final Field f) {
    final boolean isInput = f instanceof InputField;
    if (f.isHidden()) {
      return styleHidden;
    }

    if (isInput) {
      final InputField inputField = (InputField) f;
      if (inputField.isChanged()) {
        return styleInputChanged;
      } else {
        return styleInput;
      }
    }

    final int i = (f.getExtendedColor() == 0) ? 0 : f.getExtendedColor() - 0xf0;
    Color foregroundColor = extendedColors[i];
    Color backgroundColor = Color.black;
    if (f.getExtendedHighlight() == Field.ATTR_EH_REV_VIDEO) {
      final Color tmp = backgroundColor;
      backgroundColor = foregroundColor;
      foregroundColor = tmp;
    }
    boolean isUnderline = f.getExtendedHighlight() == Field.ATTR_EH_UNDERSCORE;

    if (f.isIntensified()) {
      foregroundColor = Color.white;
    }
    return createStyle(foregroundColor, backgroundColor, isUnderline);
  }