Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012-2014 Erwin Müller <erwin.mueller@deventm.org>
   *
   * This file is part of prefdialog-core.
   *
   * prefdialog-core is free software: you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as published by the
   * Free Software Foundation, either version 3 of the License, or (at your
   * option) any later version.
  *
  * prefdialog-core is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public License
  * along with prefdialog-core. If not, see <http://www.gnu.org/licenses/>.
  */
 package com.anrisoftware.prefdialog.core;
 
 import static info.clearthought.layout.TableLayoutConstants.FILL;
 import static info.clearthought.layout.TableLayoutConstants.PREFERRED;
 import static java.lang.String.format;
 
 
Sets a title label on top of the field that is embedded in a scroll pane. The title can show the icon if the correct text position is set.

Author(s):
Erwin Mueller, erwin.mueller@deventm.org
Since:
1.0
See also:
AbstractContainerField
 
 @SuppressWarnings("serial")
 public abstract class AbstractTitleScrollField<ComponentType extends Component>
         extends AbstractTitleField<ComponentType> {
 
     private static final String FIELD_SCROLL_NAME = "scrollpane";
 
     private final JScrollPane fieldScroll;
 
     private final TableLayout layout;

    
 
     protected AbstractTitleScrollField(ComponentType component,
             Object parentObjectString fieldName) {
         super(componentparentObjectfieldName);
         this. = new JScrollPane();
         this. = createLayout();
         setup();
     }
 
     private void setup() {
         setupContainer();
         setupFieldScroll();
     }
 
     private TableLayout createLayout() {
         double[] col = {  };
         double[] row = {  };
         return new TableLayout(colrow);
     }
 
     private void setupFieldScroll() {
     }
 
     @Override
     public void setName(String name) {
         super.setName(name);
         .setName(format("%s-%s"name));
     }
 
     @Override
     public void setEnabled(boolean enabled) {
         super.setEnabled(enabled);
         .setEnabled(enabled);
     }
 
     @Override
     public void setContainer(JPanel container) {
         super.setContainer(container);
         setupContainer();
     }
 
     @Override
     public void setComponent(ComponentType component) {
         super.setComponent(component);
        setupContainer();
    }
    @Override
    public void setWidth(Number width) {
        super.setWidth(width);
        int w = width.intValue();
        if (w ==  || w == ) {
            return;
        }
        int height = .getPreferredSize().;
        .setPreferredSize(new Dimension(wheight));
    }
    @Override
    public void setHeight(Number height) {
        super.setHeight(height);
        int h = height.intValue();
        if (h ==  || h == ) {
            return;
        }
        int width = .getPreferredSize().;
        .setPreferredSize(new Dimension(widthh));
    }
    public JScrollPane getFieldScroll() {
        return ;
    }
    private void setupContainer() {
        Container container = getContainer();
        container.removeAll();
        container.setLayout();
        container.add(getTitleLabel(), "0, 0");
        container.add("0, 1");
    }
New to GrepCode? Check out our FAQ X