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:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("Justified Titled Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED);
    JButton myRaisedButton = new JButton("My Raised");
    myRaisedButton.setBorder(myRaisedBorder);

    Container contentPane = frame.getContentPane();
    contentPane.add(myRaisedButton);//w w  w .  j a v a2s.com
    frame.setSize(300, 200);
    frame.setVisible(true);

}

From source file:Borders.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Borders");

    int center = SwingConstants.CENTER;
    JLabel labelOne = new JLabel("raised BevelBorder", center);
    labelOne.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    JLabel labelTwo = new JLabel("EtchedBorder", center);
    labelTwo.setBorder(BorderFactory.createEtchedBorder());
    JLabel labelThree = new JLabel("MatteBorder", center);
    labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink));
    JLabel labelFour = new JLabel("TitledBorder", center);
    Border etch = BorderFactory.createEtchedBorder();
    labelFour.setBorder(BorderFactory.createTitledBorder(etch, "Title"));
    JLabel labelFive = new JLabel("TitledBorder", center);
    Border low = BorderFactory.createLoweredBevelBorder();
    labelFive/* w ww.  j  av  a  2s . c om*/
            .setBorder(BorderFactory.createTitledBorder(low, "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM));
    JLabel labelSix = new JLabel("CompoundBorder", center);
    Border one = BorderFactory.createEtchedBorder();
    Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue);
    labelSix.setBorder(BorderFactory.createCompoundBorder(one, two));

    frame.setLayout(new GridLayout(3, 2));
    frame.add(labelOne);
    frame.add(labelTwo);
    frame.add(labelThree);
    frame.add(labelFour);
    frame.add(labelFive);
    frame.add(labelSix);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}

From source file:BorderLayoutExample.java

public static void main(String[] args) {
    BorderSample bs = new BorderSample();
    bs.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container pane = bs.getContentPane();
    pane.setLayout(new BorderLayout());
    JLabel label = new JLabel("North", JLabel.CENTER);
    label.setFont(new Font("Courier", Font.BOLD, 36));
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    pane.add(label, BorderLayout.NORTH);
    label = new JLabel("South", JLabel.CENTER);
    label.setFont(new Font("Courier", Font.BOLD, 36));
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    pane.add(label, BorderLayout.SOUTH);
    label = new JLabel("East", JLabel.CENTER);
    label.setFont(new Font("Courier", Font.BOLD, 36));
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    pane.add(label, BorderLayout.EAST);
    label = new JLabel("West", JLabel.CENTER);
    label.setFont(new Font("Courier", Font.BOLD, 36));
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    pane.add(label, BorderLayout.WEST);
    label = new JLabel("Center", JLabel.CENTER);
    label.setFont(new Font("Courier", Font.BOLD, 36));
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    pane.add(label, BorderLayout.CENTER);
    bs.setSize(400, 300);//from w  w w  .j ava2 s  .co m
    bs.setVisible(true);
}

From source file:BevelBorderRAISED.java

public BevelBorderRAISED() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    JLabel label;/*ww w.  j a va2  s.  c  o m*/

    label = new JLabel("Beveled (like a button)");
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    panel.add(label);

    getContentPane().add(panel);
    pack();
}

From source file:Main.java

/**
 * Returns a styled JButton./*from  ww  w. j a v a 2s .c  o  m*/
 *
 * @param style button type
 * @return a styled button
 */
