Example usage for javax.swing BorderFactory createMatteBorder

List of usage examples for javax.swing BorderFactory createMatteBorder

Introduction

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

Prototype

public static MatteBorder createMatteBorder(int top, int left, int bottom, int right, Icon tileIcon) 

Source Link

Document

Creates a matte-look border that consists of multiple tiles of a specified icon.

Usage

From source file:org.ut.biolab.medsavant.client.view.Menu.java

public Menu(JPanel panel) {

    resetMap();//from   w  w  w .j  av  a  2 s.c o  m

    setLayout(new BorderLayout());

    primaryMenuButtons = new ButtonGroup();

    primaryMenu = ViewUtil.getPrimaryBannerPanel();

    secondaryMenu = new JPanel();
    secondaryMenu.setBackground(ViewUtil.getSecondaryMenuColor());

    tertiaryMenu = new JPanel();
    tertiaryMenu.setBorder(ViewUtil.getBottomLineBorder());
    tertiaryMenu.setBackground(Color.white);
    // tertiaryMenu.setBorder(ViewUtil.getMediumBorder());
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenu);
    //tertiaryMenu.setMinimumSize(new Dimension(9999, 30));
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenu);

    int padding = 5;

    primaryMenu.setLayout(new BoxLayout(primaryMenu, BoxLayout.X_AXIS));
    primaryMenu.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(150, 150, 150)),
            BorderFactory.createEmptyBorder(padding, padding, padding, padding)));

    primaryMenuSectionButtonContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(primaryMenuSectionButtonContainer);

    NotificationsPanel n = NotificationsPanel.getNotifyPanel(NotificationsPanel.JOBS_PANEL_NAME);

    JPanel appStorePanel = ViewUtil.getClearPanel();
    JButton appStoreButton = ViewUtil
            .getIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.MENU_STORE));
    ViewUtil.applyHorizontalBoxLayout(appStorePanel);
    appStorePanel.add(ViewUtil.subTextComponent(appStoreButton, "App Store"));

    appStoreButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            MedSavantFrame.getInstance().showAppStore();
        }

    });

    int componentpadding = 10;
    primaryMenu.add(Box.createHorizontalStrut(componentpadding));
    primaryMenu.add(primaryMenuSectionButtonContainer);
    primaryMenu.add(Box.createHorizontalGlue());

    FlowLayout fl = new FlowLayout(FlowLayout.RIGHT, componentpadding, 1);
    JPanel rightSidePanel = ViewUtil.getClearPanel();
    rightSidePanel.setLayout(fl);
    rightSidePanel.add(updatesPanel);
    rightSidePanel.add(n);
    rightSidePanel.add(appStorePanel);
    rightSidePanel.add(getLoginMenuItem());
    primaryMenu.add(rightSidePanel);
    /*
    primaryMenu.add(updatesPanel);
    primaryMenu.add(ViewUtil.getMediumSeparator());
            
    primaryMenu.add(n);
    primaryMenu.add(ViewUtil.getMediumSeparator());
            
    primaryMenu.add(appStorePanel);
    primaryMenu.add(ViewUtil.getMediumSeparator());
    primaryMenu.add(getLoginMenuItem());
    */
    add(primaryMenu, BorderLayout.NORTH);

    secondaryMenu.setLayout(new BoxLayout(secondaryMenu, BoxLayout.Y_AXIS));
    //secondaryMenu.setBorder(ViewUtil.getRightLineBorder());

    secondaryMenu.setPreferredSize(new Dimension(150, 100));

    contentContainer = panel;

    ReferenceController.getInstance().addListener(new Listener<ReferenceEvent>() {
        @Override
        public void handleEvent(ReferenceEvent event) {
            if (event.getType() == ReferenceEvent.Type.CHANGED) {
                updateSections();
            }
        }
    });

    ProjectController.getInstance().addListener(new Listener<ProjectEvent>() {
        @Override
        public void handleEvent(ProjectEvent evt) {
            if (!GeneticsSection.isInitialized && evt.getType() == ProjectEvent.Type.CHANGED) {
                //once this section is initialized, referencecombobox fires
                //referencechanged event on every project change
                updateSections();
            }
        }
    });

    LoginController.getInstance().addListener(new Listener<LoginEvent>() {
        @Override
        public void handleEvent(LoginEvent evt) {
            if (evt.getType() == LoginEvent.Type.LOGGED_OUT) {
                contentContainer.removeAll();
                ViewController.getInstance().changeSubSectionTo(null);
                currentView = null;
                resetMap();
            }
        }
    });

    tertiaryMenuPanelVisibilityContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenuPanelVisibilityContainer);

    tertiaryMenuPanelAccessoryContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenuPanelAccessoryContainer);

    clearMenu();
}

