Example usage for javax.swing JLabel setBorder

List of usage examples for javax.swing JLabel setBorder

Introduction

In this page you can find the example usage for javax.swing JLabel setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:com.web.vehiclerouting.optaplanner.common.swingui.SolverAndPersistenceFrame.java

private JComponent createQuickOpenPanel(List<Action> quickOpenActionList, List<File> fileList, String title) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    if (fileList.isEmpty()) {
        JLabel noneLabel = new JLabel("None");
        noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        panel.add(noneLabel);//from  w w  w  .  j  av a2  s .c o m
    } else {
        for (File file : fileList) {
            Action quickOpenAction = new QuickOpenAction(file);
            quickOpenActionList.add(quickOpenAction);
            JButton quickOpenButton = new JButton(quickOpenAction);
            quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT);
            quickOpenButton.setMargin(new Insets(0, 0, 0, 0));
            panel.add(quickOpenButton);
        }
    }
    JScrollPane scrollPane = new JScrollPane(panel);
    scrollPane.getVerticalScrollBar().setUnitIncrement(25);
    scrollPane.setMinimumSize(new Dimension(100, 80));
    // Size fits into screen resolution 1024*768
    scrollPane.setPreferredSize(new Dimension(180, 200));
    JPanel titlePanel = new JPanel(new BorderLayout());
    titlePanel.add(scrollPane, BorderLayout.CENTER);
    titlePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2),
            BorderFactory.createTitledBorder(title)));
    return titlePanel;
}

From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java

private void refreshQuickOpenPanel(JPanel panel, List<Action> quickOpenActionList, List<File> fileList) {
    panel.removeAll();/*from w  w  w  .  ja va  2  s.c om*/
    quickOpenActionList.clear();
    if (fileList.isEmpty()) {
        JLabel noneLabel = new JLabel("None");
        noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        panel.add(noneLabel);
    } else {
        for (File file : fileList) {
            Action quickOpenAction = new QuickOpenAction(file);
            quickOpenActionList.add(quickOpenAction);
            JButton quickOpenButton = new JButton(quickOpenAction);
            quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT);
            quickOpenButton.setMargin(new Insets(0, 0, 0, 0));
            panel.add(quickOpenButton);
        }
    }
}

From source file:hr.fer.zemris.vhdllab.platform.gui.dialog.save.SaveDialog.java

public SaveDialog(LocalizationSource source, SaveContext context) {
    super(source);
    Validate.notNull(context, "Save variant can't be null");
    // setup label
    JLabel label = new JLabel(getMainMessage(source, context));
    int width = DIALOG_WIDTH - 2 * BORDER;
    int height = LABEL_HEIGHT - 2 * BORDER;
    label.setPreferredSize(new Dimension(width, height));
    label.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER));

    // setup check box list
    list = new CheckBoxList();
    width = DIALOG_WIDTH - 2 * BORDER;/*w  w  w.j av  a 2 s . c o  m*/
    height = 0; // because list is a center component and it doesnt need
    // height
    list.setPreferredSize(new Dimension(width, height));
    list.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER));

    // setup select all and deselect all buttons
    JButton selectAll = new JButton(source.getMessage(SELECT_ALL_MESSAGE));
    selectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    selectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            list.setSelectionToAll(true);
        }
    });

    JButton deselectAll = new JButton(source.getMessage(DESELECT_ALL_MESSAGE));
    deselectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    deselectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            list.setSelectionToAll(false);
        }
    });

    Box selectBox = Box.createHorizontalBox();
    selectBox.add(selectAll);
    selectBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT)));
    selectBox.add(deselectAll);
    selectBox.setBorder(BorderFactory.createEmptyBorder(0, 0, BORDER, 0));

    // setup ok and cancel buttons
    JButton ok = new JButton(source.getMessage(OK_MESSAGE));
    ok.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeDialog(new ArrayList<File>());
        }
    });

    JButton cancel = new JButton(source.getMessage(CANCEL_MESSAGE));
    cancel.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeDialog(null);
        }
    });

    Box actionBox = Box.createHorizontalBox();
    actionBox.add(ok);
    actionBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT)));
    actionBox.add(cancel);
    actionBox.setBorder(BorderFactory.createEmptyBorder(BORDER, 0, BORDER, 0));

    JPanel selectPanel = new JPanel(new BorderLayout());
    selectPanel.add(selectBox, BorderLayout.EAST);
    JPanel actionPanel = new JPanel(new BorderLayout());
    actionPanel.add(actionBox, BorderLayout.EAST);

    JCheckBox alwaysSave = new JCheckBox(source.getMessage(ALWAYS_SAVE_MESSAGE));
    alwaysSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkBox = (JCheckBox) e.getSource();
            Preferences preferences = Preferences.userNodeForPackage(SaveDialog.class);
            preferences.putBoolean(SHOULD_AUTO_SAVE, checkBox.isSelected());
        }
    });
    alwaysSave.setSelected(false);
    JPanel alwaysSavePanel = new JPanel(new BorderLayout());
    alwaysSavePanel.add(alwaysSave, BorderLayout.WEST);

    JPanel lowerPanel = new JPanel(new BorderLayout());
    lowerPanel.add(selectPanel, BorderLayout.NORTH);
    lowerPanel.add(alwaysSavePanel, BorderLayout.CENTER);
    lowerPanel.add(actionPanel, BorderLayout.SOUTH);

    this.setLayout(new BorderLayout());
    JPanel messagePanel = new JPanel(new BorderLayout());
    messagePanel.add(label, BorderLayout.NORTH);
    messagePanel.add(list, BorderLayout.CENTER);
    messagePanel.add(lowerPanel, BorderLayout.SOUTH);
    this.getContentPane().add(messagePanel, BorderLayout.CENTER);
    this.getRootPane().setDefaultButton(ok);
    this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
    this.setTitle(getTitle(source, context));
}

