Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.StyledText


        }
      });
   
      // log area

    log = new StyledText(child2,SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    grid_data = new GridData(GridData.FILL_BOTH);
    grid_data.horizontalSpan = 1;
    grid_data.horizontalIndent = 4;
    log.setLayoutData(grid_data);
    log.setIndent( 4 );
View Full Code Here


    shell.setLayout(layout);
    GridData grid_data = new GridData(GridData.FILL_BOTH );
    shell.setLayoutData(grid_data);

   
    log = new StyledText(shell,SWT.READ_ONLY | SWT.V_SCROLL | SWT.BORDER | SWT.WRAP | SWT.NO_FOCUS );
    grid_data = new GridData(GridData.FILL_BOTH);
    grid_data.horizontalSpan = 1;
    grid_data.horizontalIndent = 4;
    grid_data.widthHint = 300;
    grid_data.heightHint = 400;
View Full Code Here

        addOption( opt5, NetStatusPluginTester.TEST_BT_CONNECT );
       
      // log area
   
    log = new StyledText(main,SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    grid_data = new GridData(GridData.FILL_BOTH);
    grid_data.horizontalSpan = 1;
    grid_data.horizontalIndent = 4;
    log.setLayoutData(grid_data);
    log.setIndent( 4 );
View Full Code Here

        } catch (IOException e) {
        }
      }
    } else {

      StyledText helpPanel = new StyledText(cWhatsNew, SWT.VERTICAL | SWT.HORIZONTAL);

      helpPanel.setEditable(false);
      try {
        helpPanel.setRedraw(false);
        helpPanel.setWordWrap(false);
        helpPanel.setFont(monospace);

        black = ColorCache.getColor(display, 0, 0, 0);
        white = ColorCache.getColor(display, 255, 255, 255);
        light = ColorCache.getColor(display, 200, 200, 200);
        grey = ColorCache.getColor(display, 50, 50, 50);
        green = ColorCache.getColor(display, 30, 80, 30);
        blue = ColorCache.getColor(display, 20, 20, 80);
        int style;
        boolean setStyle;

        helpPanel.setForeground(grey);

        String[] lines = sWhatsNew.split("\\r?\\n");
        for (int i = 0; i < lines.length; i++) {
          String line = lines[i];

          setStyle = false;
          fg = grey;
          bg = white;
          style = SWT.NORMAL;

          char styleChar;
          String text;

          if (line.length() < 2) {
            styleChar = ' ';
            text = " " + lineSeparator;
          } else {
            styleChar = line.charAt(0);
            text = line.substring(1) + lineSeparator;
          }

          switch (styleChar) {
            case '*':
              text = "  * " + text;
              fg = green;
              setStyle = true;
              break;
            case '+':
              text = "     " + text;
              fg = black;
              bg = light;
              style = SWT.BOLD;
              setStyle = true;
              break;
            case '!':
              style = SWT.BOLD;
              setStyle = true;
              break;
            case '@':
              fg = blue;
              setStyle = true;
              break;
            case '$':
              bg = blue;
              fg = white;
              style = SWT.BOLD;
              setStyle = true;
              break;
            case ' ':
              text = "  " + text;
              break;
             
            default:
              text = styleChar + text;
          }

          helpPanel.append(text);

          if (setStyle) {
            int lineCount = helpPanel.getLineCount() - 1;
            int charCount = helpPanel.getCharCount();
            //          System.out.println("Got Linecount " + lineCount + ", Charcount " + charCount);

            int lineOfs = helpPanel.getOffsetAtLine(lineCount - 1);
            int lineLen = charCount - lineOfs;
            //          System.out.println("Setting Style : " + lineOfs + ", " + lineLen);
            helpPanel.setStyleRange(new StyleRange(lineOfs, lineLen, fg, bg,
                style));
            helpPanel.setLineBackground(lineCount - 1, 1, bg);
          }
        }

        helpPanel.setRedraw(true);
      } catch (Exception e) {
        System.out.println("Unable to load help contents because:" + e);
        //e.printStackTrace();
      }
    }
View Full Code Here

      }
     
      shell.setText(MessageText.getString("sharing.progress.title"));
     

      tasks = new StyledText(shell, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER)
      tasks.setBackground(dialog_display.getSystemColor(SWT.COLOR_WHITE));     
     
      progress = new ProgressBar(shell, SWT.NULL);
      progress.setMinimum(0);
      progress.setMaximum(100);           
View Full Code Here

   
    label = new Label(panel, SWT.NULL);
   
      // blah
   
    textResults = new StyledText(panel, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP );
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.heightHint = 70;
    gridData.horizontalSpan = 4;
    textResults.setLayoutData(gridData);
    textResults.setBackground(panel.getDisplay().getSystemColor(SWT.COLOR_WHITE));
