Example usage for javax.swing BorderFactory createEmptyBorder

List of usage examples for javax.swing BorderFactory createEmptyBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createEmptyBorder.

Prototype

public static Border createEmptyBorder() 

Source Link

Document

Creates an empty border that takes up no space.

Usage

From source file:fi.smaa.jsmaa.gui.views.CriterionView.java

public JComponent buildPanel() {
    FormLayout layout = new FormLayout("pref:grow:fill", "p, 3dlu, p, 3dlu, p");

    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(BorderFactory.createEmptyBorder());
    CellConstraints cc = new CellConstraints();

    builder.add(buildOverviewPart(), cc.xy(1, 1));

    int row = 3;//w  ww. j  av  a 2 s.c om
    if (criterion instanceof OutrankingCriterion) {
        LayoutUtil.addRow(layout);
        builder.addSeparator("Thresholds", cc.xy(1, 3));
        LayoutUtil.addRow(layout);
        builder.add(buildThresholdsPart(), cc.xy(1, 5));
        row = 7;
    }
    builder.addSeparator("Measurements", cc.xy(1, row));

    JComponent measPanel = null;
    if (criterion instanceof CardinalCriterion && model.getMeasurements() instanceof IndependentMeasurements) {
        ImpactMatrixPresentationModel iModel = new ImpactMatrixPresentationModel(
                (IndependentMeasurements) model.getMeasurements());
        measPanel = new CardinalCriterionMeasurementsView((CardinalCriterion) criterion, iModel).buildPanel();
    } else if (criterion instanceof OrdinalCriterion
            && model.getMeasurements() instanceof IndependentMeasurements) {
        OrdinalCriterionMeasurementsPM pm = new OrdinalCriterionMeasurementsPM((OrdinalCriterion) criterion,
                (IndependentMeasurements) model.getMeasurements());
        measPanel = new OrdinalCriterionMeasurementsView(pm).buildPanel();
    }
    builder.add(measPanel, cc.xy(1, row + 2));

    row += 4;
    if (criterion instanceof ScaleCriterion) {
        LayoutUtil.addRow(layout);
        builder.addSeparator("Value function", cc.xy(1, row));
        LayoutUtil.addRow(layout);

        final JPanel chartPanel = buildValueFunctionChartPanel((ScaleCriterion) criterion);

        builder.add(chartPanel, cc.xy(1, row + 2));
        row += 4;
    }

    if (model instanceof SMAATRIModel) {
        LayoutUtil.addRow(layout);
        builder.addSeparator("Profiles (category boundaries)", cc.xy(1, row));
        LayoutUtil.addRow(layout);
        builder.add(new ProfilesView((OutrankingCriterion) criterion, (SMAATRIModel) model).buildPanel(),
                cc.xy(1, row + 2));
    }

    return builder.getPanel();
}

From source file:de.erdesignerng.visual.editor.openxavaexport.ConvertPropertyAdapter.java

@Override
public void model2view(Object aModel, String aPropertyName) {

    OpenXavaOptions theOptions = (OpenXavaOptions) aModel;

    String theCurrentTypeName = helper.getText(ERDesignerBundle.CURRENTDATATYPE);
    String theTargetTypeName = helper.getText(ERDesignerBundle.TARGETDATATYPE);
    String theStereoTypeName = helper.getText(ERDesignerBundle.STEREOTYPE);

    String[] theTargetTypes = new String[theOptions.getTypeMapping().keySet().size()];
    String[] theStereoTypes = new String[theOptions.getTypeMapping().keySet().size()];

    List<DataType> theCurrentTypes = new ArrayList<>();
    theCurrentTypes.addAll(theOptions.getTypeMapping().keySet());

    Collections.sort(theCurrentTypes, new BeanComparator("name"));
    int theRow = 0;
    for (DataType theType : theCurrentTypes) {
        OpenXavaTypeMap theMap = theOptions.getTypeMapping().get(theType);
        theTargetTypes[theRow] = theMap.getJavaType();
        theStereoTypes[theRow] = theMap.getStereoType();
        theRow++;//ww  w.  jav  a2  s.  c  o  m
    }

    DefaultTable theTable = (DefaultTable) getComponent()[0];
    OpenXavaExportTableModel theModel = new OpenXavaExportTableModel(theCurrentTypeName, theTargetTypeName,
            theStereoTypeName, theCurrentTypes, theTargetTypes, theStereoTypes);
    theTable.setModel(theModel);

    theTable.getColumnModel().getColumn(0).setCellRenderer(ModelItemDefaultCellRenderer.getInstance());
    theTable.getColumnModel().getColumn(1).setCellRenderer(ModelItemDefaultCellRenderer.getInstance());
    theTable.getColumnModel().getColumn(2).setCellRenderer(ModelItemDefaultCellRenderer.getInstance());

    DefaultComboBox theTargetTypesEditor = new DefaultComboBox();
    theTargetTypesEditor.setBorder(BorderFactory.createEmptyBorder());
    theTargetTypesEditor.setModel(new DefaultComboBoxModel(OpenXavaOptions.SUPPORTED_STEREOTYPES));
    theTable.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(theTargetTypesEditor));
    theTable.setRowHeight((int) theTargetTypesEditor.getPreferredSize().getHeight());
}