From source file:edu.ku.brc.af.ui.db.DatabaseLoginPanel.java

/**
 * @param usrLblKey/* ww  w. j  a  v a2  s  .com*/
 * @param userNameTF
 * @param pwdLblKey
 * @param passwordTF
 * @param statusLbl
 * @param imgIcon
 * @return
 */
public static JPanel createLoginPanel(final String usrLblKey, final JTextField userNameTF,
        final String usernameHintKey, final String pwdLblKey, final JPasswordField passwordTF,
        final JLabel statusLbl, final ImageIcon imgIcon) {
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,f:p:g,2px,p", "p,4px,p,10px,p,8px"));

    boolean hasUsrNmHint = StringUtils.isNotEmpty(usernameHintKey);
    pb.add(UIHelper.createI18NFormLabel(usrLblKey), cc.xy(1, 1));
    pb.add(userNameTF, cc.xyw(3, 1, hasUsrNmHint ? 1 : 3));
    if (hasUsrNmHint) {
        pb.add(UIHelper.createI18NLabel(usernameHintKey), cc.xy(5, 1));
    }

    pb.add(UIHelper.createI18NFormLabel(pwdLblKey), cc.xy(1, 3));
    pb.add(passwordTF, cc.xyw(3, 3, 1));
    pb.add(statusLbl, cc.xyw(1, 5, 5));

    PanelBuilder outerPanel = new PanelBuilder(new FormLayout("p,3dlu,p:g", "t:p:g")); //$NON-NLS-1$ //$NON-NLS-2$
    JLabel icon = new JLabel(imgIcon);
    icon.setBorder(BorderFactory.createEmptyBorder(10, 10, 2, 2));
    pb.getPanel().setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5));
    outerPanel.add(icon, cc.xy(1, 1));
    outerPanel.add(pb.getPanel(), cc.xy(3, 1));

    return outerPanel.getPanel();
}

From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java