View Full Code Here

       cancel_button.setEnabled( false );
      
       
      // log area
   
    log = new StyledText(main,SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    grid_data = new GridData(GridData.FILL_BOTH);
    grid_data.horizontalSpan = 1;
    grid_data.horizontalIndent = 4;
    log.setLayoutData(grid_data);
    log.setIndent( 4 );
View Full Code Here

    this.icon = icon;
    detailsShell = new Shell(display,SWT.BORDER | SWT.ON_TOP);
    Utils.setShellIcon(detailsShell);
   
    detailsShell.setLayout(new FillLayout());
    StyledText textDetails = new StyledText(detailsShell, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER)
    textDetails.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    textDetails.setWordWrap( true );
    detailsShell.layout();   
    detailsShell.setSize(550,300);   
   

    int popupWidth = 280;
    int popupHeight = 170;

    shell = new Shell(display,SWT.ON_TOP);
    Utils.setShellIcon(shell);

    FormLayout layout = new FormLayout();
    layout.marginHeight = 0; layout.marginWidth = 0;
    try {
      layout.spacing = 0;
    } catch (NoSuchFieldError e) {
      /* Ignore for Pre 3.0 SWT.. */
    }
    shell.setLayout(layout);
   
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image popup_image = imageLoader.getImage("popup");

    // this code is here to ensure that we can still show error messages even if images
    // are failing to load (e.g. coz there's a ! in AZ install dir... )

    GC gcImage = null;
    if (ImageLoader.isRealImage(popup_image)) {
      shellImg = new Image(display, popup_image, SWT.IMAGE_COPY);
      popupWidth = popup_image.getBounds().width;
      popupHeight = popup_image.getBounds().height;
    } else {
      shellImg = new Image(display,
          new Rectangle(0, 0, popupWidth, popupHeight));
    }
    imageLoader.releaseImage("popup");

    shell.setSize(popupWidth, popupHeight);

    gcImage = new GC(shellImg);

    Image imgIcon = imageLoader.getImage(icon);
    int iconWidth = 0;
    int iconHeight = 15;
    if (ImageLoader.isRealImage(imgIcon)) {
      gcImage.drawImage(imgIcon, 5, 5);
      iconWidth = imgIcon.getBounds().width;
      iconHeight = imgIcon.getBounds().height;
    }
    imageLoader.releaseImage(icon);
     

    Font tempFont = shell.getFont();
    FontData[] fontDataMain = tempFont.getFontData();
    for (int i = 0; i < fontDataMain.length; i++) {
      fontDataMain[i].setStyle(SWT.BOLD);
      fontDataMain[i].setHeight((int) (fontDataMain[i].getHeight() * 1.2));
    }

    Font fontTitle = new Font(display, fontDataMain);
    gcImage.setFont(fontTitle);

    Rectangle rect = new Rectangle(iconWidth + 10, 5, popupWidth - iconWidth
        - 15, iconHeight);
    GCStringPrinter.printString(gcImage, title, rect);

    gcImage.setFont(tempFont);
    fontTitle.dispose();

    rect = new Rectangle(5, iconHeight + 5, popupWidth - 10, popupHeight
        - iconHeight - 60);
    boolean bItFit = GCStringPrinter.printString(gcImage, errorMessage, rect);

    gcImage.dispose();
    if (!bItFit && details == null)
      details = errorMessage;
   
    if(details != null)
      textDetails.setText(details);

    final Button btnDetails = new Button(shell,SWT.TOGGLE);
    Messages.setLanguageText(btnDetails,"popup.error.details");   
    btnDetails.setEnabled(details != null);
   
View Full Code Here

          boolean bShow = btnDetails.getSelection();
          if (bShow) {
            Shell detailsShell = new Shell(display, SWT.BORDER | SWT.ON_TOP);
            Utils.setShellIcon(detailsShell);
            detailsShell.setLayout(new FillLayout());
            StyledText textDetails = new StyledText(detailsShell, SWT.READ_ONLY
                | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
            textDetails.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
            textDetails.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
            textDetails.setWordWrap(true);
            textDetails.setText(sDetails);
            detailsShell.layout();
            Rectangle shellBounds = shell.getBounds();
            detailsShell.setBounds(shellBounds.x + shellBounds.width
                - DETAILS_WIDTH, shellBounds.y - DETAILS_HEIGHT, DETAILS_WIDTH,
                DETAILS_HEIGHT);
View Full Code Here

    copyright.setText("Copyright (C) 2007-2010 JMule Team");
    copyright.setFont(bold_font);
   
    new Label(container1,SWT.NONE);
   
    StyledText about_text = new StyledText(container1,SWT.LEFT | SWT.READ_ONLY);
    about_text.setText(_._("aboutwindow.tab.general.label.about"));
    about_text.setWordWrap(true);
    about_text.setBackground(shell.getBackground());
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    about_text.setLayoutData(layout_data);
   
    Composite links_container = new Composite(content,SWT.NONE);
    links_container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout = new GridLayout(2,false);
    layout.marginWidth = 15;
View Full Code Here

TOP

Related Classes of org.eclipse.swt.custom.StyledText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.