From source file:com.stefanbrenner.droplet.ui.DevicePanel.java

/**
 * Create the panel.//w  ww .  j  a  v  a 2  s.com
 */
public DevicePanel(final JComponent parent, final IDroplet droplet, final T device) {

    this.parent = parent;

    setDevice(device);

    setLayout(new BorderLayout(0, 5));
    setBorder(BorderFactory.createLineBorder(Color.BLACK));
    setBackground(DropletColors.getBackgroundColor(device));

    BeanAdapter<T> adapter = new BeanAdapter<T>(device, true);

    // device name textfield
    txtName = BasicComponentFactory.createTextField(adapter.getValueModel(IDevice.PROPERTY_NAME));
    txtName.setHorizontalAlignment(SwingConstants.CENTER);
    txtName.setColumns(1);
    txtName.setToolTipText(device.getName());
    adapter.addBeanPropertyChangeListener(IDevice.PROPERTY_NAME, new PropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            txtName.setToolTipText(device.getName());
        }
    });
    add(txtName, BorderLayout.NORTH);

    // actions panel with scroll pane
    actionsPanel = new JPanel();
    actionsPanel.setLayout(new BoxLayout(actionsPanel, BoxLayout.Y_AXIS));
    actionsPanel.setBackground(getBackground());

    JScrollPane scrollPane = new JScrollPane(actionsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    // resize vertical scrollbar
    scrollPane.getVerticalScrollBar().putClientProperty("JComponent.sizeVariant", "mini"); //$NON-NLS-1$ //$NON-NLS-2$
    SwingUtilities.updateComponentTreeUI(scrollPane);
    // we need no border
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    add(scrollPane, BorderLayout.CENTER);

    {
        JPanel panel = new JPanel();
        panel.setLayout(new GridLayout(0, 1));

        createAddButton(panel);

        // remove button
        JButton btnRemove = new JButton(Messages.getString("ActionDevicePanel.removeDevice")); //$NON-NLS-1$
        btnRemove.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(final ActionEvent action) {
                int retVal = JOptionPane.showConfirmDialog(DevicePanel.this,
                        Messages.getString("ActionDevicePanel.removeDevice") + " '" + device.getName() + "'?", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
                        StringUtils.EMPTY, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
                if (retVal == JOptionPane.YES_OPTION) {
                    droplet.removeDevice(device);
                }
            }
        });
        btnRemove.setFocusable(false);
        panel.add(btnRemove);

        add(panel, BorderLayout.SOUTH);
    }

}

From source file:net.sourceforge.ganttproject.gui.options.InterfaceOptionPageProvider.java

@Override
public Component buildPageComponent() {
    OptionsPageBuilder builder = new OptionsPageBuilder();
    builder.setUiFacade(getUiFacade());//from  www .  ja v a 2  s.  c  o  m
    Component component = builder.buildPage(getOptionGroups(), getPageID());
    myLabel = UIUtil.createHtmlPane("", NotificationManager.DEFAULT_HYPERLINK_LISTENER);
    myLabel.setBorder(BorderFactory.createEmptyBorder());
    myLabel.setVisible(false);

    JPanel wrapper = new JPanel(new BorderLayout());
    wrapper.add(component, BorderLayout.NORTH);
    wrapper.add(myLabel, BorderLayout.SOUTH);
    return wrapper;
}

