Example usage for javax.swing BorderFactory createLoweredBevelBorder

List of usage examples for javax.swing BorderFactory createLoweredBevelBorder

Introduction

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

Prototype

public static Border createLoweredBevelBorder() 

Source Link

Document

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

Usage

From source file:com.rapidminer.gui.plotter.charts.AbstractPieChartPlotter.java

public AbstractPieChartPlotter(final PlotterConfigurationModel settings) {
    super(settings);
    setBackground(Color.white);//from   w ww  .j  a va2 s  .  co  m
    useDistinct = new ListeningJCheckBox("_" + PARAMETERS_USE_DISTINCT, "Use Only Distinct", false);
    useDistinct.setToolTipText("Indicates if only distinct values should be used for aggregation functions.");
    useDistinct.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            settings.setParameterAsBoolean(PARAMETERS_USE_DISTINCT, useDistinct.isSelected());
        }
    });

    String[] allFunctions = new String[AbstractAggregationFunction.KNOWN_AGGREGATION_FUNCTION_NAMES.length + 1];
    allFunctions[0] = "none";
    System.arraycopy(AbstractAggregationFunction.KNOWN_AGGREGATION_FUNCTION_NAMES, 0, allFunctions, 1,
            AbstractAggregationFunction.KNOWN_AGGREGATION_FUNCTION_NAMES.length);
    aggregationFunction = new ListeningJComboBox(settings, "_" + PARAMETERS_AGGREGATION, allFunctions);
    aggregationFunction.setToolTipText(
            "Select the type of the aggregation function which should be used for grouped values.");
    aggregationFunction.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            settings.setParameterAsString(PARAMETERS_AGGREGATION,
                    aggregationFunction.getSelectedItem().toString());
        }
    });

    for (int i = 0; i < allFunctions.length; i++) {
        if (allFunctions[i].equals("count")) {
            aggregationFunction.setSelectedIndex(i);
        }
    }

    explodingGroupList = new ExtendedJList(new ExtendedListModel(), 200);
    explodingGroupListSelectionModel = new ListeningListSelectionModel("_" + PARAMETERS_EXPLOSION_GROUPS,
            explodingGroupList);
    explodingGroupList.setSelectionModel(explodingGroupListSelectionModel);
    explodingGroupList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                Object[] values = explodingGroupList.getSelectedValues();
                List<String> list = new LinkedList<String>();
                for (Object object : values) {
                    list.add((String) object);
                }
                String result = ParameterTypeEnumeration.transformEnumeration2String(list);
                settings.setParameterAsString(PARAMETERS_EXPLOSION_GROUPS, result);
            }
        }
    });
    explodingGroupList.setForeground(Color.BLACK);
    explodingGroupList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    explodingGroupList.setBorder(BorderFactory.createLoweredBevelBorder());
    explodingGroupList.setCellRenderer(new PlotterPanel.LineStyleCellRenderer(this));

    updateGroups();

    explodingSlider = new ListeningJSlider("_" + PARAMETERS_EXPLOSION_AMOUNT, 0, 100, 0);
    explodingSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            settings.setParameterAsInt(PARAMETERS_EXPLOSION_AMOUNT, explodingSlider.getValue());
        }
    });
}

From source file:LocationSensitiveDemo.java

