Example usage for javax.swing.border BevelBorder BevelBorder

List of usage examples for javax.swing.border BevelBorder BevelBorder

Introduction

In this page you can find the example usage for javax.swing.border BevelBorder BevelBorder.

Prototype

public BevelBorder(int bevelType) 

Source Link

Document

Creates a bevel border with the specified type and whose colors will be derived from the background color of the component passed into the paintBorder method.

Usage

From source file:op.care.dfn.PnlDFN.java

/**
 * This method is called from within the constructor to
 * initialize the form./*from w  w w .j  a  va  2s . com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jspDFN = new JScrollPane();
    cpDFN = new CollapsiblePanes();

    //======== this ========
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    //======== jspDFN ========
    {
        jspDFN.setBorder(new BevelBorder(BevelBorder.RAISED));

        //======== cpDFN ========
        {
            cpDFN.setLayout(new BoxLayout(cpDFN, BoxLayout.X_AXIS));
        }
        jspDFN.setViewportView(cpDFN);
    }
    add(jspDFN);
}

From source file:org.apache.pdfbox.debugger.PDFDebugger.java

/**
 * This method is called from within the constructor to initialize the form.
 *///from w  w w .  j  a  v a  2s  .c  o  m
private void initComponents() {
    jSplitPane1 = new javax.swing.JSplitPane();
    jScrollPane1 = new JScrollPane();
    tree = new Tree(this);
    jScrollPane2 = new JScrollPane();
    jTextPane1 = new javax.swing.JTextPane();

    tree.setCellRenderer(new PDFTreeCellRenderer());
    tree.setModel(null);

    setTitle("Apache PDFBox Debugger");

    addWindowListener(new java.awt.event.WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent windowEvent) {
            tree.requestFocusInWindow();
            super.windowOpened(windowEvent);
        }

        @Override
        public void windowClosing(WindowEvent evt) {
            exitForm(evt);
        }
    });

    jScrollPane1.setBorder(new BevelBorder(BevelBorder.RAISED));
    jScrollPane1.setPreferredSize(new Dimension(350, 500));
    tree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent evt) {
            jTree1ValueChanged(evt);
        }
    });

    jScrollPane1.setViewportView(tree);

    jSplitPane1.setRightComponent(jScrollPane2);
    jSplitPane1.setDividerSize(3);

    jScrollPane2.setPreferredSize(new Dimension(300, 500));
    jScrollPane2.setViewportView(jTextPane1);

    jSplitPane1.setLeftComponent(jScrollPane1);

    JScrollPane documentScroller = new JScrollPane();
    documentScroller.setViewportView(documentPanel);

    statusPane = new TreeStatusPane(tree);
    statusPane.getPanel().setBorder(new BevelBorder(BevelBorder.RAISED));
    statusPane.getPanel().setPreferredSize(new Dimension(300, 25));
    getContentPane().add(statusPane.getPanel(), BorderLayout.PAGE_START);

    getContentPane().add(jSplitPane1, BorderLayout.CENTER);

    statusBar = new ReaderBottomPanel();
    getContentPane().add(statusBar, BorderLayout.SOUTH);

    // create menus
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(createFileMenu());
    menuBar.add(createEditMenu());
    menuBar.add(createViewMenu());
    setJMenuBar(menuBar);

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = 1000;
    int height = 970;
    setBounds((screenSize.width - width) / 2, (screenSize.height - height) / 2, width, height);

    // drag and drop to open files
    setTransferHandler(new TransferHandler() {
        @Override
        public boolean canImport(TransferSupport transferSupport) {
            return transferSupport.isDataFlavorSupported(DataFlavor.javaFileListFlavor);
        }

        @Override
        @SuppressWarnings("unchecked")
        public boolean importData(TransferSupport transferSupport) {
            try {
                Transferable transferable = transferSupport.getTransferable();
                List<File> files = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
                readPDFFile(files.get(0), "");
                return true;
            } catch (IOException e) {
                new ErrorDialog(e).setVisible(true);
                return true;
            } catch (UnsupportedFlavorException e) {
                throw new RuntimeException(e);
            }
        }
    });

    // Mac OS X file open/quit handler
    if (IS_MAC_OS) {
        try {
            Method osxOpenFiles = getClass().getDeclaredMethod("osxOpenFiles", String.class);
            osxOpenFiles.setAccessible(true);
            OSXAdapter.setFileHandler(this, osxOpenFiles);

            Method osxQuit = getClass().getDeclaredMethod("osxQuit");
            osxQuit.setAccessible(true);
            OSXAdapter.setQuitHandler(this, osxQuit);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
}

From source file:org.esa.nest.dat.views.polarview.PolarView.java

@Override
public JPopupMenu createPopupMenu(MouseEvent event) {
    final JPopupMenu popup = new JPopupMenu();

    final JMenuItem itemNext = createMenuItem("Next");
    popup.add(itemNext);//from  ww w  .j  av a2 s  . co m
    itemNext.setEnabled(currentRecord < numRecords);

    final JMenuItem itemPrev = createMenuItem("Previous");
    popup.add(itemPrev);
    itemPrev.setEnabled(currentRecord > 0);

    final JMenuItem itemColourScale = createMenuItem("Colour Scale");
    popup.add(itemColourScale);

    final JMenu unitMenu = new JMenu("Unit");
    popup.add(unitMenu);

    if (waveProductType == WaveProductType.WAVE_SPECTRA) {
        createCheckedMenuItem(unitTypes[Unit.AMPLITUDE.ordinal()], unitMenu, graphUnit == Unit.AMPLITUDE);
        createCheckedMenuItem(unitTypes[Unit.INTENSITY.ordinal()], unitMenu, graphUnit == Unit.INTENSITY);
    } else {
        createCheckedMenuItem(unitTypes[Unit.REAL.ordinal()], unitMenu, graphUnit == Unit.REAL);
        createCheckedMenuItem(unitTypes[Unit.IMAGINARY.ordinal()], unitMenu, graphUnit == Unit.IMAGINARY);
        createCheckedMenuItem(unitTypes[Unit.AMPLITUDE.ordinal()], unitMenu, graphUnit == Unit.AMPLITUDE);
        createCheckedMenuItem(unitTypes[Unit.INTENSITY.ordinal()], unitMenu, graphUnit == Unit.INTENSITY);
    }

    final JMenuItem itemExportReadout = createMenuItem("Export Readouts");
    popup.add(itemExportReadout);

    popup.setLabel("Justification");
    popup.setBorder(new BevelBorder(BevelBorder.RAISED));
    popup.addPopupMenuListener(this);
    popup.show(this, event.getX(), event.getY());

    return popup;
}

From source file:org.esa.snap.graphbuilder.rcp.dialogs.support.GraphPanel.java

private void checkPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {

        final JPopupMenu popup = new JPopupMenu();
        popup.add(addMenu);/*from   w w w .ja  va2s  .  co  m*/

        if (selectedNode != null) {
            final JMenuItem item = new JMenuItem("Delete");
            popup.add(item);
            item.setHorizontalTextPosition(JMenuItem.RIGHT);
            item.addActionListener(this);

            final NodeSource[] sources = selectedNode.getNode().getSources();
            if (sources.length > 0) {
                final JMenu removeSourcedMenu = new JMenu("Remove Source");
                for (NodeSource ns : sources) {
                    final JMenuItem nsItem = new JMenuItem(ns.getSourceNodeId());
                    removeSourcedMenu.add(nsItem);
                    nsItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                    nsItem.addActionListener(removeSourceListener);
                }
                popup.add(removeSourcedMenu);
            }
        }

        if (!graphEx.getGraphNodeList().isGraphComplete()) {
            final JMenuItem connectItem = new JMenuItem("Connect Graph", null);
            connectItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            connectItem.addActionListener(connectListener);
            popup.add(connectItem);
        }

        popup.setLabel("Justification");
        popup.setBorder(new BevelBorder(BevelBorder.RAISED));
        popup.addPopupMenuListener(this);
        popup.show(this, e.getX(), e.getY());
        showRightClickHelp = false;
    }
}

