Example usage for javax.swing BorderFactory createBevelBorder

List of usage examples for javax.swing BorderFactory createBevelBorder

Introduction

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

Prototype

public static Border createBevelBorder(int type) 

Source Link

Document

Creates a beveled border of the specified type, using brighter shades of the component's current background color for highlighting, and darker shading for shadows.

Usage

From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphForm.java

private void createUI(JFreeChart chart, String helpID) {
    final TableLayout tableLayout = new TableLayout(2);
    tableLayout.setTablePadding(4, 4);//  w ww. j a  va2 s . co  m
    tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    tableLayout.setTableFill(TableLayout.Fill.BOTH);
    tableLayout.setTableWeightY(1.0);
    tableLayout.setColumnWeightX(0, 1.0);
    tableLayout.setColumnWeightX(1, 0.0);
    tableLayout.setRowWeightY(0, 1.0);
    tableLayout.setRowWeightY(1, 0.0);
    tableLayout.setCellRowspan(0, 1, 2);
    tableLayout.setCellFill(1, 0, TableLayout.Fill.HORIZONTAL);
    tableLayout.setCellPadding(1, 0, new Insets(5, 5, 5, 5));

    mainPanel = new JPanel(tableLayout);
    mainPanel.setPreferredSize(new Dimension(320, 200));

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2)));
    mainPanel.add(chartPanel);
    mainPanel.add(createButtonPanel(helpID));
    mainPanel.add(validatorUI.createUI());
}

From source file:mergedoc.ui.MergeDocFrame.java

/**
 * ??????//  ww  w.ja  va  2  s  . c om
 * @throws MergeDocException ?????
 */
private void initComponent() throws MergeDocException {

    // ????
    preferencePanel = new PreferencePanel();
    mergeManager = new MergeManager();

    // ???
    mainPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS));
    mainPanel.add(preferencePanel);

    // ??????
    JPanel outerPanel = new JPanel();
    outerPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS));
    outerPanel.add(mainPanel);
    outerPanel.add(ComponentFactory.createSpacer(0, 7));
    outerPanel.add(buttonBar);
    getContentPane().add(outerPanel);

    // ?
    initListener();
    buttonBar.setState(buttonBar.INIT_STATE);

    // 
    ConfigManager config = ConfigManager.getInstance();
    String iconPath = config.getFile("icon.png").toString();
    Image icon = Toolkit.getDefaultToolkit().createImage(iconPath);
    setIconImage(icon);

    // 
    setTitle(SETTING_TITLE);
    Persister psst = Persister.getInstance();
    setLocation(psst.getInt(Persister.WINDOW_X, 0), psst.getInt(Persister.WINDOW_Y, 0));
    setSize(psst.getInt(Persister.WINDOW_WIDTH, 700), psst.getInt(Persister.WINDOW_HEIGHT, 570));
    int state = psst.getInt(Persister.WINDOW_STATE, NORMAL);
    if ((state & Frame.ICONIFIED) != ICONIFIED) {
        setExtendedState(state);
    }
    setVisible(true);
}

From source file:org.adempiere.apps.graph.PerformanceIndicator.java

/**
 *    Constructor//from  w  w  w .j av a 2s .  c o  m
 *   @param goal goal model
 */
public PerformanceIndicator(MGoal goal) {
    super();
    m_goal = goal;
    setName(m_goal.getName());
    //vpj-cd e-evolution getPreferredSize();      //   calculate size
    init();
    //
    setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    setOpaque(true);
    //vpj-cd e-evolution updateDisplay();

    //
    mRefresh.addActionListener(this);
    popupMenu.add(mRefresh);
    //
    addMouseListener(this);
}

From source file:hermes.browser.dialog.HermesAdminFactoryConfigPanel.java

public void init() {
    final Border border = BorderFactory.createBevelBorder(BevelBorder.RAISED);
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createTitledBorder(border, ADMIN_FACTORY));

    afCombo.setModel(cfComboModel);//from   w  w w.  j ava  2 s .  com

    propertyTableSP.setViewportView(propertyTable);
    propertyTable.setSortable(true);
    add(afCombo, BorderLayout.NORTH);
    add(propertyTableSP, BorderLayout.CENTER);

    popupMenu.add(addItem);
    popupMenu.add(removeItem);

    addItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            try {
                propertyTableModel.insertRow();
            } catch (Exception ex) {
                cat.error(ex.getMessage(), ex);
            }
        }
    });

    removeItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (propertyTable.getSelectedRow() != -1) {
                propertyTableModel.removeRow(propertyTable.getSelectedRow());
            }
        }
    });

    final MouseAdapter m = new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                if (e.getComponent() == propertyTableSP) {
                    removeItem.setEnabled(false);
                } else {
                    removeItem.setEnabled(true);
                }

                if (propertySelectionComboBox.getModel().getSize() == 0) {
                    addItem.setEnabled(false);
                } else {
                    addItem.setEnabled(true);
                }

                popupMenu.show(e.getComponent(), e.getX(), e.getY());
            }
        }
    };

    propertyTableSP.addMouseListener(m);
    propertyTable.addMouseListener(m);
    propertyTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

    cfComboModel.addListDataListener(new ListDataListener() {
        public void contentsChanged(ListDataEvent arg0) {
            final String className = HermesBrowser.getConfigDAO()
                    .getAdminClassForPlugIn((String) cfComboModel.getSelectedItem());
            final ClassLoaderManager classLoaderManager = (ClassLoaderManager) SingletonManager
                    .get(ClassLoaderManager.class);

            try {
                if (propertyTableModel != null) {
                    final ClassLoader classLoader = classLoaderManager
                            .getClassLoader(dialog.getSelectedLoader());
                    Thread.currentThread().setContextClassLoader(classLoader);

                    bean = (HermesAdminFactory) classLoader.loadClass(className).newInstance();
                    propertyTableModel.setBean(bean);
                    updateCellEditor();
                    dialog.setDirty();
                }
            } catch (Throwable e) {
                HermesBrowser.getBrowser().showErrorDialog(
                        "Unable to locate this plugin.\nSelect the loader the JMS provider classes are in before choosing the plugin.");
                cfComboModel.setSelectedItem(ConfigDAO.DEFAULT_PLUGIN);
            }
        }

        public void intervalAdded(ListDataEvent arg0) {
            // NOP
        }

        public void intervalRemoved(ListDataEvent arg0) {
            // NOP
        }
    });

}