public LocationSensitiveDemo() {
    super("Location Sensitive Drag and Drop Demo");

    treeModel = getDefaultTreeModel();/* ww w . java2s.c om*/
    tree = new JTree(treeModel);
    tree.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    tree.setDropMode(DropMode.ON);
    namesPath = tree.getPathForRow(2);
    tree.expandRow(2);
    tree.expandRow(1);
    tree.setRowHeight(0);

    tree.setTransferHandler(new TransferHandler() {

        public boolean canImport(TransferHandler.TransferSupport info) {
            // for the demo, we'll only support drops (not clipboard paste)
            if (!info.isDrop()) {
                return false;
            }

            String item = (String) indicateCombo.getSelectedItem();

            if (item.equals("Always")) {
                info.setShowDropLocation(true);
            } else if (item.equals("Never")) {
                info.setShowDropLocation(false);
            }

            // we only import Strings
            if (!info.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                return false;
            }

            // fetch the drop location
            JTree.DropLocation dl = (JTree.DropLocation) info.getDropLocation();

            TreePath path = dl.getPath();

            // we don't support invalid paths or descendants of the names folder
            if (path == null || namesPath.isDescendant(path)) {
                return false;
            }

            return true;
        }

        public boolean importData(TransferHandler.TransferSupport info) {
            // if we can't handle the import, say so
            if (!canImport(info)) {
                return false;
            }

            // fetch the drop location
            JTree.DropLocation dl = (JTree.DropLocation) info.getDropLocation();

            // fetch the path and child index from the drop location
            TreePath path = dl.getPath();
            int childIndex = dl.getChildIndex();

            // fetch the data and bail if this fails
            String data;
            try {
                data = (String) info.getTransferable().getTransferData(DataFlavor.stringFlavor);
            } catch (UnsupportedFlavorException e) {
                return false;
            } catch (IOException e) {
                return false;
            }

            // if child index is -1, the drop was on top of the path, so we'll
            // treat it as inserting at the end of that path's list of children
            if (childIndex == -1) {
                childIndex = tree.getModel().getChildCount(path.getLastPathComponent());
            }

            // create a new node to represent the data and insert it into the model
            DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(data);
            DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) path.getLastPathComponent();
            treeModel.insertNodeInto(newNode, parentNode, childIndex);

            // make the new node visible and scroll so that it's visible
            tree.makeVisible(path.pathByAddingChild(newNode));
            tree.scrollRectToVisible(tree.getPathBounds(path.pathByAddingChild(newNode)));

            // demo stuff - remove for blog
            model.removeAllElements();
            model.insertElementAt("String " + (++count), 0);
            // end demo stuff

            return true;
        }
    });

    JList dragFrom = new JList(model);
    dragFrom.setFocusable(false);
    dragFrom.setPrototypeCellValue("String 0123456789");
    model.insertElementAt("String " + count, 0);
    dragFrom.setDragEnabled(true);
    dragFrom.setBorder(BorderFactory.createLoweredBevelBorder());

    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    JPanel wrap = new JPanel();
    wrap.add(new JLabel("Drag from here:"));
    wrap.add(dragFrom);
    p.add(Box.createHorizontalStrut(4));
    p.add(Box.createGlue());
    p.add(wrap);
    p.add(Box.createGlue());
    p.add(Box.createHorizontalStrut(4));
    getContentPane().add(p, BorderLayout.NORTH);

    getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
    indicateCombo = new JComboBox(new String[] { "Default", "Always", "Never" });
    indicateCombo.setSelectedItem("INSERT");

    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    wrap = new JPanel();
    wrap.add(new JLabel("Show drop location:"));
    wrap.add(indicateCombo);
    p.add(Box.createHorizontalStrut(4));
    p.add(Box.createGlue());
    p.add(wrap);
    p.add(Box.createGlue());
    p.add(Box.createHorizontalStrut(4));
    getContentPane().add(p, BorderLayout.SOUTH);

    getContentPane().setPreferredSize(new Dimension(400, 450));
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Build the component.//  w w  w .  ja  v a  2  s .com
 */
private void makePane() {
    font = (new JLabel()).getFont().deriveFont(Font.ITALIC, 11.0f);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(12, 12, 0, 12));
    setBackground(backgroundColor);

    add(getHelpBox());
    add(Box.createVerticalStrut(12));

    infoPanel = new JPanel(new BorderLayout(22, 18));
    {
        infoPanel.setAlignmentX(LEFT_ALIGNMENT);
        infoPanel.setBackground(background);

        Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
                BorderFactory.createEmptyBorder(12, 22, 12, 22));
        infoPanel.setBorder(border);

        JLabel text = new JLabel(Config.getString("export.publish.info") + " " + serverName,
                SwingConstants.CENTER);
        text.setForeground(headingColor);
        infoPanel.add(text, BorderLayout.NORTH);

        createScenarioDisplay();
        infoPanel.add(leftPanel, BorderLayout.CENTER);
        infoPanel.add(getTagDisplay(), BorderLayout.EAST);
    }

    add(infoPanel);
    add(Box.createVerticalStrut(16));
    add(getLoginPanel());
    add(Box.createVerticalStrut(10));
}

From source file:com.att.aro.ui.view.menu.tools.RegexWizard.java