private void setupControls() {

    // Layout and setup UI components...

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    add(_namePanel);// w  w  w.j  av  a 2s .c o  m
    _namePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_fieldsPanel);
    _fieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_classConfigsTree);
    _classConfigsTree.setAlignmentX(Component.LEFT_ALIGNMENT);
    _classConfigsTree.setPreferredSize(new Dimension(300, 300));
    add(_buttonsPanel);
    _buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    JLabel l;

    // Admin UI Management Panels use a title
    // (in a particular "title font") to identify themselves
    l = new JLabel("Edit Db4oSyncSource Configuration", SwingConstants.CENTER);
    l.setBorder(new TitledBorder(""));
    l.setFont(titlePanelFont);
    _namePanel.add(l);

    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.gridwidth = 1;
    labelConstraints.fill = GridBagConstraints.NONE;
    labelConstraints.weightx = 0.0;
    labelConstraints.gridx = 0;
    labelConstraints.gridy = 0;
    labelConstraints.anchor = GridBagConstraints.EAST;

    GridBagConstraints fieldConstraints = new GridBagConstraints();
    fieldConstraints.gridwidth = 2;
    fieldConstraints.fill = GridBagConstraints.HORIZONTAL;
    fieldConstraints.weightx = 1.0;
    fieldConstraints.gridx = 1;
    fieldConstraints.gridy = 0;

    _fieldsPanel.add(new JLabel("Source URI: "), labelConstraints);
    _fieldsPanel.add(_sourceUriValue, fieldConstraints);

    labelConstraints.gridy = GridBagConstraints.RELATIVE;
    fieldConstraints.gridy = GridBagConstraints.RELATIVE;

    _fieldsPanel.add(new JLabel("Name: "), labelConstraints);
    _fieldsPanel.add(_nameValue, fieldConstraints);

    fieldConstraints.gridwidth = 1;

    _fieldsPanel.add(new JLabel("db4o File: "), labelConstraints);
    _fieldsPanel.add(_dbFileValue, fieldConstraints);

    _dbFileValue.setEditable(false);

    fieldConstraints.gridwidth = 2;

    GridBagConstraints buttonConstraints = new GridBagConstraints();
    buttonConstraints.gridwidth = 1;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 2;
    buttonConstraints.gridy = 3;
    _dbFileLocateButton.setText("...");
    _fieldsPanel.add(_dbFileLocateButton, buttonConstraints);

    buttonConstraints.gridwidth = 3;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 0;
    buttonConstraints.gridy = GridBagConstraints.RELATIVE;
    buttonConstraints.anchor = GridBagConstraints.CENTER;

    // Ensure all the controls use the Admin UI standard font
    Component[] components = _fieldsPanel.getComponents();
    for (int i = 0; i < components.length; i++) {

        Component c = components[i];
        c.setFont(defaultFont);

    }

    _confirmButton.setText("Add");
    _buttonsPanel.add(_confirmButton);

}

From source file:com.funambol.json.admin.JsonConnectorConfigPanel.java

/**
 * Create the panel/*  w  w  w.j  a v a2s . c  o m*/
 */
private void init() {

    JLabel title, serverLabel;
    JPanel seccPanel;
    JPanel behaviourOnErrorsPanel;

    title = new JLabel();
    seccPanel = new JPanel();
    behaviourOnErrorsPanel = new JPanel();

    serverLabel = new JLabel();
    serverValue = new JTextField();

    setLayout(null);

    title.setFont(titlePanelFont);
    title.setText("Funambol Json Connector");
    title.setBounds(new Rectangle(14, 5, 316, 28));
    title.setAlignmentX(SwingConstants.CENTER);
    title.setBorder(new TitledBorder(""));

    seccPanel.setLayout(null);
    seccPanel.setBorder(new TitledBorder("HTTP Server Configuration"));

    serverLabel.setText("Server:");
    seccPanel.add(serverLabel);
    serverLabel.setBounds(10, 20, 116, 15);
    seccPanel.add(serverValue);
    serverValue.setBounds(150, 20, 220, 19);
    serverValue.setFont(defaultFont);

    add(seccPanel);
    seccPanel.setBounds(10, 50, 380, 70);

    //the ssl option panel

    behaviourOnErrorsPanel.setBorder(new TitledBorder("Behaviour on errors"));
    behaviourOnErrorsPanel.setLayout(null);

    stopSyncOnFatalError.setText("Stop sync on fatal errors");
    stopSyncOnFatalError.setBounds(10, 25, 200, 15);

    behaviourOnErrorsPanel.add(stopSyncOnFatalError);

    add(behaviourOnErrorsPanel);
    behaviourOnErrorsPanel.setBounds(10, 130, 380, 60);

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Save");
    add(confirmButton);
    confirmButton.setBounds(160, 200, 70, 25);

    confirmButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                JsonConnectorConfigPanel.this.actionPerformed(new ActionEvent(JsonConnectorConfigPanel.this,
                        ACTION_EVENT_UPDATE, event.getActionCommand()));
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage()));
            }
        }
    });

    //
    // Setting font...
    //
    Component[] components = getComponents();
    for (int i = 0; (components != null) && (i < components.length); ++i) {
        components[i].setFont(defaultFont);
    }

    //
    // We add it as the last one so that the font won't be changed
    //
    add(title);
}

From source file:com.diversityarrays.kdxplore.field.OriginDirectionTraversalChoicePanel.java

