Example usage for javax.swing BorderFactory createEtchedBorder

List of usage examples for javax.swing BorderFactory createEtchedBorder

Introduction

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

Prototype

public static Border createEtchedBorder(Color highlight, Color shadow) 

Source Link

Document

Creates a border with an "etched" look using the specified highlighting and shading colors.

Usage

From source file:Main.java

public Main() {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createEtchedBorder(Color.red, Color.black));

    add(labelTwo);//from   w  w  w .ja  v  a2s . c om

    JLabel labelThree = new JLabel("MatteBorder");
    labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink));
    add(labelThree);

    JLabel labelFour = new JLabel("TitledBorder");
    labelFour.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink),
                    "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM));
    add(labelFour);

    JLabel labelSix = new JLabel("CompoundBorder");
    Border one = BorderFactory.createEtchedBorder();
    Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue);
    labelSix.setBorder(BorderFactory.createCompoundBorder(one, two));
    add(labelSix);

}

From source file:ExtendedParagraphExample.java

public static void createDocumentStyles(StyleContext sc) {
    Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE);

    // Create and add the main document style
    Style mainStyle = sc.addStyle(mainStyleName, defaultStyle);
    StyleConstants.setLeftIndent(mainStyle, 16);
    StyleConstants.setRightIndent(mainStyle, 16);
    StyleConstants.setFirstLineIndent(mainStyle, 16);
    StyleConstants.setFontFamily(mainStyle, "serif");
    StyleConstants.setFontSize(mainStyle, 12);

    // Create and add the constant width style
    Style cwStyle = sc.addStyle(charStyleName, null);
    StyleConstants.setFontFamily(cwStyle, "monospaced");
    StyleConstants.setForeground(cwStyle, Color.white);

    // Create and add the heading style
    Style heading2Style = sc.addStyle(heading2StyleName, null);
    StyleConstants.setForeground(heading2Style, Color.red);
    StyleConstants.setFontSize(heading2Style, 16);
    StyleConstants.setFontFamily(heading2Style, "serif");
    StyleConstants.setBold(heading2Style, true);
    StyleConstants.setLeftIndent(heading2Style, 8);
    StyleConstants.setFirstLineIndent(heading2Style, 0);

    // Create and add the extended para styles
    Style paraStyle = sc.addStyle(paraStyleName, null);
    Color bgColor = Color.gray;
    ExtendedStyleConstants.setParagraphBackground(paraStyle, bgColor);
    ExtendedStyleConstants.setParagraphBorder(paraStyle,
            BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2),
                    BorderFactory.createCompoundBorder(
                            BorderFactory.createEtchedBorder(bgColor.brighter(), bgColor.darker()),
                            BorderFactory.createEmptyBorder(4, 4, 4, 4))));
}

From source file:it.cnr.istc.iloc.gui.TimelinesChart.java

@Override
public void inconsistentNode(Solver.Node n) {
    setBorder(BorderFactory.createEtchedBorder(Color.red, null));
}

From source file:unikn.dbis.univis.visualization.pivottable.VPivotTable.java

public VPivotTable() {
    setBorder(new EtchedBorder());
    setPreferredSize(new Dimension(1000, 700));
    setLayout(new BorderLayout());
    setBackground(Color.white);//from   w w  w.  ja va 2 s  .  c om

    /* *** First Row *** */
    JLabel jlabelMeasure = new JLabel("Measure:");
    jlabelMeasure.setVisible(false);
    JLabel jlabelX = new JLabel("X-Axis Elements:");
    JLabel forVerticalSpace = new JLabel(" ");
    panelFirstRow = new JPanel(new VTableLayout(3, 2, 3, 3));

    dropAreaMeasure = new JTextArea(textInMeasureBox);
    dropAreaMeasure.setToolTipText(textInMeasureBox);
    dropAreaMeasure.setForeground(Color.LIGHT_GRAY);
    dropAreaMeasure.setEditable(false);
    dropAreaMeasure.setPreferredSize(new Dimension(100, 20));
    dropAreaMeasure.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));
    dropAreaMeasure.setVisible(false);

    dropAreaX = new JTextArea(textInXYBox);
    dropAreaX.setToolTipText(textInXYBox);
    dropAreaX.setForeground(Color.LIGHT_GRAY);
    dropAreaX.setEditable(false);
    dropAreaX.setPreferredSize(new Dimension(400, 20));
    dropAreaX.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));

    panelFirstRow.add(jlabelMeasure);
    panelFirstRow.add(jlabelX);
    panelFirstRow.add(dropAreaMeasure);
    panelFirstRow.add(dropAreaX);
    panelFirstRow.add(forVerticalSpace);
    add(panelFirstRow, BorderLayout.NORTH);

    /* *** Second Row *** */
    JLabel jlabelY1 = new JLabel("Y-Axis");
    JLabel jlabelY2 = new JLabel("Elements:");
    panelSecondRow = new JPanel(new VTableLayout(1, 2, 3, 3));

    dropAreaY = new JTextArea(textInXYBox);
    dropAreaY.setToolTipText(textInXYBox);
    dropAreaY.setForeground(Color.LIGHT_GRAY);
    dropAreaY.setEditable(false);
    dropAreaY.setLineWrap(true);
    dropAreaY.setWrapStyleWord(true);
    dropAreaY.setPreferredSize(new Dimension(100, 400));
    dropAreaY.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));

    JPanel panelY = new JPanel(new VTableLayout(3, 1, 1, 1));
    panelY.add(jlabelY1);
    panelY.add(jlabelY2);
    panelY.add(dropAreaY);
    panelSecondRow.add(panelY);
    add(panelSecondRow, BorderLayout.WEST);

    new DropTarget(dropAreaX, DnDConstants.ACTION_COPY_OR_MOVE, this);
    new DropTarget(dropAreaY, DnDConstants.ACTION_COPY_OR_MOVE, this);
}