From source file:org.gcaldaemon.gui.ConfigEditor.java

private ConfigEditor(MainConfig config, ProgressMonitor monitor) throws Exception {
    this.config = config;
    try {//from   w w  w . j a  v a 2s.  c o m

        // Init swing
        System.setProperty("sun.awt.noerasebackground", "false"); //$NON-NLS-1$ //$NON-NLS-2$
        System.setProperty("swing.aatext", "true"); //$NON-NLS-1$ //$NON-NLS-2$
        System.setProperty("swing.boldMetal", "false"); //$NON-NLS-1$ //$NON-NLS-2$
        Locale locale = Locale.getDefault();
        String code = null;
        try {
            code = config.getConfigProperty(Configurator.EDITOR_LANGUAGE, null);
            if (code != null) {
                locale = new Locale(code);
            }
        } catch (Exception invalidLocale) {
            log.warn(invalidLocale);
        }
        if (!Messages.setUserLocale(locale)) {
            locale = Locale.ENGLISH;
            Messages.setUserLocale(locale);
            code = null;
        }
        if (code == null) {
            config.setConfigProperty(Configurator.EDITOR_LANGUAGE, locale.getLanguage().toLowerCase());
        }
        try {
            boolean lookAndFeelChanged = false;
            String oldLaf = UIManager.getLookAndFeel().getClass().getName();
            String newLaf = config.getConfigProperty(Configurator.EDITOR_LOOK_AND_FEEL,
                    UIManager.getCrossPlatformLookAndFeelClassName());
            lookAndFeelChanged = !oldLaf.equals(newLaf);
            if (lookAndFeelChanged) {
                UIManager.setLookAndFeel(newLaf);
            }
            if (config.getConfigProperty(Configurator.EDITOR_LOOK_AND_FEEL, null) == null) {
                config.setConfigProperty(Configurator.EDITOR_LOOK_AND_FEEL, newLaf);
            }
            if (lookAndFeelChanged) {
                new ConfigEditor(config, monitor);
                dispose();
                return;
            }
        } catch (Exception invalidLaf) {
            log.warn(invalidLaf);
        }

        // Window settings
        setTitle(Messages.getString("config.editor") + " - " + config.getConfigPath()); //$NON-NLS-1$ //$NON-NLS-2$
        setIconImage(TOOLKIT.getImage(ConfigEditor.class.getResource("/org/gcaldaemon/gui/icons/icon.gif"))); //$NON-NLS-1$
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        Container root = getContentPane();
        root.setLayout(new BorderLayout());
        root.add(folder, BorderLayout.CENTER);
        folder.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        folder.setTabPlacement(JTabbedPane.LEFT);
        folder.addChangeListener(this);
        status.setBorder(new BevelBorder(BevelBorder.LOWERED));
        root.add(status, BorderLayout.SOUTH);

        // Create menu items
        fileMenu = new JMenu(Messages.getString("file")); //$NON-NLS-1$
        saveMenu = new JMenuItem(Messages.getString("save"), getIcon("save")); //$NON-NLS-1$ //$NON-NLS-2$
        exitMenu = new JMenuItem(Messages.getString("exit"), getIcon("exit")); //$NON-NLS-1$ //$NON-NLS-2$
        viewMenu = new JMenu(Messages.getString("view")); //$NON-NLS-1$
        langMenu = new JMenu(Messages.getString("language")); //$NON-NLS-1$
        lafMenu = new JMenu(Messages.getString("look.and.feel")); //$NON-NLS-1$
        transMenu = new JMenuItem(Messages.getString("translate")); //$NON-NLS-1$
        logMenu = new JMenuItem(Messages.getString("log.viewer")); //$NON-NLS-1$
        helpMenu = new JMenu(Messages.getString("help")); //$NON-NLS-1$
        aboutMenu = new JMenuItem(Messages.getString("about")); //$NON-NLS-1$

        // Build menu
        setJMenuBar(menuBar);
        menuBar.add(fileMenu);
        fileMenu.add(saveMenu);
        fileMenu.addSeparator();
        fileMenu.add(exitMenu);
        menuBar.add(viewMenu);
        viewMenu.add(logMenu);
        viewMenu.addSeparator();
        viewMenu.add(langMenu);
        viewMenu.add(lafMenu);
        langMenu.add(transMenu);
        menuBar.add(helpMenu);
        helpMenu.add(aboutMenu);

        // Build language menu
        Locale[] locales = Messages.getAvailableLocales();
        String[] names = new String[locales.length];
        String temp;
        int i;
        for (i = 0; i < locales.length; i++) {
            names[i] = locales[i].getDisplayLanguage(Locale.ENGLISH);
            if (names[i] == null || names[i].length() == 0) {
                names[i] = locales[i].getLanguage().toLowerCase();
            }
            temp = locales[i].getDisplayLanguage(locale);
            if (temp != null && temp.length() > 0 && !temp.equals(names[i])) {
                names[i] = names[i] + " [" + temp + ']';
            }
        }
        Arrays.sort(names, String.CASE_INSENSITIVE_ORDER);
        if (locales.length != 0) {
            langMenu.addSeparator();
        }
        for (i = 0; i < locales.length; i++) {
            JMenuItem item = new JMenuItem(names[i]);
            item.setName('!' + names[i]);
            langMenu.add(item);
            item.addActionListener(this);
        }

        // Build look and feel menu
        LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
        LookAndFeelInfo info;
        for (i = 0; i < infos.length; i++) {
            info = infos[i];
            JMenuItem item = new JMenuItem(info.getName());
            item.addActionListener(this);
            item.setName('#' + info.getClassName());
            lafMenu.add(item);
        }

        // Action listeners
        addWindowListener(this);
        folder.addChangeListener(this);
        exitMenu.addActionListener(this);
        saveMenu.addActionListener(this);
        transMenu.addActionListener(this);
        logMenu.addActionListener(this);
        aboutMenu.addActionListener(this);

        // Add pages
        addPage("common.settings", new CommonPage(config, this)); //$NON-NLS-1$
        addPage("http.settings", new HttpPage(config, this)); //$NON-NLS-1$
        addPage("file.settings", new FilePage(config, this)); //$NON-NLS-1$
        addPage("feed.settings", new FeedPage(config, this)); //$NON-NLS-1$
        addPage("ldap.settings", new LdapPage(config, this)); //$NON-NLS-1$
        addPage("notifier.settings", new NotifierPage(config, this)); //$NON-NLS-1$
        addPage("sendmail.settings", new SendmailPage(config, this)); //$NON-NLS-1$
        addPage("mailterm.settings", new MailtermPage(config, this)); //$NON-NLS-1$

        // Set tab colors
        Iterator editors = disabledServices.iterator();
        while (editors.hasNext()) {
            setServiceEnabled((BooleanEditor) editors.next(), false);
        }
        disabledServices = null;

        // Show GUI
        setResizable(true);
        Dimension size = TOOLKIT.getScreenSize();
        int w = size.width - 50;
        int h = size.height - 70;
        w = Math.min(w, 1000);
        h = Math.min(h, 700);
        setSize(w, h);
        setLocation((size.width - w) / 2, (size.height - h) / 2);
        validate();
        if (monitor != null) {
            monitor.dispose();
        }
        setVisible(true);
        toFront();
    } catch (Exception error) {
        if (monitor != null) {
            monitor.dispose();
        }
        error(Messages.getString("error"), "Unable to start configurator: " + error, error);
    }
}

From source file:plugin.notes.gui.NotesView.java

/**
 *  Sets a border of an editing button to indicate that the function of the
 *  button is active according to the text location of the cursor
 *
 *@param  button  Button to highlight/* ww  w.  j  a va  2 s.c  o m*/
 */
private void highlightButton(JButton button) {
    button.setBorder(new BevelBorder(BevelBorder.LOWERED));
}

From source file:wjhk.jupload2.policies.DefaultUploadPolicy.java

/**
 * @see wjhk.jupload2.policies.UploadPolicy#createStatusBar(javax.swing.JLabel,
 *      JUploadPanel)//from  www  .j  a v  a2 s  . c  o  m
 */
public JPanel createStatusBar(JLabel content, JUploadPanel mainPanel) {
    if (this.showStatusbar) {
        JPanel pstatus = new JPanel();
        pstatus.setLayout(new BorderLayout());
        pstatus.add(content, BorderLayout.CENTER);
        pstatus.setBorder(new BevelBorder(BevelBorder.LOWERED));
        return pstatus;
    }
    return null;
}