public OriginDirectionTraversalChoicePanel(Closure<Void> onChange) {

    this.onChange = onChange;

    Border lineBorder = new LineBorder(Color.BLACK);
    JComponent topsep, leftsep, rightsep, botsep;

    topsep = new JSeparator(JSeparator.VERTICAL);
    botsep = new JSeparator(JSeparator.VERTICAL);

    topsep.setBorder(lineBorder);/*  w ww . ja  va 2 s  . co  m*/
    botsep.setBorder(lineBorder);

    leftsep = new JSeparator(JSeparator.HORIZONTAL);
    rightsep = new JSeparator(JSeparator.HORIZONTAL);

    GBH gbh = new GBH(this);
    int y = 0;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_ul);
    gbh.add(1, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, crb_ul_right);
    //      gbh.add(2,y, 1,2, GBH.VERT, 1,1, GBH.CENTER, topsep);
    gbh.add(3, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, crb_ur_left);
    gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_ur);
    ++y;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_ul_down, new Insets(10, 0, 0, 0)));
    //         gbh.add(1,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx);
    //         gbh.add(2,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx);
    gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_ur_down, new Insets(10, 0, 0, 0)));
    ++y;

    gbh.add(0, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, leftsep);
    JLabel label = gbh.add(1, y, 3, 1, GBH.HORZ, 1, 1, GBH.CENTER, "Origin & Direction");
    gbh.add(4, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, rightsep);
    ++y;
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setBorder(lineBorder);

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_ll_up, new Insets(0, 0, 10, 0)));
    //         gbh.add(1,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx);
    //      gbh.add(2,y, 1,2, GBH.VERT, 1,1, GBH.CENTER, botsep);
    //         gbh.add(2,y, 1,1, GBH.NONE, 1,1, GBH.CENTER, xxx);
    gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, withInsets(crb_lr_up, new Insets(0, 0, 10, 0)));
    ++y;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_ll);
    gbh.add(1, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, crb_ll_right);
    gbh.add(3, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, crb_lr_left);
    gbh.add(4, y, 1, 1, GBH.NONE, 1, 1, GBH.CENTER, corner_lr);
    ++y;

    gbh.add(0, y, 5, 1, GBH.HORZ, 1, 1, GBH.CENTER, new JSeparator(JSeparator.HORIZONTAL));
    ++y;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Traversal:");
    gbh.add(1, y, 1, 1, GBH.HORZ, 2, 1, GBH.CENTER, rbPanel);
    ++y;
}

From source file:com.josue.tileset.editor.Editor.java

private void addLightSourceTile(Tile tile) {
    if (!tile.equals(selectedTile) && selectedTile != null) {
        JLabel label = tileLabels.get(tile);
        if (tile.getId() == selectedTile.getId()) { //already contains
            selectedTile.setLight(null);
            label.setBorder(null);
        } else {//from  ww w . j av a 2  s  .  c  om
            selectedTile.setLight(new Light());
            selectedTile.getLight().setLightTileOffset(tile.getId() - selectedTile.getId());
            label.setBorder(new LineBorder(Color.YELLOW, 2));
            lightTb.setSelected(true);
        }
    }
}

From source file:com.josue.tileset.editor.Editor.java