public static JButton creaStyledButton(int style) {
    JButton jb = new JButton();
    jb.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    jb.setMargin(new Insets(0, 5, 1, 5));
    switch (style) {
    case STYLE_EDIT: {
        jb.setText("edit");
        jb.setToolTipText("edit");
        jb.setPreferredSize(new Dimension(60, 30));
        return jb;
    }
    case STYLE_OK: {
        jb.setText("ok");
        jb.setToolTipText("confirm changes");
        jb.setPreferredSize(new Dimension(60, 30));
        return jb;
    }
    case STYLE_CANCEL: {
        jb.setText("cancel");
        jb.setToolTipText("discard changes");
        jb.setPreferredSize(new Dimension(60, 30));
        return jb;
    }
    case STYLE_INSBEFOREROW: {
        jb.setIcon(ICON_INSBEFOREROW);
        jb.setToolTipText("insert row before");
        jb.setName("INSBEFOREROW");
        return jb;
    }
    case STYLE_INSAFTERROW: {
        jb.setIcon(ICON_INSAFTERROW);
        jb.setToolTipText("insert row after");
        jb.setName("INSAFTERROW");
        return jb;
    }
    case STYLE_DELETEROW: {
        jb.setIcon(ICON_DELETEROW);
        jb.setToolTipText("delete row");
        jb.setName("DELETEROW");
        return jb;
    }
    case STYLE_CLONEBEFOREROW: {
        jb.setIcon(ICON_CLONEBEFOREROW);
        jb.setToolTipText("clone row before");
        jb.setName("CLONEBEFOREROW");
        return jb;
    }
    case STYLE_CLONEAFTERROW: {
        jb.setIcon(ICON_CLONEAFTERROW);
        jb.setToolTipText("clone row after");
        jb.setName("CLONEAFTERROW");
        return jb;
    }
    case STYLE_DEFAULTROWS: {
        jb.setIcon(ICON_DEFAULTROWS);
        jb.setToolTipText("set default values");
        jb.setName("DEFAULTROWS");
        return jb;
    }
    default: {
        return null;
    }
    }
}

From source file:com.opendoorlogistics.studio.tables.grid.HeaderCellRenderer.java

/**
 * /*from ww  w.  j a v  a 2  s .c om*/
 */
protected void initLabel(JLabel label) {
    label.setOpaque(true);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
}

From source file:com.github.fritaly.dualcommander.Utils.java

public static Border createRaisedBevelBorder() {
    return BorderFactory.createCompoundBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED),
            Utils.createEmptyBorder(1));
}

From source file:fxts.stations.ui.ApplicationFrame.java

/**
 * Fires creation of menu, statusbar and toolbar.
 *//*from  w w  w  . j a  v a 2 s. co m*/
public void create() {
    //creating of the toolbar
    mToolBar = createToolBar();
    //creating of the statusbar
    mStatusBar = createStatusBar();
    //creating of the menu
    mMenuBar = createMenu();
    //setting of childmanager
    mChildManager = new ChildManager();

    //adds the menu
    if (mMenuBar != null) {
        setJMenuBar(mMenuBar);
    }
    Container cp = getContentPane();

    //adds the StatusBar
    if (mStatusBar != null) {
        mStatusBar.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
        cp.add(BorderLayout.SOUTH, mStatusBar);
    }

    //adds ToolBar
    if (mToolBar != null) {
        mToolBar.setFloatable(true);
        mToolBar.setBorder(new EtchedBorder());
        cp.add(BorderLayout.NORTH, mToolBar);
    }

    //adds childmanager
    if (mChildManager != null) {
        cp.add(BorderLayout.CENTER, mChildManager);
    }
}

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

public TaggingPanel(final Collection<String> initialTags) {
    super(new BorderLayout());

    for (final String tag : initialTags) {
        taglist.addTag(new TagItem(tag));
    }// www.j a v  a2  s  .  c o m
    final BetterTextField inputField = new BetterTextField();
    addTagActionListener = new AddTagActionListener(inputField);
    inputField.addActionListener(addTagActionListener);
    final String hint = "Type a tag and press enter";
    inputField.setPlaceHolder(hint);
    inputField.setToolTipText(hint);
    inputField.setInputVerifier(new TagInputVerifier(inputField));
    inputField.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0),
            BorderFactory.createBevelBorder(BevelBorder.LOWERED)));

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

    final JScrollPane tagScrollPane = new JScrollPane(taglist);
    tagScrollPane.setBorder(null);

    final JPanel centerPanel = new JPanel(new BorderLayout());
    centerPanel.add(inputField, BorderLayout.NORTH);
    centerPanel.add(tagScrollPane, BorderLayout.CENTER);
    centerPanel.setMaximumSize(new Dimension(250, 500));
    centerPanel.setPreferredSize(new Dimension(200, 200));

    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    add(Box.createHorizontalGlue());
    add(centerPanel);
    add(Box.createHorizontalGlue());

}

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

/**
 * @see Graph//from   w w  w.j  av  a2 s  .c  o m
 */
@Override
public ChartPanel getChartPanel() {
    final XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    plot.setBackgroundPaint(Color.darkGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setInsets(new RectangleInsets(0, 0, 0, 0));
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);

    final JFreeChart chart = new JFreeChart(null, new Font("SansSerif", Font.BOLD, 24), plot, true);
    chart.setBackgroundPaint(Color.white);
    chart.removeLegend();
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    return chartPanel;
}