private JTextArea createTextAreaAndProperties(String title) {
    JTextArea textArea = new JTextArea();
    textArea.setLineWrap(true);//  w  w  w. ja v a 2 s  .  c o m
    TitledBorder ttlBorder = BorderFactory.createTitledBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()), title);
    ttlBorder.setTitleColor(Color.BLUE);
    ttlBorder.setTitleFont(ttlBorder.getTitleFont().deriveFont(Font.BOLD));
    textArea.setBorder(ttlBorder);
    textArea.addFocusListener(this);
    return textArea;
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates a login panel with a username and password and a create account option
 * @return Login panel Component/*from  ww  w . ja  v  a  2  s  . c  o m*/
 */
private JComponent getLoginPanel() {
    JComponent loginPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 4));

    loginPanel.setBackground(background);
    loginPanel.setAlignmentX(LEFT_ALIGNMENT);
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createEmptyBorder(12, 12, 12, 12));
    loginPanel.setBorder(border);

    JLabel text = new JLabel(Config.getString("export.publish.login"));
    text.setForeground(headingColor);
    text.setVerticalAlignment(SwingConstants.TOP);
    loginPanel.add(text);

    text = new JLabel(Config.getString("export.publish.username"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    userNameField = new JTextField(10);
    userNameField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            String text = userNameField.getText();
            return text.length() > 0;
        }
    });
    userNameField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForExistingScenario();
        }
    });
    loginPanel.add(userNameField);
    text = new JLabel(Config.getString("export.publish.password"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    passwordField = new JPasswordField(10);
    loginPanel.add(passwordField);

    JLabel createAccountLabel = new JLabel(Config.getString("export.publish.createAccount"));
    {
        createAccountLabel.setBackground(background);

        createAccountLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        GreenfootUtil.makeLink(createAccountLabel, createAccountUrl);
    }
    loginPanel.add(createAccountLabel);
    return loginPanel;
}

From source file:de.xplib.xdbm.ui.dialog.FirstStartSetup.java

/**
 * /*ww  w .  j a  v  a 2 s . co  m*/
 */
private void initUI() {

    this.getContentPane().setLayout(this.mainLayout);

    Locale l = this.config.getLocale();
    Object[] args = new Object[0];

    this.jfField.addFileFilter(JFileField.JAR_FILE_FILTER);
    this.jfField.setFileSelectionMode(JFileChooser.FILES_ONLY);
    this.jfField.addSelectListener(new FileSelectListener());
    this.jfField.addDocumentListener(new EnableButtonListener());
    this.jfField.setToolTipText(MessageManager.getText("setup.dialog.jarfile.tooltip", "text", args, l));

    this.jtfClass.getDocument().addDocumentListener(new EnableButtonListener());
    this.jtfClass.setToolTipText(MessageManager.getText("setup.dialog.class.tooltip", "text", args, l));

    this.jtfDbURI.setToolTipText(MessageManager.getText("setup.dialog.dburi.tooltip", "text", args, l));

    this.jbTest.setEnabled(false);
    this.jbTest.setText(MessageManager.getText("setup.dialog.test.label", "text", args, l));
    this.jbTest.setToolTipText(MessageManager.getText("setup.dialog.test.tooltip", "text", args, l));
    this.jbTest.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent ae) {
            if (actionPerformedTest(ae)) {
                JOptionPane.showMessageDialog(FirstStartSetup.this,
                        MessageManager.getText("setup.dialog.test.success.message", "text", new Object[0],
                                config.getLocale()),
                        MessageManager.getText("setup.dialog.test.success.title", "text", new Object[0],
                                config.getLocale()),
                        JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });

    this.jbCancel.setText(MessageManager.getText("setup.dialog.cancel.label", "text", args, l));
    this.jbCancel.setToolTipText(MessageManager.getText("setup.dialog.cancel.tooltip", "text", args, l));
    this.jbCancel.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent ae) {
            System.exit(0);
        }
    });

    this.jbOk.setEnabled(false);
    this.jbOk.setText(MessageManager.getText("setup.dialog.ok.label", "text", args, l));
    this.jbOk.setToolTipText(MessageManager.getText("setup.dialog.ok.tooltip", "text", args, l));
    this.jbOk.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent ae) {
            if (actionPerformedTest(ae)) {

                String jar = jfField.getText().trim();

                config.putDriver(jar, jtfClass.getText().trim());

                String uri = jtfDbURI.getText().trim();
                if (!uri.equals("")) {
                    config.putDatabaseURI(jar, uri);
                }

                dispose();
            }
        }
    });

    FormLayout layout = new FormLayout("right:pref, 3dlu, pref, 3dlu, pref, 3dlu, pref",
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 9dlu, p, 3dlu, p");

    layout.setColumnGroups(new int[][] { { 3, 5, 7 } });

    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();

    //      Obtain a reusable constraints object to place components in the grid.
    CellConstraints cc = new CellConstraints();

    //         Fill the grid with components; the builder can create
    //         frequently used components, e.g. separators and labels.

    //         Add a titled separator to cell (1, 1) that spans 7 columns.
    builder.addSeparator(MessageManager.getText("setup.dialog.header", "text", args, l), cc.xyw(1, 1, 7));
    builder.addLabel(MessageManager.getText("setup.dialog.jarfile.label", "text", args, l), cc.xy(1, 3));
    builder.add(this.jfField, cc.xyw(3, 3, 5));
    builder.addLabel(MessageManager.getText("setup.dialog.class.label", "text", args, l), cc.xy(1, 5));
    builder.add(this.jtfClass, cc.xyw(3, 5, 5));
    builder.addLabel(MessageManager.getText("setup.dialog.dburi.label", "text", args, l), cc.xy(1, 7));
    builder.add(this.jtfDbURI, cc.xyw(3, 7, 5));

    builder.addSeparator("", cc.xyw(1, 9, 7));

    builder.add(this.jbTest, cc.xy(3, 11));
    builder.add(this.jbCancel, cc.xy(5, 11));
    builder.add(this.jbOk, cc.xy(7, 11));

    this.getContentPane().add(builder.getPanel(), BorderLayout.CENTER);

    this.statusPanel.setLayout(this.statusLayout);
    this.statusPanel.add(this.statusLabel);
    this.statusPanel.add(this.statusBar);

    this.statusLabel.setBorder(BorderFactory.createLoweredBevelBorder());

    this.statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
    this.statusBar.setStringPainted(true);

    this.getContentPane().add(this.statusPanel, BorderLayout.SOUTH);
}