private void mountButtons(List<Tile> tiles, int cols, int rows) {

    imagePanel.removeAll();/*w  w  w  .j  a v  a 2 s  .co m*/
    if (animatedPerformer != null) {
        animatedPerformer.stop();
        animatedPerformer = null;
    }

    imagePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    Dimension dimension = new Dimension(cols * TILE_SIZE, rows * TILE_SIZE);

    for (Tile tile : tiles) {
        final JLabel tileLabel = new JLabel();

        tileLabel.setIcon(new ImageIcon(tile.getImage()));
        Dimension labelDimension = new Dimension(TILE_SIZE, TILE_SIZE);
        tileLabel.setMinimumSize(labelDimension);
        tileLabel.setMaximumSize(labelDimension);
        tileLabel.setPreferredSize(labelDimension);
        tileLabel.setSize(labelDimension);
        tileLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                if (SwingUtilities.isRightMouseButton(evt)) {//select animated sequence

                    if (animatedAction.isSelected()) {
                        addAnimatedTile(tile);
                    } else {
                        addLightSourceTile(tile);
                    }

                } else {

                    if (animatedPerformer != null) {
                        animatedPerformer.stop();
                    }
                    Iterator<JLabel> iterator = tileLabels.values().iterator();
                    while (iterator.hasNext()) {
                        JLabel next = iterator.next();
                        next.revalidate();
                    }
                    imagePanel.repaint();
                    for (Map.Entry<Tile, JLabel> entry : tileLabels.entrySet()) {
                        Tile key = entry.getKey();
                        JLabel value = entry.getValue();
                        value.setBorder(null); //clear borders
                    }

                    selectedTile = tile;//this isolate for the next operations
                    tileLabel.setBorder(new LineBorder(Color.RED, 2));

                    previewLabel.setIcon(new ImageIcon(tile.getImage()));
                    animatedTb.setSelected(selectedTile.isAnimated());
                    lightTb.setSelected(selectedTile.isLight());
                    solidTb.setSelected(selectedTile.isSolid());

                    if (tile.isAnimated()) {

                        for (Integer animatesTileOffset : selectedTile.getAnimation().getAnimatedSequence()) { //display animated borders
                            for (Map.Entry<Tile, JLabel> entry : tileLabels.entrySet()) {
                                Tile key = entry.getKey();
                                JLabel value = entry.getValue();
                                if (key.getId() == selectedTile.getId() + animatesTileOffset) {
                                    value.setBorder(new LineBorder(Color.BLUE, 2));
                                }
                            }

                        }

                        animatedPerformer = new Timer(
                                (int) (selectedTile.getAnimation().getAnimationInterval()),
                                new TileAnimator(selectedTile, previewLabel, loadedTiles));
                        animatedPerformer.start();
                    }
                    if (selectedTile.isLight()) {//light color has preference
                        for (Tile tile : tiles) {
                            if (tile.getId() == selectedTile.getLightTileId()) {
                                JLabel found = tileLabels.get(tile);
                                found.setBorder(new LineBorder(Color.YELLOW, 2));
                                break;
                            }
                        }

                    }
                }
            }

            @Override
            public void mouseExited(MouseEvent e) {
                if (selectedTile != null && selectedTile.getAnimation() != null && selectedTile.getAnimation()
                        .getAnimatedSequence().contains(tile.getId() - selectedTile.getId())) {
                    tileLabel.setBorder(new LineBorder(Color.BLUE, 2));
                } else if (selectedTile != null && selectedTile.isLight()
                        && selectedTile.getLightTileId() == tile.getId()) {
                    tileLabel.setBorder(new LineBorder(Color.YELLOW, 2));
                } else if (selectedTile != null) {
                    JLabel get = tileLabels.get(selectedTile);
                    if (!get.equals(tileLabel)) { //keep the red border if is the selected
                        tileLabel.setBorder(null);
                    }
                } else {
                    tileLabel.setBorder(null);
                }
            }

            @Override
            public void mouseEntered(MouseEvent e) {
                if (selectedTile != null && selectedTile.getAnimation() != null
                        && !selectedTile.getAnimation().getAnimatedSequence()
                                .contains(tile.getId() - selectedTile.getId())
                        && tile.getLight() != null && tile.getLight().getLightTileOffset() != 0) {
                    tileLabel.setBorder(new LineBorder(Color.RED, 2));
                } else if (selectedTile == null) {
                    tileLabel.setBorder(new LineBorder(Color.RED, 2));
                }
            }
        });
        tileLabels.put(tile, tileLabel);
        imagePanel.add(tileLabel);
    }

    imagePanel.setMaximumSize(dimension);
    imagePanel.setMinimumSize(dimension);
    imagePanel.setPreferredSize(dimension);
    imagePanel.revalidate();
    imagePanel.repaint();
    this.pack();
}

From source file:org.pgptool.gui.ui.mainframe.MainFrameView.java

private void initFormComponents() {
    lblNoDataToDisplay = new JLabel(Messages.get("phrase.noDecryptedFilesAreMonitoredAtTheMoment"));
    lblNoDataToDisplay.setHorizontalAlignment(JLabel.CENTER);

    SgLayout sgl = new SgLayout(1, 3, 0, 0);
    sgl.setColSize(0, 100, SgLayout.SIZE_TYPE_WEIGHTED);
    sgl.setRowSize(1, 100, SgLayout.SIZE_TYPE_WEIGHTED);
    panelRoot = new JPanel(sgl);
    panelRoot.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));

    int row = 0;//w  w w  .  j a  va  2 s .co  m
    JLabel lblPrevDecryptedFiles = new JLabel(
            UiUtils.plainToBoldHtmlString(text("phrase.previouslyDecrpytedFiles")));
    panelRoot.add(lblPrevDecryptedFiles, sgl.cs(0, row));
    lblPrevDecryptedFiles.setBorder(BorderFactory.createEmptyBorder(14, 0, 0, 0));

    row++;
    panelTablePlaceholder = new JPanel(new BorderLayout());
    panelTablePlaceholder.add(initTableComponent(), BorderLayout.CENTER);
    panelRoot.add(panelTablePlaceholder, sgl.cs(0, row));

    // add message panel
    row++;
    hintsPanel = new JPanel(new BorderLayout());
    panelRoot.add(hintsPanel, sgl.cs(0, row));
    // hintView.renderTo(hintsPanel, BorderLayout.CENTER);
}