From source file:Proiect.uploadFTP.java

public void propFTP() {
    uploadFTP.setBackground(Encrypter.color_light);
    pan1.setBackground(Encrypter.color_light);
    pan1.setBorder(BorderFactory.createEmptyBorder(6, 5, 10, 5));
    pan2.setBackground(Encrypter.color_light);
    inpan1.setBackground(Encrypter.color_light);
    inpan2.setBackground(Encrypter.color_light);
    pan3.setBackground(Encrypter.color_light);
    pan4.setBackground(Encrypter.color_light);

    adress.setForeground(Encrypter.color_blue);
    user.setForeground(Encrypter.color_blue);
    pass.setForeground(Encrypter.color_blue);
    folder.setForeground(Encrypter.color_blue);
    filen.setForeground(Encrypter.color_blue);

    adressf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    adressf.setSelectionColor(Encrypter.color_black);
    adressf.setSelectedTextColor(Encrypter.color_white);
    adressf.setBackground(Encrypter.color_light);

    userf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    userf.setSelectionColor(Encrypter.color_black);
    userf.setSelectedTextColor(Encrypter.color_white);
    userf.setBackground(Encrypter.color_light);

    passf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    passf.setSelectionColor(Encrypter.color_black);
    passf.setSelectedTextColor(Encrypter.color_white);
    passf.setBackground(Encrypter.color_light);

    folderf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    folderf.setSelectionColor(Encrypter.color_black);
    folderf.setSelectedTextColor(Encrypter.color_white);
    folderf.setBackground(Encrypter.color_light);

    status.setHorizontalAlignment(SwingConstants.RIGHT);

    ImageIcon title_icon = getImageIcon("assets/icons/upload.png");
    titleFTP.setForeground(Encrypter.color_blue);
    titleFTP.setFont(Encrypter.font16);/*from  w ww  . j a v a  2 s.com*/
    titleFTP.setIcon(title_icon);

    connect.setBackground(Encrypter.color_light);
    connect.setBorder(BorderFactory.createEmptyBorder());
    connect.setForeground(Encrypter.color_black);
    connect.setFont(Encrypter.font16);
    connect.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    connect.setToolTipText("Transfer File");

    browsef.setBackground(Encrypter.color_light);
    browsef.setBorder(BorderFactory.createEmptyBorder());
    browsef.setForeground(Encrypter.color_black);
    browsef.setFont(Encrypter.font16);
    browsef.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    browsef.setToolTipText("Add file");

    ImageIcon exit_icon = getImageIcon("assets/icons/exit.png");
    exit.setBackground(Encrypter.color_light);
    exit.setBorder(BorderFactory.createLineBorder(Encrypter.color_dark, 0));
    exit.setForeground(Encrypter.color_black);
    exit.setFont(Encrypter.font16);
    exit.setIcon(exit_icon);
    exit.setToolTipText("Exit");

    ImageIcon adv_icon = getImageIcon("assets/icons/adv_ftp.png");
    adv.setIcon(adv_icon);
    adv.setBackground(Encrypter.color_light);
    adv.setBorder(BorderFactory.createLineBorder(Encrypter.color_light, 0));
    adv.setFont(Encrypter.font16);
    adv.setToolTipText("Display server files");
    adv.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("Text", "txt"));
    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("HTM", "htm"));
    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("XHTML", "xhtml"));
    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("HTML", "html"));
    chooserf.setAcceptAllFileFilterUsed(false);
}

From source file:Proiect.uploadFTP.java