From source file:org.bhavaya.ui.view.ChartView.java

protected void initImpl() {
    super.initImpl();

    analyticsModel = new AnalyticsTableModel(beanTable);
    analyticsModel.setGrouped(true);/*from w  w w.ja va  2s  .c  o  m*/
    tableModelDataSet = new TableModelDataSet(analyticsModel);

    if (tableViewConfigurationToUseOnInit != null) {
        configureFromTableViewConfiguration(tableViewConfigurationToUseOnInit);
    } else if (configuration != null) {
        applyConfigToModels();
    }

    chartControl.init();

    setChartType(VERTICAL_BAR);
    setPlot3D(false);

    chartPanel.setMaximumDrawHeight(1200);
    chartPanel.setMaximumDrawWidth(1400);

    chartPanel.setBorder(BorderFactory.createLoweredBevelBorder());

    viewComponent = createViewComponent(chartPanel);

    //            pluggablePanel = new PluggablePanel(UIUtilities.createLoadingComponent("Waiting to load data"));

    ApplicationContext.getInstance().addGuiTask(new Task("ChartView loading data for " + getName()) {
        public void run() {
            try {
                //                        pluggablePanel.setPluggedComponent(UIUtilities.createLoadingComponent("Loading data..."));
                getBeanCollection().size(); //this ensures that a lazy beanCollection is inflated
                if (!isDisposed()) { // CriteriaBeanCollectionLoadDecorator may have disposed the view based a user request
                    EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            try {
                                beanTable.setBeanCollection(getBeanCollection());
                                //                                        pluggablePanel.setPluggedComponent(BeanCollectionTableView.super.getComponent());
                            } catch (Exception e) {
                                log.error(e);
                                //                                        handleError(e);
                            }
                        }
                    });
                }
            } catch (Throwable e) {
                log.error(e);
                //                        handleError(e);
            }
        }
    });
}

From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java

/**
 * @param nObj//from w  w w. jav a  2 s .  c om
 * @param panel
 * @return true if a form was effectively rendered, i.e. when at least 1
 *         parameter was available
 * @throws IllegalActionException
 */