From source file:com.eviware.soapui.support.components.SimpleForm.java

public SimpleForm(String columnSpec) {
    this(new FormLayout(columnSpec), BorderFactory.createEmptyBorder());
}

From source file:edu.ku.brc.ui.ImageDisplay.java

/**
 * Constructor./*from w w  w  .  jav a 2s . c o  m*/
 * @param imgWidth the desired image width
 * @param imgHeight the desired image height
 * @param isEditMode whether it is in browse mode or edit mode
 * @param hasBorder whether it has a border
 */
public ImageDisplay(final int imgWidth, final int imgHeight, boolean isEditMode, boolean hasBorder) {
    super(new BorderLayout());

    setBorder(hasBorder ? new EtchedBorder(EtchedBorder.LOWERED) : BorderFactory.createEmptyBorder());

    setPreferredSize(new Dimension(imgWidth, imgHeight));

    this.isEditMode = isEditMode;
    this.paintComponent = this;
    createUI();

    setDoubleBuffered(true);
}

From source file:com.limegroup.gnutella.gui.themes.setters.SubstanceThemeSetter.java

public void apply() {
    SubstanceLookAndFeel.setSkin(_skinClassName);
    ThemeMediator.applyCommonSkinUI();//  w w  w  .jav a  2s  .  co  m

    float scaledFontPolicyFactor = WINDOWS_SCALED_FONT_POLICY_FACTOR;
    if (OSUtils.isMacOSX()) {
        scaledFontPolicyFactor = MAC_SCALED_FONT_POLICY_FACTOR;
    } else if (OSUtils.isLinux()) {
        scaledFontPolicyFactor = LINUX_SCALED_FONT_POLICY_FACTOR;
    }

    if (LookUtils.IS_OS_WINDOWS) {
        fixWindowsOSFont();
    } else if (LookUtils.IS_OS_LINUX) {
        fixLinuxOSFont();
    }

    SubstanceLookAndFeel.setFontPolicy(SubstanceFontUtilities.getScaledFontPolicy(scaledFontPolicyFactor));

    //reduceFont("Label.font");
    //reduceFont("Table.font");
    //ResourceManager.setFontSizes(-1);
    //ResourceManager.setFontSizes(0);

    UIManager.put("Tree.leafIcon", UIManager.getIcon("Tree.closedIcon"));

    // remove split pane borders
    UIManager.put("SplitPane.border", BorderFactory.createEmptyBorder());

    if (!OSUtils.isMacOSX()) {
        UIManager.put("Table.focusRowHighlightBorder", UIManager.get("Table.focusCellHighlightBorder"));
    }

    UIManager.put("Table.focusCellHighlightBorder", BorderFactory.createEmptyBorder(1, 1, 1, 1));

    // Add a bold text version of simple text.
    Font normal = UIManager.getFont("Table.font");
    FontUIResource bold = new FontUIResource(normal.getName(), Font.BOLD, normal.getSize());
    UIManager.put("Table.font.bold", bold);
    UIManager.put("Tree.rowHeight", 0);
}

From source file:krasa.cpu.CpuUsagePanel.java

@Override
public void updateUI() {
    refreshColors();/*from w  w w. j  av  a  2s.  c  o  m*/
    myBufferedImage = null;
    super.updateUI();
    setFont(getWidgetFont());
    setBorder(BorderFactory.createEmptyBorder());
}

From source file:net.sf.jabref.gui.maintable.MainTable.java