public void actionFTP() {
    adressf.addCaretListener(new CaretListener() {
        public void caretUpdate(CaretEvent e) {
            InetAddress thisIp;/*  w w w  . jav  a 2  s  . c  om*/
            try {
                thisIp = InetAddress.getLocalHost();
                titleFTP.setText("Connection: " + thisIp.getHostAddress() + " -> " + adressf.getText());
            } catch (UnknownHostException e1) {
                e1.printStackTrace();
            }
        }
    });

    exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            saveState();
            uploadFTP.dispose();
            tree.dispose();
        }
    });

    connect.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            FTPClient client = new FTPClient();
            FileInputStream fis = null;
            String pass = String.valueOf(passf.getPassword());
            try {
                if (filename == null) {
                    status.setText("File does not exist!");
                } else {
                    // Server address
                    client.connect(adressf.getText());
                    // Login credentials
                    client.login(userf.getText(), pass);
                    if (client.isConnected()) {
                        status.setText("Succesfull transfer!");
                        // File type
                        client.setFileType(FTP.BINARY_FILE_TYPE);
                        // File location
                        File file = new File(filepath);
                        fis = new FileInputStream(file);
                        // Change the folder on the server
                        client.changeWorkingDirectory(folderf.getText());
                        // Save the file on the server
                        client.storeFile(filename, fis);
                    } else {
                        status.setText("Transfer failed!");
                    }
                }
                client.logout();
            } catch (IOException e1) {
                Encrypter.printException(e1);
            } finally {
                try {
                    if (fis != null) {
                        fis.close();
                    }
                    client.disconnect();
                } catch (IOException e1) {
                    Encrypter.printException(e1);
                }
            }
        }
    });

    browsef.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            int retval = chooserf.showOpenDialog(chooserf);
            if (retval == JFileChooser.APPROVE_OPTION) {
                status.setText("");
                filename = chooserf.getSelectedFile().getName().toString();
                filepath = chooserf.getSelectedFile().getPath();
                filenf.setText(chooserf.getSelectedFile().getName().toString());
            }
        }
    });

    adv.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {

            tree.setSize(220, uploadFTP.getHeight());
            tree.setLocation(uploadFTP.getX() + 405, uploadFTP.getY());
            tree.setResizable(false);
            tree.setIconImage(Toolkit.getDefaultToolkit()
                    .getImage(getClass().getClassLoader().getResource("assets/ico.png")));
            tree.setUndecorated(true);
            tree.getRootPane().setBorder(BorderFactory.createLineBorder(Encrypter.color_black, 2));
            tree.setVisible(true);
            tree.setLayout(new BorderLayout());

            JLabel labeltree = new JLabel("Server documents");
            labeltree.setOpaque(true);
            labeltree.setBackground(Encrypter.color_light);
            labeltree.setBorder(BorderFactory.createMatteBorder(8, 10, 10, 0, Encrypter.color_light));
            labeltree.setForeground(Encrypter.color_blue);
            labeltree.setFont(Encrypter.font16);

            JButton refresh = new JButton("");
            ImageIcon refresh_icon = getImageIcon("assets/icons/refresh.png");
            refresh.setIcon(refresh_icon);
            refresh.setBackground(Encrypter.color_light);
            refresh.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
            refresh.setForeground(Encrypter.color_black);
            refresh.setFont(Encrypter.font16);
            refresh.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

            final FTPClient client = new FTPClient();
            DefaultMutableTreeNode top = new DefaultMutableTreeNode(adressf.getText());
            DefaultMutableTreeNode files = null;
            DefaultMutableTreeNode leaf = null;

            final JTree tree_view = new JTree(top);
            tree_view.setForeground(Encrypter.color_black);
            tree_view.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
            tree_view.putClientProperty("JTree.lineStyle", "None");
            tree_view.setBackground(Encrypter.color_light);
            JScrollPane scrolltree = new JScrollPane(tree_view);
            scrolltree.setBackground(Encrypter.color_light);
            scrolltree.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0));

            UIManager.put("Tree.textBackground", Encrypter.color_light);
            UIManager.put("Tree.selectionBackground", Encrypter.color_blue);
            UIManager.put("Tree.selectionBorderColor", Encrypter.color_blue);

            tree_view.updateUI();

            final String pass = String.valueOf(passf.getPassword());
            try {
                client.connect(adressf.getText());
                client.login(userf.getText(), pass);
                client.enterLocalPassiveMode();
                if (client.isConnected()) {
                    try {
                        FTPFile[] ftpFiles = client.listFiles();
                        for (FTPFile ftpFile : ftpFiles) {
                            files = new DefaultMutableTreeNode(ftpFile.getName());
                            top.add(files);
                            if (ftpFile.getType() == FTPFile.DIRECTORY_TYPE) {
                                FTPFile[] ftpFiles1 = client.listFiles(ftpFile.getName());
                                for (FTPFile ftpFile1 : ftpFiles1) {
                                    leaf = new DefaultMutableTreeNode(ftpFile1.getName());
                                    files.add(leaf);
                                }
                            }
                        }
                    } catch (IOException e1) {
                        Encrypter.printException(e1);
                    }
                    client.disconnect();
                } else {
                    status.setText("Failed connection!");
                }
            } catch (IOException e1) {
                Encrypter.printException(e1);
            } finally {
                try {
                    client.disconnect();
                } catch (IOException e1) {
                    Encrypter.printException(e1);
                }
            }

            tree.add(labeltree, BorderLayout.NORTH);
            tree.add(scrolltree, BorderLayout.CENTER);
            tree.add(refresh, BorderLayout.SOUTH);

            uploadFTP.addComponentListener(new ComponentListener() {

                public void componentMoved(ComponentEvent e) {
                    tree.setLocation(uploadFTP.getX() + 405, uploadFTP.getY());
                }

                public void componentShown(ComponentEvent e) {
                }

                public void componentResized(ComponentEvent e) {
                }

                public void componentHidden(ComponentEvent e) {
                }
            });

            uploadFTP.addWindowListener(new WindowListener() {
                public void windowActivated(WindowEvent e) {
                    tree.toFront();
                }

                public void windowOpened(WindowEvent e) {
                }

                public void windowIconified(WindowEvent e) {
                }

                public void windowDeiconified(WindowEvent e) {
                }

                public void windowDeactivated(WindowEvent e) {
                }

                public void windowClosing(WindowEvent e) {
                }

                public void windowClosed(WindowEvent e) {
                }
            });

            refresh.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    tree.dispose();
                    tree.setVisible(true);
                }
            });
        }
    });

}