private boolean renderModelComponent(final boolean deep, final NamedObj nObj, final JPanel panel) {
    if (logger.isDebugEnabled()) {
        logger.debug("renderModelComponent() - Entity " + nObj.getFullName()); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (nObj instanceof CompositeActor && deep) {
        return renderCompositeModelComponent((CompositeActor) nObj, panel);
    } else {
        renderModelComponentAnnotations(nObj, panel);
        final IPasserelleEditorPaneFactory epf = getEditorPaneFactoryForComponent(nObj);
        Component component = null;
        // XXX: temp need to use the new isencia api
        final IPasserelleQuery passerelleQuery = epf.createEditorPaneWithAuthorizer(nObj, this, this);
        if (!passerelleQuery.hasAutoSync()) {
            try {
                final Set<ParameterToWidgetBinder> queryBindings = passerelleQuery.getParameterBindings();
                for (final ParameterToWidgetBinder parameterToWidgetBinder : queryBindings) {
                    hmiFields.put(parameterToWidgetBinder.getBoundParameter().getFullName(),
                            parameterToWidgetBinder);
                }
            } catch (final Exception exception) {
                throw new RuntimeException("Error creating bindings for passerelleQuery", exception);
            }
        }

        final IPasserelleComponent passerelleComponent = passerelleQuery.getPasserelleComponent();
        if (!(passerelleComponent instanceof Component)) {
            return false;
        }

        component = (Component) passerelleComponent;
        // System.out.println("renderModelComponent "+passerelleComponent);
        // Component c =
        // EditorPaneFactory.createEditorPaneWithAuthorizer(nObj, this,
        // this);
        if (component != null && !(component instanceof PasserelleEmptyQuery)) {
            final String name = ModelUtils.getFullNameButWithoutModelName(getCurrentModel(), nObj);
            component.setName(name);
            final JPanel globalPanel = new JPanel(new BorderLayout());

            // Panel for title
            final JPanel titlePanel = createTitlePanel(name);

            // Add a nice background to panels
            titlePanel.setBackground(panel.getBackground());
            ((JComponent) component).setBackground(panel.getBackground());
            // Border
            final Border loweredbevel = BorderFactory.createLoweredBevelBorder();
            final TitledBorder border = BorderFactory.createTitledBorder(loweredbevel/* ,name */);
            globalPanel.setBorder(border);

            globalPanel.add(titlePanel, BorderLayout.NORTH);
            globalPanel.add(component, BorderLayout.CENTER);
            panel.add(globalPanel);

            // StateMachine stuff
            StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, name, component);
            StateMachine.getInstance().compile();
            return true;
        }
        return false;
    }
}

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

private JPanel createScorePanel() {
    JPanel scorePanel = new JPanel(new BorderLayout());
    scorePanel.setBorder(BorderFactory.createEtchedBorder());
    showConstraintMatchesDialogAction = new ShowConstraintMatchesDialogAction();
    showConstraintMatchesDialogAction.setEnabled(false);
    scorePanel.add(new JButton(showConstraintMatchesDialogAction), BorderLayout.WEST);
    resultLabel = new JLabel("Score:");
    resultLabel.setBorder(BorderFactory.createLoweredBevelBorder());
    scorePanel.add(resultLabel, BorderLayout.CENTER);
    refreshScreenDuringSolvingCheckBox = new JCheckBox("Refresh screen during solving",
            solutionPanel.isRefreshScreenDuringSolving());
    scorePanel.add(refreshScreenDuringSolvingCheckBox, BorderLayout.EAST);
    return scorePanel;
}

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

private JPanel createScorePanel() {
    JPanel scorePanel = new JPanel(new BorderLayout());
    scorePanel.setBorder(BorderFactory.createEtchedBorder());
    showConstraintMatchesDialogAction = new ShowConstraintMatchesDialogAction();
    showConstraintMatchesDialogAction.setEnabled(false);
    scorePanel.add(new JButton(showConstraintMatchesDialogAction), BorderLayout.WEST);
    scoreField = new JTextField("Score:");
    scoreField.setEditable(false);/*from   w  w  w  . ja  v a 2  s.co m*/
    scoreField.setForeground(Color.BLACK);
    scoreField.setBorder(BorderFactory.createLoweredBevelBorder());
    scorePanel.add(scoreField, BorderLayout.CENTER);
    refreshScreenDuringSolvingCheckBox = new JCheckBox("Refresh screen during solving",
            solutionPanel.isRefreshScreenDuringSolving());
    scorePanel.add(refreshScreenDuringSolvingCheckBox, BorderLayout.EAST);
    return scorePanel;
}