From source file:be.ac.ua.comp.scarletnebula.gui.SSHPanel.java

public SSHPanel(final Server server) {
    super();//from w ww.j  a v a  2 s.c o m

    final JCTermSwing term = new JCTermSwing();
    term.setCompression(7);
    term.setAntiAliasing(true);

    setLayout(new BorderLayout());

    addComponentListener(new ComponentListener() {

        @Override
        public void componentShown(final ComponentEvent e) {
        }

        @Override
        public void componentResized(final ComponentEvent e) {
            final Component c = e.getComponent();
            int cw = c.getWidth();
            int ch = c.getHeight();

            final JPanel source = ((JPanel) c);

            final int cwm = source.getBorder() != null
                    ? source.getBorder().getBorderInsets(c).left + source.getBorder().getBorderInsets(c).right
                    : 0;
            final int chm = source.getBorder() != null
                    ? source.getBorder().getBorderInsets(c).bottom + source.getBorder().getBorderInsets(c).top
                    : 0;
            cw -= cwm;
            ch -= chm;

            term.setBorder(BorderFactory.createMatteBorder(0, 0, term.getTermHeight() - c.getHeight(),
                    term.getTermWidth() - c.getWidth(), Color.BLACK));
            term.setSize(cw, ch);
            term.setPreferredSize(new Dimension(cw, ch));
            // term.setMinimumSize(new Dimension(cw, ch));
            term.setMaximumSize(new Dimension(cw, ch));
            term.redraw(0, 0, term.getTermWidth(), term.getTermHeight());
        }

        @Override
        public void componentMoved(final ComponentEvent e) { // TODO
            // Auto-generated
            // method
            // stub

        }

        @Override
        public void componentHidden(final ComponentEvent e) { // TODO
            // Auto-generated
            // method
            // stub

        }
    });

    add(term, BorderLayout.CENTER);

    setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20),
            BorderFactory.createBevelBorder(BevelBorder.LOWERED)));

    final Thread connectionThread = new Thread() {
        @Override
        public void run() {

            Connection connection = null;
            try {
                final SSHCommandConnection commandConnection = (SSHCommandConnection) server
                        .newCommandConnection(new NotPromptingJschUserInfo());

                connection = commandConnection.getJSchTerminalConnection();

                term.requestFocusInWindow();
                term.start(connection);
            } catch (final Exception e) {
                for (final ExceptionListener listener : exceptionListeners) {
                    listener.exceptionThrown(e);
                }

                log.warn("Exception thrown by SSHPanel", e);
            } finally {
            }

        }
    };

    connectionThread.start();
}

From source file:hermes.browser.dialog.GeneralRendererConfigPanel.java

private void init() {
    Border border = BorderFactory.createBevelBorder(BevelBorder.RAISED);
    JPanel topPanel = new JPanel();

    topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    topPanel.setLayout(new GridLayout(1, 2));

    infoLabel1.setText("Message Renderers");

    setLayout(new BorderLayout());
    setBorder(BorderFactory.createTitledBorder(border, "Renderers"));

    topPanel.add(infoLabel1);//from   w w w  .ja  v a 2 s . c  o m
    topSP.setViewportView(classTable);

    classTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

    add(topPanel, BorderLayout.NORTH);
    add(splitPane, BorderLayout.CENTER);

    splitPane.add(topSP, "top");
    splitPane.add(bottomSP, "bottom");
    splitPane.setDividerLocation(200);

    // splitPane.setShowGripper(true) ;

    classTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            doRendererSelected(e);
        }
    });

}

From source file:hermes.browser.dialog.DestinationPropertyConfigPanel.java

