Package javax.swing.text

Examples of javax.swing.text.Style


    public Object getAttribute(final Object key) {
        Iterator it = styleList.iterator();
        Object result = null;
        while (result == null && it.hasNext()) {
            Style style = styleSheet.getStyle(it.next().toString());
            result = style.getAttribute(key);
        }
        if (result != null) {
            return result;
        }
        it = sheetList.iterator();
View Full Code Here


        while (result == null && it.hasNext()) {
            Selector styleSelector = (Selector)it.next();
            if (!elementSelector.applies(styleSelector.getLastSelector())) {
                continue;
            }
            Style style = styleSheet.getStyle(styleSelector.toString());
            result = style.getAttribute(key);
        }
        if (result != null) {
            return result;
        }
        it = sheetList.iterator();
View Full Code Here

    public boolean containsAttribute(final Object arg0, final Object arg1) {
        Iterator it = styleList.iterator();
        boolean result = false;
        while (!result && it.hasNext()) {
            Style style = styleSheet.getStyle(it.next().toString());
            result = style.containsAttribute(arg0, arg1);
        }
        if (result) {
            return result;
        }
        it = sheetList.iterator();
View Full Code Here

    } catch (IOException e) {
      handleException(e);
    }
    // Create menus after loading preferences to get code pages.
    this.setJMenuBar(createMenuBar());
    Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    defaultStyle = StyleContext.getDefaultStyleContext().addStyle("defaultAnnot", defaultStyle);
    StyleConstants.setBackground(defaultStyle, selectionColor);
    this.styleMap.put(CAS.TYPE_NAME_ANNOTATION, defaultStyle);
    this.textPopup = new JPopupMenu();
    this.fsTree.addFocusListener(new TreeFocusHandler(this.fsTree));
View Full Code Here

  public void saveColorPreferences(File file) throws IOException {
    Properties prefs1 = new Properties();
    Iterator<String> it = this.styleMap.keySet().iterator();
    String type;
    Style style;
    Color fg, bg;
    while (it.hasNext()) {
      type = it.next();
      style = this.styleMap.get(type);
      fg = StyleConstants.getForeground(style);
View Full Code Here

    FileOutputStream out = new FileOutputStream(file);
    prefs1.store(out, "Color preferences for annotation viewer.");
  }

  public void loadColorPreferences(File file) throws IOException {
    Style parent = this.styleMap.get(CAS.TYPE_NAME_ANNOTATION);
    StyleContext sc = StyleContext.getDefaultStyleContext();
    Properties prefs1 = new Properties();
    FileInputStream in = new FileInputStream(file);
    prefs1.load(in);
    String typeName, value;
    Style style;
    Color color;
    int pos;
    Iterator<?> it = prefs1.keySet().iterator();
    while (it.hasNext()) {
      typeName = (String) it.next();
View Full Code Here

  }

  private JPanel createCustomizationPanel(String typeName) {
    this.currentTypeName = typeName;
    String defaultAnnotStyleName = CAS.TYPE_NAME_ANNOTATION;
    Style defaultAnnotStyle = this.styleMap.get(defaultAnnotStyleName);
    GridLayout layout = new GridLayout(0, 1);
    JPanel topPanel = new JPanel(layout);
    this.textPane = new JTextPane();
    Style style = this.styleMap.get(typeName);
    if (style == null) {
      style = defaultAnnotStyle;
    }
    Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
    this.textPane.addStyle(defaultStyleName, defaultStyle);
    setCurrentStyle(style);
    this.fgColor = StyleConstants.getForeground(this.currentStyle);
    this.bgColor = StyleConstants.getBackground(this.currentStyle);
    this.fgIcon = new ColorIcon(this.fgColor);
View Full Code Here

    return topPanel;
  }

  private void setCustomizationPanel(String typeName) {
    this.currentTypeName = typeName;
    Style defaultAnnotStyle = this.styleMap.get(CAS.TYPE_NAME_ANNOTATION);
    Style style = this.styleMap.get(typeName);
    if (style == null) {
      style = defaultAnnotStyle;
    }
    // Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(
    // StyleContext.DEFAULT_STYLE);
View Full Code Here

    buttonPanel.add(this.cancelButton);
    enableButtons(false);
  }

  private void setTextPane() {
    Style defaultStyle = this.textPane.getStyle(defaultStyleName);
    // Style style = textPane.getStyle(typeName);
    // if (style == null || defaultStyle == null) {
    // System.out.println("Style is null.");
    // }
    Document doc = this.textPane.getDocument();
View Full Code Here

  }

  private class AcceptButtonHandler implements ActionListener {

    public void actionPerformed(ActionEvent event) {
      Style style = AnnotationDisplayCustomizationFrame.this.styleMap
          .get(AnnotationDisplayCustomizationFrame.this.currentTypeName);
      if (style == null) {
        style = AnnotationDisplayCustomizationFrame.this.textPane.addStyle(
            AnnotationDisplayCustomizationFrame.this.currentTypeName,
            AnnotationDisplayCustomizationFrame.this.styleMap.get(CAS.TYPE_NAME_ANNOTATION));
View Full Code Here

TOP

Related Classes of javax.swing.text.Style

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.