public MainTable(MainTableFormat tableFormat, MainTableDataModel model, JabRefFrame frame, BasePanel panel) {
    super();/* w w  w .ja  v a 2 s.c  o m*/
    this.model = model;

    addFocusListener(Globals.getFocusListener());
    setAutoResizeMode(Globals.prefs.getInt(JabRefPreferences.AUTO_RESIZE_MODE));

    this.tableFormat = tableFormat;
    this.panel = panel;

    setModel(GlazedListsSwing.eventTableModelWithThreadProxyList(model.getTableRows(), tableFormat));

    tableColorCodes = Globals.prefs.getBoolean(JabRefPreferences.TABLE_COLOR_CODES_ON);
    localSelectionModel = (DefaultEventSelectionModel<BibEntry>) GlazedListsSwing
            .eventSelectionModelWithThreadProxyList(model.getTableRows());
    setSelectionModel(localSelectionModel);
    pane = new JScrollPane(this);
    pane.setBorder(BorderFactory.createEmptyBorder());
    pane.getViewport().setBackground(Globals.prefs.getColor(JabRefPreferences.TABLE_BACKGROUND));
    setGridColor(Globals.prefs.getColor(JabRefPreferences.GRID_COLOR));
    if (Globals.prefs.getBoolean(JabRefPreferences.TABLE_SHOW_GRID)) {
        setShowGrid(true);
    } else {
        setShowGrid(false);
        setIntercellSpacing(new Dimension(0, 0));
    }

    this.setTableHeader(new PreventDraggingJTableHeader(this, tableFormat));

    comparatorChooser = this.createTableComparatorChooser(this,
            model.getSortedForUserDefinedTableColumnSorting(), TableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD);

    this.tableColumnListener = new PersistenceTableColumnListener(this);

    // set table header render AFTER creation of comparatorChooser (this enables sort arrow rendering)
    this.getTableHeader()
            .setDefaultRenderer(new MainTableHeaderRenderer(this.getTableHeader().getDefaultRenderer()));

    // TODO: Figure out, whether this call is needed.
    getSelected();

    // enable DnD
    setDragEnabled(true);
    TransferHandler xfer = new EntryTableTransferHandler(this, frame, panel);
    setTransferHandler(xfer);
    pane.setTransferHandler(xfer);

    setupComparatorChooser();
    model.updateMarkingState(Globals.prefs.getBoolean(JabRefPreferences.FLOAT_MARKED_ENTRIES));
    setWidths();
}

From source file:com.funambol.email.admin.user.ResultSearchUserPanel.java

/**
 * Set up graphic elements for this panel.
 *
 * @throws Exception if error occures during creation of the panel
 *///w ww  . j  a va2  s .c o m
private void init() throws Exception {

    // create objects to display
    this.setLayout(new BorderLayout());
    this.setBorder(BorderFactory.createEmptyBorder());

    // create a model for the user table and pass it to the JTable object
    model = new UserTableModel();
    table = new JTable(model);

    table.setShowGrid(true);
    table.setAutoscrolls(true);
    table.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
    JScrollPane scrollpane = new JScrollPane(table);
    table.setPreferredScrollableViewportSize(new Dimension(800, 200));
    table.setFont(GuiFactory.defaultTableFont);
    table.getTableHeader().setFont(GuiFactory.defaultTableHeaderFont);
    this.add(scrollpane, BorderLayout.CENTER);

    //
    // Select user.
    //
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    ListSelectionModel rowSM = table.getSelectionModel();

    rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent event) {

            if (event.getValueIsAdjusting()) {
                return;
            }

            ListSelectionModel lsm = (ListSelectionModel) event.getSource();

            if (lsm.isSelectionEmpty()) {

                selectedUser = null;
            } else {

                int selectedRow = lsm.getMinSelectionIndex();
                selectedUser = users[selectedRow];
            }
        }
    });

    rowSM.clearSelection();

    table.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent event) {

            if (event.getClickCount() < 2) {
                return;
            }

            //
            // If the selected user is already associated to an account
            // then insertion process can't go on.
            //

            String userName = selectedUser.getUsername();
            String value[] = new String[] { userName };
            WhereClause wc = new WhereClause("username", value, WhereClause.OPT_EQ, true);
            MailServerAccount[] tmp = null;
            try {
                tmp = WSDao.getAccounts(wc);
            } catch (Exception e) {
            }

            if (tmp.length > 0) {

                StringBuilder sb = new StringBuilder("The user ");
                sb.append(userName).append(" is already associated to an account");
                Object[] options = { "OK" };
                JOptionPane.showOptionDialog(null, sb.toString(), "Warning", JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.WARNING_MESSAGE, null, options, options[0]);

            } else {
                //
                // Go to next step.
                //
                step.goToNextStep();
            }
        }
    });

}