public DestinationPropertyConfigPanel(String hermesId, Destination bean, DestinationConfig config) {
    try {/*  w ww . j a va  2 s.com*/
        this.bean = bean;
        this.config = config;

        final Border border = BorderFactory.createBevelBorder(BevelBorder.RAISED);
        setLayout(new BorderLayout());

        add(tabbedPane);

        generalPanel.setLayout(new BorderLayout());

        if (bean != null) {
            beanPropertyPanel = new BeanPropertyPanel(bean, true, false);
            beanPropertyPanel.init();
            beanPropertyPanel.setBorder(BorderFactory.createTitledBorder(border, "Provider Properties"));
        }

        generalPanel.setBorder(BorderFactory.createTitledBorder(border, "Hermes Properties"));

        tabbedPane.add("Hermes", generalPanel);

        if (bean != null) {
            tabbedPane.add("Provider", beanPropertyPanel);
        }

        tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);

        init();
    } catch (IllegalAccessException e) {
        throw new HermesRuntimeException(e);
    } catch (InvocationTargetException e) {
        throw new HermesRuntimeException(e);
    } catch (NoSuchMethodException e) {
        throw new HermesRuntimeException(e);
    }
}

From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java

private final JPanel getAllImagesPanel(final CloudProvider provider) {
    final JPanel panel = new JPanel(new BorderLayout());
    final TableRowSorter<MachineImageTableModel> sorter = new TableRowSorter<MachineImageTableModel>(
            allImagesModel);//w ww.j av  a2  s . com
    allImagesTable.setRowSorter(sorter);
    allImagesTable.setFillsViewportHeight(true);
    allImagesTable.addMouseListener(new SmartImageModelContextMenuMouseListener(provider, allImagesModel,
            allImagesTable, favoriteImagesPanel.getModel()));

    final JPanel aboveTable = new JPanel(new BorderLayout());
    final JPanel searchPanel = getSearchPanel(sorter);

    aboveTable.add(searchPanel, BorderLayout.NORTH);
    aboveTable.add(throbberPanel, BorderLayout.SOUTH);

    panel.add(aboveTable, BorderLayout.NORTH);

    final JScrollPane tableScrollPane = new JScrollPane(allImagesTable);
    tableScrollPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 20, 10, 20),
            BorderFactory.createBevelBorder(BevelBorder.LOWERED)));

    panel.add(tableScrollPane, BorderLayout.CENTER);

    return panel;
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java

private final JPanel getMainPanel() {
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    final ServerList linkedServerList = new ServerList(linkedServerListModel);
    linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList);
    linkedServerScrollPane//from  w w  w. j a va2 s . c om
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers"));
    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    linkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(linkedServerScrollPane, c);

    final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel);
    unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList);
    unlinkedServerScrollPane
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers"));

    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final JPanel middlePanel = new JPanel();
    middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS));
    middlePanel.add(Box.createVerticalGlue());

    final JButton linkSelectionButton = new JButton("<");
    final JButton unlinkSelectionButton = new JButton(">");

    linkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from unlinked to linked list
            final int selection = unlinkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection);

            unlinkedServerListModel.removeServer(server);

            linkedServerListModel.addServer(server);
        }
    });

    unlinkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from linked to unlinked list
            final int selection = linkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this,
                    "You are about to unlink a server. "
                            + "Unlinking a server will permanently remove \nall data associated with "
                            + "this server, but the server will keep running. "
                            + "\n\nAre you sure you wish to continue?",
                    "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);

            if (answer != JOptionPane.YES_OPTION) {
                return;
            }

            final Server server = linkedServerListModel.getVisibleServerAtIndex(selection);

            linkedServerListModel.removeServer(server);

            unlinkedServerListModel.addServer(server);
        }
    });

    middlePanel.add(unlinkSelectionButton);
    middlePanel.add(Box.createVerticalStrut(10));
    middlePanel.add(linkSelectionButton);
    middlePanel.add(Box.createVerticalGlue());

    c.gridx = 1;
    c.gridy = 0;
    c.weightx = 0.0;
    c.weighty = 0.0;

    mainPanel.add(middlePanel, c);

    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(unlinkedServerScrollPane, c);
    return mainPanel;
}

From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java

private JPanel getSearchPanel(final TableRowSorter<MachineImageTableModel> sorter) {
    final JPanel searchPanel = new JPanel(new GridBagLayout());
    searchPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20));

    add(searchPanel, BorderLayout.NORTH);
    final PlatformComboBox platformComboBox = new PlatformComboBox();

    final GridBagConstraints c = new GridBagConstraints();
    c.weightx = 0.0;/*  w w  w  .j  a v a 2 s. co m*/
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(0, 0, 0, 5);

    searchPanel.add(platformComboBox, c);
    final ArchitectureComboBox architectureComboBox = new ArchitectureComboBox();

    c.gridx = 1;
    searchPanel.add(architectureComboBox, c);

    final BetterTextField searchField = new BetterTextField();
    searchField.setPlaceHolder("Search terms");

    searchField.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    c.gridx = 2;
    c.weightx = 1.0;
    c.insets = new Insets(0, 0, 0, 0);
    searchPanel.add(searchField, c);

    searchField.addActionListener(
            new SearchFieldListener(architectureComboBox, sorter, platformComboBox, searchField));

    return searchPanel;
}