From source file:rita.widget.SourceCode.java

private void createHideCodeButton() {

    this.codeButton = new JButton(createImageIcon("/images/sourcecode/source_code_small.png"));
    codeButton.addActionListener(new SourceCodeEnlargerTimer());
    codeButton.addMouseListener(this);
    codeButton.setBounds(0, 0, MIN_WIDTH, BUTTON_HEIGHT);
    codeButton.setFont(smallButtonFont);
    codeButton.setAlignmentX(LEFT_ALIGNMENT);
    codeButton.setText(Language.get("codeButton.title.open"));
    codeButton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLACK));
}

From source file:storybook.toolkit.swing.SwingUtil.java

public static JPanel createMenuBarSpacer(boolean linie) {
    MigLayout layout = new MigLayout("insets 0", "[1]");
    JPanel panel = new JPanel(layout);
    panel.setOpaque(false);/*from w w w  .jav  a  2s. c o  m*/
    JLabel label = new JLabel(" ");
    if (linie) {
        Border border = BorderFactory.createMatteBorder(0, 1, 0, 0, Color.gray);
        label.setBorder(border);
        panel.add(label, "center");
    }
    panel.setMaximumSize(new Dimension(2, 10));
    return panel;
}

From source file:tvbrowser.ui.mainframe.MainFrame.java

public void updateToolbar() {
    JPanel contentPane = (JPanel) getContentPane();

    if (mToolBarPanel != null) {
        contentPane.remove(mToolBarPanel);
    }/*from w  w w  .ja va  2  s  . co m*/

    mToolBarModel = DefaultToolBarModel.getInstance();
    mToolBar = new ToolBar(mToolBarModel);
    mToolBar.setOpaque(false);

    String location = mToolBar.getToolbarLocation();

    if (Settings.propIsToolbarVisible.getBoolean()) {
        if (mToolBarPanel == null) {
            mToolBarPanel = new JPanel(new BorderLayout()) {
                public void updateUI() {
                    super.updateUI();
                    setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, getBackground().darker()));
                }
            };
            addContextMenuMouseListener(mToolBarPanel);
            mSearchField = new SearchField();
        } else {
            mToolBarPanel.removeAll();
        }

        if (location.compareTo(BorderLayout.NORTH) == 0) {
            mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.CENTER);
            if (Settings.propIsSearchFieldVisible.getBoolean()) {
                mToolBarPanel.add(mSearchField, BorderLayout.EAST);
            }
        } else {
            mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.WEST);
            if (Settings.propIsSearchFieldVisible.getBoolean()) {
                mToolBarPanel.add(mSearchField, BorderLayout.SOUTH);
            }
        }

        contentPane.add(mToolBarPanel, location);
    }

    contentPane.invalidate();
    contentPane.updateUI();
}